From 58800bbe6e474679dcfbc03735541a578280dd85 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Wed, 1 Jun 2022 17:46:35 -0400 Subject: [PATCH] 18984: Change resource type filter defaults, rearrange / rename process filters Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- .../resource-type-filters.test.ts | 36 ++++++++++--------- .../resource-type-filters.ts | 26 +++++++------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/store/resource-type-filters/resource-type-filters.test.ts b/src/store/resource-type-filters/resource-type-filters.test.ts index f001770e..5972f60c 100644 --- a/src/store/resource-type-filters/resource-type-filters.test.ts +++ b/src/store/resource-type-filters/resource-type-filters.test.ts @@ -4,7 +4,7 @@ import { getInitialResourceTypeFilters, serializeResourceTypeFilters, ObjectTypeFilter, CollectionTypeFilter, ProcessTypeFilter, GroupTypeFilter, buildProcessStatusFilters, ProcessStatusFilter } from './resource-type-filters'; import { ResourceKind } from 'models/resource'; -import { deselectNode } from 'models/tree'; +import { selectNode, deselectNode } from 'models/tree'; import { pipe } from 'lodash/fp'; import { FilterBuilder } from 'services/api/filter-builder'; @@ -31,21 +31,21 @@ describe("serializeResourceTypeFilters", () => { const filters = getInitialResourceTypeFilters(); const serializedFilters = serializeResourceTypeFilters(filters); expect(serializedFilters) - .toEqual(`["uuid","is_a",["${ResourceKind.PROJECT}","${ResourceKind.PROCESS}","${ResourceKind.COLLECTION}","${ResourceKind.WORKFLOW}"]]`); + .toEqual(`["uuid","is_a",["${ResourceKind.PROJECT}","${ResourceKind.COLLECTION}","${ResourceKind.WORKFLOW}","${ResourceKind.PROCESS}"]],["container_requests.requesting_container_uuid","=",null]`); }); it("should serialize all but collection filters", () => { const filters = deselectNode(ObjectTypeFilter.COLLECTION)(getInitialResourceTypeFilters()); const serializedFilters = serializeResourceTypeFilters(filters); expect(serializedFilters) - .toEqual(`["uuid","is_a",["${ResourceKind.PROJECT}","${ResourceKind.PROCESS}","${ResourceKind.WORKFLOW}"]]`); + .toEqual(`["uuid","is_a",["${ResourceKind.PROJECT}","${ResourceKind.WORKFLOW}","${ResourceKind.PROCESS}"]],["container_requests.requesting_container_uuid","=",null]`); }); it("should serialize output collections and projects", () => { const filters = pipe( () => getInitialResourceTypeFilters(), - deselectNode(ObjectTypeFilter.PROCESS), - deselectNode(ObjectTypeFilter.WORKFLOW), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), deselectNode(CollectionTypeFilter.GENERAL_COLLECTION), deselectNode(CollectionTypeFilter.LOG_COLLECTION), deselectNode(CollectionTypeFilter.INTERMEDIATE_COLLECTION), @@ -59,8 +59,8 @@ describe("serializeResourceTypeFilters", () => { it("should serialize intermediate collections and projects", () => { const filters = pipe( () => getInitialResourceTypeFilters(), - deselectNode(ObjectTypeFilter.PROCESS), - deselectNode(ObjectTypeFilter.WORKFLOW), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), deselectNode(CollectionTypeFilter.GENERAL_COLLECTION), deselectNode(CollectionTypeFilter.LOG_COLLECTION), deselectNode(CollectionTypeFilter.OUTPUT_COLLECTION), @@ -75,8 +75,8 @@ describe("serializeResourceTypeFilters", () => { const filters = pipe( () => getInitialResourceTypeFilters(), deselectNode(ObjectTypeFilter.PROJECT), - deselectNode(ObjectTypeFilter.PROCESS), - deselectNode(ObjectTypeFilter.WORKFLOW), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), deselectNode(CollectionTypeFilter.OUTPUT_COLLECTION) )(); @@ -91,7 +91,7 @@ describe("serializeResourceTypeFilters", () => { deselectNode(ObjectTypeFilter.PROJECT), deselectNode(ProcessTypeFilter.CHILD_PROCESS), deselectNode(ObjectTypeFilter.COLLECTION), - deselectNode(ObjectTypeFilter.WORKFLOW), + deselectNode(ObjectTypeFilter.DEFINITION), )(); const serializedFilters = serializeResourceTypeFilters(filters); @@ -104,8 +104,10 @@ describe("serializeResourceTypeFilters", () => { () => getInitialResourceTypeFilters(), deselectNode(ObjectTypeFilter.PROJECT), deselectNode(ProcessTypeFilter.MAIN_PROCESS), + deselectNode(ObjectTypeFilter.DEFINITION), deselectNode(ObjectTypeFilter.COLLECTION), - deselectNode(ObjectTypeFilter.WORKFLOW), + + selectNode(ProcessTypeFilter.CHILD_PROCESS), )(); const serializedFilters = serializeResourceTypeFilters(filters); @@ -116,9 +118,9 @@ describe("serializeResourceTypeFilters", () => { it("should serialize all project types", () => { const filters = pipe( () => getInitialResourceTypeFilters(), - deselectNode(ObjectTypeFilter.PROCESS), deselectNode(ObjectTypeFilter.COLLECTION), - deselectNode(ObjectTypeFilter.WORKFLOW), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), )(); const serializedFilters = serializeResourceTypeFilters(filters); @@ -130,9 +132,9 @@ describe("serializeResourceTypeFilters", () => { const filters = pipe( () => getInitialResourceTypeFilters(), deselectNode(GroupTypeFilter.PROJECT), - deselectNode(ObjectTypeFilter.PROCESS), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), deselectNode(ObjectTypeFilter.COLLECTION), - deselectNode(ObjectTypeFilter.WORKFLOW), )(); const serializedFilters = serializeResourceTypeFilters(filters); @@ -144,9 +146,9 @@ describe("serializeResourceTypeFilters", () => { const filters = pipe( () => getInitialResourceTypeFilters(), deselectNode(GroupTypeFilter.FILTER_GROUP), - deselectNode(ObjectTypeFilter.PROCESS), + deselectNode(ObjectTypeFilter.DEFINITION), + deselectNode(ProcessTypeFilter.MAIN_PROCESS), deselectNode(ObjectTypeFilter.COLLECTION), - deselectNode(ObjectTypeFilter.WORKFLOW), )(); const serializedFilters = serializeResourceTypeFilters(filters); diff --git a/src/store/resource-type-filters/resource-type-filters.ts b/src/store/resource-type-filters/resource-type-filters.ts index 9f6d73ba..04c056dc 100644 --- a/src/store/resource-type-filters/resource-type-filters.ts +++ b/src/store/resource-type-filters/resource-type-filters.ts @@ -25,9 +25,9 @@ export enum ProcessStatusFilter { export enum ObjectTypeFilter { PROJECT = 'Project', - PROCESS = 'Process', - COLLECTION = 'Data collection', WORKFLOW = 'Workflow', + COLLECTION = 'Data collection', + DEFINITION = 'Definition', } export enum GroupTypeFilter { @@ -43,8 +43,8 @@ export enum CollectionTypeFilter { } export enum ProcessTypeFilter { - MAIN_PROCESS = 'Main', - CHILD_PROCESS = 'Child', + MAIN_PROCESS = 'Runs', + CHILD_PROCESS = 'Intermediate Steps', } const initFilter = (name: string, parent = '', isSelected?: boolean, isExpanded?: boolean) => @@ -63,9 +63,9 @@ const initFilter = (name: string, parent = '', isSelected?: boolean, isExpanded? export const getSimpleObjectTypeFilters = pipe( (): DataTableFilters => createTree(), initFilter(ObjectTypeFilter.PROJECT), - initFilter(ObjectTypeFilter.PROCESS), - initFilter(ObjectTypeFilter.COLLECTION), initFilter(ObjectTypeFilter.WORKFLOW), + initFilter(ObjectTypeFilter.COLLECTION), + initFilter(ObjectTypeFilter.DEFINITION), ); // Using pipe() with more than 7 arguments makes the return type be 'any', @@ -78,9 +78,10 @@ export const getInitialResourceTypeFilters = pipe( initFilter(GroupTypeFilter.FILTER_GROUP, ObjectTypeFilter.PROJECT), ), pipe( - initFilter(ObjectTypeFilter.PROCESS, '', false, true), - initFilter(ProcessTypeFilter.MAIN_PROCESS, ObjectTypeFilter.PROCESS), - initFilter(ProcessTypeFilter.CHILD_PROCESS, ObjectTypeFilter.PROCESS, false) + initFilter(ObjectTypeFilter.WORKFLOW, '', false, true), + initFilter(ObjectTypeFilter.DEFINITION, ObjectTypeFilter.WORKFLOW), + initFilter(ProcessTypeFilter.MAIN_PROCESS, ObjectTypeFilter.WORKFLOW), + initFilter(ProcessTypeFilter.CHILD_PROCESS, ObjectTypeFilter.WORKFLOW, false), ), pipe( initFilter(ObjectTypeFilter.COLLECTION, '', true, true), @@ -89,7 +90,6 @@ export const getInitialResourceTypeFilters = pipe( initFilter(CollectionTypeFilter.INTERMEDIATE_COLLECTION, ObjectTypeFilter.COLLECTION), initFilter(CollectionTypeFilter.LOG_COLLECTION, ObjectTypeFilter.COLLECTION), ), - initFilter(ObjectTypeFilter.WORKFLOW) ); @@ -134,11 +134,11 @@ const objectTypeToResourceKind = (type: ObjectTypeFilter) => { switch (type) { case ObjectTypeFilter.PROJECT: return ResourceKind.PROJECT; - case ObjectTypeFilter.PROCESS: + case ObjectTypeFilter.WORKFLOW: return ResourceKind.PROCESS; case ObjectTypeFilter.COLLECTION: return ResourceKind.COLLECTION; - case ObjectTypeFilter.WORKFLOW: + case ObjectTypeFilter.DEFINITION: return ResourceKind.WORKFLOW; } }; @@ -156,7 +156,7 @@ const serializeObjectTypeFilters = ({ fb, selectedFilters }: ReturnType processFilters.length > 0 - ? set.add(ObjectTypeFilter.PROCESS) + ? set.add(ObjectTypeFilter.WORKFLOW) : set, set => Array.from(set) )(); -- 2.30.2