mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
Extract variables to utils/unit
Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import ConsumptionGauge from '@shell/components/ConsumptionGauge';
|
||||
import { METRIC, NODE } from '@shell/config/types';
|
||||
import { formatSi, exponentNeeded, UNITS, parseSi } from '@shell/utils/units';
|
||||
|
||||
import { UNIT_SUFFIX } from '../utils/unit';
|
||||
export default {
|
||||
name: 'HarvesterMemoryUsed',
|
||||
components: { ConsumptionGauge },
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
memoryUnits() {
|
||||
const exponent = exponentNeeded(this.memoryTotal, 1024);
|
||||
|
||||
return `${ UNITS[exponent] }i`;
|
||||
return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
|
||||
},
|
||||
|
||||
node() {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import ConsumptionGauge from '@shell/components/ConsumptionGauge';
|
||||
import { LONGHORN } from '@shell/config/types';
|
||||
import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units';
|
||||
import { UNIT_SUFFIX } from '../utils/unit';
|
||||
|
||||
export default {
|
||||
name: 'HarvesterStorageUsed',
|
||||
@@ -75,13 +76,13 @@ export default {
|
||||
allocatedUnits() {
|
||||
const exponent = exponentNeeded(this.storageStats.total, 1024);
|
||||
|
||||
return `${ UNITS[exponent] }i`;
|
||||
return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
|
||||
},
|
||||
|
||||
usedUnits() {
|
||||
const exponent = exponentNeeded(this.storageStats.maximum, 1024);
|
||||
|
||||
return `${ UNITS[exponent] }i`;
|
||||
return `${ UNITS[exponent] }${ UNIT_SUFFIX }`;
|
||||
},
|
||||
|
||||
formatUsed() {
|
||||
|
||||
Reference in New Issue
Block a user