Merge "fix: fix the quota info"
This commit is contained in:
commit
af6b92b3bc
@ -19,7 +19,7 @@ import { typeColors, getUsedValueColor } from './Ring';
|
|||||||
export default function Line(props) {
|
export default function Line(props) {
|
||||||
const {
|
const {
|
||||||
used = 0,
|
used = 0,
|
||||||
add = 1,
|
add = 0,
|
||||||
reserved = 0,
|
reserved = 0,
|
||||||
limit = 1,
|
limit = 1,
|
||||||
title = '',
|
title = '',
|
||||||
|
@ -54,7 +54,7 @@ const testChinese = (str) => {
|
|||||||
export default function Ring(props) {
|
export default function Ring(props) {
|
||||||
const {
|
const {
|
||||||
used = 0,
|
used = 0,
|
||||||
add = 1,
|
add = 0,
|
||||||
reserved = 0,
|
reserved = 0,
|
||||||
limit = 1,
|
limit = 1,
|
||||||
title = '',
|
title = '',
|
||||||
|
@ -26,6 +26,7 @@ export class StepCreate extends StepAction {
|
|||||||
this.store = globalContainersStore;
|
this.store = globalContainersStore;
|
||||||
this.projectStore = globalProjectStore;
|
this.projectStore = globalProjectStore;
|
||||||
this.getQuota();
|
this.getQuota();
|
||||||
|
this.state.isLoading = true;
|
||||||
this.errorMsg = '';
|
this.errorMsg = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,22 +86,26 @@ export class StepCreate extends StepAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get quotaInfo() {
|
get quotaInfo() {
|
||||||
|
if (this.state.isLoading) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const {
|
const {
|
||||||
containers = {},
|
containers = {},
|
||||||
cpu = {},
|
cpu = {},
|
||||||
memory = {},
|
memory = {},
|
||||||
disk = {},
|
disk = {},
|
||||||
} = this.projectStore.zunQuota;
|
} = this.projectStore.zunQuota;
|
||||||
const { limit } = containers || {};
|
const { left = 0 } = containers || {};
|
||||||
if (!limit) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const {
|
const {
|
||||||
data: { cpu: cpuCount, memory: memoryCount, disk: diskCount } = {},
|
data: {
|
||||||
|
cpu: cpuCount = 0,
|
||||||
|
memory: memoryCount = 0,
|
||||||
|
disk: diskCount = 0,
|
||||||
|
} = {},
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const containersQuotaInfo = {
|
const containersQuotaInfo = {
|
||||||
...containers,
|
...containers,
|
||||||
add: 1,
|
add: left ? 1 : 0,
|
||||||
name: 'containers',
|
name: 'containers',
|
||||||
title: t('Containers'),
|
title: t('Containers'),
|
||||||
};
|
};
|
||||||
@ -136,6 +141,9 @@ export class StepCreate extends StepAction {
|
|||||||
|
|
||||||
async getQuota() {
|
async getQuota() {
|
||||||
await this.projectStore.fetchProjectZunQuota();
|
await this.projectStore.fetchProjectZunQuota();
|
||||||
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getQuotaMessage(input, left, name) {
|
getQuotaMessage(input, left, name) {
|
||||||
@ -153,7 +161,11 @@ export class StepCreate extends StepAction {
|
|||||||
|
|
||||||
checkQuota(data, quota) {
|
checkQuota(data, quota) {
|
||||||
const { containers = {}, cpu = {}, memory = {}, disk = {} } = quota || {};
|
const { containers = {}, cpu = {}, memory = {}, disk = {} } = quota || {};
|
||||||
const { cpu: cpuCount, memory: memoryCount, disk: diskCount } = data || {};
|
const {
|
||||||
|
cpu: cpuCount = 0,
|
||||||
|
memory: memoryCount = 0,
|
||||||
|
disk: diskCount = 0,
|
||||||
|
} = data || {};
|
||||||
|
|
||||||
const { left: containerLeft = 0 } = containers;
|
const { left: containerLeft = 0 } = containers;
|
||||||
const containerMsg = this.getQuotaMessage(
|
const containerMsg = this.getQuotaMessage(
|
||||||
|
Loading…
Reference in New Issue
Block a user