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