Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* 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
2020-08-26 15:44:50 -07:00

64 lines
2.5 KiB
TypeScript

import Component from '@ember/component';
// @ts-ignore: Ignore import of compiled template
import template from '../../../templates/components/configurable/containers/entity-feature-configs';
import { task } from 'ember-concurrency';
import { layout } from '@ember-decorators/component';
import { ETaskPromise } from '@datahub/utils/types/concurrency';
import { readEntityFeatureConfigs } from '@datahub/shared/api/entity-configs';
import { alias } from '@ember/object/computed';
import { set } from '@ember/object';
import { containerDataSource } from '@datahub/utils/api/data-source';
import { DataModelEntityInstance } from '@datahub/data-models/constants/entity';
/**
* This container is the data source for requesting entity feature configs
* Renders the yielded components if there are configs for the provided entity @urn and config @target
*
* TODO META-11238: Separate entity feature configs container with configurable feature wrapper
* This container should not contain render logic after being genericized
*/
@layout(template)
@containerDataSource<EntityFeatureConfigsContainer>('getContainerDataTask', ['entity', 'targetFeature'])
export default class EntityFeatureConfigsContainer extends Component {
/**
* The entity providing context for the feature configs
*/
entity?: DataModelEntityInstance;
/**
* The urn of the provided entity used for requesting configs specific to that entity
*/
@alias('entity.urn')
urn?: string;
/**
* The target feature for which this container is requesting entity configs for
* TODO META-11234: Allow for entity feature configs container to batch for multiple targets
*/
targetFeature = '';
/**
* The entity configs used for rendering configurable feature components
* TODO META-11234: Allow for entity feature configs container to batch for multiple targets
* Configs should be a record of configs when there are multiple targets however the current midtier implementation
* only fetches for an appworx-deprecation flag
*/
configs = false;
/**
* Parent container task to get all data for the container component
*/
@task(function*(this: EntityFeatureConfigsContainer): IterableIterator<Promise<boolean>> {
if (this.urn && this.targetFeature) {
try {
const configs: boolean = ((yield readEntityFeatureConfigs(this.urn, this.targetFeature)) as unknown) as boolean;
set(this, 'configs', configs);
} catch {
// Do nothing
}
}
})
getContainerDataTask!: ETaskPromise<Promise<boolean>>;
}