Update models with groups, colelctions, workflows and processes
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 4 Jul 2018 12:35:52 +0000 (14:35 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 4 Jul 2018 12:35:52 +0000 (14:35 +0200)
Feature #13703

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/models/collection.ts
src/models/container-request.ts [new file with mode: 0644]
src/models/group.ts [new file with mode: 0644]
src/models/kinds.ts [new file with mode: 0644]
src/models/process.ts [new file with mode: 0644]
src/models/project.ts
src/models/workflow.ts [new file with mode: 0644]
src/services/groups-service/groups-service.ts
src/views/project-panel/project-panel-item.ts

index 316b1fac59f6271ddc4fb2a0e6844669327f8c39..cf5b4e68ce0d2d36331715461a4879b593cd5dcb 100644 (file)
@@ -2,7 +2,24 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
 //
 // 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 (file)
index 0000000..44dd615
--- /dev/null
@@ -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 (file)
index 0000000..dae516b
--- /dev/null
@@ -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 (file)
index 0000000..15bd622
--- /dev/null
@@ -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 (file)
index 0000000..1e04cb1
--- /dev/null
@@ -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;
index 7d29de872974c62e5c7f9ce6fec6c3b591a1d5e6..beb9810cc0282a8830719887194bb90de259cab8 100644 (file)
@@ -2,7 +2,12 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
 //
 // 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 (file)
index 0000000..2054550
--- /dev/null
@@ -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
index 1e5318530853fbbe4b947b45311261550a9f7235..aa39e64ed58ee8cccfebef071593cbebd39f4d78 100644 (file)
@@ -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";
 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;
 
 interface ContensArguments {
     limit?: number;
@@ -27,13 +21,19 @@ interface ContensArguments {
     recursive?: boolean;
 }
 
     recursive?: boolean;
 }
 
+export type GroupContentsResource =
+    CollectionResource |
+    ProjectResource |
+    WorkflowResource |
+    ProcessResource;
+
 export default class GroupsService extends CommonResourceService<GroupResource> {
 
     constructor(serverApi: AxiosInstance) {
         super(serverApi, "groups");
     }
 
 export default class GroupsService extends CommonResourceService<GroupResource> {
 
     constructor(serverApi: AxiosInstance) {
         super(serverApi, "groups");
     }
 
-    contents (uuid: string, args: ContensArguments = {}): Promise<ListResults<Resource>> {
+    contents(uuid: string, args: ContensArguments = {}): Promise<ListResults<GroupContentsResource>> {
         const { filters, order, ...other } = args;
         const params = {
             ...other,
         const { filters, order, ...other } = args;
         const params = {
             ...other,
index cf77aaf14e2c84ba6be3f749c004eb83532ae24f..9a9f845f57e975cb720a84c09124c6197f88de1d 100644 (file)
@@ -2,8 +2,9 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Resource } from "../../common/api/common-resource-service";
 import { DataItem } from "../../components/data-table/data-table";
 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;
 
 export interface ProjectPanelItem extends DataItem {
     uuid: string;
@@ -16,15 +17,17 @@ export interface ProjectPanelItem extends DataItem {
     status?: string;
 }
 
     status?: string;
 }
 
-export function resourceToDataItem(r: Resource): ProjectPanelItem {
+
+export function resourceToDataItem(r: GroupContentsResource): ProjectPanelItem {
     return {
         key: r.uuid,
         uuid: r.uuid,
     return {
         key: r.uuid,
         uuid: r.uuid,
-        name: r.uuid,
+        name: r.name,
         kind: r.kind,
         url: "",
         owner: r.ownerUuid,
         kind: r.kind,
         url: "",
         owner: r.ownerUuid,
-        lastModified: r.modifiedAt
+        lastModified: r.modifiedAt,
+        status:  r.kind === ResourceKind.Process ? r.state : undefined
     };
 }
 
     };
 }