mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 00:08:56 +00:00
feat: update
This commit is contained in:
parent
9df30ee2b0
commit
55a78fdca9
@ -407,5 +407,6 @@ const msg = {
|
|||||||
detail: "Detail",
|
detail: "Detail",
|
||||||
marketplace: "Marketplace",
|
marketplace: "Marketplace",
|
||||||
menus: "Menus",
|
menus: "Menus",
|
||||||
|
saveReload: "Save and reload page",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -406,5 +406,6 @@ const msg = {
|
|||||||
detail: "Detail",
|
detail: "Detail",
|
||||||
marketplace: "Marketplace",
|
marketplace: "Marketplace",
|
||||||
menus: "Menus",
|
menus: "Menus",
|
||||||
|
saveReload: "Save and reload page",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -404,5 +404,6 @@ const msg = {
|
|||||||
detail: "详细",
|
detail: "详细",
|
||||||
marketplace: "市场",
|
marketplace: "市场",
|
||||||
menusManagement: "菜单",
|
menusManagement: "菜单",
|
||||||
|
saveReload: "保存并重新加载页面",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -172,18 +172,19 @@ export const appStore = defineStore({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
async getActivateMenus() {
|
async getActivateMenus() {
|
||||||
// localStorage.removeItem("customMenus");
|
|
||||||
const resp = (await this.queryMenuItems()) || {};
|
const resp = (await this.queryMenuItems()) || {};
|
||||||
const menus = (resp.getMenuItems || []).map((d: MenuOptions, index: number) => {
|
const menus = (resp.getMenuItems || []).map((d: MenuOptions, index: number) => {
|
||||||
const t = `${d.title.replace(/\s+/g, "-")}`;
|
const t = `${d.title.replace(/\s+/g, "-")}`;
|
||||||
d.name = `${t}-${index}`;
|
d.name = `${t}-${index}`;
|
||||||
d.path = `/${t}`;
|
d.path = `/${t}`;
|
||||||
|
d.id = d.name;
|
||||||
if (d.subItems && d.subItems.length) {
|
if (d.subItems && d.subItems.length) {
|
||||||
d.hasGroup = true;
|
d.hasGroup = true;
|
||||||
d.subItems = d.subItems.map((item: any, sub: number) => {
|
d.subItems = d.subItems.map((item: any, sub: number) => {
|
||||||
const id = `${item.title.replace(/\s+/g, "-")}`;
|
const id = `${item.title.replace(/\s+/g, "-")}`;
|
||||||
item.name = `${id}-${index}${sub}`;
|
item.name = `${id}-${index}${sub}`;
|
||||||
item.path = `/${t}/${id}`;
|
item.path = `/${t}/${id}`;
|
||||||
|
item.id = item.name;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -195,6 +196,7 @@ export const appStore = defineStore({
|
|||||||
layer: d.layer,
|
layer: d.layer,
|
||||||
activate: d.activate,
|
activate: d.activate,
|
||||||
icon: d.icon,
|
icon: d.icon,
|
||||||
|
id: d.id,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -226,16 +228,18 @@ export const appStore = defineStore({
|
|||||||
await this.getCurrentMenus();
|
await this.getCurrentMenus();
|
||||||
},
|
},
|
||||||
getCurrentMenus() {
|
getCurrentMenus() {
|
||||||
const current = this.activateMenus.filter((d: MenuOptions) => {
|
const current = [];
|
||||||
if (this.checkedKeys.includes(d.name)) {
|
for (const d of this.activateMenus) {
|
||||||
d.subItems = d.subItems.filter((item: any) => {
|
const subItems = [];
|
||||||
|
for (const item of d.subItems) {
|
||||||
if (this.checkedKeys.includes(item.name)) {
|
if (this.checkedKeys.includes(item.name)) {
|
||||||
return item;
|
subItems.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (subItems.length && d.activate) {
|
||||||
|
current.push({ ...d, subItems });
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return d;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
this.setCurrentMenus(current);
|
this.setCurrentMenus(current);
|
||||||
},
|
},
|
||||||
async queryOAPTimeInfo() {
|
async queryOAPTimeInfo() {
|
||||||
|
2
src/types/app.d.ts
vendored
2
src/types/app.d.ts
vendored
@ -55,6 +55,7 @@ export interface MenuOptions {
|
|||||||
name?: string;
|
name?: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
hasGroup?: boolean;
|
hasGroup?: boolean;
|
||||||
|
id?: string;
|
||||||
subItems: {
|
subItems: {
|
||||||
layer: string;
|
layer: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
@ -63,5 +64,6 @@ export interface MenuOptions {
|
|||||||
name?: string;
|
name?: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
notShow?: boolean;
|
notShow?: boolean;
|
||||||
|
id?: string;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ limitations under the License. -->
|
|||||||
/>
|
/>
|
||||||
<div class="footer flex-v">
|
<div class="footer flex-v">
|
||||||
<el-button class="btn" size="small" type="primary" @click="getCheckedNodes">
|
<el-button class="btn" size="small" type="primary" @click="getCheckedNodes">
|
||||||
{{ t("save") }}
|
{{ t("saveReload") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -46,11 +46,10 @@ limitations under the License. -->
|
|||||||
appStore.setPageTitle("Menus");
|
appStore.setPageTitle("Menus");
|
||||||
|
|
||||||
function getCheckedNodes() {
|
function getCheckedNodes() {
|
||||||
const checkedKeys = treeRef.value!.getCheckedKeys(false);
|
const checkedKeys = treeRef.value!.getCheckedKeys(false, false);
|
||||||
|
|
||||||
appStore.setCheckedKeys(checkedKeys);
|
window.localStorage.setItem("customMenus", JSON.stringify(checkedKeys));
|
||||||
appStore.getCurrentMenus();
|
window.location.reload();
|
||||||
window.localStorage.setItem("customMenus", JSON.stringify(checkedKeys.value));
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user