Fix gauge greater 100 and unit

https://github.com/rancher/rancher/issues/19413
This commit is contained in:
n313893254 2019-06-13 14:43:25 +08:00
parent 2c0e103f34
commit 750e5fc482
2 changed files with 4 additions and 4 deletions

View File

@ -25,8 +25,8 @@ export default Component.extend({
podUsage: computed('nodes.@each.{allocatable,requested}', 'intl.locale', function() {
return this.getGauge('pods',
(u, t) => formatSi(u, 1000, '', '', 0, exponentNeeded(t), 1).replace(/\s.*$/, ''),
(t) => formatSi(t, 1000, '', '', 0, exponentNeeded(t), 1), 'used',
(u, t) => formatSi(u, 1000, '', '', 0, exponentNeeded(Math.max(u, t)), 1).replace(/\s.*$/, ''),
(t, u) => formatSi(t, 1000, '', '', 0, exponentNeeded(Math.max(u, t)), 1), 'used',
);
}),
@ -124,7 +124,7 @@ export default Component.extend({
return this.get('intl').t(`clusterDashboard.subtitle.${ keyword }`, {
used: usedCb ? (usedCb(used, total) || '').trim() : used,
total: totalCb ? (totalCb(total) || '').trim() : total,
total: totalCb ? (totalCb(total, used) || '').trim() : total,
});
},
});

View File

@ -74,7 +74,7 @@ function repaintTicks(svg, tooltip, width, height, margin, ticks, value, thickne
function repaintArc(width, margin, value, thickness, valuePath, maxPath) {
const r = calcR(width, margin);
valuePath.attr('d', createArc(-135, value, r, thickness))
valuePath.attr('d', createArc(-135, Math.min(value, 100), r, thickness))
.attr('transform', `translate(${ margin + r
},${ margin + r }), scale(1, 1)`);
maxPath.attr('d', createArc(-135, 100, r, thickness))