Skip to content

Commit

Permalink
Merge pull request #1249 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SazukinPavel authored Nov 17, 2023
2 parents 56a659d + 5085e05 commit 1433107
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 25 deletions.
14 changes: 4 additions & 10 deletions admin-ui/src/components/account/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,9 @@ export default {
this.currency = this.account.currency;
this.uuid = this.account.uuid;
this.keys = this.account.data?.ssh_keys || [];
if (this.namespaces.length < 2) {
this.$store.dispatch("namespaces/fetch");
}
if (this.services.length < 2) {
this.$store.dispatch("services/fetch");
}
if (this.servicesProviders.length < 2) {
this.$store.dispatch("servicesProviders/fetch");
}
this.$store.dispatch("namespaces/fetch");
this.$store.dispatch("services/fetch", { showDeleted: true });
this.$store.dispatch("servicesProviders/fetch");
},
computed: {
namespaces() {
Expand Down Expand Up @@ -355,7 +349,7 @@ export default {
}
},
whmcsApi() {
return this.$store.getters['settings/whmcsApi']
return this.$store.getters["settings/whmcsApi"];
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions admin-ui/src/components/search/filterTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-chip
v-for="tag in tags.slice(0, 2)"
:key="tag.title"
class="ml-1"
class="ml-1 pa-1"
small
outlined
color="primary"
Expand All @@ -12,7 +12,7 @@
<v-icon small>mdi-close</v-icon>
</v-btn>
</v-chip>
<v-chip v-if="tags.length > 2" class="ml-1" small outlined color="primary"
<v-chip v-if="tags.length > 2" class="ml-1 pa-1" small outlined color="primary"
>and more {{ tags.length - 2 }}</v-chip
>
</div>
Expand Down
18 changes: 16 additions & 2 deletions admin-ui/src/components/search/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,16 @@ const saveSearchData = (name) => {
const data = { current: currentLayout.value?.id, layouts: layouts.value };
const key = getSearchKey(name);
localStorage.setItem(key, JSON.stringify(data));
const localKey = `${key}-local`;
if (
!currentLayout.value?.id &&
JSON.stringify(filter.value) !== JSON.stringify("{}")
) {
localStorage.setItem(localKey, JSON.stringify(filter.value));
} else {
localStorage.removeItem(localKey);
}
};
const loadSearchData = (name) => {
Expand All @@ -386,6 +396,9 @@ const loadSearchData = (name) => {
if (data?.current) {
currentLayout.value = layouts.value.find((l) => l.id === data.current);
filter.value = currentLayout.value.filter;
} else {
const localKey = `${key}-local`;
filter.value = JSON.parse(localStorage.getItem(localKey) || `{}`);
}
};
Expand Down Expand Up @@ -514,13 +527,14 @@ watch(searchName, (value, oldValue) => {
if (oldValue) {
saveSearchData(oldValue);
}
currentLayout.value = undefined;
param.value = "";
filter.value = {};
currentLayout.value = undefined;
blankLayout.value = getBlankLayout();
layouts.value = [];
if (value) {
loadSearchData(value);
setTimeout(() => loadSearchData(value), 0);
}
if (layouts.value.length === 0) {
addNewLayout({ title: "Default" });
Expand Down
11 changes: 5 additions & 6 deletions admin-ui/src/store/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,16 @@ export default {
},
},
actions: {
fetch({ commit },params) {
fetch({ commit }, params) {
commit("setLoading", true);
commit("setInstances", []);
commit("setServices", []);
return new Promise((resolve, reject) => {
api.services
.list(params)
.then((response) => {
const servicesWithoutDel = response.pool.filter(
(s) => s.status !== "DEL"
);
commit("setServices", servicesWithoutDel);
commit("setInstances", servicesWithoutDel);
commit("setServices", response.pool);
commit("setInstances", response.pool);
resolve(response);
})
.catch((error) => {
Expand Down
9 changes: 6 additions & 3 deletions admin-ui/src/views/InstancePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {
data: () => ({
tabsIndex: 0,
navTitles: config.navTitles ?? {},
instanceTitle: "",
}),
mixins: [snackbar],
methods: {
Expand Down Expand Up @@ -91,9 +92,6 @@ export default {
({ uuid }) => uuid === id
);
},
instanceTitle() {
return this.instance?.title ?? "not found";
},
instanceLoading() {
return this.$store.getters["services/isLoading"];
},
Expand Down Expand Up @@ -125,6 +123,11 @@ export default {
},
created() {
this.$store.dispatch("services/fetch", { showDeleted: true }).then(() => {
if (!this.instance) {
this.instanceTitle = "Not found";
} else {
this.instanceTitle = this.instance.title;
}
document.title = `${this.instanceTitle} | NoCloud`;
});
},
Expand Down
3 changes: 3 additions & 0 deletions admin-ui/src/views/Plans.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ export default {
this.$store
.dispatch("plans/fetch", {
withCount: true,
params: {
anonymously: false,
},
})
.then(() => {
this.fetchError = "";
Expand Down
9 changes: 7 additions & 2 deletions admin-ui/src/views/Showcases.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ const showcases = computed(() =>
);
const isLoading = computed(() => store.getters["showcases/isLoading"]);
onMounted(async () => {
onMounted(() => {
fetchShowcases();
store.commit("reloadBtn/setCallback", { event: fetchShowcases});
});
const fetchShowcases = async () => {
try {
await store.dispatch("showcases/fetch", false);
} catch (e) {
store.commit("snackbar/showSnackbarError", {
message: e.response?.data?.message || "Error during fetch info",
});
}
});
};
const deleteSelected = async () => {
try {
Expand Down

0 comments on commit 1433107

Please sign in to comment.