[ARVADOS-WORKBENCH2] updated: 1.4.1-305-geb976b59

Git user git at public.arvados.org
Tue Mar 31 15:18:29 UTC 2020


Summary of changes:
 src/common/config.ts                               |   4 +-
 src/components/column-selector/column-selector.tsx |   4 +-
 .../data-table-filters-popover.test.tsx            |  24 +++
 .../data-table-filters-popover.tsx                 |  11 +-
 .../data-table-filters/data-table-filters-tree.tsx |  10 +-
 .../data-table-filters/data-table-filters.test.tsx |  27 ---
 .../data-table-filters/data-table-filters.tsx      | 200 ---------------------
 src/components/data-table/data-table.test.tsx      |  25 +--
 src/components/tree/tree.tsx                       |  21 +--
 src/store/advanced-tab/advanced-tab.tsx            |   5 +-
 .../non-writable-collection-action-set.ts          |  18 +-
 .../user-dialog/attributes-dialog.tsx              |  25 +--
 src/views/collection-panel/collection-panel.tsx    |  21 ++-
 src/views/collection-panel/helpers.ts              |   6 +
 .../virtual-machine-user-panel.tsx                 |  40 +++--
 15 files changed, 110 insertions(+), 331 deletions(-)
 create mode 100644 src/components/data-table-filters/data-table-filters-popover.test.tsx
 delete mode 100644 src/components/data-table-filters/data-table-filters.test.tsx
 create mode 100644 src/views/collection-panel/helpers.ts

       via  eb976b594a51435922f94bd169b09715bb90b36e (commit)
       via  c64a3f2050687b7771f3d8389f5bcce65d65bad0 (commit)
       via  9521f4b07335fa8529d38ccf292acbd930be985a (commit)
       via  4ac83e75f248d2f993d64a41e055c6f5b59da4f7 (commit)
       via  255a4048de05a99096a72de0f644284ed9177749 (commit)
       via  9e38e0583dc943efcfe71ad722c814e92bac4d8a (commit)
       via  e3a0a85ef733c5cc337802e37b82c168c138f366 (commit)
       via  88ab5c4388e8bbe9dfa29ef5fff653a511d3096b (commit)
       via  25b49c962890e0d54c25e7e4ed2f266a74657004 (commit)
       via  9a1a41a402d4233e6c5b3dad870dfb13eb429df4 (commit)
       via  fbbd14b6916d6936fd5513834c56d6fd00ece7d8 (commit)
       via  4967fd074acbcdc792fedbb06c142c3a73634fe4 (commit)
       via  0fa33224ceb6be353bc5a6fdc0bb019a0cb710c7 (commit)
       via  a83c684b87584b790e6f8f0331452692e6e357ff (commit)
       via  db5a3f09820e8d41aeef7000d95b0ea67507c5a3 (commit)
      from  08439235be955812555b80a31f1e6461c7d90513 (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 eb976b594a51435922f94bd169b09715bb90b36e
Merge: c64a3f20 08439235
Author: PiotrAleksander <piotrhugonow at gmail.com>
Date:   Tue Mar 31 17:18:23 2020 +0200

    merge with remote


commit c64a3f2050687b7771f3d8389f5bcce65d65bad0
Author: PiotrAleksander <piotrhugonow at gmail.com>
Date:   Tue Mar 31 17:16:43 2020 +0200

    checkIfWritableBy based on user and owner

diff --git a/src/store/advanced-tab/advanced-tab.tsx b/src/store/advanced-tab/advanced-tab.tsx
index d60d0941..f11e54ff 100644
--- a/src/store/advanced-tab/advanced-tab.tsx
+++ b/src/store/advanced-tab/advanced-tab.tsx
@@ -435,7 +435,7 @@ const containerRequestApiResponse = (apiResponse: ContainerRequestResource) => {
 const collectionApiResponse = (apiResponse: CollectionResource) => {
     const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, name, description, properties, portableDataHash, replicationDesired,
         replicationConfirmedAt, replicationConfirmed, manifestText, deleteAt, trashAt, isTrashed, storageClassesDesired,
-        storageClassesConfirmed, storageClassesConfirmedAt, currentVersionUuid, version, preserveVersion, fileCount, fileSizeTotal, writableBy } = apiResponse;
+        storageClassesConfirmed, storageClassesConfirmedAt, currentVersionUuid, version, preserveVersion, fileCount, fileSizeTotal } = apiResponse;
     const response = `
 "uuid": "${uuid}",
 "owner_uuid": "${ownerUuid}",
@@ -461,8 +461,7 @@ const collectionApiResponse = (apiResponse: CollectionResource) => {
 "version": ${version},
 "preserve_version": ${preserveVersion},
 "file_count": ${fileCount},
-"file_size_total": ${fileSizeTotal},
-"writable_by": ${writableBy}`;
+"file_size_total": ${fileSizeTotal}`;
 
     return <span style={{ marginLeft: '-15px' }}>{'{'} {response} {'\n'} <span style={{ marginLeft: '-15px' }}>{'}'}</span></span>;
 };
diff --git a/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts b/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts
index 7c15d424..c38a98a1 100644
--- a/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts
@@ -5,13 +5,10 @@
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleFavoriteAction } from "../actions/favorite-action";
 import { toggleFavorite } from "~/store/favorites/favorites-actions";
-import { ShareIcon, CopyIcon, DetailsIcon } from "~/components/icon/icon";
+import { ShareIcon, CopyIcon } from "~/components/icon/icon";
 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
 import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
-import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
-import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
 import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
-import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
 
 export const nonWritableCollectionActionSet: ContextMenuActionSet = [[
     {
@@ -37,17 +34,4 @@ export const nonWritableCollectionActionSet: ContextMenuActionSet = [[
         }
 
     },
-    {
-        icon: DetailsIcon,
-        name: "View details",
-        execute: dispatch => {
-            dispatch<any>(toggleDetailsPanel());
-        }
-    },
-    {
-        component: ToggleTrashAction,
-        execute: (dispatch, resource) => {
-            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
-        }
-    },
 ]];
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index faaf623b..ad813c3b 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -25,7 +25,9 @@ import { openDetailsPanel } from '~/store/details-panel/details-panel-action';
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 import { getPropertyChip } from '~/views-components/resource-properties-form/property-chip';
 import { IllegalNamingWarning } from '~/components/warning/warning';
-import { getUserUuid } from '~/common/getuser';
+import { ProjectResource } from '~/models/project';
+import { checkIfWritable } from './helpers';
+import { User } from '~/models/user';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link';
 
@@ -59,7 +61,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 interface CollectionPanelDataProps {
     item: CollectionResource;
-    userUuid: string;
+    owner: ProjectResource;
+    user: User;
 }
 
 type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
@@ -68,8 +71,12 @@ type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
 export const CollectionPanel = withStyles(styles)(
     connect((state: RootState, props: RouteComponentProps<{ id: string }>) => {
         const item = getResource(props.match.params.id)(state.resources);
-        const userUuid = getUserUuid(state);
-        return { item, userUuid };
+        let owner;
+        if (item) {
+            owner = getResource(item.ownerUuid)(state.resources);
+        }
+        const user = state.auth.user;
+        return { item, owner, user };
     })(
         class extends React.Component<CollectionPanelProps> {
 
@@ -154,9 +161,9 @@ export const CollectionPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                const { userUuid } = this.props;
-                const { uuid, ownerUuid, name, description, kind, isTrashed, writableBy } = this.props.item;
-                const writable = writableBy.indexOf(userUuid) >= 0;
+                const { uuid, ownerUuid, name, description, kind, isTrashed } = this.props.item;
+                const { owner, user } = this.props;
+                const writable = checkIfWritable(user, owner);
                 const menuKind = writable ? isTrashed
                     ? ContextMenuKind.TRASHED_COLLECTION
                     : ContextMenuKind.COLLECTION : ContextMenuKind.NON_WRITABLE_COLLECTION;
diff --git a/src/views/collection-panel/helpers.ts b/src/views/collection-panel/helpers.ts
new file mode 100644
index 00000000..e3caad18
--- /dev/null
+++ b/src/views/collection-panel/helpers.ts
@@ -0,0 +1,6 @@
+import { User } from "~/models/user";
+import { ProjectResource } from "~/models/project";
+
+export const checkIfWritable = (user: User, owner: ProjectResource): boolean => {
+    return user.isActive && (user.isAdmin || user.uuid === owner.uuid || (owner.writableBy.indexOf(user.uuid) > -1));
+};
\ No newline at end of file

commit 9521f4b07335fa8529d38ccf292acbd930be985a
Author: PiotrAleksander <piotrhugonow at gmail.com>
Date:   Fri Feb 28 11:54:37 2020 +0100

    remove local config.json from public

diff --git a/public/config.json b/public/config.json
deleted file mode 100644
index d51bce26..00000000
--- a/public/config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "API_HOST": "ce8i5.arvadosapi.com"
-}

commit 4ac83e75f248d2f993d64a41e055c6f5b59da4f7
Author: PiotrAleksander <piotrhugonow at gmail.com>
Date:   Wed Feb 26 12:44:37 2020 +0100

    16118 WIP removed default writableBy value

diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 3e0aab65..faaf623b 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -155,7 +155,7 @@ export const CollectionPanel = withStyles(styles)(
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
                 const { userUuid } = this.props;
-                const { uuid, ownerUuid, name, description, kind, isTrashed, writableBy = [] } = this.props.item;
+                const { uuid, ownerUuid, name, description, kind, isTrashed, writableBy } = this.props.item;
                 const writable = writableBy.indexOf(userUuid) >= 0;
                 const menuKind = writable ? isTrashed
                     ? ContextMenuKind.TRASHED_COLLECTION

commit 255a4048de05a99096a72de0f644284ed9177749
Author: PiotrAleksander <piotrhugonow at gmail.com>
Date:   Wed Feb 26 11:58:13 2020 +0100

    16118 WIP added non_writable_collection contextMenuKind used if writableBy does not contain userUuid

diff --git a/public/config.json b/public/config.json
new file mode 100644
index 00000000..d51bce26
--- /dev/null
+++ b/public/config.json
@@ -0,0 +1,3 @@
+{
+  "API_HOST": "ce8i5.arvadosapi.com"
+}
diff --git a/src/index.tsx b/src/index.tsx
index bf810fb7..990aa398 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -28,6 +28,7 @@ import { collectionFilesActionSet } from '~/views-components/context-menu/action
 import { collectionFilesItemActionSet } from '~/views-components/context-menu/action-sets/collection-files-item-action-set';
 import { collectionFilesNotSelectedActionSet } from '~/views-components/context-menu/action-sets/collection-files-not-selected-action-set';
 import { collectionActionSet } from '~/views-components/context-menu/action-sets/collection-action-set';
+import { nonWritableCollectionActionSet } from '~/views-components/context-menu/action-sets/non-writable-collection-action-set';
 import { collectionResourceActionSet } from '~/views-components/context-menu/action-sets/collection-resource-action-set';
 import { processActionSet } from '~/views-components/context-menu/action-sets/process-action-set';
 import { loadWorkbench } from '~/store/workbench/workbench-actions';
@@ -73,6 +74,7 @@ addMenuActionSet(ContextMenuKind.COLLECTION_FILES, collectionFilesActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_NOT_SELECTED, collectionFilesNotSelectedActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
+addMenuActionSet(ContextMenuKind.NON_WRITABLE_COLLECTION, nonWritableCollectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
 addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
 addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
diff --git a/src/models/collection.ts b/src/models/collection.ts
index baa25c7a..e22b44b3 100644
--- a/src/models/collection.ts
+++ b/src/models/collection.ts
@@ -23,6 +23,7 @@ export interface CollectionResource extends TrashableResource {
     unsignedManifestText?: string;
     fileCount: number;
     fileSizeTotal: number;
+    writableBy: string[];
 }
 
 export const getCollectionUrl = (uuid: string) => {
diff --git a/src/store/advanced-tab/advanced-tab.tsx b/src/store/advanced-tab/advanced-tab.tsx
index f11e54ff..d60d0941 100644
--- a/src/store/advanced-tab/advanced-tab.tsx
+++ b/src/store/advanced-tab/advanced-tab.tsx
@@ -435,7 +435,7 @@ const containerRequestApiResponse = (apiResponse: ContainerRequestResource) => {
 const collectionApiResponse = (apiResponse: CollectionResource) => {
     const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, name, description, properties, portableDataHash, replicationDesired,
         replicationConfirmedAt, replicationConfirmed, manifestText, deleteAt, trashAt, isTrashed, storageClassesDesired,
-        storageClassesConfirmed, storageClassesConfirmedAt, currentVersionUuid, version, preserveVersion, fileCount, fileSizeTotal } = apiResponse;
+        storageClassesConfirmed, storageClassesConfirmedAt, currentVersionUuid, version, preserveVersion, fileCount, fileSizeTotal, writableBy } = apiResponse;
     const response = `
 "uuid": "${uuid}",
 "owner_uuid": "${ownerUuid}",
@@ -461,7 +461,8 @@ const collectionApiResponse = (apiResponse: CollectionResource) => {
 "version": ${version},
 "preserve_version": ${preserveVersion},
 "file_count": ${fileCount},
-"file_size_total": ${fileSizeTotal}`;
+"file_size_total": ${fileSizeTotal},
+"writable_by": ${writableBy}`;
 
     return <span style={{ marginLeft: '-15px' }}>{'{'} {response} {'\n'} <span style={{ marginLeft: '-15px' }}>{'}'}</span></span>;
 };
diff --git a/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts b/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts
new file mode 100644
index 00000000..7c15d424
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/non-writable-collection-action-set.ts
@@ -0,0 +1,53 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import { ToggleFavoriteAction } from "../actions/favorite-action";
+import { toggleFavorite } from "~/store/favorites/favorites-actions";
+import { ShareIcon, CopyIcon, DetailsIcon } from "~/components/icon/icon";
+import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
+import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
+import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
+import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
+import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
+
+export const nonWritableCollectionActionSet: ContextMenuActionSet = [[
+    {
+        icon: ShareIcon,
+        name: "Share",
+        execute: (dispatch, { uuid }) => {
+            dispatch<any>(openSharingDialog(uuid));
+        }
+    },
+    {
+        component: ToggleFavoriteAction,
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleFavorite(resource)).then(() => {
+                dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+            });
+        }
+    },
+    {
+        icon: CopyIcon,
+        name: "Copy to project",
+        execute: (dispatch, resource) => {
+            dispatch<any>(openCollectionCopyDialog(resource));
+        }
+
+    },
+    {
+        icon: DetailsIcon,
+        name: "View details",
+        execute: dispatch => {
+            dispatch<any>(toggleDetailsPanel());
+        }
+    },
+    {
+        component: ToggleTrashAction,
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+        }
+    },
+]];
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 65e98cc5..f1c27866 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -73,6 +73,7 @@ export enum ContextMenuKind {
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
     COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
     COLLECTION = 'Collection',
+    NON_WRITABLE_COLLECTION = 'NonWritableCollection',
     COLLECTION_ADMIN = 'CollectionAdmin',
     COLLECTION_RESOURCE = 'CollectionResource',
     TRASHED_COLLECTION = 'TrashedCollection',
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index c4221937..3e0aab65 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -25,6 +25,7 @@ import { openDetailsPanel } from '~/store/details-panel/details-panel-action';
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 import { getPropertyChip } from '~/views-components/resource-properties-form/property-chip';
 import { IllegalNamingWarning } from '~/components/warning/warning';
+import { getUserUuid } from '~/common/getuser';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link';
 
@@ -58,6 +59,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 interface CollectionPanelDataProps {
     item: CollectionResource;
+    userUuid: string;
 }
 
 type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
@@ -66,7 +68,8 @@ type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
 export const CollectionPanel = withStyles(styles)(
     connect((state: RootState, props: RouteComponentProps<{ id: string }>) => {
         const item = getResource(props.match.params.id)(state.resources);
-        return { item };
+        const userUuid = getUserUuid(state);
+        return { item, userUuid };
     })(
         class extends React.Component<CollectionPanelProps> {
 
@@ -90,7 +93,7 @@ export const CollectionPanel = withStyles(styles)(
                                         </IconButton>
                                     </Tooltip>
                                 }
-                                title={item && <span><IllegalNamingWarning name={item.name}/>{item.name}</span>}
+                                title={item && <span><IllegalNamingWarning name={item.name} />{item.name}</span>}
                                 titleTypographyProps={this.titleProps}
                                 subheader={item && item.description}
                                 subheaderTypographyProps={this.titleProps} />
@@ -129,15 +132,15 @@ export const CollectionPanel = withStyles(styles)(
                                     <Grid item xs={12}>
                                         {Object.keys(item.properties).map(k =>
                                             Array.isArray(item.properties[k])
-                                            ? item.properties[k].map((v: string) =>
-                                                getPropertyChip(
-                                                    k, v,
-                                                    this.handleDelete(k, v),
-                                                    classes.tag))
-                                            : getPropertyChip(
-                                                k, item.properties[k],
-                                                this.handleDelete(k, item.properties[k]),
-                                                classes.tag)
+                                                ? item.properties[k].map((v: string) =>
+                                                    getPropertyChip(
+                                                        k, v,
+                                                        this.handleDelete(k, v),
+                                                        classes.tag))
+                                                : getPropertyChip(
+                                                    k, item.properties[k],
+                                                    this.handleDelete(k, item.properties[k]),
+                                                    classes.tag)
                                         )}
                                     </Grid>
                                 </Grid>
@@ -151,16 +154,20 @@ export const CollectionPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                const { uuid, ownerUuid, name, description, kind, isTrashed } = this.props.item;
+                const { userUuid } = this.props;
+                const { uuid, ownerUuid, name, description, kind, isTrashed, writableBy = [] } = this.props.item;
+                const writable = writableBy.indexOf(userUuid) >= 0;
+                const menuKind = writable ? isTrashed
+                    ? ContextMenuKind.TRASHED_COLLECTION
+                    : ContextMenuKind.COLLECTION : ContextMenuKind.NON_WRITABLE_COLLECTION;
+
                 const resource = {
                     uuid,
                     ownerUuid,
                     name,
                     description,
                     kind,
-                    menuKind: isTrashed
-                        ? ContextMenuKind.TRASHED_COLLECTION
-                        : ContextMenuKind.COLLECTION
+                    menuKind
                 };
                 this.props.dispatch<any>(openContextMenu(event, resource));
             }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list