From ecd046c663938c8713bec71b9567668858b4c866 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Tue, 22 Mar 2022 16:31:47 +0800 Subject: [PATCH] reload dashboards --- src/locales/lang/en.ts | 1 + src/locales/lang/zh.ts | 1 + src/store/modules/dashboard.ts | 11 +++++++ src/views/dashboard/List.vue | 33 ++++++++++++++++----- src/views/dashboard/graphs/InstanceList.vue | 4 +++ src/views/dashboard/graphs/ServiceList.vue | 4 +++ 6 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index c5f578a4..26dc9d19 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -122,6 +122,7 @@ const msg = { editWarning: "You are entering edit mode", viewWarning: "You are entering view mode", virtualDatabase: "Virtual Database", + reloadDashboards: "Reload dashboards", hourTip: "Select Hour", minuteTip: "Select Minute", secondTip: "Select Second", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 3a37d58b..f8702996 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -122,6 +122,7 @@ const msg = { editWarning: "你正在进入编辑模式", viewWarning: "你正在进入预览模式", virtualDatabase: "虚拟数据库", + reloadDashboards: "重新加载仪表盘", hourTip: "选择小时", minuteTip: "选择分钟", secondTip: "选择秒数", diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 6e7d33a0..c3a688b1 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -326,6 +326,17 @@ export const dashboardStore = defineStore({ sessionStorage.getItem("dashboards") || "[]" ); }, + async resetTemplates() { + const res = await this.fetchTemplates(); + if (res.errors) { + this.dashboards = []; + ElMessage.error(res.errors); + return; + } + this.dashboards = JSON.parse( + sessionStorage.getItem("dashboards") || "[]" + ); + }, async updateDashboard(setting: { id: string; configuration: string }) { const res: AxiosResponse = await graphql.query("updateTemplate").params({ setting, diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue index 9211c0cd..9a4c8908 100644 --- a/src/views/dashboard/List.vue +++ b/src/views/dashboard/List.vue @@ -18,7 +18,7 @@ limitations under the License. --> @@ -28,6 +28,10 @@ limitations under the License. --> + + + {{ t("reloadDashboards") }} + + {{ t("newDashboard") }} @@ -37,7 +41,7 @@ limitations under the License. -->
- + - +