sort dashboard list

This commit is contained in:
Qiuxia Fan 2022-03-17 13:51:08 +08:00
parent 3306e3b382
commit 458bc57100
3 changed files with 11 additions and 5 deletions

View File

@ -96,8 +96,8 @@ const msg = {
taskList: "Task List", taskList: "Task List",
sampledTraces: "Sampled Traces", sampledTraces: "Sampled Traces",
editTab: "Enable editing tab names", editTab: "Enable editing tab names",
label: "Name", label: "Service Name",
id: "ID", id: "Service ID",
setRoot: "Set this to root", setRoot: "Set this to root",
setNormal: "Set this to normal", setNormal: "Set this to normal",
export: "Export Dashboard Templates", export: "Export Dashboard Templates",

View File

@ -96,8 +96,8 @@ const msg = {
taskList: "任务列表", taskList: "任务列表",
sampledTraces: "采样的追踪", sampledTraces: "采样的追踪",
editTab: "开启编辑Tab的名称", editTab: "开启编辑Tab的名称",
label: "名称", label: "服务名称",
id: "编号", id: "服务编号",
setRoot: "设置成为根", setRoot: "设置成为根",
setNormal: "设置成为普通", setNormal: "设置成为普通",
export: "导出仪表板模板", export: "导出仪表板模板",

View File

@ -40,6 +40,7 @@ limitations under the License. -->
:style="{ width: '100%', fontSize: '13px' }" :style="{ width: '100%', fontSize: '13px' }"
v-loading="loading" v-loading="loading"
ref="multipleTableRef" ref="multipleTableRef"
:default-sort="{ prop: 'name' }"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="35" /> <el-table-column type="selection" width="35" />
@ -173,7 +174,12 @@ async function importTemplates(event: any) {
el!.value = ""; el!.value = "";
} }
function exportTemplates() { function exportTemplates() {
const templates = multipleSelection.value.map((d: DashboardItem) => { const arr = multipleSelection.value.sort(
(a: DashboardItem, b: DashboardItem) => {
return a.name.localeCompare(b.name);
}
);
const templates = arr.map((d: DashboardItem) => {
const key = [d.layer, d.entity, d.name.split(" ").join("-")].join("_"); const key = [d.layer, d.entity, d.name.split(" ").join("-")].join("_");
const layout = JSON.parse(sessionStorage.getItem(key) || "{}"); const layout = JSON.parse(sessionStorage.getItem(key) || "{}");
return layout; return layout;