mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-13 18:04:55 +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
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
import Component from '@ember/component';
|
|
import { setProperties } from '@ember/object';
|
|
import { task } from 'ember-concurrency';
|
|
import { IDatasetColumn, IDatasetColumnWithHtmlComments } from 'datahub-web/typings/api/datasets/columns';
|
|
import { IDatasetSchema } from 'datahub-web/typings/api/datasets/schema';
|
|
import { augmentObjectsWithHtmlComments } from 'datahub-web/utils/api/datasets/columns';
|
|
import { readDatasetSchemaByUrn } from 'datahub-web/utils/api/datasets/schema';
|
|
import { containerDataSource } from '@datahub/utils/api/data-source';
|
|
import { ETaskPromise } from '@datahub/utils/types/concurrency';
|
|
|
|
@containerDataSource<DatasetSchemaContainer>('getDatasetSchemaTask', ['urn'])
|
|
export default class DatasetSchemaContainer extends Component {
|
|
/**
|
|
* The urn identifier for the dataset
|
|
* @type {string}
|
|
*/
|
|
urn!: string;
|
|
|
|
/**
|
|
* json string for the dataset schema properties
|
|
* @type {string}
|
|
*/
|
|
json: string;
|
|
|
|
/**
|
|
* Stores the last modified date on the dataset schema as an utc time string
|
|
* @type {string}
|
|
*/
|
|
lastModifiedString = '';
|
|
|
|
/**
|
|
* List of schema properties for the dataset
|
|
* @type {IDatasetColumnWithHtmlComments | IDatasetColumn}
|
|
*/
|
|
schemas: Array<IDatasetColumnWithHtmlComments | IDatasetColumn>;
|
|
|
|
/**
|
|
* If there is schema or not
|
|
*/
|
|
isEmpty = false;
|
|
|
|
/**
|
|
* Reads the schema for the dataset
|
|
*/
|
|
@task(function*(this: DatasetSchemaContainer): IterableIterator<Promise<IDatasetSchema>> {
|
|
const { columns = [], rawSchema: json, lastModified } = ((yield readDatasetSchemaByUrn(
|
|
this.urn
|
|
)) as unknown) as IDatasetSchema;
|
|
|
|
const lastModifiedString = lastModified ? new Date(lastModified).toLocaleString() : '';
|
|
|
|
const schemas = augmentObjectsWithHtmlComments(columns);
|
|
|
|
setProperties(this, { schemas, json: json || '{}', lastModifiedString, isEmpty: !json });
|
|
})
|
|
getDatasetSchemaTask!: ETaskPromise<IDatasetSchema>;
|
|
}
|