mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-23 16:48:12 +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
96 lines
2.9 KiB
TypeScript
96 lines
2.9 KiB
TypeScript
import Component from '@glimmer/component';
|
|
import { set, action, computed } from '@ember/object';
|
|
import { DataModelEntityInstance } from '@datahub/data-models/constants/entity';
|
|
import { TopConsumer } from '@datahub/metadata-types/constants/metadata/top-consumers';
|
|
import { IConfigurator } from '@datahub/shared/types/configurator/configurator';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
interface ITopConsumersInsightArgs {
|
|
// The context entity that the top consumers insight is describing
|
|
entity?: DataModelEntityInstance;
|
|
// options for rendering the Top Consumers insight
|
|
options?: {
|
|
// The name of the component to render within the Top Consumers insight
|
|
component: string;
|
|
// Flag indicating that concurrency task handler component should only handle async loading
|
|
isOptional: boolean;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* The top consumers insight component is the presentational interface for top consumers.
|
|
* It renders different insight components depending on the renderProps it was given.
|
|
* This component also contains logic for rendering a modal that renders a full UI of all top consumer aspect data.
|
|
*/
|
|
export default class TopConsumersInsight extends Component<ITopConsumersInsightArgs> {
|
|
/**
|
|
* Injects the config service
|
|
*/
|
|
@service
|
|
configurator!: IConfigurator;
|
|
|
|
/**
|
|
* Top consumer enum declared in the component for convenient access
|
|
*/
|
|
topConsumer = TopConsumer;
|
|
|
|
/**
|
|
* The tooltip displayed in the insight for top users
|
|
*/
|
|
topUsersTooltipText = 'Individuals using this dataset most frequently';
|
|
|
|
/**
|
|
* The tooltip displayed in the insight for top groups
|
|
*/
|
|
topGroupsTooltipText = 'Headless accounts (groups on Hadoop Grid) using this dataset most frequently';
|
|
|
|
/**
|
|
* Flag determining whether top consumers modal is being shown
|
|
*/
|
|
isShowingTopConsumersModal = false;
|
|
|
|
/**
|
|
* The tab id currently selected in the top consumers modal
|
|
*/
|
|
tabSelected?: TopConsumer;
|
|
|
|
/**
|
|
* Gets the flag guard for showing the top consumers insight
|
|
* @default false
|
|
*/
|
|
@computed('configurator.showTopConsumers')
|
|
get showTopConsumers(): boolean {
|
|
const { configurator } = this;
|
|
return configurator && configurator.getConfig('showTopConsumers', { useDefault: true, default: false });
|
|
}
|
|
|
|
/**
|
|
* Action triggered when the tab is changed in the top consumers modal
|
|
* @param tab the tab that is being selected
|
|
*/
|
|
@action
|
|
tabSelectionDidChange(tab: TopConsumer): void {
|
|
set(this, 'tabSelected', tab);
|
|
}
|
|
|
|
/**
|
|
* Action triggered to show the top consumers modal
|
|
* @param tab the tab that the top consumers modal will show on render
|
|
*/
|
|
@action
|
|
showTopConsumersModal(tab?: TopConsumer): void {
|
|
if (tab) {
|
|
this.tabSelectionDidChange(tab);
|
|
set(this, 'isShowingTopConsumersModal', true);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Action triggered to close the top consumers modal
|
|
*/
|
|
@action
|
|
closeTopConsumersModal(): void {
|
|
set(this, 'isShowingTopConsumersModal', false);
|
|
}
|
|
}
|