Merge branch '21988-details-panel-loading'
[arvados.git] / services / workbench2 / src / common / labels.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ResourceKind } from "models/resource";
6 import { ProcessTypeFilter } from "store/resource-type-filters/resource-type-filters";
7
8 export const resourceLabel = (type: string, subtype = '') => {
9     switch (type) {
10         case ResourceKind.COLLECTION:
11             return "Data collection";
12         case ResourceKind.PROJECT:
13             if (subtype === "filter") {
14                 return "Filter group";
15             } else if (subtype === "role") {
16                 return "Group";
17             }
18             return "Project";
19         case ResourceKind.PROCESS:
20             if (subtype === ProcessTypeFilter.MAIN_PROCESS) {
21                 return "Workflow Run";
22             }
23             return "Workflow Step";
24         case ResourceKind.USER:
25             return "User";
26         case ResourceKind.GROUP:
27             return "Group";
28         case ResourceKind.VIRTUAL_MACHINE:
29             return "Virtual Machine";
30         case ResourceKind.WORKFLOW:
31             return "Workflow";
32         default:
33             return "Unknown";
34     }
35 };