Skip to content

Commit

Permalink
Merge pull request #1187 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dimquaa authored Oct 18, 2023
2 parents ce01984 + 70b5a6b commit 54e363c
Show file tree
Hide file tree
Showing 24 changed files with 744 additions and 307 deletions.
2 changes: 1 addition & 1 deletion admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"core-js": "^3.32.1",
"date-fns": "^2.29.3",
"glob-parent": "^6.0.2",
"jodit-vue": "^2.6.0",
"js-cookie": "^3.0.5",
"json-schema": "^0.4.0",
"nocloud-ui": "^1.0.7",
Expand All @@ -31,7 +32,6 @@
"vue-apexcharts": "^1.6.2",
"vue-i18n": "^8.28.2",
"vue-router": "^3.6.5",
"vue2-editor": "^2.10.3",
"vuetify": "^2.7.1",
"vuex": "^3.4.0",
"yaml": "^2.3.1"
Expand Down
13 changes: 10 additions & 3 deletions admin-ui/src/components/account/info.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<template>
<v-card elevation="0" color="background-light" class="pa-4">
<div style="position: absolute; top: 0; right: 75px">
<div style="position: absolute; top: 0; right: 25px">
<div>
<v-chip color="primary" outlined
>Balance: {{ account.balance?.toFixed(2) }}
<v-chip class="mr-3" color="primary" outlined
>Balance: {{ account.balance?.toFixed(2) || 0 }}
{{ account.currency }}</v-chip
>
<v-btn
:to="{
name: 'Transactions create',
params: { account: account.uuid },
}"
>Create transaction/invoice</v-btn
>
</div>
</div>

Expand Down
7 changes: 1 addition & 6 deletions admin-ui/src/components/dialogs/changeMonitorings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<v-card-title>{{ nextPaymentDates[key].title }}</v-card-title>
</v-col>
<v-col cols="8">
<date-picker :min="min" v-model="nextPaymentDates[key].value" />
<date-picker v-model="nextPaymentDates[key].value" />
</v-col>
</v-row>
</div>
Expand Down Expand Up @@ -58,7 +58,6 @@ const changeDatesLoading = ref(false);
const isChangeAll = ref(true);
const nextPaymentDates = ref({});
const newAllDate = ref();
const min = ref();
const setNextPaymentDate = () => {
const data = JSON.parse(JSON.stringify(template.value.data));
Expand Down Expand Up @@ -138,10 +137,6 @@ const changeDates = async () => {
onMounted(() => {
setNextPaymentDate();
//tommoraw
min.value = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
.toISOString()
.slice(0, 10);
});
</script>
Expand Down
43 changes: 30 additions & 13 deletions admin-ui/src/components/instance/controls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
class="mr-2"
v-for="btn in vmControlBtns"
:key="btn.action + btn.title"
:disabled="btn.disabled"
:loading="isSendActionLoading"
@click="
sendVmAction({
action: btn.action,
template: { ...template, type: type },
params: btn.data,
})
"
:disabled="btn.disabled || (!!runningActionName && runningActionName!==btn.action)"
:loading="runningActionName === btn.action"
@click="sendAction(btn)"
>
{{ btn.title || btn.action }}
</v-btn>
Expand Down Expand Up @@ -69,6 +63,7 @@ export default {
isLoading: false,
isSaveLoading: false,
isLockLoading: false,
runningActionName: "",
}),
methods: {
...mapActions("actions", ["sendVmAction"]),
Expand Down Expand Up @@ -199,6 +194,18 @@ export default {
this.isSaveLoading = false;
});
},
async sendAction(btn) {
this.runningActionName = btn.action;
try {
await this.sendVmAction({
action: btn.action,
template: { ...this.template, type: this.type },
params: btn.data,
});
} finally {
this.runningActionName = "";
}
},
},
computed: {
...mapGetters("actions", ["isSendActionLoading"]),
Expand Down Expand Up @@ -294,17 +301,27 @@ export default {
(this.template.state.meta.state !== 3 &&
[0, 18, 20].includes(this.template.state.meta.lcm_state)),
reboot:
this.template.state.meta.lcm_state === 6 ||
this.template.state.meta.lcm_state === 21 ||
this.template.state.meta.state === 5 ||
(this.template.state.meta.state !== 3 &&
(this.template.state.meta.lcm_state === 18 ||
this.template.state.meta.lcm_state === 20)) ||
(this.template.state.meta.lcm_state === 0 &&
this.template.state.meta.state === 8),
resume:
this.template.state.meta.state === 3 &&
![18, 20].includes(this.template.state.meta.lcm_state),
suspend: this.template.state.meta.state === 5,
vnc: this.template.state.meta.state === 5,
this.template.state.meta.lcm_state === 21 ||
this.template.state.meta.lcm_state === 6 ||
(this.template.state.meta.state === 3 &&
![18, 20].includes(this.template.state.meta.lcm_state)),
suspend:
this.template.state.meta.state === 5 ||
this.template.state.meta.lcm_state === 21 ||
this.template.state.meta.lcm_state === 6,
vnc:
this.template.state.meta.state === 5 ||
this.template.state.meta.lcm_state === 21 ||
this.template.state.meta.lcm_state === 6,
};
},
ovhActions() {
Expand Down
Loading

0 comments on commit 54e363c

Please sign in to comment.