Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor menu generation strategy to support sub-menu items. #5177

Merged
merged 13 commits into from
Jan 19, 2024

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Jan 11, 2024

What type of PR is this?

/area console
/kind feature
/milestone 2.12.x

What this PR does / why we need it:

重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。

图片

配置方式:

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 即可。

最终文档会补充在:halo-dev/docs#291

Which issue(s) this PR fixes:

Fixes #4807

Special notes for your reviewer:

  1. 可以按照上述配置方式测试。
  2. 可以安装 plugin-s3-1.5.0-SNAPSHOT.jar.zip 进行测试。

Does this PR introduce a user-facing change?

重构 Console 和 UC 的菜单生成逻辑,支持配置二级菜单项。

Signed-off-by: Ryan Wang <i@ryanc.cc>
@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/console Issues or PRs related to the Halo Console labels Jan 11, 2024
@f2c-ci-robot f2c-ci-robot bot requested a review from guqing January 11, 2024 07:32
@f2c-ci-robot f2c-ci-robot bot added this to the 2.12.x milestone Jan 11, 2024
@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 11, 2024
@f2c-ci-robot f2c-ci-robot bot requested a review from wzrove January 11, 2024 07:32
Copy link

codecov bot commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (86e688a) 55.98% compared to head (ba14a16) 55.98%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5177   +/-   ##
=========================================
  Coverage     55.98%   55.98%           
  Complexity     3027     3027           
=========================================
  Files           538      538           
  Lines         17973    17973           
  Branches       1319     1319           
=========================================
  Hits          10062    10062           
  Misses         7367     7367           
  Partials        544      544           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
Signed-off-by: Ryan Wang <i@ryanc.cc>
@ruibaby ruibaby removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 17, 2024
@ruibaby ruibaby changed the title WIP: Refactor menu generation strategy to support sub-menu items. Refactor menu generation strategy to support sub-menu items. Jan 17, 2024
Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2024
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

It works very well.

image

Copy link

f2c-ci-robot bot commented Jan 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 3ebb45c into halo-dev:main Jan 19, 2024
7 checks passed
LIlGG pushed a commit to LIlGG/halo that referenced this pull request Jan 19, 2024
…v#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 即可。

最终文档会补充在:halo-dev/docs#291

#### Which issue(s) this PR fixes:

Fixes halo-dev#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 的菜单生成逻辑,支持配置二级菜单项。
```
@ruibaby ruibaby modified the milestones: 2.12.x, 2.12.0 Jan 19, 2024
@ruibaby ruibaby deleted the refactor/menu branch January 25, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

期望 Console 侧边菜单支持二级菜单
3 participants