Skip to content

Commit

Permalink
Merge pull request #770 from Support-pl/dev-fixes
Browse files Browse the repository at this point in the history
fixed some bugs
  • Loading branch information
639852 authored Sep 10, 2024
2 parents 6c934e4 + e943f6b commit b40d995
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 29 deletions.
3 changes: 2 additions & 1 deletion public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"languages": ["en", "ru", "vi", "fr", "pl"],
"department": "nocloud",
"vdc_enabled": true,
"shared_enabled": true
"shared_enabled": true,
"cloud_enabled": true
}
1 change: 1 addition & 0 deletions src/appconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
languages: globalConfig.languages ?? ['en'],
vdcEnabled: globalConfig.vdc_enabled ?? false,
sharedEnabled: globalConfig.shared_enabled ?? false,
cloudEnabled: globalConfig.cloud_enabled ?? false,

whmcsSiteUrl: globalConfig.whmcs?.site_url ?? '',
whmcsRegistration: globalConfig.whmcs?.registration ?? false,
Expand Down
10 changes: 6 additions & 4 deletions src/components/cloud/modules/ione/panels/plan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { computed, inject, nextTick, reactive, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useCloudStore } from '@/stores/cloud.js'
import { getPeriods, getTarification } from '@/functions.js'
import ioneDrive from '@/components/cloud/create/ioneDrive.vue'
import ioneFilters from '@/components/cloud/create/ioneFilters.vue'
import ioneProducts from '@/components/cloud/create/ioneProducts.vue'
Expand Down Expand Up @@ -137,13 +138,14 @@ watch(() => props.productSize, (value) => {
emits('update:periods', getPeriods(value, props.plans))
})
const data = localStorage.getItem('data') ?? route.query.data
const data = localStorage.getItem('data') ?? route.query.data ?? '{}'
if (props.products.length > 0) {
const { productSize } = JSON.parse(data ?? '{}')
const { productSize } = JSON.parse(data)
if (productSize) setProduct(productSize)
else if (props.products.length < 6) {
if (productSize && props.products.includes(productSize)) {
setProduct(productSize)
} else if (props.products.length < 6) {
setProduct(props.products[1] ?? props.products[0])
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/components/cloud/modules/ovh vps/panels/plan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ const productKey = computed(() => {
watch(product, (value) => {
const product = props.products.find(({ group }) => group === value)
const dataString = (localStorage.getItem('data'))
? localStorage.getItem('data')
: route.query.data ?? '{}'
const dataString = localStorage.getItem('data') ?? route.query.data ?? '{}'
const data = JSON.parse(dataString)
if (!product) return
Expand Down Expand Up @@ -209,9 +207,7 @@ watch(products, async (value) => {
return
}
const dataString = (localStorage.getItem('data'))
? localStorage.getItem('data')
: route.query.data ?? '{}'
const dataString = localStorage.getItem('data') ?? route.query.data ?? '{}'
if (dataString.includes('productSize')) {
const data = JSON.parse(dataString)
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"cpu": "CPU",
"ram": "RAM",
"gpu": "GPU",
"highCPU": "high CPU",
"highCPU": "high CPU from 3.50GHz",
"withAdministration": "with administration",
"country": {
"VN": "Vietnam",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"cpu": "ЦП",
"ram": "ОЗУ",
"gpu": "ГП",
"highCPU": "ЦП с повышенной частотой",
"highCPU": "ЦП с повышенной частотой от 3.50GHz",
"withAdministration": "с администрированием",
"country": {
"BY": "Беларусь",
Expand Down
10 changes: 9 additions & 1 deletion src/routes/cloud/createPaas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const { filteredPlans, product, productSize, isPlansLoading } = useCloudPlans(ta
watch(isPlansLoading, () => {
if (dataLocalStorage.value.billing_plan) {
cloudStore.planId = dataLocalStorage.value.billing_plan.uuid
// cloudStore.planId = dataLocalStorage.value.billing_plan.uuid
} else if (dataLocalStorage.value.locationId) {
tarification.value = periods.value[0]?.value ?? ''
}
Expand Down Expand Up @@ -216,6 +216,14 @@ watch(periods, (periods) => {
})
function setLocation (value) {
if (route.query.data) {
const query = { ...route.query }
delete query.data
dataLocalStorage.value = ''
router.push({ query })
}
if (!(localStorage.getItem('data') && authStore.isLogged)) {
cloudStore.locationId = value
return
Expand Down
28 changes: 17 additions & 11 deletions src/stores/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,23 @@ export const useAppStore = defineStore('app', () => {
})
})

const buttons = computed(() =>
(isButtonsVisible.value)
? [
{ icon: DatabaseFilled, title: 'cloud' },
{ icon: AppstoreOutlined, title: 'services' },
{ icon: MessageOutlined, title: 'support' },
{ icon: FundOutlined, title: 'billing' },
{ icon: SettingFilled, title: 'settings' }
]
: []
)
const buttons = computed(() => {
if (isButtonsVisible.value) {
const result = [
{ icon: AppstoreOutlined, title: 'services' },
{ icon: MessageOutlined, title: 'support' },
{ icon: FundOutlined, title: 'billing' },
{ icon: SettingFilled, title: 'settings' }
]

if (config.cloudEnabled) {
result.unshift({ icon: DatabaseFilled, title: 'cloud' })
}
return result
}

return []
})

function toDate (timestamp, sep = '.', withTime = true, reverse) {
if (timestamp < 1) return '-'
Expand Down
11 changes: 7 additions & 4 deletions src/stores/invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export const useInvoicesStore = defineStore('invoices', () => {
if (filter.value[0] === 'all' || filter.value.length === 0) {
filtered = invoices.value
} else {
filtered = invoices.value.filter(ticket => filter.value.includes(ticket.status))
filtered = invoices.value.filter(({ status }) => filter.value.includes(status))
}

return filtered.sort((a, b) => {
return filtered.toSorted((a, b) => {
const dictionary = {
Cancelled: 1,
Paid: 1,
Expand Down Expand Up @@ -73,8 +73,11 @@ export const useInvoicesStore = defineStore('invoices', () => {
})

result.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
if (!response[0]?.ERROR) invoices.value = result
else return response[0].ERROR
if (!response[0]?.ERROR) {
invoices.value = result.filter(({ id }) => id)
} else {
return response[0].ERROR
}

return result
} catch (error) {
Expand Down

0 comments on commit b40d995

Please sign in to comment.