Skip to content

Commit

Permalink
Merge pull request #220 from Support-pl/dev
Browse files Browse the repository at this point in the history
fixed some bugs
  • Loading branch information
639852 authored Jul 5, 2023
2 parents a566432 + acecaca commit 165000e
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 74 deletions.
7 changes: 7 additions & 0 deletions src/components/appMain/appHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ export default {
this.isVisible = true;
},
routeBack() {
if (this.getActiveTab.title.includes('iaas') && this.$route.query.product) {
const query = { ...this.$route.query };
delete query.product;
this.$router.push({ path: '/iaas', query });
return;
}
if (this.getActiveTab.title.includes('service')) {
this.$router.push('/services');
return;
Expand Down
4 changes: 2 additions & 2 deletions src/components/appMain/cloud/cloudItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
{{ localDate }}
</div>

<div class="item__status" v-if="networking.length < 1">
<div class="item__status" v-if="networking.length < 1 && instance.groupname === 'Self-Service VDS SSD HC'">
IP: {{ $t("ip.none") }}
</div>
<div class="item__status" v-else-if="networking.length < 2">
{{ instance.domain }}
{{ instance.domain ?? instance.groupname }}
</div>

<a-collapse v-else v-model="activeKey" expandIconPosition="right" :bordered="false">
Expand Down
16 changes: 14 additions & 2 deletions src/components/appMain/cloud/vnc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
v-if="isMaintananceMode"
main-page-button
></maintanance-mode>

<iframe
frameborder="0"
style="width: 100%; height: 100%"
v-else-if="instance.billingPlan.type.includes('ovh')"
:src="url"
/>
<template v-else>
<div id="noVNC_status"></div>

Expand Down Expand Up @@ -270,8 +277,13 @@ export default {
baseURL.splice(0, 1);
this.token = res.meta.token;
this.desktopName = this.instance?.title ?? 'Unknown';
this.url = `wss://${this.instance.sp}.proxy.${baseURL.join('.')}socket?${res.meta.url}`;
this.connect(this.$store.state.nocloud.auth.token);
if (res.meta.info) {
this.url = `wss://${this.instance.sp}.proxy.${baseURL.join('.')}socket?${res.meta.url}`;
this.connect(this.$store.state.nocloud.auth.token);
} else {
this.url = res.meta.url;
}
})
.catch(err => console.error(err));
},
Expand Down
82 changes: 42 additions & 40 deletions src/components/appMain/modules/ione/createInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,46 @@ export default {
osName(name) {
return name.toLowerCase().replace(/[-_\d]/g, ' ').split(' ')[0];
},
changePeriods() {
const value = [];
const types = new Set();
const day = 3600 * 24
const month = day * 30;
const year = day * 365;
this.plans.forEach((plan) => {
types.add(plan.type);
if (plan.kind === 'DYNAMIC') value.push(
{ value: 'Hourly', label: 'ssl_product.Hourly' }
);
if (plan.kind !== 'STATIC') return;
const periods = Object.values(plan.products).map((el) => +el.period);
if (periods.includes(day)) value.push(
{ value: 'Daily', label: 'daily', period: day }
);
if (periods.includes(month)) value.push(
{ value: 'Monthly', label: 'ssl_product.Monthly', period: month }
);
if (periods.includes(year)) value.push(
{ value: 'Annually', label: 'annually', period: year }
);
if (periods.includes(year * 2)) value.push(
{ value: 'Biennially', label: 'biennially', period: year * 2 }
);
});
if (types.size > 1) return;
value.sort((a, b) => (a.value === 'Hourly') ? 1 : a.period - b.period);
this.options.drive = false;
this.$emit('setData', { key: 'periods', value });
},
changeNetwork(type) {
switch (type) {
case 'public':
Expand Down Expand Up @@ -386,6 +426,7 @@ export default {
},
created() {
if (!this.user?.uuid) this.$store.dispatch('nocloud/auth/fetchUserData');
this.changePeriods();
},
beforeMount() {
const images = Object.entries(this.itemSP?.publicData.templates ?? {});
Expand Down Expand Up @@ -440,46 +481,7 @@ export default {
}
},
watch: {
plans() {
const value = [];
const types = new Set();
const day = 3600 * 24
const month = day * 30;
const year = day * 365;
this.plans.forEach((plan) => {
types.add(plan.type);
if (plan.kind === 'DYNAMIC') value.push(
{ value: 'Hourly', label: 'ssl_product.Hourly' }
);
if (plan.kind !== 'STATIC') return;
const periods = Object.values(plan.products).map((el) => +el.period);
if (periods.includes(day)) value.push(
{ value: 'Daily', label: 'daily', period: day }
);
if (periods.includes(month)) value.push(
{ value: 'Monthly', label: 'ssl_product.Monthly', period: month }
);
if (periods.includes(year)) value.push(
{ value: 'Annually', label: 'annually', period: year }
);
if (periods.includes(year * 2)) value.push(
{ value: 'Biennially', label: 'biennially', period: year * 2 }
);
});
if (types.size > 1) return;
value.sort((a, b) => (a.value === 'Hourly') ? 1 : a.period - b.period);
this.options.drive = false;
this.$emit('setData', { key: 'periods', value });
},
plans() { this.changePeriods() },
activeKey() { this.changePanelHeight() }
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/appMain/modules/ovh cloud/openInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,10 @@ export default {
},
statusVM() {
if (!this.VM) return;
if (this.VM.state.state === 'PENDING' || this.VM.data.suspended_manually) {
const isPending = ['PENDING', 'OPERATION'].includes(this.VM.state.state);
const isSuspended = this.VM.data.suspended_manually;
if (isPending || isSuspended) {
return { shutdown: true, reboot: true, start: true, recover: true };
}
Expand Down
10 changes: 7 additions & 3 deletions src/components/appMain/modules/ovh vps/openInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,10 @@
shape="round"
size="large"
:disabled="VM.state.state !== 'RUNNING'"
@click="openVNC"
>
VNC
<router-link :to="{ path: `${$route.params.uuid}/vnc` }">
VNC
</router-link>
</a-button>
</div>
</a-col>
Expand Down Expand Up @@ -946,7 +947,10 @@ export default {
},
statusVM() {
if (!this.VM) return;
if (this.VM.state.state === 'PENDING' || this.VM.data.suspended_manually) {
const isPending = ['PENDING', 'OPERATION'].includes(this.VM.state.state);
const isSuspended = this.VM.data.suspended_manually;
if (isPending || isSuspended) {
return { shutdown: true, reboot: true, start: true, recover: true };
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/appMain/newPaaS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1631,8 +1631,6 @@ export default {
anonymously: !this.isLoggedIn
})
.then(({ pool }) => {
this.$store.commit('nocloud/plans/setPlans', pool);
const keys = Object.entries(this.itemSP.meta.showcase ?? {});
const [showcase] = keys.find(([key, { billing_plans }]) => {
const plan = this.filteredPlans.find(({ uuid }) => billing_plans.includes(uuid));
Expand Down
8 changes: 1 addition & 7 deletions src/components/balance/balance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default {
this.$store.dispatch("nocloud/auth/fetchBillingData")
.then((res) => {
this.currency.suffix = res.currency_code ?? this.defaultCurrency;
this.currency = Object.assign({}, this.currency);
})
.catch((err) => console.error(err));
},
Expand Down Expand Up @@ -114,13 +115,6 @@ export default {
if (this.amount == "") this.amount = 0;
this.amount += amount;
},
},
watch: {
defaultCurrency(value) {
if (this.user.currency_code) return;
this.currency.suffix = value;
this.currency = Object.assign({}, this.currency);
}
}
};
</script>
Expand Down
38 changes: 31 additions & 7 deletions src/components/services/iaas/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
<div class="order__inputs order__field">
<div class="order__option">
<div class="order__product" v-if="$route.query.product">
<div
class="order__slider-name"
style="font-size: 20px; font-weight: 700; margin-bottom: 10px"
v-html="getProducts.name"
/>
<div class="order__product-name" v-html="getProducts.name" />
</div>

<div v-else class="order__grid">
Expand Down Expand Up @@ -246,7 +242,7 @@ export default {

this.products = prod.sort((a, b) => b.name - a.name);
this.products.forEach(({ description }, i) => {
const desc = description.replace('/templates', `${this.$config.WHMCSsiteurl}$&`,);
const desc = description.replace('/templates', `${this.$config.WHMCSsiteurl}$&`);
const start = desc.indexOf('<img');
const end = desc.indexOf('">', start);
const image = desc.slice(start, end + 2);
Expand Down Expand Up @@ -548,6 +544,20 @@ export default {
margin-bottom: 10px;
}

.order__product-name {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
font-size: 20px;
font-weight: 700;
}

.order__product .order__product-name .img_prod {
max-height: 75px;
margin: 0;
}

.order__option div > .img_prod {
display: block;
max-width: 200px;
Expand All @@ -564,6 +574,10 @@ export default {
gap: 5px;
}

.order__option .order__slider-name .ant-checkbox {
box-shadow: 0 0 5px var(--main);
}

.order__option .order__slider-name img {
max-height: 65px;
}
Expand Down Expand Up @@ -598,8 +612,13 @@ export default {
opacity: 1;
}

.order__option .ant-card-head {
background: var(--bright_bg);
}

.order__option .ant-card-body {
display: flex;
flex-wrap: wrap;
gap: 5px;
}

Expand All @@ -608,9 +627,14 @@ export default {
}

.card-item {
width: 50%;
width: 100%;
cursor: pointer;
border: 0 solid transparent;
background: var(--bright_bg);
}

.card-item .order__slider-name {
justify-items: start;
}

.card-item--active {
Expand Down
2 changes: 1 addition & 1 deletion src/components/services/vm/lilbtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default {
.find(({ uuid }) => uuid === this.service.uuid);
this.isLoading = true;
instance.data.auto_renew = value;
this.$set(instance.data, 'auto_renew', value);
this.$store.dispatch('nocloud/vms/updateService', service)
.then(() => {
const message = this.$t('Done');
Expand Down
8 changes: 2 additions & 6 deletions src/routes/invoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ export default {
this.setPagination();
}
if (localStorage.getItem('order')) {
this.value = localStorage.getItem('order');
} else {
localStorage.setItem('order', this.value);
}
if (this.$store.getters['nocloud/auth/currencies'].length < 1) {
this.$store.dispatch('nocloud/auth/fetchCurrencies');
}
Expand All @@ -176,7 +171,6 @@ export default {
},
watch: {
value() {
localStorage.setItem('order', this.value);
this.$store.commit('nocloud/transactions/setActiveTab', this.value);
if (this.value === 'Invoice') return;
if (this.transactions.length > 0) return;
Expand Down Expand Up @@ -233,10 +227,12 @@ export default {
.invoices__wrapper {
padding: 20px 10px;
}
.invoices__wrapper .ant-radio-group {
width: 100%;
margin: 0 1px 20px;
}
.invoices__wrapper .ant-radio-button-wrapper {
width: 50%;
text-align: center;
Expand Down
14 changes: 11 additions & 3 deletions src/routes/userService.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
{{ $t("description") | capitalize }}:
</div>
<div class="service-page__info-value">
<div v-html="description"></div>
<div :style="(service.desc_product) ? 'padding: 0 15px' : ''" v-html="description"></div>
</div>
</div>

Expand Down Expand Up @@ -444,10 +444,12 @@ export default {
return !this.service.clientid && meta?.renew !== false;
},
description() {
const key = this.service.product ?? this.service.config.product;
const key = this.service.product ?? this.service.config?.product;
const { meta } = this.service.billingPlan?.products[key] ?? {};
const description = this.service.desc_product
.replace('/templates', `${this.$config.WHMCSsiteurl}$&`);
return meta?.description;
return meta?.description ?? description;
}
},
};
Expand Down Expand Up @@ -498,4 +500,10 @@ export default {
.service-page__info-value {
font-size: 1.1rem;
}
.service-page__info-value div > .img_prod {
display: block;
max-width: 200px;
margin: 0 auto 10px;
}
</style>

0 comments on commit 165000e

Please sign in to comment.