You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by qi...@apache.org on 2024/01/16 10:24:01 UTC
(skywalking-booster-ui) branch main updated: fix: import dashboard templates (#363)
This is an automated email from the ASF dual-hosted git repository.
qiuxiafan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git
The following commit(s) were added to refs/heads/main by this push:
new a46b91d1 fix: import dashboard templates (#363)
a46b91d1 is described below
commit a46b91d1cff91c9a4acccbfda1fe8ee179316c2e
Author: Fine0830 <fa...@gmail.com>
AuthorDate: Tue Jan 16 18:23:55 2024 +0800
fix: import dashboard templates (#363)
---
src/store/modules/dashboard.ts | 3 +--
src/views/dashboard/List.vue | 12 +++++++-----
.../dashboard/related/topology/config/Metrics.vue | 20 ++++++++++++++------
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts
index 6aa3da63..6aca1c06 100644
--- a/src/store/modules/dashboard.ts
+++ b/src/store/modules/dashboard.ts
@@ -429,8 +429,7 @@ export const dashboardStore = defineStore({
d.layer === this.currentDashboard?.layer,
);
if (index > -1) {
- const { t } = useI18n();
- ElMessage.error(t("nameError"));
+ ElMessage.error("The dashboard name cannot be duplicate");
return;
}
res = await graphql.query("addNewTemplate").params({ setting: { configuration: JSON.stringify(c) } });
diff --git a/src/views/dashboard/List.vue b/src/views/dashboard/List.vue
index 05a31b65..e57a92df 100644
--- a/src/views/dashboard/List.vue
+++ b/src/views/dashboard/List.vue
@@ -315,19 +315,19 @@ limitations under the License. -->
}
loading.value = true;
for (const item of arr) {
- const { layer, name, entity, isRoot, children, isDefault } = item.configuration;
+ const { layer, name, entity, isRoot, children, isDefault, expressions, expressionsConfig } = item.configuration;
const index = dashboardStore.dashboards.findIndex((d: DashboardItem) => d.id === item.id);
const p: DashboardItem = {
name: name.split(" ").join("-"),
layer: layer,
entity: entity,
- isRoot: false,
- isDefault: false,
+ isRoot: isRoot || false,
+ isDefault: isDefault || false,
+ expressions: expressions,
+ expressionsConfig: expressionsConfig,
};
if (index > -1) {
p.id = item.id;
- p.isRoot = isRoot;
- p.isDefault = isDefault;
}
dashboardStore.setCurrentDashboard(p);
dashboardStore.setLayout(children);
@@ -336,6 +336,7 @@ limitations under the License. -->
dashboards.value = dashboardStore.dashboards;
loading.value = false;
dashboardFile.value = null;
+ searchDashboards(currentPage.value);
}
function exportTemplates() {
if (!multipleSelection.value.length) {
@@ -597,6 +598,7 @@ limitations under the License. -->
loading.value = false;
sessionStorage.setItem("dashboards", JSON.stringify(dashboards.value));
sessionStorage.removeItem(`${row.layer}_${row.entity}_${row.name}`);
+ searchDashboards(currentPage.value);
}
function searchDashboards(pageIndex: number) {
const list = JSON.parse(sessionStorage.getItem("dashboards") || "[]");
diff --git a/src/views/dashboard/related/topology/config/Metrics.vue b/src/views/dashboard/related/topology/config/Metrics.vue
index 12b7263d..6a5d6f7f 100644
--- a/src/views/dashboard/related/topology/config/Metrics.vue
+++ b/src/views/dashboard/related/topology/config/Metrics.vue
@@ -110,11 +110,6 @@ limitations under the License. -->
return m.length ? m : [{ label: "", value: "" }];
});
const currentMetric = ref<string>(metricList.value[0].value);
- const currentConfig = ref<{ unit: string; calculation: string; label: string }>({
- unit: "",
- calculation: "",
- label: "",
- });
const currentIndex = ref<number>(0);
const getMetricConfig = computed(() => {
if (props.type === "hierarchyServicesConfig") {
@@ -125,7 +120,12 @@ limitations under the License. -->
},
ConfigFieldTypes.ISDEFAULT,
);
- return (dashboard && dashboard.expressionsConfig) || [];
+ if (!dashboard) {
+ return [];
+ }
+ const config = dashboard.expressionsConfig || [];
+
+ return config || [];
}
let config = [];
@@ -143,6 +143,14 @@ limitations under the License. -->
return config || [];
});
+ const currentConfig = ref<{ unit: string; calculation: string; label: string }>(
+ getMetricConfig.value[0] || {
+ unit: "",
+ calculation: "",
+ label: "",
+ },
+ );
+
function changeConfigs(param: { [key: string]: string }) {
const metricConfig = getMetricConfig.value || [];
metricConfig[currentIndex.value] = {