1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { TreeItem } from "../../components/tree/tree";
6 import { Project } from "../../models/project";
7 import { findTreeItem } from "../../store/project/project-reducer";
8 import { ResourceKind } from "../../models/resource";
9 import { Collection } from "../../models/collection";
10 import { getResourceUrl } from "../../store/navigation/navigation-action";
11 import { ProjectExplorerItem } from "../../views-components/project-explorer/project-explorer-item";
13 export const projectExplorerItems = (projects: Array<TreeItem<Project>>, treeItemId: string, collections: Array<Collection>): ProjectExplorerItem[] => {
14 const dataItems: ProjectExplorerItem[] = [];
16 const treeItem = findTreeItem(projects, treeItemId);
20 url: getResourceUrl(treeItem.data),
21 kind: ResourceKind.LEVEL_UP,
22 owner: treeItem.data.ownerUuid,
23 uuid: treeItem.data.uuid,
24 lastModified: treeItem.data.modifiedAt
28 treeItem.items.forEach(p => {
31 kind: ResourceKind.PROJECT,
32 url: getResourceUrl(treeItem.data),
33 owner: p.data.ownerUuid,
35 lastModified: p.data.modifiedAt
36 } as ProjectExplorerItem;
43 collections.forEach(c => {
46 kind: ResourceKind.COLLECTION,
47 url: getResourceUrl(c),
50 lastModified: c.modifiedAt
51 } as ProjectExplorerItem;