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