mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-19 16:37:36 +00:00
sort dashboards
This commit is contained in:
parent
107a3d85dd
commit
2e24925301
@ -227,7 +227,6 @@ export const dashboardStore = defineStore({
|
|||||||
this.showConfig = show;
|
this.showConfig = show;
|
||||||
},
|
},
|
||||||
selectWidget(item: Nullable<LayoutConfig>) {
|
selectWidget(item: Nullable<LayoutConfig>) {
|
||||||
console.log(item);
|
|
||||||
this.selectedGrid = item;
|
this.selectedGrid = item;
|
||||||
},
|
},
|
||||||
setLayer(id: string) {
|
setLayer(id: string) {
|
||||||
@ -294,7 +293,7 @@ export const dashboardStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
const data = res.data.data.getAllTemplates;
|
const data = res.data.data.getAllTemplates;
|
||||||
const list = [];
|
let list = [];
|
||||||
for (const t of data) {
|
for (const t of data) {
|
||||||
const c = JSON.parse(t.configuration);
|
const c = JSON.parse(t.configuration);
|
||||||
const key = [c.layer, c.entity, c.name].join("_");
|
const key = [c.layer, c.entity, c.name].join("_");
|
||||||
@ -311,6 +310,17 @@ export const dashboardStore = defineStore({
|
|||||||
JSON.stringify({ id: t.id, configuration: c })
|
JSON.stringify({ id: t.id, configuration: c })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
list = list.sort((a, b) => {
|
||||||
|
const nameA = a.name.toUpperCase();
|
||||||
|
const nameB = b.name.toUpperCase();
|
||||||
|
if (nameA < nameB) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (nameA > nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
sessionStorage.setItem("dashboards", JSON.stringify(list));
|
sessionStorage.setItem("dashboards", JSON.stringify(list));
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
|
@ -46,6 +46,7 @@ limitations under the License. -->
|
|||||||
ref="multipleTableRef"
|
ref="multipleTableRef"
|
||||||
:default-sort="{ prop: 'name' }"
|
:default-sort="{ prop: 'name' }"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
|
height="637px"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column prop="name" label="Name">
|
<el-table-column prop="name" label="Name">
|
||||||
@ -214,9 +215,9 @@ function exportTemplates() {
|
|||||||
});
|
});
|
||||||
const name = `dashboards.json`;
|
const name = `dashboards.json`;
|
||||||
saveFile(templates, name);
|
saveFile(templates, name);
|
||||||
// setTimeout(() => {
|
setTimeout(() => {
|
||||||
// multipleTableRef.value!.clearSelection();
|
multipleTableRef.value!.clearSelection();
|
||||||
// }, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
function handleEdit(row: DashboardItem) {
|
function handleEdit(row: DashboardItem) {
|
||||||
dashboardStore.setMode(true);
|
dashboardStore.setMode(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user