Code cleanup for health score gauge handler

This commit is contained in:
cptran777 2018-08-17 14:14:16 -07:00
parent 7192f9b6ff
commit 6ec7b2151e
4 changed files with 13 additions and 29 deletions

View File

@ -4,8 +4,6 @@ import { IDatasetHealth } from 'wherehows-web/typings/api/datasets/health';
import { readDatasetHealthByUrn } from 'wherehows-web/utils/api/datasets/health';
import { get, set } from '@ember/object';
// import { once } from '@ember/runloop';
export default class HealthScoreGauge extends Component {
/**
* 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
* @type {string}
*/
tagName: '';
tagName = '';
elementId = <any>undefined;
/**
* The health score to be passed to the container
*/
healthScore: number;
healthScore: number = 0;
didInsertElement() {
get(this, 'getHealthScoreTask').perform();

View File

@ -56,7 +56,7 @@ export default class VisualizationChartsScoreGauge extends Component {
* @type {number}
* @default 0
*/
score: number = this.score || 0;
score: number;
/**
* Represents the maximum value a score can be. Helps us to calculate a percentage score

View File

@ -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;
}
}

View File

@ -1,4 +1,8 @@
{{visualization/charts/score-gauge
{{#if getHealthScoreTask.isIdle}}
{{visualization/charts/score-gauge
class="dataset-health-score"
score=healthScore
title="Health Score:"}}
{{else}}
{{pendulum-ellipsis-animation}}
{{/if}}