[ARVADOS-WORKBENCH2] updated: 1.4.1-200-g8f2f8ac6
Git user
git at public.arvados.org
Tue Dec 24 18:34:27 UTC 2019
Summary of changes:
.../resource-type-filters.test.ts | 28 ++++++++++++++++-
.../resource-type-filters/resource-type-filters.ts | 36 +++++++++++++---------
2 files changed, 49 insertions(+), 15 deletions(-)
via 8f2f8ac64a147b67e07000be1e0ec2aaa88db510 (commit)
from bde378e940fac774283c1e7ad666c94c4b68c32f (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 8f2f8ac64a147b67e07000be1e0ec2aaa88db510
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Tue Dec 24 15:31:07 2019 -0300
15047: Fixes build by nesting pipe() calls instead of passing more tha 7 args.
Also: adds tests.
It seems that lodash's pipe() (an alias of flow()) function changes its
return type to 'any' when being passed more than 7 arguments, sometimes
breaking the build (in this case, resource-type-filters.test.ts)
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.test.ts b/src/store/resource-type-filters/resource-type-filters.test.ts
index 02f017ed..2f4d3cad 100644
--- a/src/store/resource-type-filters/resource-type-filters.test.ts
+++ b/src/store/resource-type-filters/resource-type-filters.test.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { getInitialResourceTypeFilters, serializeResourceTypeFilters, ObjectTypeFilter, CollectionTypeFilter } from './resource-type-filters';
+import { getInitialResourceTypeFilters, serializeResourceTypeFilters, ObjectTypeFilter, CollectionTypeFilter, ProcessTypeFilter } from './resource-type-filters';
import { ResourceKind } from '~/models/resource';
import { deselectNode } from '~/models/tree';
import { pipe } from 'lodash/fp';
@@ -47,4 +47,30 @@ describe("serializeResourceTypeFilters", () => {
expect(serializedFilters)
.toEqual(`["uuid","is_a",["${ResourceKind.COLLECTION}"]],["collections.properties.type","not in",["output"]]`);
});
+
+ it("should serialize only main processes", () => {
+ const filters = pipe(
+ () => getInitialResourceTypeFilters(),
+ deselectNode(ObjectTypeFilter.PROJECT),
+ deselectNode(ProcessTypeFilter.CHILD_PROCESS),
+ deselectNode(ObjectTypeFilter.COLLECTION)
+ )();
+
+ const serializedFilters = serializeResourceTypeFilters(filters);
+ expect(serializedFilters)
+ .toEqual(`["uuid","is_a",["${ResourceKind.PROCESS}"]],["container_requests.requesting_container_uuid","=",null]`);
+ });
+
+ it("should serialize only child processes", () => {
+ const filters = pipe(
+ () => getInitialResourceTypeFilters(),
+ deselectNode(ObjectTypeFilter.PROJECT),
+ deselectNode(ProcessTypeFilter.MAIN_PROCESS),
+ deselectNode(ObjectTypeFilter.COLLECTION)
+ )();
+
+ const serializedFilters = serializeResourceTypeFilters(filters);
+ expect(serializedFilters)
+ .toEqual(`["uuid","is_a",["${ResourceKind.PROCESS}"]],["container_requests.requesting_container_uuid","!=",null]`);
+ });
});
diff --git a/src/store/resource-type-filters/resource-type-filters.ts b/src/store/resource-type-filters/resource-type-filters.ts
index d1996a00..4ee9c5f3 100644
--- a/src/store/resource-type-filters/resource-type-filters.ts
+++ b/src/store/resource-type-filters/resource-type-filters.ts
@@ -57,27 +57,35 @@ export const getSimpleObjectTypeFilters = pipe(
initFilter(ObjectTypeFilter.COLLECTION),
);
+// Using pipe() with more tha 7 arguments makes the return type be 'any',
+// causing compile issues.
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),
- initFilter(CollectionTypeFilter.LOG_COLLECTION, ObjectTypeFilter.COLLECTION),
+ pipe(
+ initFilter(ObjectTypeFilter.PROCESS),
+ initFilter(ProcessTypeFilter.MAIN_PROCESS, ObjectTypeFilter.PROCESS),
+ initFilter(ProcessTypeFilter.CHILD_PROCESS, ObjectTypeFilter.PROCESS)
+ ),
+ pipe(
+ initFilter(ObjectTypeFilter.COLLECTION),
+ initFilter(CollectionTypeFilter.GENERAL_COLLECTION, ObjectTypeFilter.COLLECTION),
+ initFilter(CollectionTypeFilter.OUTPUT_COLLECTION, ObjectTypeFilter.COLLECTION),
+ initFilter(CollectionTypeFilter.LOG_COLLECTION, ObjectTypeFilter.COLLECTION),
+ ),
);
export const getInitialProcessStatusFilters = pipe(
(): DataTableFilters => createTree<DataTableFilterItem>(),
- initFilter(ProcessStatusFilter.ALL, '', true),
- initFilter(ProcessStatusFilter.RUNNING, '', false),
- initFilter(ProcessStatusFilter.FAILED, '', false),
- initFilter(ProcessStatusFilter.COMPLETED, '', false),
- initFilter(ProcessStatusFilter.CANCELLED, '', false),
- initFilter(ProcessStatusFilter.QUEUED, '', false),
- initFilter(ProcessStatusFilter.LOCKED, '', false),
+ pipe(
+ initFilter(ProcessStatusFilter.ALL, '', true),
+ initFilter(ProcessStatusFilter.RUNNING, '', false),
+ initFilter(ProcessStatusFilter.FAILED, '', false),
+ initFilter(ProcessStatusFilter.COMPLETED, '', false),
+ initFilter(ProcessStatusFilter.CANCELLED, '', false),
+ initFilter(ProcessStatusFilter.QUEUED, '', false),
+ initFilter(ProcessStatusFilter.LOCKED, '', false),
+ ),
);
export const getTrashPanelTypeFilters = pipe(
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list