[ARVADOS-WORKBENCH2] updated: 1.4.1-228-gbbd6e180
Git user
git at public.arvados.org
Tue Jan 21 19:51:00 UTC 2020
Summary of changes:
.../all-processes-panel-middleware-service.ts | 68 +++++++++++++++++++---
.../resource-type-filters/resource-type-filters.ts | 53 +++++++++++++++--
.../subprocess-panel-middleware-service.ts | 37 ++----------
.../all-processes-panel/all-processes-panel.tsx | 20 +++----
4 files changed, 122 insertions(+), 56 deletions(-)
via bbd6e1809d764ca269793424d3084bdb93311828 (commit)
via bc2b30cc5df5c23e9f1e00482d135e68d383f0de (commit)
via ca382107cccf8008ebf08b0d0b7aa7740327a780 (commit)
from 06d87a1bfa835b10193b9ecf87f62f7a707d55fa (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 bbd6e1809d764ca269793424d3084bdb93311828
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Tue Jan 21 16:49:21 2020 -0300
15012: Adds filtering by process type & ordering by name and created_at date.
Default 'process type' filter status is: show only main processes.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
index 43432cfd..df4bc74b 100644
--- a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
+++ b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
@@ -11,10 +11,18 @@ import { Dispatch, MiddlewareAPI } from "redux";
import { resourcesActions } from "~/store/resources/resources-actions";
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
-import { getDataExplorer, DataExplorer } from "~/store/data-explorer/data-explorer-reducer";
+import { getDataExplorer, DataExplorer, getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
import { loadMissingProcessesInformation } from "~/store/project-panel/project-panel-middleware-service";
import { DataColumns } from "~/components/data-table/data-table";
-import { ProcessStatusFilter, buildProcessStatusFilters } from "../resource-type-filters/resource-type-filters";
+import {
+ ProcessStatusFilter,
+ buildProcessStatusFilters,
+ serializeOnlyProcessTypeFilters
+} from "../resource-type-filters/resource-type-filters";
+import { AllProcessesPanelColumnNames } from "~/views/all-processes-panel/all-processes-panel";
+import { OrderBuilder, OrderDirection } from "~/services/api/order-builder";
+import { ProcessResource } from "~/models/process";
+import { SortDirection } from "~/components/data-table/data-column";
export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -56,6 +64,7 @@ export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareSe
const getParams = ( dataExplorer: DataExplorer ) => ({
...dataExplorerToListParams(dataExplorer),
+ order: getOrder(dataExplorer),
filters: getFilters(dataExplorer)
});
@@ -68,13 +77,34 @@ const getFilters = ( dataExplorer: DataExplorer ) => {
const nameFilter = new FilterBuilder().addILike("name", dataExplorer.searchValue).getFilters();
const statusFilter = buildProcessStatusFilters(new FilterBuilder(), activeStatusFilter).getFilters();
+ const typeFilters = serializeOnlyProcessTypeFilters(getDataExplorerColumnFilters(columns, AllProcessesPanelColumnNames.TYPE));
return joinFilters(
nameFilter,
- statusFilter
+ // TODO: When 15019 is merged, this won't be necessary
+ joinFilters(
+ statusFilter,
+ typeFilters)
);
};
+const getOrder = (dataExplorer: DataExplorer) => {
+ const sortColumn = getSortColumn(dataExplorer);
+ const order = new OrderBuilder<ProcessResource>();
+ if (sortColumn) {
+ const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
+ ? OrderDirection.ASC
+ : OrderDirection.DESC;
+
+ const columnName = sortColumn && sortColumn.name === AllProcessesPanelColumnNames.NAME ? "name" : "createdAt";
+ return order
+ .addOrder(sortDirection, columnName)
+ .getOrder();
+ } else {
+ return order.getOrder();
+ }
+};
+
const allProcessesPanelDataExplorerIsNotSet = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'All Processes panel is not ready.',
diff --git a/src/store/resource-type-filters/resource-type-filters.ts b/src/store/resource-type-filters/resource-type-filters.ts
index 6766bfca..1cc547ec 100644
--- a/src/store/resource-type-filters/resource-type-filters.ts
+++ b/src/store/resource-type-filters/resource-type-filters.ts
@@ -57,7 +57,7 @@ export const getSimpleObjectTypeFilters = pipe(
initFilter(ObjectTypeFilter.COLLECTION),
);
-// Using pipe() with more tha 7 arguments makes the return type be 'any',
+// Using pipe() with more than 7 arguments makes the return type be 'any',
// causing compile issues.
export const getInitialResourceTypeFilters = pipe(
(): DataTableFilters => createTree<DataTableFilterItem>(),
@@ -75,6 +75,12 @@ export const getInitialResourceTypeFilters = pipe(
),
);
+export const getInitialProcessTypeFilters = pipe(
+ (): DataTableFilters => createTree<DataTableFilterItem>(),
+ initFilter(ProcessTypeFilter.MAIN_PROCESS),
+ initFilter(ProcessTypeFilter.CHILD_PROCESS, '', false)
+);
+
export const getInitialProcessStatusFilters = pipe(
(): DataTableFilters => createTree<DataTableFilterItem>(),
pipe(
@@ -179,7 +185,7 @@ const serializeProcessTypeFilters = ({ fb, selectedFilters }: ReturnType<typeof
() => getMatchingFilters(values(ProcessTypeFilter), selectedFilters),
filters => filters,
mappedFilters => ({
- fb: buildProcessTypeFilters({ fb, filters: mappedFilters }),
+ fb: buildProcessTypeFilters({ fb, filters: mappedFilters, use_prefix: true }),
selectedFilters
})
)();
@@ -187,14 +193,14 @@ const serializeProcessTypeFilters = ({ fb, selectedFilters }: ReturnType<typeof
const PROCESS_TYPES = values(ProcessTypeFilter);
const PROCESS_PREFIX = GroupContentsResourcePrefix.PROCESS;
-const buildProcessTypeFilters = ({ fb, filters }: { fb: FilterBuilder, filters: string[] }) => {
+const buildProcessTypeFilters = ({ fb, filters, use_prefix }: { fb: FilterBuilder, filters: string[], use_prefix: boolean }) => {
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);
+ return fb.addEqual('requesting_container_uuid', null, use_prefix ? PROCESS_PREFIX : '');
case includes(ProcessTypeFilter.CHILD_PROCESS, filters):
- return fb.addDistinct('requesting_container_uuid', null, PROCESS_PREFIX);
+ return fb.addDistinct('requesting_container_uuid', null, use_prefix ? PROCESS_PREFIX : '');
default:
return fb;
}
@@ -208,6 +214,19 @@ export const serializeResourceTypeFilters = pipe(
({ fb }) => fb.getFilters(),
);
+export const serializeOnlyProcessTypeFilters = pipe(
+ createFiltersBuilder,
+ ({ fb, selectedFilters }: ReturnType<typeof createFiltersBuilder>) => pipe(
+ () => getMatchingFilters(values(ProcessTypeFilter), selectedFilters),
+ filters => filters,
+ mappedFilters => ({
+ fb: buildProcessTypeFilters({ fb, filters: mappedFilters, use_prefix: false }),
+ selectedFilters
+ })
+ )(),
+ ({ fb }) => fb.getFilters(),
+);
+
export const serializeSimpleObjectTypeFilters = (filters: Tree<DataTableFilterItem>) => {
return getSelectedNodes(filters)
.map(f => f.id)
diff --git a/src/views/all-processes-panel/all-processes-panel.tsx b/src/views/all-processes-panel/all-processes-panel.tsx
index 79575c74..723cf75b 100644
--- a/src/views/all-processes-panel/all-processes-panel.tsx
+++ b/src/views/all-processes-panel/all-processes-panel.tsx
@@ -15,10 +15,10 @@ import { ArvadosTheme } from '~/common/custom-theme';
import { ALL_PROCESSES_PANEL_ID } from '~/store/all-processes-panel/all-processes-panel-action';
import {
ProcessStatus,
- ResourceLastModifiedDate,
ResourceName,
ResourceOwner,
- ResourceType
+ ResourceType,
+ ResourceCreatedAtDate
} from '~/views-components/data-explorer/renderers';
import { ProcessIcon } from '~/components/icon/icon';
import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions';
@@ -28,7 +28,7 @@ import { ContainerRequestState } from "~/models/container-request";
import { RootState } from '~/store/store';
import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
import { createTree } from '~/models/tree';
-import { getSimpleObjectTypeFilters, getInitialProcessStatusFilters } from '~/store/resource-type-filters/resource-type-filters';
+import { getInitialProcessStatusFilters, getInitialProcessTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
type CssRules = "toolbar" | "button";
@@ -47,7 +47,7 @@ export enum AllProcessesPanelColumnNames {
STATUS = "Status",
TYPE = "Type",
OWNER = "Owner",
- LAST_MODIFIED = "Last modified"
+ CREATED_AT = "Started at"
}
export interface AllProcessesPanelFilter extends DataTableFilterItem {
@@ -75,8 +75,7 @@ export const allProcessesPanelColumns: DataColumns<string> = [
name: AllProcessesPanelColumnNames.TYPE,
selected: true,
configurable: true,
- // TODO: Only filter by process type (main, subprocess)
- filters: getSimpleObjectTypeFilters(),
+ filters: getInitialProcessTypeFilters(),
render: uuid => <ResourceType uuid={uuid} />
},
{
@@ -87,12 +86,12 @@ export const allProcessesPanelColumns: DataColumns<string> = [
render: uuid => <ResourceOwner uuid={uuid} />
},
{
- name: AllProcessesPanelColumnNames.LAST_MODIFIED,
+ name: AllProcessesPanelColumnNames.CREATED_AT,
selected: true,
configurable: true,
sortDirection: SortDirection.DESC,
filters: createTree(),
- render: uuid => <ResourceLastModifiedDate uuid={uuid} />
+ render: uuid => <ResourceCreatedAtDate uuid={uuid} />
}
];
@@ -147,7 +146,7 @@ export const AllProcessesPanel = withStyles(styles)(
dataTableDefaultView={
<DataTableDefaultView
icon={ProcessIcon}
- messages={['All Processes list empty.']}
+ messages={['Processes list empty.']}
/>
} />;
}
commit bc2b30cc5df5c23e9f1e00482d135e68d383f0de
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Tue Jan 21 14:56:15 2020 -0300
15012: Adds process status filtering to all_processes page.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
index be8c9c49..43432cfd 100644
--- a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
+++ b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
@@ -2,17 +2,19 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { DataExplorerMiddlewareService } from "~/store/data-explorer/data-explorer-middleware-service";
+import { DataExplorerMiddlewareService, dataExplorerToListParams, getDataExplorerColumnFilters } from "~/store/data-explorer/data-explorer-middleware-service";
import { RootState } from "../store";
import { ServiceRepository } from "~/services/services";
-import { FilterBuilder } from "~/services/api/filter-builder";
+import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
import { allProcessesPanelActions } from "./all-processes-panel-action";
import { Dispatch, MiddlewareAPI } from "redux";
import { resourcesActions } from "~/store/resources/resources-actions";
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
-import { getDataExplorer } from "~/store/data-explorer/data-explorer-reducer";
+import { getDataExplorer, DataExplorer } from "~/store/data-explorer/data-explorer-reducer";
import { loadMissingProcessesInformation } from "~/store/project-panel/project-panel-middleware-service";
+import { DataColumns } from "~/components/data-table/data-table";
+import { ProcessStatusFilter, buildProcessStatusFilters } from "../resource-type-filters/resource-type-filters";
export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -26,11 +28,8 @@ export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareSe
} else {
try {
api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
- const processItems: any = await this.services.containerRequestService.list({
- filters: new FilterBuilder()
- .addILike("name", dataExplorer.searchValue)
- .getFilters()
- });
+ const processItems = await this.services.containerRequestService.list(
+ { ...getParams(dataExplorer) });
api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
api.dispatch(resourcesActions.SET_RESOURCES(processItems.items));
@@ -41,7 +40,7 @@ export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareSe
page: Math.floor(processItems.offset / processItems.limit),
rowsPerPage: processItems.limit
}));
- } catch (e) {
+ } catch {
api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
api.dispatch(allProcessesPanelActions.SET_ITEMS({
items: [],
@@ -55,6 +54,27 @@ export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareSe
}
}
+const getParams = ( dataExplorer: DataExplorer ) => ({
+ ...dataExplorerToListParams(dataExplorer),
+ filters: getFilters(dataExplorer)
+});
+
+const getFilters = ( dataExplorer: DataExplorer ) => {
+ const columns = dataExplorer.columns as DataColumns<string>;
+ const statusColumnFilters = getDataExplorerColumnFilters(columns, 'Status');
+ const activeStatusFilter = Object.keys(statusColumnFilters).find(
+ filterName => statusColumnFilters[filterName].selected
+ ) || ProcessStatusFilter.ALL;
+
+ const nameFilter = new FilterBuilder().addILike("name", dataExplorer.searchValue).getFilters();
+ const statusFilter = buildProcessStatusFilters(new FilterBuilder(), activeStatusFilter).getFilters();
+
+ return joinFilters(
+ nameFilter,
+ statusFilter
+ );
+};
+
const allProcessesPanelDataExplorerIsNotSet = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'All Processes panel is not ready.',
diff --git a/src/store/resource-type-filters/resource-type-filters.ts b/src/store/resource-type-filters/resource-type-filters.ts
index 4ee9c5f3..6766bfca 100644
--- a/src/store/resource-type-filters/resource-type-filters.ts
+++ b/src/store/resource-type-filters/resource-type-filters.ts
@@ -213,3 +213,27 @@ export const serializeSimpleObjectTypeFilters = (filters: Tree<DataTableFilterIt
.map(f => f.id)
.map(objectTypeToResourceKind);
};
+
+export const buildProcessStatusFilters = ( fb:FilterBuilder, activeStatusFilter:string ): FilterBuilder => {
+ switch (activeStatusFilter) {
+ case ProcessStatusFilter.COMPLETED: {
+ fb.addEqual('container.state', 'Complete');
+ fb.addEqual('container.exit_code', '0');
+ break;
+ }
+ case ProcessStatusFilter.FAILED: {
+ fb.addEqual('container.state', 'Complete');
+ fb.addDistinct('container.exit_code', '0');
+ break;
+ }
+ case ProcessStatusFilter.CANCELLED:
+ case ProcessStatusFilter.FAILED:
+ case ProcessStatusFilter.LOCKED:
+ case ProcessStatusFilter.QUEUED:
+ case ProcessStatusFilter.RUNNING: {
+ fb.addEqual('container.state', activeStatusFilter);
+ break;
+ }
+ }
+ return fb;
+};
\ No newline at end of file
diff --git a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
index 4363bb7c..6fdb8de2 100644
--- a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
+++ b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
@@ -20,7 +20,7 @@ import { SubprocessPanelColumnNames } from '~/views/subprocess-panel/subprocess-
import { FilterBuilder, joinFilters } from '~/services/api/filter-builder';
import { subprocessPanelActions } from './subprocess-panel-actions';
import { DataColumns } from '~/components/data-table/data-table';
-import { ProcessStatusFilter } from '../resource-type-filters/resource-type-filters';
+import { ProcessStatusFilter, buildProcessStatusFilters } from '../resource-type-filters/resource-type-filters';
import { ContainerRequestResource } from '~/models/container-request';
import { progressIndicatorActions } from '../progress-indicator/progress-indicator-actions';
import { loadMissingProcessesInformation } from '../project-panel/project-panel-middleware-service';
@@ -85,31 +85,11 @@ export const getFilters = (
const statusColumnFilters = getDataExplorerColumnFilters(columns, 'Status');
const activeStatusFilter = Object.keys(statusColumnFilters).find(
filterName => statusColumnFilters[filterName].selected
- );
+ ) || ProcessStatusFilter.ALL;
// Get all the subprocess' container requests and containers.
const fb = new FilterBuilder().addEqual('requesting_container_uuid', parentContainerRequest.containerUuid);
- switch (activeStatusFilter) {
- case ProcessStatusFilter.COMPLETED: {
- fb.addEqual('container.state', 'Complete');
- fb.addEqual('container.exit_code', '0');
- break;
- }
- case ProcessStatusFilter.FAILED: {
- fb.addEqual('container.state', 'Complete');
- fb.addDistinct('container.exit_code', '0');
- break;
- }
- case ProcessStatusFilter.CANCELLED:
- case ProcessStatusFilter.FAILED:
- case ProcessStatusFilter.LOCKED:
- case ProcessStatusFilter.QUEUED:
- case ProcessStatusFilter.RUNNING: {
- fb.addEqual('container.state', activeStatusFilter);
- break;
- }
- }
- const statusFilters = fb.getFilters();
+ const statusFilters = buildProcessStatusFilters(fb, activeStatusFilter).getFilters();
const nameFilters = dataExplorer.searchValue
? new FilterBuilder()
diff --git a/src/views/all-processes-panel/all-processes-panel.tsx b/src/views/all-processes-panel/all-processes-panel.tsx
index 4bd45973..79575c74 100644
--- a/src/views/all-processes-panel/all-processes-panel.tsx
+++ b/src/views/all-processes-panel/all-processes-panel.tsx
@@ -28,7 +28,7 @@ import { ContainerRequestState } from "~/models/container-request";
import { RootState } from '~/store/store';
import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
import { createTree } from '~/models/tree';
-import { getSimpleObjectTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
+import { getSimpleObjectTypeFilters, getInitialProcessStatusFilters } from '~/store/resource-type-filters/resource-type-filters';
type CssRules = "toolbar" | "button";
@@ -67,7 +67,8 @@ export const allProcessesPanelColumns: DataColumns<string> = [
name: AllProcessesPanelColumnNames.STATUS,
selected: true,
configurable: true,
- filters: createTree(),
+ mutuallyExclusiveFilters: true,
+ filters: getInitialProcessStatusFilters(),
render: uuid => <ProcessStatus uuid={uuid} />
},
{
commit ca382107cccf8008ebf08b0d0b7aa7740327a780
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Tue Jan 21 14:13:27 2020 -0300
15012: Removes duplicated code.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
index d52f27b4..4363bb7c 100644
--- a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
+++ b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
@@ -23,6 +23,7 @@ import { DataColumns } from '~/components/data-table/data-table';
import { ProcessStatusFilter } from '../resource-type-filters/resource-type-filters';
import { ContainerRequestResource } from '~/models/container-request';
import { progressIndicatorActions } from '../progress-indicator/progress-indicator-actions';
+import { loadMissingProcessesInformation } from '../project-panel/project-panel-middleware-service';
export class SubprocessMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -39,18 +40,10 @@ export class SubprocessMiddlewareService extends DataExplorerMiddlewareService {
const parentContainerRequest = await this.services.containerRequestService.get(parentContainerRequestUuid);
const containerRequests = await this.services.containerRequestService.list(
{ ...getParams(dataExplorer, parentContainerRequest) });
- const containerUuids: string[] = containerRequests.items.reduce(
- (uuids, { containerUuid }) =>
- containerUuid
- ? [...uuids, containerUuid]
- : uuids, []);
- const containers = await this.services.containerService.list({
- filters: new FilterBuilder().addIn('uuid', containerUuids).getFilters()
- });
api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
api.dispatch(updateResources(containerRequests.items));
- api.dispatch(updateResources(containers.items));
+ await api.dispatch<any>(loadMissingProcessesInformation(containerRequests.items));
// Populate the actual user view
api.dispatch(setItems(containerRequests));
} catch {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list