Skip to content

Commit

Permalink
Merge pull request #1237 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SazukinPavel authored Nov 15, 2023
2 parents 96835d4 + 6b7af63 commit aedac4d
Show file tree
Hide file tree
Showing 19 changed files with 308 additions and 108 deletions.
39 changes: 20 additions & 19 deletions admin-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,28 +257,30 @@
</v-list>
</v-navigation-drawer>

<v-app-bar v-if="isLoggedIn" app color="background" elevation="0">
<v-app-bar app color="background" elevation="0">
<v-row style="width: 100%" justify="center" align="center">
<v-col>
<app-search />
</v-col>
<v-col class="d-flex justify-start">
<v-btn
v-if="btnStates.visible"
:disabled="btnStates.disabled"
color="background-light"
fab
small
:loading="btnLoading"
@click="() => this.$store.dispatch('reloadBtn/onclick')"
>
<v-icon>mdi-reload</v-icon>
</v-btn>
</v-col>
<template v-if="isLoggedIn">
<v-col>
<app-search />
</v-col>
<v-col class="d-flex justify-start">
<v-btn
v-if="btnStates.visible"
:disabled="btnStates.disabled"
color="background-light"
fab
small
:loading="btnLoading"
@click="() => this.$store.dispatch('reloadBtn/onclick')"
>
<v-icon>mdi-reload</v-icon>
</v-btn>
</v-col>
</template>
<v-col class="d-flex justify-end align-center">
<languages v-if="false" />
<themes/>
<v-menu offset-y transition="slide-y-transition">
<v-menu v-if="isLoggedIn" offset-y transition="slide-y-transition">
<template v-slot:activator="{ on, attrs }">
<v-btn
class="mx-2"
Expand Down Expand Up @@ -492,7 +494,6 @@ export default {
source.postMessage({ theme: this.theme }, "*");
return;
}
console.log(data, origin);
});
this.$store.dispatch("auth/load");
Expand Down
5 changes: 5 additions & 0 deletions admin-ui/src/components/accounts_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ export default {
},
searchFields() {
return [
{
title: "Title",
key: "title",
type: "input",
},
{
title: "Status",
key: "status",
Expand Down
5 changes: 4 additions & 1 deletion admin-ui/src/components/historyTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
</router-link>
</template>
<template v-slot:[`item.uuid`]="{ item }">
<router-link :to="getEntityByUuid(item).route">
<router-link
v-if="getEntityByUuid(item).route"
:to="getEntityByUuid(item).route"
>
{{
`${
getEntityByUuid(item).item?.title || getEntityByUuid(item).item
Expand Down
14 changes: 12 additions & 2 deletions admin-ui/src/components/instances_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,12 @@ export default {
billingPlan,
config: { planCode, duration },
} = item;
const key = `${duration} ${planCode}`;
let key;
if(item.type==='ovh'){
key = `${duration} ${planCode}`;
}else{
key=item.product
}
return billingPlan.products[key]?.title;
},
Expand Down Expand Up @@ -511,7 +516,7 @@ export default {
access: (item) => this.getAccount(item)?.title,
email: this.getEmail,
state: getState,
product: (item) => item.product ?? this.getTariff(item) ?? "custom",
product: (item) => this.getTariff(item) ?? item.product ?? "custom",
price: this.getNcuPrice,
accountPrice: this.getAccountPrice,
period: this.getPeriod,
Expand All @@ -536,6 +541,11 @@ export default {
},
searchFields() {
return [
{
key: "title",
title: "Title",
type: "input",
},
{
key: "service",
items: this.getSearchKeyItems("service"),
Expand Down
5 changes: 5 additions & 0 deletions admin-ui/src/components/namespaces_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export default {
},
searchFields() {
return [
{
title: "Title",
key: "title",
type: "input",
},
{
title: "Access",
key: "access.level",
Expand Down
130 changes: 95 additions & 35 deletions admin-ui/src/components/plans_products_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,32 @@
<v-divider inset vertical class="mx-4" />
<v-spacer />

<v-dialog width="90vw" v-model="isEditOpen">
<template v-slot:activator="{ on, attrs }">
<v-btn
:disabled="selected.length < 1"
v-bind="attrs"
v-on="on"
class="mr-2"
color="background-light"
>
Edit
</v-btn>
</template>

<v-card class="pa-4">
<v-subheader class="px-0"> Description: </v-subheader>
<rich-editor v-model="newMeta.description" />

<v-row class="mt-5" justify="end">
<v-btn class="mx-2" @click="isEditOpen = false"
>Close</v-btn
>
<v-btn @click="saveNewMeta" class="mx-2">Save</v-btn>
</v-row>
</v-card>
</v-dialog>

<v-btn
:disabled="selected.length < 1"
class="mr-2"
Expand Down Expand Up @@ -140,21 +166,21 @@
/>
</v-radio-group>
</template>

<template v-slot:[`item.meta.addons`]="{ item }">
<v-dialog width="90vw">
<template v-slot:activator="{ on, attrs }">
<v-btn icon v-bind="attrs" v-on="on">
<v-icon> mdi-menu-open </v-icon>
</v-btn>
</template>

<plans-empty-addons-table
:product="item"
@update:addons="(value) => $set(item.meta, 'addons', value)"
/>
</v-dialog>
</template>
<template v-slot:[`item.meta.addons`]="{ item }">
<v-dialog width="90vw">
<template v-slot:activator="{ on, attrs }">
<v-btn icon v-bind="attrs" v-on="on">
<v-icon> mdi-menu-open </v-icon>
</v-btn>
</template>

<plans-empty-addons-table
:product="item"
@update:addons="(value) => $set(item.meta, 'addons', value)"
/>
</v-dialog>
</template>

<template v-slot:expanded-item="{ headers, item }">
<td />
Expand All @@ -166,29 +192,31 @@
v-if="type === 'empty'"
v-model="item.meta.image"
/>
<v-subheader class="px-0">
{{
type === "empty" ? "Description" : "Amount of resources"
}}:
</v-subheader>

<v-subheader class="px-0"> Description: </v-subheader>
<rich-editor
class="html-editor"
v-model="item.meta.description"
/>

<template v-if="type === 'empty'">
<rich-editor class="html-editor" v-model="item.meta.description" />
<plans-empty-table
:resources="item.meta.resources ?? []"
@update:resource="(value) =>
changeMeta(value, item.id, item.meta.resources)
@update:resource="
(value) => changeMeta(value, item.id, item.meta.resources)
"
/>
</template>

<json-editor
v-else
:json="item.resources"
@changeValue="
(value) => changeProduct('amount', value, item.id)
"
/>
<template v-else>
<v-subheader class="px-0"> Amount of resources </v-subheader>
<json-editor
:json="item.resources"
@changeValue="
(value) => changeProduct('amount', value, item.id)
"
/>
</template>

<v-subheader class="px-0 pt-4">Installation price:</v-subheader>
<v-text-field
Expand Down Expand Up @@ -265,9 +293,14 @@ const headers = ref([
{ text: "Sorter", value: "sorter" },
]);
if (props.type === "empty") headers.value.push({
text: "Addons", value: "meta.addons"
})
const isEditOpen = ref(false);
const newMeta = ref({ description: "" });
if (props.type === "empty")
headers.value.push({
text: "Addons",
value: "meta.addons",
});
onMounted(() => {
setProductsArray();
Expand All @@ -289,9 +322,10 @@ function changeResource(data) {
}
function changeMeta(data, id, resources) {
const value = (data.key === "resources")
? data.value
: JSON.parse(JSON.stringify(resources));
const value =
data.key === "resources"
? data.value
: JSON.parse(JSON.stringify(resources));
if (data.key !== "resources") {
const i = value.findIndex(({ id }) => id === data.id);
Expand Down Expand Up @@ -385,6 +419,32 @@ const copyProducts = () => {
selected.value = [];
};
const saveNewMeta = () => {
setProductsArray();
const newProducts = {};
for (const product of productsArray.value) {
const key = product.key;
delete product.key;
newProducts[key] = product;
}
for (const product of selected.value) {
const key = product.key;
delete product.key;
newProducts[key] = {
...product,
meta: { ...product.meta, ...newMeta.value },
};
}
changeProduct("products", newProducts);
setFullDates(newProducts);
selected.value = [];
isEditOpen.value = false;
newMeta.value = { description: "" };
};
function addConfig() {
const result = { ...products.value };
result[""] = {
Expand Down
Loading

0 comments on commit aedac4d

Please sign in to comment.