mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-26 01:23:16 +00:00
Fixes issues where going from another tab to health tab does not render charts in ds view
This commit is contained in:
parent
479f575383
commit
c9e74754b4
@ -1,7 +1,7 @@
|
|||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { get, computed, setProperties, getProperties } from '@ember/object';
|
import { get, computed, setProperties, getProperties, set } from '@ember/object';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
import ComputedProperty from '@ember/object/computed';
|
import ComputedProperty, { equal } from '@ember/object/computed';
|
||||||
import { IChartDatum } from 'wherehows-web/typings/app/visualization/charts';
|
import { IChartDatum } from 'wherehows-web/typings/app/visualization/charts';
|
||||||
import { IHealthScore, IDatasetHealth } from 'wherehows-web/typings/api/datasets/health';
|
import { IHealthScore, IDatasetHealth } from 'wherehows-web/typings/api/datasets/health';
|
||||||
import { healthCategories, healthSeverity, healthDetail } from 'wherehows-web/constants/data/temp-mock/health';
|
import { healthCategories, healthSeverity, healthDetail } from 'wherehows-web/constants/data/temp-mock/health';
|
||||||
@ -69,6 +69,22 @@ export default class DatasetHealthContainer extends Component {
|
|||||||
*/
|
*/
|
||||||
tableData: Array<IHealthScore> = [];
|
tableData: Array<IHealthScore> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passed in from the higher level component, we use this property in order to determine whether the dataset health
|
||||||
|
* tab is the currently selected tab
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
tabSelected: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculated from the currently selected tab to determine whether this container is the currently selected tab.
|
||||||
|
* Note: Highcharts calculates size and other chart details upon initial render and doesn't do a good job of handling
|
||||||
|
* rerenders. Because of this we want those calculations to take place when dataset health is the currently active tab,
|
||||||
|
* otherwise we will insert elements off screen and size will default to 0 and we lose our charts
|
||||||
|
* @type {ComputedProperty<boolean>}
|
||||||
|
*/
|
||||||
|
isActiveTab = equal('tabSelected', 'health');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modified categoryMetrics to add properties that will help us render our actual charts without modifying the original
|
* Modified categoryMetrics to add properties that will help us render our actual charts without modifying the original
|
||||||
* data
|
* data
|
||||||
@ -163,4 +179,11 @@ export default class DatasetHealthContainer extends Component {
|
|||||||
currentSeverityFilter: filterType === 'severity' && newFilterName !== currentSeverityFilter ? newFilterName : ''
|
currentSeverityFilter: filterType === 'severity' && newFilterName !== currentSeverityFilter ? newFilterName : ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
console.log('constructing');
|
||||||
|
console.log(this.tabSelected);
|
||||||
|
set(this, 'tabSelected', this.tabSelected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<h3>Metadata Health</h3>
|
<h3>Metadata Health</h3>
|
||||||
{{datasets/health/metrics-charts
|
{{datasets/health/metrics-charts
|
||||||
|
isActiveTab=isActiveTab
|
||||||
categoryData=renderedCategories
|
categoryData=renderedCategories
|
||||||
severityData=renderedSeverity
|
severityData=renderedSeverity
|
||||||
onCategorySelect=(action onFilterSelect "category")
|
onCategorySelect=(action onFilterSelect "category")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="dataset-health__chart-container">
|
<div class="dataset-health__chart-container">
|
||||||
{{#if categoryData}}
|
{{#if (and isActiveTab categoryData)}}
|
||||||
{{visualization/charts/horizontal-bar-chart
|
{{visualization/charts/horizontal-bar-chart
|
||||||
title="Categories"
|
title="Categories"
|
||||||
series=categoryData
|
series=categoryData
|
||||||
@ -8,7 +8,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="dataset-health__chart-container">
|
<div class="dataset-health__chart-container">
|
||||||
{{#if severityData}}
|
{{#if (and isActiveTab severityData)}}
|
||||||
{{visualization/charts/horizontal-bar-chart
|
{{visualization/charts/horizontal-bar-chart
|
||||||
class="severity-chart"
|
class="severity-chart"
|
||||||
title="Severity"
|
title="Severity"
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
{{#if shouldShowDatasetHealth}}
|
{{#if shouldShowDatasetHealth}}
|
||||||
{{#tabs.tabpanel tabIds.Health}}
|
{{#tabs.tabpanel tabIds.Health}}
|
||||||
{{datasets/containers/dataset-health urn=encodedUrn}}
|
{{datasets/containers/dataset-health urn=encodedUrn tabSelected=tabSelected}}
|
||||||
{{/tabs.tabpanel}}
|
{{/tabs.tabpanel}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user