mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 16:15:25 +00:00
use throttle to avoid re-save
This commit is contained in:
parent
0dec2fb912
commit
583b8fca50
@ -396,7 +396,7 @@ export const dashboardStore = defineStore({
|
||||
}
|
||||
if (!json.status) {
|
||||
ElMessage.error(json.message);
|
||||
return;
|
||||
return json;
|
||||
}
|
||||
if (!this.currentDashboard.id) {
|
||||
ElMessage.success("Saved successfully");
|
||||
@ -418,6 +418,7 @@ export const dashboardStore = defineStore({
|
||||
|
||||
sessionStorage.setItem(key, JSON.stringify(l));
|
||||
sessionStorage.setItem("dashboards", JSON.stringify(this.dashboards));
|
||||
return json;
|
||||
},
|
||||
async deleteDashboard() {
|
||||
const res: AxiosResponse = await graphql
|
||||
|
@ -373,7 +373,7 @@ async function handleDelete(row: DashboardItem) {
|
||||
sessionStorage.setItem("dashboards", JSON.stringify(dashboards.value));
|
||||
sessionStorage.removeItem(`${row.layer}_${row.entity}_${row.name}`);
|
||||
}
|
||||
function searchDashboards(pageIndex?: number) {
|
||||
function searchDashboards(pageIndex?: any) {
|
||||
const list = JSON.parse(sessionStorage.getItem("dashboards") || "[]");
|
||||
const arr = list.filter((d: { name: string }) =>
|
||||
d.name.includes(searchText.value)
|
||||
|
@ -118,6 +118,7 @@ import { useSelectorStore } from "@/store/modules/selectors";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { Option } from "@/types/app";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useThrottleFn } from "@vueuse/core";
|
||||
|
||||
const { t } = useI18n();
|
||||
const dashboardStore = useDashboardStore();
|
||||
@ -145,6 +146,7 @@ const states = reactive<{
|
||||
currentDestService: "",
|
||||
currentDestPod: "",
|
||||
});
|
||||
const applyDashboard = useThrottleFn(dashboardStore.saveDashboard, 3000);
|
||||
if (params.layerId) {
|
||||
dashboardStore.setLayer(params.layerId);
|
||||
dashboardStore.setEntity(params.entity);
|
||||
@ -346,7 +348,7 @@ function setTabControls(id: string) {
|
||||
dashboardStore.addTabControls("Topology");
|
||||
break;
|
||||
case "apply":
|
||||
dashboardStore.saveDashboard();
|
||||
applyDashboard();
|
||||
break;
|
||||
default:
|
||||
ElMessage.info("Don't support this control");
|
||||
@ -375,7 +377,7 @@ function setControls(id: string) {
|
||||
dashboardStore.addControl("Topology");
|
||||
break;
|
||||
case "apply":
|
||||
dashboardStore.saveDashboard();
|
||||
applyDashboard();
|
||||
break;
|
||||
default:
|
||||
dashboardStore.addControl("Widget");
|
||||
|
Loading…
Reference in New Issue
Block a user