X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/89c3c647797787377f4d950b38d320ee3b28e92c..ec121e0e865fe99c5df5453ed5fa819594b1cdd6:/src/views-components/project-properties-dialog/project-properties-dialog.tsx diff --git a/src/views-components/project-properties-dialog/project-properties-dialog.tsx b/src/views-components/project-properties-dialog/project-properties-dialog.tsx index d165f981..c2982b3d 100644 --- a/src/views-components/project-properties-dialog/project-properties-dialog.tsx +++ b/src/views-components/project-properties-dialog/project-properties-dialog.tsx @@ -9,10 +9,11 @@ import { RootState } from '~/store/store'; import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog"; import { ProjectResource } from '~/models/project'; import { PROJECT_PROPERTIES_DIALOG_NAME, deleteProjectProperty } from '~/store/details-panel/details-panel-action'; -import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Chip, withStyles, StyleRulesCallback, WithStyles } from '@material-ui/core'; +import { Dialog, DialogTitle, DialogContent, DialogActions, Button, withStyles, StyleRulesCallback, WithStyles } from '@material-ui/core'; import { ArvadosTheme } from '~/common/custom-theme'; import { ProjectPropertiesForm } from '~/views-components/project-properties-dialog/project-properties-form'; import { getResource } from '~/store/resources/resources'; +import { getPropertyChip } from "../resource-properties-form/property-chip"; type CssRules = 'tag'; @@ -28,46 +29,53 @@ interface ProjectPropertiesDialogDataProps { } interface ProjectPropertiesDialogActionProps { - handleDelete: (key: string) => void; + handleDelete: (key: string, value: string) => void; } -const mapStateToProps = ({ detailsPanel, resources }: RootState): ProjectPropertiesDialogDataProps => { - const project = getResource(detailsPanel.resourceUuid)(resources) as ProjectResource; - return { project }; -}; +const mapStateToProps = ({ detailsPanel, resources, properties }: RootState): ProjectPropertiesDialogDataProps => ({ + project: getResource(detailsPanel.resourceUuid)(resources) as ProjectResource, +}); const mapDispatchToProps = (dispatch: Dispatch): ProjectPropertiesDialogActionProps => ({ - handleDelete: (key: string) => dispatch(deleteProjectProperty(key)) + handleDelete: (key: string, value: string) => () => dispatch(deleteProjectProperty(key, value)), }); -type ProjectPropertiesDialogProps = ProjectPropertiesDialogDataProps & ProjectPropertiesDialogActionProps & WithDialogProps<{}> & WithStyles; +type ProjectPropertiesDialogProps = ProjectPropertiesDialogDataProps & ProjectPropertiesDialogActionProps & WithDialogProps<{}> & WithStyles; export const ProjectPropertiesDialog = connect(mapStateToProps, mapDispatchToProps)( withStyles(styles)( - withDialog(PROJECT_PROPERTIES_DIALOG_NAME)( - ({ classes, open, closeDialog, handleDelete, project }: ProjectPropertiesDialogProps) => - - Properties - - - {project && project.properties && - Object.keys(project.properties).map(k => { - return handleDelete(k)} - label={`${k}: ${project.properties[k]}`} />; - }) - } - - - - - -))); \ No newline at end of file + + + ) + ));