[ARVADOS-WORKBENCH2] created: 1.4.1-181-g0450e574
Git user
git at public.arvados.org
Sat Dec 21 22:48:07 UTC 2019
at 0450e574b42cfbd89bcc97672abf5bfc80804b4c (commit)
commit 0450e574b42cfbd89bcc97672abf5bfc80804b4c
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 e1a1b835..138c6647 100644
--- a/src/store/resource-type-filters/resource-type-filters.ts
+++ b/src/store/resource-type-filters/resource-type-filters.ts
@@ -23,6 +23,11 @@ export enum CollectionTypeFilter {
LOG_COLLECTION = 'Log',
}
+export enum ProcessTypeFilter {
+ MAIN_PROCESS = 'Main',
+ CHILD_PROCESS = 'Child',
+}
+
const initFilter = (name: string, parent = '') =>
setNode<DataTableFilterItem>({
id: name,
@@ -46,6 +51,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),
@@ -82,11 +89,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)
)();
@@ -135,10 +146,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(),
);
commit dfdbade80f524b21f381757473f0b897231bed87
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Sat Dec 21 19:32:38 2019 -0300
15047: Adds 'distinct' filter to filter builder.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/services/api/filter-builder.ts b/src/services/api/filter-builder.ts
index d5903c56..a3ce6af0 100644
--- a/src/services/api/filter-builder.ts
+++ b/src/services/api/filter-builder.ts
@@ -13,6 +13,10 @@ export class FilterBuilder {
return this.addCondition(field, "=", value, "", "", resourcePrefix);
}
+ public addDistinct(field: string, value?: string | boolean | null, resourcePrefix?: string){
+ return this.addCondition(field, "!=", value, "", "", resourcePrefix);
+ }
+
public addLike(field: string, value?: string, resourcePrefix?: string) {
return this.addCondition(field, "like", value, "%", "%", resourcePrefix);
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list