// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; import { connect } from 'react-redux'; import { RootState } from '~/store/store'; import { openProjectPropertiesDialog } from '~/store/details-panel/details-panel-action'; import { ProjectIcon, RenameIcon } from '~/components/icon/icon'; import { ProjectResource } from '~/models/project'; import { formatDate } from '~/common/formatters'; import { ResourceKind } from '~/models/resource'; import { resourceLabel } from '~/common/labels'; import { DetailsData } from "./details-data"; import { DetailsAttribute } from "~/components/details-attribute/details-attribute"; import { RichTextEditorLink } from '~/components/rich-text-editor-link/rich-text-editor-link'; import { withStyles, StyleRulesCallback, Chip, WithStyles } from '@material-ui/core'; import { ArvadosTheme } from '~/common/custom-theme'; import * as CopyToClipboard from 'react-copy-to-clipboard'; import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; import { getTagValueLabel, getTagKeyLabel, Vocabulary } from '~/models/vocabulary'; import { getVocabulary } from "~/store/vocabulary/vocabulary-selectors"; import { Dispatch } from 'redux'; export class ProjectDetails extends DetailsData { getIcon(className?: string) { return ; } getDetails() { return ; } } type CssRules = 'tag' | 'editIcon'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ tag: { marginRight: theme.spacing.unit, marginBottom: theme.spacing.unit }, editIcon: { fontSize: '1.125rem', cursor: 'pointer' } }); interface ProjectDetailsComponentDataProps { project: ProjectResource; vocabulary: Vocabulary; } interface ProjectDetailsComponentActionProps { onClick: () => void; onCopy: (message: string) => void; } const mapStateToProps = ({ properties }: RootState) => ({ vocabulary: getVocabulary(properties), }); const mapDispatchToProps = (dispatch: Dispatch) => ({ onClick: () => dispatch(openProjectPropertiesDialog()), onCopy: (message: string) => dispatch(snackbarActions.OPEN_SNACKBAR({ message, hideDuration: 2000, kind: SnackbarKind.SUCCESS })) }); type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDetailsComponentActionProps & WithStyles; const ProjectDetailsComponent = connect(mapStateToProps, mapDispatchToProps)( withStyles(styles)( ({ classes, project, onClick, vocabulary, onCopy }: ProjectDetailsComponentProps) =>
{/* Missing attr */} {/* Missing attr */} {/**/} {project.description ? : '---' }
{ Object.keys(project.properties).map(k => { const label = `${getTagKeyLabel(k, vocabulary)}: ${getTagValueLabel(k, project.properties[k], vocabulary)}`; return ( onCopy("Copied")}> ); }) }
));