Merge branch '16037-download-selected-functionality-messes-up-file-names'
[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' linkToUuid={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             <DetailsAttribute label='Collection UUID' linkToUuid={this.item.uuid} value={this.item.uuid} />
28             <DetailsAttribute label='Content address' linkToUuid={this.item.portableDataHash} value={this.item.portableDataHash} />
29             {/* Missing attrs */}
30             <DetailsAttribute label='Number of files' value={this.item.fileCount} />
31             <DetailsAttribute label='Content size' value={formatFileSize(this.item.fileSizeTotal)} />
32         </div>;
33     }
34 }