2021-02-03 11:49:51 -08:00
|
|
|
import * as React from 'react';
|
2021-02-23 12:45:42 -08:00
|
|
|
import { DatabaseFilled, DatabaseOutlined } from '@ant-design/icons';
|
2021-02-03 11:49:51 -08:00
|
|
|
import { Dataset, EntityType } from '../../../types.generated';
|
|
|
|
import { Profile } from './profile/Profile';
|
2021-02-23 12:45:42 -08:00
|
|
|
import { Entity, IconStyleType, PreviewType } from '../Entity';
|
2021-02-03 11:49:51 -08:00
|
|
|
import { Preview } from './preview/Preview';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Definition of the DataHub Dataset entity.
|
|
|
|
*/
|
|
|
|
export class DatasetEntity implements Entity<Dataset> {
|
|
|
|
type: EntityType = EntityType.Dataset;
|
|
|
|
|
2021-02-23 12:45:42 -08:00
|
|
|
icon = (fontSize: number, styleType: IconStyleType) => {
|
|
|
|
if (styleType === IconStyleType.TAB_VIEW) {
|
|
|
|
return <DatabaseOutlined style={{ fontSize }} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (styleType === IconStyleType.HIGHLIGHT) {
|
|
|
|
return <DatabaseFilled style={{ fontSize, color: '#B37FEB' }} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DatabaseFilled
|
|
|
|
style={{
|
|
|
|
fontSize,
|
|
|
|
color: '#BFBFBF',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
isSearchEnabled = () => true;
|
|
|
|
|
|
|
|
isBrowseEnabled = () => true;
|
|
|
|
|
|
|
|
getAutoCompleteFieldName = () => 'name';
|
|
|
|
|
|
|
|
getPathName = () => 'dataset';
|
|
|
|
|
|
|
|
getCollectionName = () => 'Datasets';
|
|
|
|
|
|
|
|
renderProfile = (urn: string) => <Profile urn={urn} />;
|
|
|
|
|
2021-02-09 14:30:23 -08:00
|
|
|
renderPreview = (_: PreviewType, data: Dataset) => {
|
2021-02-03 11:49:51 -08:00
|
|
|
return (
|
|
|
|
<Preview
|
|
|
|
urn={data.urn}
|
|
|
|
name={data.name}
|
|
|
|
origin={data.origin}
|
|
|
|
description={data.description}
|
2021-02-23 12:45:42 -08:00
|
|
|
platformName={data.platform.name}
|
2021-03-04 23:16:13 -08:00
|
|
|
platformLogo={data.platform.info?.logoUrl}
|
2021-02-23 12:45:42 -08:00
|
|
|
tags={data.tags}
|
|
|
|
owners={data.ownership?.owners}
|
2021-02-03 11:49:51 -08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|