From: Michal Klobukowski Date: Wed, 4 Jul 2018 12:35:52 +0000 (+0200) Subject: Update models with groups, colelctions, workflows and processes X-Git-Tag: 1.2.0~59^2~23 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/b0573b45f19c656ac07901004a3686ef10d402a5 Update models with groups, colelctions, workflows and processes Feature #13703 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- diff --git a/src/models/collection.ts b/src/models/collection.ts index 316b1fac..cf5b4e68 100644 --- a/src/models/collection.ts +++ b/src/models/collection.ts @@ -2,7 +2,24 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Resource } from "./resource"; +import { Resource as R } from "./resource"; +import { Resource } from "../common/api/common-resource-service"; +import { ResourceKind } from "./kinds"; -export interface Collection extends Resource { +export interface Collection extends R { +} + +export interface CollectionResource extends Resource { + kind: ResourceKind.Collection; + name: string; + description: string; + properties: any; + portableDataHash: string; + manifestText: string; + replicationDesired: number; + replicationConfirmed: number; + replicationConfirmedAt: string; + trashAt: string; + deleteAt: string; + isTrashed: boolean; } diff --git a/src/models/container-request.ts b/src/models/container-request.ts new file mode 100644 index 00000000..44dd615e --- /dev/null +++ b/src/models/container-request.ts @@ -0,0 +1,34 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { Resource } from "../common/api/common-resource-service"; +import { ResourceKind } from "./kinds"; + +export interface ContainerRequestResource extends Resource { + kind: ResourceKind.ContainerRequest; + name: string; + description: string; + properties: any; + state: string; + requestingContainerUuid: string; + containerUuid: string; + containerCountMax: number; + mounts: any; + runtimeConstraints: any; + schedulingParameters: any; + containerImage: string; + environment: any; + cwd: string; + command: string[]; + outputPath: string; + outputName: string; + outputTtl: number; + priority: number; + expiresAt: string; + useExisting: boolean; + logUuid: string; + outputUuid: string; + filters: string; + +} \ No newline at end of file diff --git a/src/models/group.ts b/src/models/group.ts new file mode 100644 index 00000000..dae516bd --- /dev/null +++ b/src/models/group.ts @@ -0,0 +1,18 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { Resource } from "../common/api/common-resource-service"; +import { ResourceKind } from "./kinds"; + +export interface GroupResource extends Resource { + kind: ResourceKind.Group; + name: string; + groupClass: string; + description: string; + properties: string; + writeableBy: string[]; + trashAt: string; + deleteAt: string; + isTrashed: boolean; +} \ No newline at end of file diff --git a/src/models/kinds.ts b/src/models/kinds.ts new file mode 100644 index 00000000..15bd6220 --- /dev/null +++ b/src/models/kinds.ts @@ -0,0 +1,12 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +export enum ResourceKind { + Collection = "arvados#collection", + ContainerRequest = "arvados#containerRequest", + Group = "arvados#group", + Process = "arvados#containerRequest", + Project = "arvados#group", + Workflow = "arvados#workflow" +} \ No newline at end of file diff --git a/src/models/process.ts b/src/models/process.ts new file mode 100644 index 00000000..1e04cb10 --- /dev/null +++ b/src/models/process.ts @@ -0,0 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { ContainerRequestResource } from "./container-request"; + +export type ProcessResource = ContainerRequestResource; diff --git a/src/models/project.ts b/src/models/project.ts index 7d29de87..beb9810c 100644 --- a/src/models/project.ts +++ b/src/models/project.ts @@ -2,7 +2,12 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Resource } from "./resource"; +import { Resource as R } from "./resource"; +import { GroupResource } from "./group"; -export interface Project extends Resource { +export interface Project extends R { +} + +export interface ProjectResource extends GroupResource { + groupClass: "project"; } diff --git a/src/models/workflow.ts b/src/models/workflow.ts new file mode 100644 index 00000000..2054550d --- /dev/null +++ b/src/models/workflow.ts @@ -0,0 +1,13 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { Resource } from "../common/api/common-resource-service"; +import { ResourceKind } from "./kinds"; + +export interface WorkflowResource extends Resource { + kind: ResourceKind.Workflow; + name: string; + description: string; + definition: string; +} \ No newline at end of file diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts index 1e531853..aa39e64e 100644 --- a/src/services/groups-service/groups-service.ts +++ b/src/services/groups-service/groups-service.ts @@ -7,17 +7,11 @@ import CommonResourceService, { Resource, ListResults } from "../../common/api/c import FilterBuilder from "../../common/api/filter-builder"; import OrderBuilder from "../../common/api/order-builder"; import { AxiosInstance } from "axios"; - -interface GroupResource extends Resource { - name: string; - groupClass: string; - description: string; - properties: string; - writeableBy: string[]; - trashAt: string; - deleteAt: string; - isTrashed: boolean; -} +import { GroupResource } from "../../models/group"; +import { CollectionResource } from "../../models/collection"; +import { ProjectResource } from "../../models/project"; +import { WorkflowResource } from "../../models/workflow"; +import { ProcessResource } from "../../models/process"; interface ContensArguments { limit?: number; @@ -27,13 +21,19 @@ interface ContensArguments { recursive?: boolean; } +export type GroupContentsResource = + CollectionResource | + ProjectResource | + WorkflowResource | + ProcessResource; + export default class GroupsService extends CommonResourceService { constructor(serverApi: AxiosInstance) { super(serverApi, "groups"); } - contents (uuid: string, args: ContensArguments = {}): Promise> { + contents(uuid: string, args: ContensArguments = {}): Promise> { const { filters, order, ...other } = args; const params = { ...other, diff --git a/src/views/project-panel/project-panel-item.ts b/src/views/project-panel/project-panel-item.ts index cf77aaf1..9a9f845f 100644 --- a/src/views/project-panel/project-panel-item.ts +++ b/src/views/project-panel/project-panel-item.ts @@ -2,8 +2,9 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Resource } from "../../common/api/common-resource-service"; import { DataItem } from "../../components/data-table/data-table"; +import { ResourceKind } from "../../models/kinds"; +import { GroupContentsResource } from "../../services/groups-service/groups-service"; export interface ProjectPanelItem extends DataItem { uuid: string; @@ -16,15 +17,17 @@ export interface ProjectPanelItem extends DataItem { status?: string; } -export function resourceToDataItem(r: Resource): ProjectPanelItem { + +export function resourceToDataItem(r: GroupContentsResource): ProjectPanelItem { return { key: r.uuid, uuid: r.uuid, - name: r.uuid, + name: r.name, kind: r.kind, url: "", owner: r.ownerUuid, - lastModified: r.modifiedAt + lastModified: r.modifiedAt, + status: r.kind === ResourceKind.Process ? r.state : undefined }; }