[arvados-workbench2] updated: 2.4.0-190-ga6e83a8e
git repository hosting
git at public.arvados.org
Wed Aug 17 07:07:04 UTC 2022
Summary of changes:
src/views-components/details-panel/collection-details.tsx | 8 ++++++--
src/views-components/details-panel/details-panel.tsx | 9 +++++++++
src/views-components/details-panel/project-details.tsx | 14 ++++++++++++--
src/views/collection-panel/collection-panel.tsx | 6 ++++++
4 files changed, 33 insertions(+), 4 deletions(-)
via a6e83a8e7ba34c1a2b2540d5790d0d273364380e (commit)
from 792a75702b6208c328d67c39b0f107e9dff0417e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a6e83a8e7ba34c1a2b2540d5790d0d273364380e
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date: Wed Aug 17 09:06:15 2022 +0200
18692: Fixed collection beeing editable within the details panel
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
diff --git a/src/views-components/details-panel/collection-details.tsx b/src/views-components/details-panel/collection-details.tsx
index 5edfbc37..4431465b 100644
--- a/src/views-components/details-panel/collection-details.tsx
+++ b/src/views-components/details-panel/collection-details.tsx
@@ -8,7 +8,7 @@ import { CollectionResource } from 'models/collection';
import { DetailsData } from "./details-data";
import { CollectionDetailsAttributes } from 'views/collection-panel/collection-panel';
import { RootState } from 'store/store';
-import { filterResources, getResource } from 'store/resources/resources';
+import { filterResources, getResource, ResourcesState } from 'store/resources/resources';
import { connect } from 'react-redux';
import { Button, Grid, ListItem, StyleRulesCallback, Typography, withStyles, WithStyles } from '@material-ui/core';
import { formatDate, formatFileSize } from 'common/formatters';
@@ -17,6 +17,7 @@ import { Dispatch } from 'redux';
import { navigateTo } from 'store/navigation/navigation-action';
import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions';
import { openCollectionUpdateDialog } from 'store/collections/collection-update-actions';
+import { resourceIsFrozen } from 'common/frozen-resources';
export type CssRules = 'versionBrowserHeader'
| 'versionBrowserItem'
@@ -82,6 +83,7 @@ export class CollectionDetails extends DetailsData<CollectionResource> {
}
interface CollectionInfoDataProps {
+ resources: ResourcesState;
currentCollection: CollectionResource | undefined;
}
@@ -91,6 +93,7 @@ interface CollectionInfoDispatchProps {
const ciMapStateToProps = (state: RootState): CollectionInfoDataProps => {
return {
+ resources: state.resources,
currentCollection: getResource<CollectionResource>(state.detailsPanel.resourceUuid)(state.resources),
};
};
@@ -110,10 +113,11 @@ type CollectionInfoProps = CollectionInfoDataProps & CollectionInfoDispatchProps
const CollectionInfo = withStyles(styles)(
connect(ciMapStateToProps, ciMapDispatchToProps)(
- ({ currentCollection, editCollection, classes }: CollectionInfoProps) =>
+ ({ currentCollection, resources, editCollection, classes }: CollectionInfoProps) =>
currentCollection !== undefined
? <div>
<Button
+ disabled={resourceIsFrozen(currentCollection, resources)}
className={classes.editButton} variant='contained'
data-cy='details-panel-edit-btn' color='primary' size='small'
onClick={() => editCollection(currentCollection)}>
diff --git a/src/views-components/details-panel/details-panel.tsx b/src/views-components/details-panel/details-panel.tsx
index adbbab79..e9175f57 100644
--- a/src/views-components/details-panel/details-panel.tsx
+++ b/src/views-components/details-panel/details-panel.tsx
@@ -27,6 +27,7 @@ import { getResource } from 'store/resources/resources';
import { toggleDetailsPanel, SLIDE_TIMEOUT, openDetailsPanel } from 'store/details-panel/details-panel-action';
import { FileDetails } from 'views-components/details-panel/file-details';
import { getNode } from 'models/tree';
+import { resourceIsFrozen } from 'common/frozen-resources';
type CssRules = 'root' | 'container' | 'opened' | 'headerContainer' | 'headerIcon' | 'tabContainer';
@@ -87,7 +88,14 @@ const mapStateToProps = ({ auth, detailsPanel, resources, collectionPanelFiles }
const file = resource
? undefined
: getNode(detailsPanel.resourceUuid)(collectionPanelFiles);
+
+ let isFrozen = false;
+ if (resource) {
+ isFrozen = resourceIsFrozen(resource, resources);
+ }
+
return {
+ isFrozen,
authConfig: auth.config,
isOpened: detailsPanel.isOpened,
tabNr: detailsPanel.tabNr,
@@ -111,6 +119,7 @@ export interface DetailsPanelDataProps {
isOpened: boolean;
tabNr: number;
res: DetailsResource;
+ isFrozen: boolean;
}
type DetailsPanelProps = DetailsPanelDataProps & WithStyles<CssRules>;
diff --git a/src/views-components/details-panel/project-details.tsx b/src/views-components/details-panel/project-details.tsx
index 6d48e984..7dc6709d 100644
--- a/src/views-components/details-panel/project-details.tsx
+++ b/src/views-components/details-panel/project-details.tsx
@@ -19,6 +19,9 @@ 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<ProjectResource> {
getIcon(className?: string) {
@@ -59,6 +62,12 @@ interface ProjectDetailsComponentActionProps {
onClick: (prj: ProjectUpdateFormDialogData) => () => void;
}
+const mapStateToProps = (state: RootState): { resources: ResourcesState } => {
+ return {
+ resources: state.resources
+ };
+};
+
const mapDispatchToProps = (dispatch: Dispatch) => ({
onClick: (prj: ProjectUpdateFormDialogData) =>
() => dispatch<any>(openProjectUpdateDialog(prj)),
@@ -66,9 +75,9 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
type ProjectDetailsComponentProps = ProjectDetailsComponentDataProps & ProjectDetailsComponentActionProps & WithStyles<CssRules>;
-const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
+const ProjectDetailsComponent = connect(mapStateToProps, mapDispatchToProps)(
withStyles(styles)(
- ({ classes, project, onClick }: ProjectDetailsComponentProps) => <div>
+ ({ classes, project, resources, onClick }: ProjectDetailsComponentProps & { resources: ResourcesState }) => <div>
{project.groupClass !== GroupClass.FILTER ?
<Button onClick={onClick({
uuid: project.uuid,
@@ -76,6 +85,7 @@ const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
description: project.description,
properties: project.properties,
})}
+ disabled={resourceIsFrozen(project, resources)}
className={classes.editButton} variant='contained'
data-cy='details-panel-edit-btn' color='primary' size='small'>
<RenameIcon className={classes.editIcon} /> Edit
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 9d127a60..a568cdef 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -36,6 +36,7 @@ import { Link } from 'react-router-dom';
import { Link as ButtonLink } from '@material-ui/core';
import { ResourceWithName, ResponsiblePerson } from 'views-components/data-explorer/renderers';
import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view';
+import { resourceIsFrozen } from 'common/frozen-resources';
type CssRules = 'root'
| 'button'
@@ -133,6 +134,11 @@ export const CollectionPanel = withStyles(styles)(connect(
}
}
}
+
+ if (item) {
+ isWritable = !resourceIsFrozen(item, state.resources);
+ }
+
return { item, isWritable, isOldVersion };
})(
class extends React.Component<CollectionPanelProps> {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list