mirror of https://github.com/rancher/ui.git
parent
7e650bc59b
commit
d51a820fc8
|
|
@ -154,10 +154,10 @@ export default Component.extend(ThrottledResize, {
|
|||
|
||||
set(this, 'chart', chart);
|
||||
chart.showLoading(LOADING_PARAMS);
|
||||
this.draw(false);
|
||||
this.draw();
|
||||
},
|
||||
|
||||
draw(update = true) {
|
||||
draw() {
|
||||
const chart = get(this, 'chart');
|
||||
|
||||
if ( !chart ) {
|
||||
|
|
@ -248,16 +248,8 @@ export default Component.extend(ThrottledResize, {
|
|||
option.yAxis.max = minMax;
|
||||
}
|
||||
|
||||
let newOptions;
|
||||
|
||||
if ( update ) {
|
||||
newOptions = { series };
|
||||
} else {
|
||||
newOptions = option;
|
||||
}
|
||||
|
||||
chart.clear();
|
||||
chart.setOption(newOptions, true);
|
||||
chart.setOption(option, true);
|
||||
|
||||
chart.hideLoading();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,11 +13,17 @@ export default Component.extend({
|
|||
loading: null,
|
||||
noGraphs: null,
|
||||
noDataLabel: 'metricsAction.noData',
|
||||
currentGraphs: null,
|
||||
|
||||
graphsDidChange: observer('graphs', function() {
|
||||
let out = [];
|
||||
const graphs = (get(this, 'graphs') || []);
|
||||
const newGrahps = graphs.map((graph) => get(graph, 'graph.title') || '').join(',');
|
||||
const changed = newGrahps !== get(this, 'currentGraphs');
|
||||
|
||||
set(this, 'currentGraphs', newGrahps);
|
||||
|
||||
if ( changed ) {
|
||||
graphs.forEach((graph, index) => {
|
||||
if (index % 3 === 0) {
|
||||
out.pushObject([graph]);
|
||||
|
|
@ -26,5 +32,20 @@ export default Component.extend({
|
|||
}
|
||||
});
|
||||
set(this, 'rows', out);
|
||||
} else {
|
||||
let rowIndex = -1;
|
||||
const currentRows = get(this, 'rows') || [];
|
||||
|
||||
graphs.forEach((graph, index) => {
|
||||
let colIndex = index % 3;
|
||||
|
||||
if ( colIndex === 0 ) {
|
||||
rowIndex++;
|
||||
}
|
||||
let row = currentRows.objectAt(rowIndex) || [];
|
||||
|
||||
set(row.objectAt(colIndex), 'series', get(graph, 'series') );
|
||||
});
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue