15159: Add unit tests for collection-file-viewer-action and TrustAllContent / secure...
[arvados-workbench2.git] / src / views-components / details-panel / details-data.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from 'react';
6 import { DetailsResource } from "models/details";
7
8 interface GetDetailsParams {
9   tabNr?: number
10   showPreview?: boolean
11 }
12
13 export abstract class DetailsData<T extends DetailsResource = DetailsResource> {
14     constructor(protected item: T) { }
15
16     getTitle(): string {
17         return this.item.name || 'Projects';
18     }
19
20     getTabLabels(): string[] {
21         return ['Details'];
22     }
23
24     abstract getIcon(className?: string): React.ReactElement<any>;
25     abstract getDetails({tabNr, showPreview}: GetDetailsParams): React.ReactElement<any>;
26 }