Merge branch '14120-rich-text-editor'
[arvados.git] / src / views-components / details-panel / project-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 { ProjectIcon } from '~/components/icon/icon';
7 import { ProjectResource } from '~/models/project';
8 import { formatDate } from '~/common/formatters';
9 import { ResourceKind } from '~/models/resource';
10 import { resourceLabel } from '~/common/labels';
11 import { DetailsData } from "./details-data";
12 import { DetailsAttribute } from "~/components/details-attribute/details-attribute";
13 import { RichTextEditorLink } from '~/components/rich-text-editor-link/rich-text-editor-link';
14
15 export class ProjectDetails extends DetailsData<ProjectResource> {
16
17     getIcon(className?: string) {
18         return <ProjectIcon className={className} />;
19     }
20
21     getDetails() {
22         return <div>
23             <DetailsAttribute label='Type' value={resourceLabel(ResourceKind.PROJECT)} />
24             {/* Missing attr */}
25             <DetailsAttribute label='Size' value='---' />
26             <DetailsAttribute label='Owner' value={this.item.ownerUuid} lowercaseValue={true} />
27             <DetailsAttribute label='Last modified' value={formatDate(this.item.modifiedAt)} />
28             <DetailsAttribute label='Created at' value={formatDate(this.item.createdAt)} />
29             {/* Missing attr */}
30             <DetailsAttribute label='File size' value='1.4 GB' />
31             <DetailsAttribute label='Description'>
32                 {this.item.description ? 
33                     <RichTextEditorLink
34                         title={`Description of ${this.item.name}`}
35                         content={this.item.description} 
36                         label='Show full description' />
37                     : '---'
38                 }
39             </DetailsAttribute>
40         </div>;
41     }
42 }