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",
sampledTraces: "Sampled Traces",
editTab: "Enable editing tab names",
label: "Name",
id: "ID",
label: "Service Name",
id: "Service ID",
setRoot: "Set this to root",
setNormal: "Set this to normal",
export: "Export Dashboard Templates",

View File

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

View File

@ -40,6 +40,7 @@ limitations under the License. -->
:style="{ width: '100%', fontSize: '13px' }"
v-loading="loading"
ref="multipleTableRef"
:default-sort="{ prop: 'name' }"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="35" />
@ -173,7 +174,12 @@ async function importTemplates(event: any) {
el!.value = "";
}
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 layout = JSON.parse(sessionStorage.getItem(key) || "{}");
return layout;