2021-02-23 12:45:42 -08:00
|
|
|
import { DashboardFilled, DashboardOutlined } from '@ant-design/icons';
|
2021-02-18 12:33:17 -08:00
|
|
|
import * as React from 'react';
|
2021-03-23 15:18:32 -07:00
|
|
|
import { Dashboard, EntityType, SearchResult } from '../../../types.generated';
|
2021-02-23 12:45:42 -08:00
|
|
|
import { Entity, IconStyleType, PreviewType } from '../Entity';
|
2021-02-18 12:33:17 -08:00
|
|
|
import { DashboardPreview } from './preview/DashboardPreview';
|
|
|
|
|
import DashboardProfile from './profile/DashboardProfile';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Definition of the DataHub Dashboard entity.
|
|
|
|
|
*/
|
|
|
|
|
export class DashboardEntity implements Entity<Dashboard> {
|
|
|
|
|
type: EntityType = EntityType.Dashboard;
|
|
|
|
|
|
2021-02-23 12:45:42 -08:00
|
|
|
icon = (fontSize: number, styleType: IconStyleType) => {
|
|
|
|
|
if (styleType === IconStyleType.TAB_VIEW) {
|
|
|
|
|
return <DashboardOutlined style={{ fontSize }} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (styleType === IconStyleType.HIGHLIGHT) {
|
|
|
|
|
return <DashboardFilled style={{ fontSize, color: 'rgb(144 163 236)' }} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<DashboardOutlined
|
|
|
|
|
style={{
|
|
|
|
|
fontSize,
|
|
|
|
|
color: '#BFBFBF',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-18 12:33:17 -08:00
|
|
|
isSearchEnabled = () => true;
|
|
|
|
|
|
2021-03-04 23:24:49 -08:00
|
|
|
isBrowseEnabled = () => true;
|
2021-02-18 12:33:17 -08:00
|
|
|
|
|
|
|
|
getAutoCompleteFieldName = () => 'title';
|
|
|
|
|
|
|
|
|
|
getPathName = () => 'dashboard';
|
|
|
|
|
|
|
|
|
|
getCollectionName = () => 'Dashboards';
|
|
|
|
|
|
|
|
|
|
renderProfile = (urn: string) => <DashboardProfile urn={urn} />;
|
|
|
|
|
|
|
|
|
|
renderPreview = (_: PreviewType, data: Dashboard) => {
|
|
|
|
|
return (
|
|
|
|
|
<DashboardPreview
|
|
|
|
|
urn={data.urn}
|
|
|
|
|
platform={data.tool}
|
|
|
|
|
name={data.info?.name}
|
|
|
|
|
description={data.info?.description}
|
2021-02-23 12:45:42 -08:00
|
|
|
access={data.info?.access}
|
2021-03-07 11:26:47 -08:00
|
|
|
tags={data.globalTags || undefined}
|
2021-02-23 12:45:42 -08:00
|
|
|
owners={data.ownership?.owners}
|
2021-02-18 12:33:17 -08:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
2021-03-23 15:18:32 -07:00
|
|
|
|
|
|
|
|
renderSearch = (result: SearchResult) => {
|
|
|
|
|
return this.renderPreview(PreviewType.SEARCH, result.entity as Dashboard);
|
|
|
|
|
};
|
2021-02-18 12:33:17 -08:00
|
|
|
}
|