1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { AxiosInstance } from "axios";
6 import { CommonResourceService } from "services/common-service/common-resource-service";
7 import { WorkflowResource } from 'models/workflow';
8 import { ApiActions } from 'services/api/api-actions';
9 import { LinkService } from 'services/link-service/link-service';
10 import { FilterBuilder } from 'services/api/filter-builder';
11 import { LinkClass } from 'models/link';
12 import { OrderBuilder } from 'services/api/order-builder';
14 export class WorkflowService extends CommonResourceService<WorkflowResource> {
16 private linksService = new LinkService(this.serverApi, this.actions);
18 constructor(serverApi: AxiosInstance, actions: ApiActions) {
19 super(serverApi, "workflows", actions);
22 async presets(workflowUuid: string) {
24 const { items: presetLinks } = await this.linksService.list({
25 filters: new FilterBuilder()
26 .addEqual('tail_uuid', workflowUuid)
27 .addEqual('link_class', LinkClass.PRESET)
31 const presetUuids = presetLinks.map(link => link.headUuid);
34 filters: new FilterBuilder()
35 .addIn('uuid', presetUuids)
37 order: new OrderBuilder<WorkflowResource>()