mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-01 05:13:15 +00:00
Code cleanup for health score gauge handler
This commit is contained in:
parent
7192f9b6ff
commit
6ec7b2151e
@ -4,8 +4,6 @@ import { IDatasetHealth } from 'wherehows-web/typings/api/datasets/health';
|
|||||||
import { readDatasetHealthByUrn } from 'wherehows-web/utils/api/datasets/health';
|
import { readDatasetHealthByUrn } from 'wherehows-web/utils/api/datasets/health';
|
||||||
import { get, set } from '@ember/object';
|
import { get, set } from '@ember/object';
|
||||||
|
|
||||||
// import { once } from '@ember/runloop';
|
|
||||||
|
|
||||||
export default class HealthScoreGauge extends Component {
|
export default class HealthScoreGauge extends Component {
|
||||||
/**
|
/**
|
||||||
* The urn identifier for the dataset
|
* The urn identifier for the dataset
|
||||||
@ -17,12 +15,14 @@ export default class HealthScoreGauge extends Component {
|
|||||||
* Defines the tag to be used in the rendered html element for this component
|
* Defines the tag to be used in the rendered html element for this component
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
tagName: '';
|
tagName = '';
|
||||||
|
|
||||||
|
elementId = <any>undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The health score to be passed to the container
|
* The health score to be passed to the container
|
||||||
*/
|
*/
|
||||||
healthScore: number;
|
healthScore: number = 0;
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
get(this, 'getHealthScoreTask').perform();
|
get(this, 'getHealthScoreTask').perform();
|
||||||
|
@ -56,7 +56,7 @@ export default class VisualizationChartsScoreGauge extends Component {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
* @default 0
|
* @default 0
|
||||||
*/
|
*/
|
||||||
score: number = this.score || 0;
|
score: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the maximum value a score can be. Helps us to calculate a percentage score
|
* Represents the maximum value a score can be. Helps us to calculate a percentage score
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import Service from '@ember/service';
|
|
||||||
import { IObject } from 'wherehows-web/typings/generic';
|
|
||||||
import { get } from '@ember/object';
|
|
||||||
|
|
||||||
export default class DatasetMeta extends Service {
|
|
||||||
healthScore: number;
|
|
||||||
|
|
||||||
healthScores: IObject<number> = {};
|
|
||||||
|
|
||||||
setHealthScoreForUrn(urn: string, score: number) {
|
|
||||||
get(this, 'healthScores')[urn] = score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DO NOT DELETE: this is how TypeScript knows how to look up your services.
|
|
||||||
declare module '@ember/service' {
|
|
||||||
interface Registry {
|
|
||||||
'dataset-meta': DatasetMeta;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,8 @@
|
|||||||
{{visualization/charts/score-gauge
|
{{#if getHealthScoreTask.isIdle}}
|
||||||
class="dataset-health-score"
|
{{visualization/charts/score-gauge
|
||||||
score=healthScore
|
class="dataset-health-score"
|
||||||
title="Health Score:"}}
|
score=healthScore
|
||||||
|
title="Health Score:"}}
|
||||||
|
{{else}}
|
||||||
|
{{pendulum-ellipsis-animation}}
|
||||||
|
{{/if}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user