From 8d88eafb9ed889081f978957ea97525fbdc539f0 Mon Sep 17 00:00:00 2001 From: PavelSazykin Date: Thu, 30 Jan 2025 14:14:59 +0400 Subject: [PATCH] fix vpn instance card --- admin-ui/src/components/instance/controls.vue | 54 +++++++++---------- .../components/modules/empty/billingLabel.vue | 2 +- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/admin-ui/src/components/instance/controls.vue b/admin-ui/src/components/instance/controls.vue index 291ab1ddb..a334109fd 100644 --- a/admin-ui/src/components/instance/controls.vue +++ b/admin-ui/src/components/instance/controls.vue @@ -118,11 +118,7 @@ > Close - + Create @@ -279,7 +275,7 @@ export default { const data = await api.plans.create(billingPlan); await api.servicesProviders.bindPlan(this.sp.uuid, [data.uuid]); return data; - } else { + } else { const title = this.getPlanTitle(this.template); const ogPlan = this.$store.getters["plans/one"]; const updatedPlan = { @@ -357,8 +353,8 @@ export default { this.showSnackbarSuccess({ message: "Instance saved successfully", }); - console.log('refresh'); - + console.log("refresh"); + this.$emit("refresh"); } catch (err) { this.showSnackbarError({ message: err.message }); @@ -742,31 +738,31 @@ export default { } return { poweroff: - this.template.state.meta.state === 5 || - (this.template.state.meta.state !== 3 && - [0, 18, 20].includes(this.template.state.meta.lcm_state)), + this.template.state.meta?.state === 5 || + (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), + 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.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)), + 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, + 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, + this.template.state.meta?.state === 5 || + this.template.state.meta?.lcm_state === 21 || + this.template.state.meta?.lcm_state === 6, start: true, }; }, diff --git a/admin-ui/src/components/modules/empty/billingLabel.vue b/admin-ui/src/components/modules/empty/billingLabel.vue index 1d4367175..157396961 100644 --- a/admin-ui/src/components/modules/empty/billingLabel.vue +++ b/admin-ui/src/components/modules/empty/billingLabel.vue @@ -20,7 +20,7 @@ const emit = defineEmits(["update"]); const { template, addons } = toRefs(props); const dueDate = computed(() => { - return formatSecondsToDate(+props.template?.data?.next_payment_date); + return formatSecondsToDate(+props.template?.data?.next_payment_date) || "-"; }); const instancePrice = ref(0);