1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RootState } from "../store";
6 import { ServiceRepository } from "services/services";
7 import { FilterBuilder, joinFilters } from "services/api/filter-builder";
8 import { Dispatch, MiddlewareAPI } from "redux";
9 import { DataExplorer } from "store/data-explorer/data-explorer-reducer";
10 import { ProcessesMiddlewareService } from "store/processes/processes-middleware-service";
11 import { subprocessPanelActions } from './subprocess-panel-actions';
12 import { getProcess } from "store/processes/process";
14 export class SubprocessMiddlewareService extends ProcessesMiddlewareService {
15 constructor(services: ServiceRepository, id: string) {
16 super(services, subprocessPanelActions, id);
19 getFilters(api: MiddlewareAPI<Dispatch, RootState>, dataExplorer: DataExplorer): string | null {
20 const state = api.getState();
21 const parentContainerRequestUuid = state.processPanel.containerRequestUuid;
22 if (!parentContainerRequestUuid) { return null; }
24 const process = getProcess(parentContainerRequestUuid)(state.resources);
25 if (!process?.container) { return null; }
27 const requesting_container = new FilterBuilder().addEqual('requesting_container_uuid', process.container.uuid).getFilters();
28 const sup = super.getFilters(api, dataExplorer);
29 if (sup === null) { return null; }
31 return joinFilters(sup, requesting_container);