2023-11-09 06:56:06 +00:00
|
|
|
import BasicLayout from "@console/layouts/BasicLayout.vue";
|
|
|
|
import BlankLayout from "@console/layouts/BlankLayout.vue";
|
2022-06-17 06:12:15 +00:00
|
|
|
import { IconBookRead } from "@halo-dev/components";
|
2024-06-26 10:42:50 +00:00
|
|
|
import { definePlugin } from "@halo-dev/console-shared";
|
|
|
|
import { markRaw } from "vue";
|
2022-11-02 09:48:23 +00:00
|
|
|
import DeletedPostList from "./DeletedPostList.vue";
|
2022-06-17 06:12:15 +00:00
|
|
|
import PostEditor from "./PostEditor.vue";
|
2024-06-26 10:42:50 +00:00
|
|
|
import PostList from "./PostList.vue";
|
|
|
|
import PostSnapshots from "./PostSnapshots.vue";
|
2022-06-17 06:12:15 +00:00
|
|
|
import CategoryList from "./categories/CategoryList.vue";
|
|
|
|
import TagList from "./tags/TagList.vue";
|
2022-11-30 14:51:49 +00:00
|
|
|
import PostStatsWidget from "./widgets/PostStatsWidget.vue";
|
|
|
|
import RecentPublishedWidget from "./widgets/RecentPublishedWidget.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: {
|
|
|
|
PostStatsWidget,
|
|
|
|
RecentPublishedWidget,
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
routes: [
|
|
|
|
{
|
|
|
|
path: "/posts",
|
Refactor menu generation strategy to support sub-menu items. (#5177)
#### What type of PR is this?
/area console
/kind feature
/milestone 2.12.x
#### What this PR does / why we need it:
重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。
<img width="557" alt="图片" src="https://github.com/halo-dev/halo/assets/21301288/0f1717ce-bd30-448b-9625-24bfd5e1c5ae">
配置方式:
```ts
export default definePlugin({
components: {},
routes: [
{
parentName: "AttachmentsRoot",
route: {
name: "S3Link",
path: "s3-link",
component: markRaw(HomeView),
meta: {
title: "S3 关联",
searchable: true,
menu: {
name: "S3 关联",
icon: markRaw(IconAddCircle),
priority: 0,
mobile: true,
},
},
},
},
],
});
```
只需要指定 parentName 并在其下 route 需要配置 meta.menu 即可。
最终文档会补充在:https://github.com/halo-dev/docs/pull/291
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/4807
#### Special notes for your reviewer:
1. 可以按照上述配置方式测试。
2. 可以安装 [plugin-s3-1.5.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/halo/files/13959977/plugin-s3-1.5.0-SNAPSHOT.jar.zip) 进行测试。
#### Does this PR introduce a user-facing change?
```release-note
重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。
```
2024-01-19 05:34:10 +00:00
|
|
|
name: "PostsRoot",
|
2022-06-17 06:12:15 +00:00
|
|
|
component: BasicLayout,
|
Refactor menu generation strategy to support sub-menu items. (#5177)
#### What type of PR is this?
/area console
/kind feature
/milestone 2.12.x
#### What this PR does / why we need it:
重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。
<img width="557" alt="图片" src="https://github.com/halo-dev/halo/assets/21301288/0f1717ce-bd30-448b-9625-24bfd5e1c5ae">
配置方式:
```ts
export default definePlugin({
components: {},
routes: [
{
parentName: "AttachmentsRoot",
route: {
name: "S3Link",
path: "s3-link",
component: markRaw(HomeView),
meta: {
title: "S3 关联",
searchable: true,
menu: {
name: "S3 关联",
icon: markRaw(IconAddCircle),
priority: 0,
mobile: true,
},
},
},
},
],
});
```
只需要指定 parentName 并在其下 route 需要配置 meta.menu 即可。
最终文档会补充在:https://github.com/halo-dev/docs/pull/291
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/4807
#### Special notes for your reviewer:
1. 可以按照上述配置方式测试。
2. 可以安装 [plugin-s3-1.5.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/halo/files/13959977/plugin-s3-1.5.0-SNAPSHOT.jar.zip) 进行测试。
#### Does this PR introduce a user-facing change?
```release-note
重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。
```
2024-01-19 05:34:10 +00:00
|
|
|
meta: {
|
|
|
|
title: "core.post.title",
|
|
|
|
searchable: true,
|
|
|
|
permissions: ["system:posts:view"],
|
|
|
|
menu: {
|
|
|
|
name: "core.sidebar.menu.items.posts",
|
|
|
|
group: "content",
|
|
|
|
icon: markRaw(IconBookRead),
|
|
|
|
priority: 0,
|
|
|
|
mobile: true,
|
|
|
|
},
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
name: "Posts",
|
|
|
|
component: PostList,
|
|
|
|
},
|
2022-11-02 09:48:23 +00:00
|
|
|
{
|
|
|
|
path: "deleted",
|
|
|
|
name: "DeletedPosts",
|
|
|
|
component: DeletedPostList,
|
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.deleted_post.title",
|
2022-11-02 09:48:23 +00:00
|
|
|
searchable: true,
|
|
|
|
permissions: ["system:posts:view"],
|
|
|
|
},
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
{
|
|
|
|
path: "editor",
|
|
|
|
name: "PostEditor",
|
|
|
|
component: PostEditor,
|
2022-09-22 04:16:11 +00:00
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.post_editor.title",
|
2022-09-28 06:50:16 +00:00
|
|
|
searchable: true,
|
2024-01-08 15:06:41 +00:00
|
|
|
hideFooter: true,
|
2022-09-30 09:48:19 +00:00
|
|
|
permissions: ["system:posts:manage"],
|
2022-09-22 04:16:11 +00:00
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
},
|
2024-04-26 10:10:06 +00:00
|
|
|
{
|
|
|
|
path: "snapshots",
|
|
|
|
name: "PostSnapshots",
|
|
|
|
component: PostSnapshots,
|
|
|
|
meta: {
|
|
|
|
title: "core.post_snapshots.title",
|
|
|
|
searchable: false,
|
|
|
|
hideFooter: true,
|
|
|
|
permissions: ["system:posts:manage"],
|
|
|
|
},
|
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
{
|
|
|
|
path: "categories",
|
|
|
|
component: BlankLayout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
name: "Categories",
|
|
|
|
component: CategoryList,
|
2022-09-22 04:16:11 +00:00
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.post_category.title",
|
2022-09-28 06:50:16 +00:00
|
|
|
searchable: true,
|
2022-09-30 09:48:19 +00:00
|
|
|
permissions: ["system:posts:view"],
|
2022-09-22 04:16:11 +00:00
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "tags",
|
|
|
|
component: BlankLayout,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
name: "Tags",
|
|
|
|
component: TagList,
|
2022-09-22 04:16:11 +00:00
|
|
|
meta: {
|
2023-03-23 08:54:33 +00:00
|
|
|
title: "core.post_tag.title",
|
2022-09-28 06:50:16 +00:00
|
|
|
searchable: true,
|
2022-09-30 09:48:19 +00:00
|
|
|
permissions: ["system:posts:view"],
|
2022-09-22 04:16:11 +00:00
|
|
|
},
|
2022-06-17 06:12:15 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-06-17 07:00:14 +00:00
|
|
|
});
|