X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/89c3c647797787377f4d950b38d320ee3b28e92c..HEAD:/src/views-components/details-panel/project-details.tsx diff --git a/src/views-components/details-panel/project-details.tsx b/src/views-components/details-panel/project-details.tsx index 91c5e027..7dc6709d 100644 --- a/src/views-components/details-panel/project-details.tsx +++ b/src/views-components/details-panel/project-details.tsx @@ -2,23 +2,32 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; -import { compose } from 'redux'; +import React from 'react'; import { connect } from 'react-redux'; -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 { ProjectIcon, RenameIcon, FilterGroupIcon } 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 { DetailsAttribute } from "components/details-attribute/details-attribute"; +import { RichTextEditorLink } from 'components/rich-text-editor-link/rich-text-editor-link'; +import { withStyles, StyleRulesCallback, WithStyles, Button } from '@material-ui/core'; +import { ArvadosTheme } from 'common/custom-theme'; +import { Dispatch } from 'redux'; +import { getPropertyChip } from '../resource-properties-form/property-chip'; +import { ResourceWithName } from '../data-explorer/renderers'; +import { GroupClass } from "models/group"; +import { openProjectUpdateDialog, ProjectUpdateFormDialogData } from 'store/projects/project-update-actions'; +import { RootState } from 'store/store'; +import { ResourcesState } from 'store/resources/resources'; +import { resourceIsFrozen } from 'common/frozen-resources'; export class ProjectDetails extends DetailsData { getIcon(className?: string) { + if (this.item.groupClass === GroupClass.FILTER) { + return ; + } return ; } @@ -27,61 +36,85 @@ export class ProjectDetails extends DetailsData { } } -type CssRules = 'tag' | 'editIcon'; +type CssRules = 'tag' | 'editIcon' | 'editButton'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ tag: { - marginRight: theme.spacing.unit, - marginBottom: theme.spacing.unit + marginRight: theme.spacing.unit / 2, + marginBottom: theme.spacing.unit / 2, }, editIcon: { + paddingRight: theme.spacing.unit / 2, fontSize: '1.125rem', - cursor: 'pointer' - } + }, + editButton: { + boxShadow: 'none', + padding: '2px 10px 2px 5px', + fontSize: '0.75rem' + }, }); - interface ProjectDetailsComponentDataProps { project: ProjectResource; } interface ProjectDetailsComponentActionProps { - onClick: () => void; + onClick: (prj: ProjectUpdateFormDialogData) => () => void; } -const mapDispatchToProps = ({ onClick: openProjectPropertiesDialog }); +const mapStateToProps = (state: RootState): { resources: ResourcesState } => { + return { + resources: state.resources + }; +}; + +const mapDispatchToProps = (dispatch: Dispatch) => ({ + onClick: (prj: ProjectUpdateFormDialogData) => + () => dispatch(openProjectUpdateDialog(prj)), +}); type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDetailsComponentActionProps & WithStyles; -const ProjectDetailsComponent = connect(null, mapDispatchToProps)( +const ProjectDetailsComponent = connect(mapStateToProps, mapDispatchToProps)( withStyles(styles)( - ({ classes, project, onClick }: ProjectDetailsComponentProps) =>
- - {/* Missing attr */} - - - - - {/* Missing attr */} - {/**/} - - {project.description ? - - : '---' - } - - -
- -
-
- { - Object.keys(project.properties).map(k => { - return ; - }) + ({ classes, project, resources, onClick }: ProjectDetailsComponentProps & { resources: ResourcesState }) =>
+ {project.groupClass !== GroupClass.FILTER ? + + : '' + } + + } /> + + + + + {project.description ? + + : '---' } + + + { + Object.keys(project.properties).map(k => + Array.isArray(project.properties[k]) + ? project.properties[k].map((v: string) => + getPropertyChip(k, v, undefined, classes.tag)) + : getPropertyChip(k, project.properties[k], undefined, classes.tag) + ) + }
-)); \ No newline at end of file + ));