Merge branch '14433_properties_inside_projects'
[arvados.git] / src / views-components / details-panel / collection-details.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { CollectionIcon } from '~/components/icon/icon';
7 import { CollectionResource } from '~/models/collection';
8 import { formatDate, formatFileSize } from '~/common/formatters';
9 import { resourceLabel } from '~/common/labels';
10 import { ResourceKind } from '~/models/resource';
11 import { DetailsData } from "./details-data";
12 import { DetailsAttribute } from "~/components/details-attribute/details-attribute";
13
14 export class CollectionDetails extends DetailsData<CollectionResource> {
15
16     getIcon(className?: string) {
17         return <CollectionIcon className={className} />;
18     }
19
20     getDetails() {
21         return <div>
22             <DetailsAttribute label='Type' value={resourceLabel(ResourceKind.COLLECTION)} />
23             <DetailsAttribute label='Size' value='---' />
24             <DetailsAttribute label='Owner' value={this.item.ownerUuid} lowercaseValue={true} />
25             <DetailsAttribute label='Last modified' value={formatDate(this.item.modifiedAt)} />
26             <DetailsAttribute label='Created at' value={formatDate(this.item.createdAt)} />
27             {/* Links but we dont have view */}
28             <DetailsAttribute label='Collection UUID' link={this.item.uuid} value={this.item.uuid} />
29             <DetailsAttribute label='Content address' link={this.item.portableDataHash} value={this.item.portableDataHash} />
30             {/* Missing attrs */}
31             <DetailsAttribute label='Number of files' value={this.data && this.data.fileCount} />
32             <DetailsAttribute label='Content size' value={formatFileSize(this.data && this.data.fileSize)} />
33         </div>;
34     }
35 }