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-banyandb.git
The following commit(s) were added to refs/heads/main by this push:
new 7a496100 Fix groups tree for property data (#575)
7a496100 is described below
commit 7a4961003f06e48e9195f47b8b7bfd087e12761d
Author: Fine0830 <[email protected]>
AuthorDate: Tue Dec 17 15:51:21 2024 +0800
Fix groups tree for property data (#575)
---
ui/src/components/Editor/tagEditor.vue | 12 ++++----
ui/src/components/GroupTree/index.vue | 54 ++++++++++++++++++----------------
2 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/ui/src/components/Editor/tagEditor.vue
b/ui/src/components/Editor/tagEditor.vue
index f575f753..07ef2351 100644
--- a/ui/src/components/Editor/tagEditor.vue
+++ b/ui/src/components/Editor/tagEditor.vue
@@ -218,9 +218,9 @@
</script>
<template>
- <el-button size="small" type="primary" color="#6E38F7" style="margin-top:
20px" @click="openAddTagFamily"
- >Add Tag</el-button
- >
+ <el-button size="small" type="primary" color="#6E38F7" style="margin-top:
20px" @click="openAddTagFamily">
+ Add Tag
+ </el-button>
<el-table :data="data.tableData" :span-method="objectSpanMethod"
style="width: 100%; margin-top: 20px" border>
<el-table-column label="Tag Family" prop="tagFamily"></el-table-column>
<el-table-column label="Tag" prop="tag"></el-table-column>
@@ -234,8 +234,9 @@
type="primary"
@click.prevent="openEditTagFamily(scope.$index)"
style="color: var(--color-main); font-weight: bold"
- >Edit</el-button
>
+ Edit
+ </el-button>
<el-popconfirm @confirm="deleteTableData(scope.$index)" title="Are you
sure to delete this?">
<template #reference>
<el-button link type="danger" style="color: red; font-weight:
bold">Delete</el-button>
@@ -289,8 +290,9 @@
data.dialogVisible = false;
initForm();
"
- >Cancel</el-button
>
+ Cancel
+ </el-button>
<el-button size="small" type="primary" color="#6E38F7"
@click="confirmForm(ruleFormRef)"> Confirm </el-button>
</div>
</span>
diff --git a/ui/src/components/GroupTree/index.vue
b/ui/src/components/GroupTree/index.vue
index b2c3c699..173ced30 100644
--- a/ui/src/components/GroupTree/index.vue
+++ b/ui/src/components/GroupTree/index.vue
@@ -176,26 +176,28 @@
filterText.value = '';
loading.value = true;
getGroupList().then((res) => {
- if (res.status == 200) {
- let group = res.data.group;
- data.groupLists = group;
- for (let i = 0; i < data.groupLists.length; i++) {
- let type = catalogToGroupType[data.groupLists[i].catalog];
- if (type !== props.type) {
- data.groupLists.splice(i, 1);
- i--;
- }
- }
- if (props.type == 'property') {
+ if (res.status === 200) {
+ data.groupLists = res.data.group.filter((d) =>
catalogToGroupType[d.catalog] === props.type);
+ if (props.type === 'property') {
+ data.groupLists = data.groupLists.map((item) => ({
+ ...item.metadata,
+ type: TargetTypes.Resources,
+ key: `property-${item.metadata.name}`,
+ catalog: item.catalog,
+ resourceOpts: item.resourceOpts,
+ }));
+ loading.value = false;
+ const { group, type } = route.params;
+ data.activeNode = `${type}-${group}`;
return;
}
let promise = data.groupLists.map((item) => {
- let type = props.type;
- let name = item.metadata.name;
+ const type = props.type;
+ const name = item.metadata.name;
return new Promise((resolve, reject) => {
getStreamOrMeasureList(type, name)
.then((res) => {
- if (res.status == 200) {
+ if (res.status === 200) {
item.children = res.data[type];
resolve();
}
@@ -205,13 +207,13 @@
});
});
});
- if (props.type == 'stream' || props.type == 'measure') {
- let promiseIndexRule = data.groupLists.map((item) => {
- let name = item.metadata.name;
+ if (props.type === 'stream' || props.type === 'measure') {
+ const promiseIndexRule = data.groupLists.map((item) => {
+ const name = item.metadata.name;
return new Promise((resolve, reject) => {
getindexRuleList(name)
.then((res) => {
- if (res.status == 200) {
+ if (res.status === 200) {
item.indexRule = res.data.indexRule;
resolve();
}
@@ -221,12 +223,12 @@
});
});
});
- let promiseIndexRuleBinding = data.groupLists.map((item) => {
- let name = item.metadata.name;
+ const promiseIndexRuleBinding = data.groupLists.map((item) => {
+ const name = item.metadata.name;
return new Promise((resolve, reject) => {
getindexRuleBindingList(name)
.then((res) => {
- if (res.status == 200) {
+ if (res.status === 200) {
item.indexRuleBinding = res.data.indexRuleBinding;
resolve();
}
@@ -240,12 +242,12 @@
promise = promise.concat(promiseIndexRuleBinding);
}
if (props.type == 'measure') {
- let TopNAggregationRule = data.groupLists.map((item) => {
- let name = item.metadata.name;
+ const TopNAggregationRule = data.groupLists.map((item) => {
+ const name = item.metadata.name;
return new Promise((resolve, reject) => {
getTopNAggregationList(name)
.then((res) => {
- if (res.status == 200) {
+ if (res.status === 200) {
item.topNAggregation = res.data.topNAggregation;
resolve();
}
@@ -264,7 +266,7 @@
})
.catch((err) => {
ElMessage({
- message: 'An error occurred while obtaining group data. Please
refresh and try again. Error: ' + err,
+ message: `An error occurred while obtaining group data. Please
refresh and try again. Error: ${err}`,
type: 'error',
duration: 3000,
});
@@ -630,7 +632,7 @@
});
}
function editGroupFunction() {
- let name = data.groupLists[data.clickIndex].metadata.name;
+ const name = data.groupLists[data.clickIndex].metadata.name;
ruleForm.value.validate((valid) => {
if (valid) {
const dataList = {