[ARVADOS-WORKBENCH2] created: 2.1.0-219-ga9bd08dd
Git user
git at public.arvados.org
Thu Mar 11 21:46:47 UTC 2021
at a9bd08dd21a33168b1bc95a46d16c7947a9440d8 (commit)
commit a9bd08dd21a33168b1bc95a46d16c7947a9440d8
Author: Ward Vandewege <ward at curii.com>
Date: Thu Mar 11 16:46:13 2021 -0500
17119: list the group class on the project details screen.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/src/views-components/details-panel/project-details.tsx b/src/views-components/details-panel/project-details.tsx
index 61797373..4a615506 100644
--- a/src/views-components/details-panel/project-details.tsx
+++ b/src/views-components/details-panel/project-details.tsx
@@ -60,6 +60,7 @@ const ProjectDetailsComponent = connect(null, mapDispatchToProps)(
withStyles(styles)(
({ classes, project, onClick }: ProjectDetailsComponentProps) => <div>
<DetailsAttribute label='Type' value={resourceLabel(ResourceKind.PROJECT)} />
+ <DetailsAttribute label='Group class' value={project.groupClass} />
<DetailsAttribute label='Owner' linkToUuid={project.ownerUuid}
uuidEnhancer={(uuid: string) => <ResourceOwnerWithName uuid={uuid} />} />
<DetailsAttribute label='Last modified' value={formatDate(project.modifiedAt)} />
commit 901a27dcbc5e09497f237d47555d8f713bb21cb9
Author: Ward Vandewege <ward at curii.com>
Date: Thu Mar 11 12:45:10 2021 -0500
17119: The "+ New" button should be disabled when viewing a filter
group.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 3ca2f0d6..bf03bf6c 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -15,7 +15,7 @@ import { navigateToRunProcess } from '~/store/navigation/navigation-action';
import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
import { getUserUuid } from '~/common/getuser';
import { matchProjectRoute } from '~/routes/routes';
-import { GroupResource } from '~/models/group';
+import { GroupClass, GroupResource } from '~/models/group';
import { ResourcesState, getResource } from '~/store/resources/resources';
import { extractUuidKind, ResourceKind } from '~/models/resource';
@@ -87,7 +87,8 @@ export const SidePanelButton = withStyles(styles)(
const currentProject = getResource<GroupResource>(currentItemId)(resources);
if (currentProject &&
currentProject.writableBy.indexOf(currentUserUUID || '') >= 0 &&
- !isProjectTrashed(currentProject, resources)) {
+ !isProjectTrashed(currentProject, resources) &&
+ currentProject.groupClass !== GroupClass.FILTER) {
enabled = true;
}
}
@@ -150,4 +151,4 @@ export const SidePanelButton = withStyles(styles)(
}
}
)
-);
\ No newline at end of file
+);
commit d9ca0c62cb1d45df5c27dee5b9d896a3a9c423b3
Author: Ward Vandewege <ward at curii.com>
Date: Thu Mar 11 12:37:39 2021 -0500
17119: the "Move to" dialog should not show filter groups as a potential
destination.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index d11f7527..5d12b419 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -21,7 +21,7 @@ import { mapTree } from '../../models/tree';
import { LinkResource, LinkClass } from "~/models/link";
import { mapTreeValues } from "~/models/tree";
import { sortFilesTree } from "~/services/collection-service/collection-service-files-response";
-import { GroupResource } from "~/models/group";
+import { GroupClass, GroupResource } from "~/models/group";
export const treePickerActions = unionize({
LOAD_TREE_PICKER_NODE: ofType<{ id: string, pickerId: string }>(),
@@ -101,11 +101,12 @@ interface LoadProjectParams {
pickerId: string;
includeCollections?: boolean;
includeFiles?: boolean;
+ includeFilterGroups?: boolean;
loadShared?: boolean;
}
export const loadProject = (params: LoadProjectParams) =>
async (dispatch: Dispatch, _: () => RootState, services: ServiceRepository) => {
- const { id, pickerId, includeCollections = false, includeFiles = false, loadShared = false } = params;
+ const { id, pickerId, includeCollections = false, includeFiles = false, includeFilterGroups = false, loadShared = false } = params;
dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId }));
@@ -121,7 +122,12 @@ export const loadProject = (params: LoadProjectParams) =>
dispatch<any>(receiveTreePickerData<GroupContentsResource>({
id,
pickerId,
- data: items,
+ data: items.filter((item) => {
+ if (!includeFilterGroups && (item as GroupResource).groupClass && (item as GroupResource).groupClass === GroupClass.FILTER) {
+ return false;
+ }
+ return true;
+ }),
extractNodeData: item => ({
id: item.uuid,
value: item,
commit 60894bab3aaca17946060ecf2d3392452547c568
Author: Ward Vandewege <ward at curii.com>
Date: Thu Mar 11 16:28:48 2021 -0500
17119: add basic filter group support.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/src/index.tsx b/src/index.tsx
index 98281b67..610d27c2 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -37,7 +37,7 @@ import { initWebSocket } from '~/websocket/websocket';
import { Config } from '~/common/config';
import { addRouteChangeHandlers } from './routes/route-change-handlers';
import { setCurrentTokenDialogApiHost } from '~/store/current-token-dialog/current-token-dialog-actions';
-import { processResourceActionSet } from '~/views-components/context-menu/action-sets/process-resource-action-set';
+import { processResourceActionSet, readOnlyProcessResourceActionSet } from '~/views-components/context-menu/action-sets/process-resource-action-set';
import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
import { trashedCollectionActionSet } from '~/views-components/context-menu/action-sets/trashed-collection-action-set';
import { setBuildInfo } from '~/store/app-info/app-info-actions';
@@ -81,6 +81,7 @@ addMenuActionSet(ContextMenuKind.OLD_VERSION_COLLECTION, oldCollectionVersionAct
addMenuActionSet(ContextMenuKind.TRASHED_COLLECTION, trashedCollectionActionSet);
addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
addMenuActionSet(ContextMenuKind.PROCESS_RESOURCE, processResourceActionSet);
+addMenuActionSet(ContextMenuKind.READONLY_PROCESS_RESOURCE, readOnlyProcessResourceActionSet);
addMenuActionSet(ContextMenuKind.TRASH, trashActionSet);
addMenuActionSet(ContextMenuKind.REPOSITORY, repositoryActionSet);
addMenuActionSet(ContextMenuKind.SSH_KEY, sshKeyActionSet);
diff --git a/src/models/group.ts b/src/models/group.ts
index e18c8ecb..365e9cce 100644
--- a/src/models/group.ts
+++ b/src/models/group.ts
@@ -15,5 +15,6 @@ export interface GroupResource extends TrashableResource {
}
export enum GroupClass {
- PROJECT = "project"
+ PROJECT = 'project',
+ FILTER = 'filter',
}
diff --git a/src/models/project.ts b/src/models/project.ts
index 8e101ce2..86ac04f6 100644
--- a/src/models/project.ts
+++ b/src/models/project.ts
@@ -5,7 +5,7 @@
import { GroupClass, GroupResource } from "./group";
export interface ProjectResource extends GroupResource {
- groupClass: GroupClass.PROJECT;
+ groupClass: GroupClass.PROJECT | GroupClass.FILTER;
}
export const getProjectUrl = (uuid: string) => {
diff --git a/src/services/project-service/project-service.test.ts b/src/services/project-service/project-service.test.ts
index 12eae0fe..3634b8cb 100644
--- a/src/services/project-service/project-service.test.ts
+++ b/src/services/project-service/project-service.test.ts
@@ -31,7 +31,7 @@ describe("CommonResourceService", () => {
expect(axiosInstance.get).toHaveBeenCalledWith("/groups", {
params: {
filters: "[" + new FilterBuilder()
- .addEqual("group_class", "project")
+ .addIn("group_class", ["project", "filter"])
.getFilters() + "]",
order: undefined
}
diff --git a/src/services/project-service/project-service.ts b/src/services/project-service/project-service.ts
index 4ae91d4d..515571e7 100644
--- a/src/services/project-service/project-service.ts
+++ b/src/services/project-service/project-service.ts
@@ -20,7 +20,7 @@ export class ProjectService extends GroupsService<ProjectResource> {
filters: joinFilters(
args.filters || '',
new FilterBuilder()
- .addEqual("group_class", GroupClass.PROJECT)
+ .addIn('group_class', [GroupClass.PROJECT, GroupClass.FILTER])
.getFilters()
)
});
diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts
index 22553885..876cb951 100644
--- a/src/store/context-menu/context-menu-actions.ts
+++ b/src/store/context-menu/context-menu-actions.ts
@@ -18,8 +18,9 @@ import { VirtualMachinesResource } from '~/models/virtual-machines';
import { KeepServiceResource } from '~/models/keep-services';
import { ProcessResource } from '~/models/process';
import { CollectionResource } from '~/models/collection';
-import { GroupResource } from '~/models/group';
+import { GroupClass, GroupResource } from '~/models/group';
import { GroupContentsResource } from '~/services/groups-service/groups-service';
+import { getProjectPanelCurrentUuid } from '~/store/project-panel/project-panel-action';
export const contextMenuActions = unionize({
OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition, resource: ContextMenuResource }>(),
@@ -206,14 +207,28 @@ export const resourceUuidToContextMenuKind = (uuid: string) =>
const { isAdmin: isAdminUser, uuid: userUuid } = getState().auth.user!;
const kind = extractUuidKind(uuid);
const resource = getResourceWithEditableStatus<GroupResource & EditableResource>(uuid, userUuid)(getState().resources);
- const isEditable = isAdminUser || (resource || {} as EditableResource).isEditable;
+ // When viewing the contents of a filter group, all contents should be treated as read only.
+ let inFilterGroup = false;
+ const projectUuid = getProjectPanelCurrentUuid(getState());
+ if (projectUuid !== undefined) {
+ const project = getResource<GroupResource>(projectUuid)(getState().resources);
+ if (project) {
+ if (project.groupClass === GroupClass.FILTER) {
+ inFilterGroup = true;
+ }
+ }
+ }
+ const isEditable = (isAdminUser || (resource || {} as EditableResource).isEditable) && !inFilterGroup;
+
switch (kind) {
case ResourceKind.PROJECT:
- return !isAdminUser
- ? isEditable
- ? ContextMenuKind.PROJECT
+ return (isAdminUser && !inFilterGroup)
+ ? (resource && resource.groupClass === GroupClass.PROJECT)
+ ? ContextMenuKind.PROJECT_ADMIN
: ContextMenuKind.READONLY_PROJECT
- : ContextMenuKind.PROJECT_ADMIN;
+ : isEditable
+ ? ContextMenuKind.PROJECT
+ : ContextMenuKind.READONLY_PROJECT;
case ResourceKind.COLLECTION:
const c = getResource<CollectionResource>(uuid)(getState().resources);
if (c === undefined) { return; }
@@ -223,15 +238,17 @@ export const resourceUuidToContextMenuKind = (uuid: string) =>
? ContextMenuKind.OLD_VERSION_COLLECTION
: (isTrashed && isEditable)
? ContextMenuKind.TRASHED_COLLECTION
- : isAdminUser
+ : (isAdminUser && !inFilterGroup)
? ContextMenuKind.COLLECTION_ADMIN
: isEditable
? ContextMenuKind.COLLECTION
: ContextMenuKind.READONLY_COLLECTION;
case ResourceKind.PROCESS:
- return !isAdminUser
- ? ContextMenuKind.PROCESS_RESOURCE
- : ContextMenuKind.PROCESS_ADMIN;
+ return (isAdminUser && !inFilterGroup)
+ ? ContextMenuKind.PROCESS_ADMIN
+ : isEditable
+ ? ContextMenuKind.PROCESS_RESOURCE
+ : ContextMenuKind.READONLY_PROCESS_RESOURCE;
case ResourceKind.USER:
return ContextMenuKind.ROOT_PROJECT;
case ResourceKind.LINK:
diff --git a/src/store/groups-panel/groups-panel-middleware-service.ts b/src/store/groups-panel/groups-panel-middleware-service.ts
index f1576a23..8589c768 100644
--- a/src/store/groups-panel/groups-panel-middleware-service.ts
+++ b/src/store/groups-panel/groups-panel-middleware-service.ts
@@ -36,7 +36,7 @@ export class GroupsPanelMiddlewareService extends DataExplorerMiddlewareService
order.addOrder(direction, 'name');
}
const filters = new FilterBuilder()
- .addNotIn('group_class', [GroupClass.PROJECT])
+ .addNotIn('group_class', [GroupClass.PROJECT, GroupClass.FILTER])
.addILike('name', dataExplorer.searchValue)
.getFilters();
const response = await this.services.groupsService
diff --git a/src/store/resources/resources.ts b/src/store/resources/resources.ts
index 696a1362..915235d1 100644
--- a/src/store/resources/resources.ts
+++ b/src/store/resources/resources.ts
@@ -6,6 +6,8 @@ import { Resource, EditableResource } from "~/models/resource";
import { ResourceKind } from '~/models/resource';
import { ProjectResource } from "~/models/project";
import { GroupResource } from "~/models/group";
+import { extractUuidObjectType, ResourceObjectType } from "~/models/resource";
+import { GroupClass } from '~/models/group';
export type ResourcesState = { [key: string]: Resource };
@@ -36,6 +38,15 @@ export const getResourceWithEditableStatus = <T extends EditableResource & Group
const resource = JSON.parse(JSON.stringify(state[id] as T));
if (resource) {
+ const objectType = extractUuidObjectType(resource.uuid);
+ switch (objectType) {
+ case ResourceObjectType.GROUP:
+ // filter groups are read-only for now
+ if (resource.groupClass === GroupClass.FILTER) {
+ resource.isEditable = false;
+ return resource;
+ }
+ }
resource.isEditable = userUuid ? getResourceWritableBy(state, id, userUuid).indexOf(userUuid) > -1 : false;
}
diff --git a/src/views-components/context-menu/action-sets/process-resource-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
index 8cab9bfd..73a65a2d 100644
--- a/src/views-components/context-menu/action-sets/process-resource-action-set.ts
+++ b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
@@ -14,21 +14,7 @@ import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions
import { openRemoveProcessDialog } from "~/store/processes/processes-actions";
import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
-export const processResourceActionSet: ContextMenuActionSet = [[
- {
- icon: RenameIcon,
- name: "Edit process",
- execute: (dispatch, resource) => {
- dispatch<any>(openProcessUpdateDialog(resource));
- }
- },
- {
- icon: ShareIcon,
- name: "Share",
- execute: (dispatch, { uuid }) => {
- dispatch<any>(openSharingDialog(uuid));
- }
- },
+export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [[
{
component: ToggleFavoriteAction,
execute: (dispatch, resource) => {
@@ -37,13 +23,6 @@ export const processResourceActionSet: ContextMenuActionSet = [[
});
}
},
- {
- icon: MoveToIcon,
- name: "Move to",
- execute: (dispatch, resource) => {
- dispatch<any>(openMoveProcessDialog(resource));
- }
- },
{
icon: CopyIcon,
name: "Copy to project",
@@ -58,6 +37,31 @@ export const processResourceActionSet: ContextMenuActionSet = [[
dispatch<any>(toggleDetailsPanel());
}
},
+]];
+
+export const processResourceActionSet: ContextMenuActionSet = [[
+ ...readOnlyProcessResourceActionSet.reduce((prev, next) => prev.concat(next), []),
+ {
+ icon: RenameIcon,
+ name: "Edit process",
+ execute: (dispatch, resource) => {
+ dispatch<any>(openProcessUpdateDialog(resource));
+ }
+ },
+ {
+ icon: ShareIcon,
+ name: "Share",
+ execute: (dispatch, { uuid }) => {
+ dispatch<any>(openSharingDialog(uuid));
+ }
+ },
+ {
+ icon: MoveToIcon,
+ name: "Move to",
+ execute: (dispatch, resource) => {
+ dispatch<any>(openMoveProcessDialog(resource));
+ }
+ },
{
name: "Remove",
icon: RemoveIcon,
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 219913cd..7f2a29f8 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -85,6 +85,7 @@ export enum ContextMenuKind {
PROCESS = "Process",
PROCESS_ADMIN = 'ProcessAdmin',
PROCESS_RESOURCE = 'ProcessResource',
+ READONLY_PROCESS_RESOURCE = 'ReadOnlyProcessResource',
PROCESS_LOGS = "ProcessLogs",
REPOSITORY = "Repository",
SSH_KEY = "SshKey",
diff --git a/src/views-components/sharing-dialog/participant-select.tsx b/src/views-components/sharing-dialog/participant-select.tsx
index ea3775e9..0a61926e 100644
--- a/src/views-components/sharing-dialog/participant-select.tsx
+++ b/src/views-components/sharing-dialog/participant-select.tsx
@@ -134,7 +134,7 @@ export const ParticipantSelect = connect()(
const userItems: ListResults<any> = await userService.list({ filters: filterUsers, limit, count: "none" });
const filterGroups = new FilterBuilder()
- .addNotIn('group_class', [GroupClass.PROJECT])
+ .addNotIn('group_class', [GroupClass.PROJECT, GroupClass.FILTER])
.addILike('name', value)
.getFilters();
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list