refactor: router and menu generation (halo-dev/console#651)
#### What type of PR is this?
/kind api-change
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
Ref https://github.com/halo-dev/halo/issues/2595
重构路由和侧边菜单生成的逻辑,**注意,此 PR 对插件的 Console 入口文件中的路由和菜单定义包含破坏性更新。**
1. 移除 `definePlugin` 方法的 `menus` 字段,改为在 route 的 meta 中定义。
2. 将 `RoutesMenu` 组件从 `@halo-dev/components` 包中移出。
3. 将 `BasicLayout` 组件从 `@halo-dev/console-shared` 包中移出。
定义路由的方式:
```ts
import { definePlugin } from "@halo-dev/console-shared";
import BasicLayout from "@/layouts/BasicLayout.vue";
import AttachmentList from "./AttachmentList.vue";
import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue";
import { IconFolder } from "@halo-dev/components";
import { markRaw } from "vue";
export default definePlugin({
name: "attachmentModule",
components: [AttachmentSelectorModal],
routes: [
{
path: "/attachments",
component: BasicLayout,
children: [
{
path: "",
name: "Attachments",
component: AttachmentList,
meta: {
title: "附件",
permissions: ["system:attachments:view"],
menu: {
name: "附件",
group: "内容",
icon: markRaw(IconFolder),
priority: 4,
mobile: true,
},
},
},
],
},
],
});
```
menu 字段类型:
```ts
interface RouteMeta {
title?: string;
searchable?: boolean;
permissions?: string[];
menu?: {
name: string;
group?: string;
icon?: Component;
priority: number;
mobile?: true;
};
}
```
插件适配需要做的改动:
1. 移除 `definePlugin` 中的 menus 字段。
2. 在需要添加到菜单的 route 中提供 `meta.menu` 对象,可参考上方的 menu 字段类型。
详细文档可查阅:https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation
todolist:
- [x] 完善预设的菜单分组定义。
- [x] 绑定权限,根据权限决定是否需要将路由添加到菜单。
- [x] 优化菜单排序的定义方式。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2595
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 需要 `pnpm build:packages`
2. 测试后台的菜单及路由是否有异常。
3. 新建角色测试路由和菜单对权限的绑定。
4. 按照 https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation 文档,创建插件,测试插件添加路由和菜单是否正常。
#### Does this PR introduce a user-facing change?
```release-note
重构路由和侧边菜单生成的逻辑。
```
2022-10-19 08:54:13 +00:00
|
|
|
import { definePlugin } from "@halo-dev/console-shared";
|
2023-11-09 06:56:06 +00:00
|
|
|
import BasicLayout from "@console/layouts/BasicLayout.vue";
|
2022-09-08 08:49:42 +00:00
|
|
|
import SinglePageList from "./SinglePageList.vue";
|
2022-11-02 09:48:23 +00:00
|
|
|
import DeletedSinglePageList from "./DeletedSinglePageList.vue";
|
2022-09-08 08:49:42 +00:00
|
|
|
import SinglePageEditor from "./SinglePageEditor.vue";
|
2022-11-30 14:51:49 +00:00
|
|
|
import SinglePageStatsWidget from "./widgets/SinglePageStatsWidget.vue";
|
2022-06-17 06:12:15 +00:00
|
|
|
import { IconPages } from "@halo-dev/components";
|
refactor: router and menu generation (halo-dev/console#651)
#### What type of PR is this?
/kind api-change
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
Ref https://github.com/halo-dev/halo/issues/2595
重构路由和侧边菜单生成的逻辑,**注意,此 PR 对插件的 Console 入口文件中的路由和菜单定义包含破坏性更新。**
1. 移除 `definePlugin` 方法的 `menus` 字段,改为在 route 的 meta 中定义。
2. 将 `RoutesMenu` 组件从 `@halo-dev/components` 包中移出。
3. 将 `BasicLayout` 组件从 `@halo-dev/console-shared` 包中移出。
定义路由的方式:
```ts
import { definePlugin } from "@halo-dev/console-shared";
import BasicLayout from "@/layouts/BasicLayout.vue";
import AttachmentList from "./AttachmentList.vue";
import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue";
import { IconFolder } from "@halo-dev/components";
import { markRaw } from "vue";
export default definePlugin({
name: "attachmentModule",
components: [AttachmentSelectorModal],
routes: [
{
path: "/attachments",
component: BasicLayout,
children: [
{
path: "",
name: "Attachments",
component: AttachmentList,
meta: {
title: "附件",
permissions: ["system:attachments:view"],
menu: {
name: "附件",
group: "内容",
icon: markRaw(IconFolder),
priority: 4,
mobile: true,
},
},
},
],
},
],
});
```
menu 字段类型:
```ts
interface RouteMeta {
title?: string;
searchable?: boolean;
permissions?: string[];
menu?: {
name: string;
group?: string;
icon?: Component;
priority: number;
mobile?: true;
};
}
```
插件适配需要做的改动:
1. 移除 `definePlugin` 中的 menus 字段。
2. 在需要添加到菜单的 route 中提供 `meta.menu` 对象,可参考上方的 menu 字段类型。
详细文档可查阅:https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation
todolist:
- [x] 完善预设的菜单分组定义。
- [x] 绑定权限,根据权限决定是否需要将路由添加到菜单。
- [x] 优化菜单排序的定义方式。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2595
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 需要 `pnpm build:packages`
2. 测试后台的菜单及路由是否有异常。
3. 新建角色测试路由和菜单对权限的绑定。
4. 按照 https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation 文档,创建插件,测试插件添加路由和菜单是否正常。
#### Does this PR introduce a user-facing change?
```release-note
重构路由和侧边菜单生成的逻辑。
```
2022-10-19 08:54:13 +00:00
|
|
|
import { markRaw } from "vue";
|
2022-06-17 06:12:15 +00:00
|
|
|
|
2022-06-17 07:00:14 +00:00
|
|
|
export default definePlugin({
|
2022-11-30 14:51:49 +00:00
|
|
|
components: {
|
|
|
|
SinglePageStatsWidget,
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
routes: [
|
|
|
|
{
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
path: "/single-pages",
|
|
|
|
component: BasicLayout,
|
2022-06-17 06:12:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
path: "",
|
|
|
|
name: "SinglePages",
|
|
|
|
component: SinglePageList,
|
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.page.title",
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
searchable: true,
|
|
|
|
permissions: ["system:singlepages:view"],
|
|
|
|
menu: {
|
2023-03-23 08:54:33 +00:00
|
|
|
name: "core.sidebar.menu.items.single_pages",
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
group: "content",
|
|
|
|
icon: markRaw(IconPages),
|
|
|
|
priority: 1,
|
2022-09-08 08:49:42 +00:00
|
|
|
},
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
},
|
2022-09-08 08:49:42 +00:00
|
|
|
},
|
|
|
|
{
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
path: "deleted",
|
|
|
|
name: "DeletedSinglePages",
|
|
|
|
component: DeletedSinglePageList,
|
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.deleted_page.title",
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
searchable: true,
|
|
|
|
permissions: ["system:singlepages:view"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "editor",
|
|
|
|
name: "SinglePageEditor",
|
|
|
|
component: SinglePageEditor,
|
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.page_editor.title",
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
searchable: true,
|
2024-01-08 15:06:41 +00:00
|
|
|
hideFooter: true,
|
refactor: refactor the page management and remove the function page (halo-dev/console#816)
#### What type of PR is this?
/kind api-change
/kind improvement
#### What this PR does / why we need it:
1. 重构页面管理,移除功能页面的功能,改为由插件自行配置菜单。
2. 改进自定义页面的 UI 权限绑定,不会再出现没有勾选相关角色,但仍然显示左侧**页面**菜单的问题。
原由请看:https://github.com/halo-dev/halo/issues/3124
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/3124
#### Screenshots:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480169-fd0490a6-bd1a-447c-bde4-155a16355734.png">
插件需要自己定义菜单配置,如:
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/211480228-146e6b53-9da4-4a60-b691-dd183f0a45c7.png">
```diff
export default definePlugin({
- name: "PluginLinks",
components: {},
routes: [
{
parentName: "Root",
route: {
- path: "/pages/functional/links",
+ path: "/links",
name: "Links",
component: LinkList,
meta: {
permissions: ["plugin:links:view"],
+ menu: {
+ name: "链接",
+ group: "content",
+ icon: markRaw(RiLinksLine),
+ },
},
},
},
],
- extensionPoints: {
- "page:functional:create": () => {
- return [
- {
- name: "链接",
- url: "/links",
- path: "/pages/functional/links",
- permissions: ["plugin:links:view"],
- },
- ];
- },
- },
});
```
#### Special notes for your reviewer:
测试方式:
1. 测试左侧菜单的页面入口是否正常。
2. 创建一个新的角色,不勾选页面的查看权限,登录后检查是否可以在左侧菜单看到页面选项。
3. 测试插件添加菜单是否正常,可测试插件:[plugin-links-1.0.0-SNAPSHOT-plain.jar.zip](https://github.com/halo-dev/console/files/10379709/plugin-links-1.0.0-SNAPSHOT-plain.jar.zip)
#### Does this PR introduce a user-facing change?
```release-note
重构页面管理,移除功能页面的功能。
```
2023-01-10 10:44:40 +00:00
|
|
|
permissions: ["system:singlepages:manage"],
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-06-17 07:00:14 +00:00
|
|
|
});
|