Merge branch 'main' into 19069-workflow-launching
[arvados-workbench2.git] / src / models / collection.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import {
6     ResourceKind,
7     TrashableResource,
8     ResourceWithProperties
9 } from "./resource";
10
11 export interface CollectionResource extends TrashableResource, ResourceWithProperties {
12     kind: ResourceKind.COLLECTION;
13     name: string;
14     description: string;
15     portableDataHash: string;
16     manifestText: string;
17     replicationDesired: number;
18     replicationConfirmed: number;
19     replicationConfirmedAt: string;
20     storageClassesDesired: string[];
21     storageClassesConfirmed: string[];
22     storageClassesConfirmedAt: string;
23     currentVersionUuid: string;
24     version: number;
25     preserveVersion: boolean;
26     unsignedManifestText?: string;
27     fileCount: number;
28     fileSizeTotal: number;
29 }
30
31 // We exclude 'manifestText' and 'unsignedManifestText' from the default
32 export const defaultCollectionSelectedFields = [
33     'name',
34     'description',
35     'portableDataHash',
36     'replicationDesired',
37     'replicationConfirmed',
38     'replicationConfirmedAt',
39     'storageClassesDesired',
40     'storageClassesConfirmed',
41     'storageClassesConfirmedAt',
42     'currentVersionUuid',
43     'version',
44     'preserveVersion',
45     'fileCount',
46     'fileSizeTotal',
47     // ResourceWithProperties field
48     'properties',
49     // TrashableResource fields
50     'trashAt',
51     'deleteAt',
52     'isTrashed',
53     // Resource fields
54     'uuid',
55     'ownerUuid',
56     'createdAt',
57     'modifiedByClientUuid',
58     'modifiedByUserUuid',
59     'modifiedAt',
60     'href',
61     'kind',
62     'etag',
63 ];
64
65 export const getCollectionUrl = (uuid: string) => {
66     return `/collections/${uuid}`;
67 };
68
69 export enum CollectionType {
70     GENERAL = 'nil',
71     OUTPUT = 'output',
72     LOG = 'log',
73     INTERMEDIATE = 'intermediate',
74 }