[ARVADOS-WORKBENCH2] created: 1.4.1-199-gbde378e9

Git user git at public.arvados.org
Sat Dec 21 22:54:21 UTC 2019


        at  bde378e940fac774283c1e7ad666c94c4b68c32f (commit)


commit bde378e940fac774283c1e7ad666c94c4b68c32f
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Sat Dec 21 19:47:26 2019 -0300

    15047: Adds 'process type' filtering to project panel.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/store/resource-type-filters/resource-type-filters.ts b/src/store/resource-type-filters/resource-type-filters.ts
index 8e856c94..d1996a00 100644
--- a/src/store/resource-type-filters/resource-type-filters.ts
+++ b/src/store/resource-type-filters/resource-type-filters.ts
@@ -33,6 +33,11 @@ export enum CollectionTypeFilter {
     LOG_COLLECTION = 'Log',
 }
 
+export enum ProcessTypeFilter {
+    MAIN_PROCESS = 'Main',
+    CHILD_PROCESS = 'Child',
+}
+
 const initFilter = (name: string, parent = '', isSelected?: boolean) =>
     setNode<DataTableFilterItem>({
         id: name,
@@ -56,6 +61,8 @@ export const getInitialResourceTypeFilters = pipe(
     (): DataTableFilters => createTree<DataTableFilterItem>(),
     initFilter(ObjectTypeFilter.PROJECT),
     initFilter(ObjectTypeFilter.PROCESS),
+    initFilter(ProcessTypeFilter.MAIN_PROCESS, ObjectTypeFilter.PROCESS),
+    initFilter(ProcessTypeFilter.CHILD_PROCESS, ObjectTypeFilter.PROCESS),
     initFilter(ObjectTypeFilter.COLLECTION),
     initFilter(CollectionTypeFilter.GENERAL_COLLECTION, ObjectTypeFilter.COLLECTION),
     initFilter(CollectionTypeFilter.OUTPUT_COLLECTION, ObjectTypeFilter.COLLECTION),
@@ -103,11 +110,15 @@ const objectTypeToResourceKind = (type: ObjectTypeFilter) => {
 
 const serializeObjectTypeFilters = ({ fb, selectedFilters }: ReturnType<typeof createFiltersBuilder>) => {
     const collectionFilters = getMatchingFilters(values(CollectionTypeFilter), selectedFilters);
+    const processFilters = getMatchingFilters(values(ProcessTypeFilter), selectedFilters);
     const typeFilters = pipe(
         () => new Set(getMatchingFilters(values(ObjectTypeFilter), selectedFilters)),
         set => collectionFilters.length > 0
             ? set.add(ObjectTypeFilter.COLLECTION)
             : set,
+        set => processFilters.length > 0
+            ? set.add(ObjectTypeFilter.PROCESS)
+            : set,
         set => Array.from(set)
     )();
 
@@ -156,10 +167,36 @@ const buildCollectionTypeFilters = ({ fb, filters }: { fb: FilterBuilder, filter
     }
 };
 
+const serializeProcessTypeFilters = ({ fb, selectedFilters }: ReturnType<typeof createFiltersBuilder>) => pipe(
+    () => getMatchingFilters(values(ProcessTypeFilter), selectedFilters),
+    filters => filters,
+    mappedFilters => ({
+        fb: buildProcessTypeFilters({ fb, filters: mappedFilters }),
+        selectedFilters
+    })
+)();
+
+const PROCESS_TYPES = values(ProcessTypeFilter);
+const PROCESS_PREFIX = GroupContentsResourcePrefix.PROCESS;
+
+const buildProcessTypeFilters = ({ fb, filters }: { fb: FilterBuilder, filters: string[] }) => {
+    switch (true) {
+        case filters.length === 0 || filters.length === PROCESS_TYPES.length:
+            return fb;
+        case includes(ProcessTypeFilter.MAIN_PROCESS, filters):
+            return fb.addEqual('requesting_container_uuid', null, PROCESS_PREFIX);
+        case includes(ProcessTypeFilter.CHILD_PROCESS, filters):
+            return fb.addDistinct('requesting_container_uuid', null, PROCESS_PREFIX);
+        default:
+            return fb;
+    }
+};
+
 export const serializeResourceTypeFilters = pipe(
     createFiltersBuilder,
     serializeObjectTypeFilters,
     serializeCollectionTypeFilters,
+    serializeProcessTypeFilters,
     ({ fb }) => fb.getFilters(),
 );
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list