Merge branch 'master' into 13905-restoring-correct-tree-state-and-panel-item-highligh...
[arvados.git] / src / views / favorite-panel / favorite-panel-item.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { GroupContentsResource } from "../../services/groups-service/groups-service";
6 import { ResourceKind } from "../../models/resource";
7
8 export interface FavoritePanelItem {
9     uuid: string;
10     name: string;
11     kind: string;
12     url: string;
13     owner: string;
14     lastModified: string;
15     fileSize?: number;
16     status?: string;
17 }
18
19
20 export function resourceToDataItem(r: GroupContentsResource): FavoritePanelItem {
21     return {
22         uuid: r.uuid,
23         name: r.name,
24         kind: r.kind,
25         url: "",
26         owner: r.ownerUuid,
27         lastModified: r.modifiedAt,
28         status:  r.kind === ResourceKind.PROCESS ? r.state : undefined
29     };
30 }
31