mirror of
https://github.com/datahub-project/datahub.git
synced 2026-01-09 00:18:52 +00:00
* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import { IDatasetEntity } from '@datahub/metadata-types/types/entity/dataset/dataset-entity';
|
|
import { FabricType } from '@datahub/metadata-types/constants/common/fabric-type';
|
|
import { DatasetPlatform } from '@datahub/metadata-types/constants/entity/dataset/platform';
|
|
import { buildDatasetLiUrn } from '@datahub/data-models/entity/dataset/utils/urn';
|
|
|
|
/**
|
|
* TODO META-11674
|
|
*
|
|
* Converts current dataset definition into the legacy one
|
|
*/
|
|
export function toLegacy(dataset: Com.Linkedin.Dataset.Dataset, urn?: string): IDatasetEntity {
|
|
const ds = {
|
|
createdTime: dataset.created.time || 0,
|
|
decommissionTime: dataset.deprecation?.decommissionTime || null,
|
|
deprecated: dataset.deprecation?.deprecated || null,
|
|
deprecationNote: dataset.deprecation?.note || null,
|
|
description: dataset.description || '',
|
|
fabric: (dataset.origin as FabricType) || FabricType.CORP,
|
|
nativeName: dataset.name,
|
|
platform: (dataset.platform as DatasetPlatform) || DatasetPlatform.HDFS,
|
|
properties: '',
|
|
tags: [],
|
|
removed: dataset.removed,
|
|
nativeType: dataset.platformNativeType || '',
|
|
modifiedTime: dataset.lastModified.time || 0,
|
|
healthScore: dataset.health?.score || 0
|
|
};
|
|
const uri = urn || buildDatasetLiUrn(ds.platform, ds.nativeName, ds.fabric);
|
|
return {
|
|
...ds,
|
|
uri
|
|
};
|
|
}
|
|
|
|
/**
|
|
* TODO META-11674
|
|
*
|
|
* Converts legacy one dataset definition into the current
|
|
*/
|
|
export function fromLegacy(dataset: IDatasetEntity): Com.Linkedin.Dataset.Dataset {
|
|
return {
|
|
// Using -1 as we don't have that information in IDatasetEntity and to make sure it is an invalid id (negative)
|
|
id: -1,
|
|
name: dataset.nativeName,
|
|
description: dataset.description,
|
|
removed: dataset.removed,
|
|
origin: dataset.fabric,
|
|
platform: dataset.platform,
|
|
created: {
|
|
time: dataset.createdTime,
|
|
actor: 'Not Available'
|
|
},
|
|
lastModified: {
|
|
time: dataset.modifiedTime,
|
|
actor: 'Not Available'
|
|
},
|
|
properties: {},
|
|
tags: [],
|
|
deploymentInfos: [],
|
|
health: dataset.healthScore
|
|
? {
|
|
score: dataset.healthScore,
|
|
validations: []
|
|
}
|
|
: undefined,
|
|
deprecation: dataset.deprecated
|
|
? {
|
|
deprecated: dataset.deprecated,
|
|
decommissionTime: dataset.decommissionTime || undefined,
|
|
note: dataset.deprecationNote || ''
|
|
}
|
|
: undefined
|
|
};
|
|
}
|