X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9ea087b587f8139416cea16fbe4caad0d6df90c4..HEAD:/src/services/workflow-service/workflow-service.ts diff --git a/src/services/workflow-service/workflow-service.ts b/src/services/workflow-service/workflow-service.ts index 60f898f1..84954213 100644 --- a/src/services/workflow-service/workflow-service.ts +++ b/src/services/workflow-service/workflow-service.ts @@ -3,12 +3,42 @@ // SPDX-License-Identifier: AGPL-3.0 import { AxiosInstance } from "axios"; -import { WorkflowResource } from '~/models/workflow'; -import { CommonResourceService } from "~/services/common-service/common-resource-service"; -import { ApiActions } from "~/services/api/api-actions"; +import { CommonResourceService } from "services/common-service/common-resource-service"; +import { WorkflowResource } from 'models/workflow'; +import { ApiActions } from 'services/api/api-actions'; +import { LinkService } from 'services/link-service/link-service'; +import { FilterBuilder } from 'services/api/filter-builder'; +import { LinkClass } from 'models/link'; +import { OrderBuilder } from 'services/api/order-builder'; export class WorkflowService extends CommonResourceService { + + private linksService = new LinkService(this.serverApi, this.actions); + constructor(serverApi: AxiosInstance, actions: ApiActions) { super(serverApi, "workflows", actions); } + + async presets(workflowUuid: string) { + + const { items: presetLinks } = await this.linksService.list({ + filters: new FilterBuilder() + .addEqual('tail_uuid', workflowUuid) + .addEqual('link_class', LinkClass.PRESET) + .getFilters() + }); + + const presetUuids = presetLinks.map(link => link.headUuid); + + return this.list({ + filters: new FilterBuilder() + .addIn('uuid', presetUuids) + .getFilters(), + order: new OrderBuilder() + .addAsc('name') + .getOrder(), + }); + + } + }