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

feat: make plugin tabs extensible #4041

Merged
merged 8 commits into from Jul 7, 2023

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Jun 6, 2023

What type of PR is this?

/area console
/kind feature
/milestone 2.7.x

What this PR does / why we need it:

插件自身的详情页面中的 Tabs 选项卡支持拓展,允许开发者自行为插件编写设置界面、一些不常用的操作页面等。

示例:

image

扩展方式:

参考文档:https://github.com/ruibaby/halo/blob/feat/plugin-tabs-extend/console/docs/extension-points/plugin-self-tabs.md

Which issue(s) this PR fixes:

Fixes #3987

Special notes for your reviewer:

需要测试:

  1. 测试任意插件的详情页面是否能够正常使用。
  2. 测试任意插件的设置表单能否正常使用。
  3. 可以尝试根据文档为某个插件添加自定义的选项卡,测试是否能够正常工作。

Does this PR introduce a user-facing change?

Console 端插件详情选项卡支持通过插件扩展。

Signed-off-by: Ryan Wang <i@ryanc.cc>
@f2c-ci-robot f2c-ci-robot bot added 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 release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jun 6, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from LIlGG and wzrove June 6, 2023 08:50
@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 6, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.7.x milestone Jun 6, 2023
@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Merging #4041 (08c2870) into main (bf2b92e) will increase coverage by 0.14%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main    #4041      +/-   ##
============================================
+ Coverage     60.04%   60.18%   +0.14%     
- Complexity     2409     2414       +5     
============================================
  Files           366      366              
  Lines         12587    12587              
  Branches        906      906              
============================================
+ Hits           7558     7576      +18     
+ Misses         4590     4571      -19     
- Partials        439      440       +1     

see 5 files with indirect coverage changes

@ruibaby ruibaby added the area/plugin Issues or PRs related to the Plugin Provider label Jun 7, 2023
@f2c-ci-robot f2c-ci-robot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2023
@ruibaby
Copy link
Member Author

ruibaby commented Jun 26, 2023

目前遇到了路由隔离的问题,没有太好的方法实现插件与插件之间定义的 Tab 路由隔离,因为目前插件详情页面是一个父级路由 /plugins/:name/,分别有 /plugins/:name/detail/plugins/:name/settings/:group,如果想将插件定义的 Tab 路由放在 /plugins/:name/ 下面,比如 /plugins/:name/foo,那么其他插件也可能通过这个路由访问到其他插件提供的路由,但是如果定义为 /plugins/plugin-xx/foo,父级路由又无法直接拿到 plugin-xx 参数,导致无法根据这个名字获取其他数据。

所以这个 PR 可能得暂时缓缓。

@f2c-ci-robot f2c-ci-robot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 28, 2023
@ruibaby ruibaby modified the milestones: 2.7.x, Backlog Jun 28, 2023
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 changed the title WIP: feat: make plugin tabs extensible feat: make plugin tabs extensible Jul 6, 2023
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2023
@ruibaby
Copy link
Member Author

ruibaby commented Jul 6, 2023

目前遇到了路由隔离的问题,没有太好的方法实现插件与插件之间定义的 Tab 路由隔离,因为目前插件详情页面是一个父级路由 /plugins/:name/,分别有 /plugins/:name/detail/plugins/:name/settings/:group,如果想将插件定义的 Tab 路由放在 /plugins/:name/ 下面,比如 /plugins/:name/foo,那么其他插件也可能通过这个路由访问到其他插件提供的路由,但是如果定义为 /plugins/plugin-xx/foo,父级路由又无法直接拿到 plugin-xx 参数,导致无法根据这个名字获取其他数据。

所以这个 PR 可能得暂时缓缓。

已经通过重构插件详情页面的路由结构解决此问题,目前插件详情页面仅有一个路由,其他包括设置表单选项卡都是通过路由参数来管理状态,包括此扩展点,重构之后也会让整个结构变得更加清晰。

可参考文档:https://github.com/ruibaby/halo/blob/feat/plugin-tabs-extend/console/docs/extension-points/plugin-self-tabs.md

@ruibaby ruibaby modified the milestones: Backlog, 2.8.x Jul 6, 2023
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

@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 Jul 7, 2023
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
/milestone 2.8.x

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2023
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jul 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing, 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 merged commit c0aae3a into halo-dev:main Jul 7, 2023
4 checks passed
@ruibaby ruibaby modified the milestones: 2.8.x, 2.8.0 Jul 7, 2023
f2c-ci-robot bot pushed a commit that referenced this pull request Jul 12, 2023
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

#### What this PR does / why we need it:

简化系统设置页面,选项卡的状态管理逻辑,放弃动态路由的模式,改为使用路由查询参数代替。

原由:#4041 (comment)

#### Special notes for your reviewer:

需要测试:

1. 测试系统设置页面能否正常工作即可。

#### Does this PR introduce a user-facing change?

```release-note
重构 Console 端系统设置页面的路由结构
```
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 area/plugin Issues or PRs related to the Plugin Provider 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.

支持在插件详情页面添加页面
3 participants