mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-15 04:01:50 +00:00
77 lines
2.6 KiB
TypeScript
77 lines
2.6 KiB
TypeScript
![]() |
import * as React from 'react';
|
||
|
import { DatabaseFilled, DatabaseOutlined } from '@ant-design/icons';
|
||
|
import { DataJob, EntityType, SearchResult } from '../../../types.generated';
|
||
|
import { Preview } from './preview/Preview';
|
||
|
import { DataJobProfile } from './profile/DataJobProfile';
|
||
|
import { Entity, IconStyleType, PreviewType } from '../Entity';
|
||
|
|
||
|
/**
|
||
|
* Definition of the DataHub DataJob entity.
|
||
|
*/
|
||
|
export class DataJobEntity implements Entity<DataJob> {
|
||
|
type: EntityType = EntityType.DataJob;
|
||
|
|
||
|
// TODO: add job specific icons
|
||
|
icon = (fontSize: number, styleType: IconStyleType) => {
|
||
|
if (styleType === IconStyleType.TAB_VIEW) {
|
||
|
return <DatabaseOutlined style={{ fontSize }} />;
|
||
|
}
|
||
|
|
||
|
if (styleType === IconStyleType.HIGHLIGHT) {
|
||
|
return <DatabaseFilled style={{ fontSize, color: '#B37FEB' }} />;
|
||
|
}
|
||
|
|
||
|
if (styleType === IconStyleType.SVG) {
|
||
|
return (
|
||
|
<path d="M342 88H120c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V168h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm578 576h-48c-8.8 0-16 7.2-16 16v176H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V680c0-8.8-7.2-16-16-16zM342 856H168V680c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zM904 88H682c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V120c0-17.7-14.3-32-32-32z" />
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<DatabaseFilled
|
||
|
style={{
|
||
|
fontSize,
|
||
|
color: '#BFBFBF',
|
||
|
}}
|
||
|
/>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
isSearchEnabled = () => false;
|
||
|
|
||
|
isBrowseEnabled = () => false;
|
||
|
|
||
|
isLineageEnabled = () => false;
|
||
|
|
||
|
getAutoCompleteFieldName = () => 'name';
|
||
|
|
||
|
getPathName = () => 'datajob';
|
||
|
|
||
|
getCollectionName = () => 'DataJobs';
|
||
|
|
||
|
renderProfile = (urn: string) => <DataJobProfile urn={urn} />;
|
||
|
|
||
|
renderPreview = (_: PreviewType, data: DataJob) => {
|
||
|
return (
|
||
|
<Preview
|
||
|
urn={data.urn}
|
||
|
name={data.info?.name || ''}
|
||
|
description={data.info?.description || ''}
|
||
|
owners={data.ownership?.owners}
|
||
|
/>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
renderSearch = (result: SearchResult) => {
|
||
|
const data = result.entity as DataJob;
|
||
|
return (
|
||
|
<Preview
|
||
|
urn={data.urn}
|
||
|
name={data.info?.name || ''}
|
||
|
description={data.info?.description || ''}
|
||
|
owners={data.ownership?.owners}
|
||
|
/>
|
||
|
);
|
||
|
};
|
||
|
}
|