import { CommandOutputParameter } from "cwlts/mappings/v1.0/CommandOutputParameter";
import { ContainerResource } from "models/container";
import { ContainerRequestResource, ContainerRequestState } from "models/container-request";
+import { FilterBuilder } from "services/api/filter-builder";
export const loadProcess = (containerRequestUuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<Process | undefined> => {
return { containerRequest };
};
-export const loadContainers = (filters: string, loadMounts: boolean = true) =>
+export const loadContainers = (containerUuids: string[], loadMounts: boolean = true) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- let args: any = { filters };
+ let args: any = {
+ filters: new FilterBuilder().addIn('uuid', containerUuids).getFilters(),
+ limit: containerUuids.length,
+ };
if (!loadMounts) {
args.select = containerFieldsNoMounts;
}
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
try {
const process = await services.containerRequestService.update(uuid, { priority: 0 });
+ dispatch<any>(updateResources([process]));
+ if (process.containerUuid) {
+ const container = await services.containerService.get(process.containerUuid, false);
+ dispatch<any>(updateResources([container]));
+ }
return process;
} catch (e) {
throw new Error('Could not cancel the process.');
}
};
+export const resumeOnHoldWorkflow = (uuid: string) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ try {
+ const process = await services.containerRequestService.update(uuid, { priority: 500 });
+ dispatch<any>(updateResources([process]));
+ if (process.containerUuid) {
+ const container = await services.containerService.get(process.containerUuid, false);
+ dispatch<any>(updateResources([container]));
+ }
+ return process;
+ } catch (e) {
+ throw new Error('Could not resume the process.');
+ }
+ };
+
export const startWorkflow = (uuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
try {