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 { PropertyChipComponent } from "../resource-properties-form/property-chip";
type CssRules = 'tag';
handleDelete: (key: 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<any>(deleteProjectProperty(key))
+ handleDelete: (key: string) => dispatch<any>(deleteProjectProperty(key)),
});
type ProjectPropertiesDialogProps = ProjectPropertiesDialogDataProps & ProjectPropertiesDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
<DialogTitle>Properties</DialogTitle>
<DialogContent>
<ProjectPropertiesForm />
- {project && project.properties &&
- Object.keys(project.properties).map(k => {
- return <Chip key={k} className={classes.tag}
+ {project && project.properties &&
+ Object.keys(project.properties).map(k =>
+ <PropertyChipComponent
onDelete={() => handleDelete(k)}
- label={`${k}: ${project.properties[k]}`} />;
- })
+ key={k} className={classes.tag}
+ propKey={k} propValue={project.properties[k]} />)
}
</DialogContent>
<DialogActions>
</Button>
</DialogActions>
</Dialog>
-)));
\ No newline at end of file
+ )
+));
\ No newline at end of file