Commit Graph

4731 Commits (15f7fe2d4fdd2a10a73b7a7e11cdb6ed66466cab)

Author SHA1 Message Date
John Niang 15f7fe2d4f Move folder console to ui 2024-02-02 22:22:51 +08:00
John Niang b4e196372d
Compatible with negative page number and size (#5311)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.13.x

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

This PR makes Halo compatible with negative page number and size parameters to resolve <https://github.com/halo-dev/halo/issues/5298>.

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

Fixes https://github.com/halo-dev/halo/issues/5298

#### Special notes for your reviewer:

Try to install [Hao theme](https://github.com/liuzhihang/halo-theme-hao/releases/tag/v1.4.7) and [Chirpy theme](https://github.com/AirboZH/halo-theme-chirpy/releases/tag/v1.3.3) and check the frontend pages.

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

```release-note
修复因限制分页参数导致部分主题页面无法正常渲染的问题。
```
2024-02-02 12:30:05 +00:00
John Niang 27db40f7f6
Support building Docker image with major version tag (#5304)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.13.x

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

This PR supports building Docker image with major version tag, e.g.: `halohub/halo:2`.

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

Fixes https://github.com/halo-dev/halo/issues/4976

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

```release-note
None
```
2024-02-02 08:38:33 +00:00
John Niang 5b93667d8f
Prepare for 2.13.0 development (#5299)
#### What type of PR is this?

/kind cleanup
/area core

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

This PR bumps version to 2.13.0-SNAPSHOT and corrects links of Halo in README.md.

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

```release-note
None
```
2024-02-01 07:11:40 +00:00
Ryan Wang e85a55e416
feat: add supports for ui permissions of notification reason type (#5286)
#### What type of PR is this?

/kind feature
/area core
/area console
/milestone 2.12.x

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

为通知类型设置添加 UI 权限判断。

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

Fixes https://github.com/halo-dev/halo/issues/4728

#### Special notes for your reviewer:

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

```release-note
为通知类型设置添加 UI 权限判断。
```
2024-01-31 12:11:25 +00:00
Takagi dff6522d43
fix: preserve white spaces when parsing the default editor (#5292)
#### What type of PR is this?

/kind bug
/area editor
/area console
/milestone 2.12.x

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

在默认富文本编辑器解析文本时,使其保留空白符。

see https://prosemirror.net/docs/ref/#model.ParseOptions.preserveWhitespace

#### How to test it?

1. 输入一串文字,在其开始、结束、内容中分别键入空白字符。
2. 保存内容
3. 刷新页面,查看空白字符是否保留。

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

Fixes #5260 

#### Does this PR introduce a user-facing change?
```release-note
解决默认富文本编辑器内容刷新后空白字符丢失的问题
```
2024-01-31 10:20:08 +00:00
John Niang 7543fb6346
Merge pull request #5291 from ruibaby/fix/pat-roles
fix: issue of non-template roles being displayed in personal token roles
2024-01-31 18:13:54 +08:00
John Niang e15923b2d4
Fix the problem of unable to enable/disable 2FA for non-admin users (#5290)
Signed-off-by: John Niang <johnniang@foxmail.com>
2024-01-31 15:44:41 +08:00
Ryan Wang 7e9f8128c3 fix: issue of non-template roles being displayed in personal token roles
Signed-off-by: Ryan Wang <i@ryanc.cc>
2024-01-31 15:42:57 +08:00
John Niang e8c6189cd0
Merge pull request #5282 from JohnNiang/chore/remove-sonar-scaning
Remove analyzing code step in test job
2024-01-30 16:55:49 +08:00
John Niang b4bf425a09 Remove analyzing code step in test job
Because we have enabled Automatic Analysis

Signed-off-by: John Niang <johnniang@foxmail.com>
2024-01-30 16:37:51 +08:00
John Niang c792cef52f
Merge pull request #5279 from guqing/bugfix/order-for-contributors
fix: the order of contributors for posts is not fixed
2024-01-30 16:27:07 +08:00
Ryan Wang 0b03ae075b
chore: change editor version to 2.12.0 (#5281)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.12.x

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

修改 `@halo-dev/richtext-editor` 的版本号,为发布 Halo 2.12 做准备。

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

```release-note
None
```
2024-01-30 07:53:54 +00:00
guqing a5b0e866bd fix: the order of contributors for posts is not fixed 2024-01-30 15:51:28 +08:00
Ryan Wang 831a19b86c
refactor: data fetching of dashboard widgets (#5280)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.12.x

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

重构 Console 仪表盘中小部件的数据获取方式。

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

```release-note
None
```
2024-01-30 07:36:20 +00:00
Ryan Wang a4e862cfc4
fix: current selected role templates will be clear after select a other role (#5276)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

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

修复创建角色时,勾选某个角色模板导致已选角色模板被清空的问题。

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

Fixes #5275 

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

```release-note
None
```
2024-01-29 10:02:25 +00:00
guqing 2de03851c4
refactor: error prompt for inability to obtain avatar permalink when starting (#5269)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
优化启动时用户头像获取不到的错误提示

原因是在启动时用户被执行 reconcile 时使用的 plugin-s3 插件还没有启动所以无法获取到 permalink 需要重试

how to test it?
使用 plugin-s3 插件作为用户头像的存储策略然后上传头像测试此 PR 在启动时的异常提示是否输出为:
```
2024-01-29T11:53:13.674+08:00  WARN 31937 --- [rReconciler-t-1] r.h.a.c.e.reconciler.UserReconciler      : Failed to get avatar permalink for user [guqing] with attachment [460be0c4-b09f-4b25-ad93-e45f30331ec7], re-enqueuing...
```
#### Which issue(s) this PR fixes:
Fixes #5268

#### Does this PR introduce a user-facing change?
```release-note
优化启动时用户头像获取不到的错误提示
```
2024-01-29 09:52:25 +00:00
Takagi 6ee5503643
pref: adapt auto save functionality for articles in the uc (#5272)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.12.x

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

为个人中心的文章适配自动保存功能

#### How to test it?

新建一个空白文章,测试当失去焦点、切换路由,或者在页面等待 20S 后,是否会自动创建文章草稿。

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

Fixes #5036 

#### Does this PR introduce a user-facing change?
```release-note
为个人中心的文章适配自动保存功能
```
2024-01-29 09:32:25 +00:00
Ryan Wang e8a9f063f1
fix: pat can not be copied (#5274)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

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

修复创建 PAT 之后,点击复制按钮无法复制 token 的问题。

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

Fixes #5273 

#### Special notes for your reviewer:

测试步骤:

1. 构建生产环境的 UC。
2. 创建 PAT,点击复制按钮,观察是否能够正常复制。

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

```release-note
修复创建 PAT 之后,点击复制按钮无法复制 token 的问题。
```
2024-01-29 09:25:12 +00:00
John Niang 47a1aa7631
Fix the problem of showing 500 error while containing special chars in excerpt (#5263)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.12.0

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

This PR refactors building html meta by using `modelFactory#createStandaloneElementTag`.

See https://github.com/halo-dev/halo/issues/4755 for more.

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

Fixes https://github.com/halo-dev/halo/issues/4755

#### Special notes for your reviewer:

Validate via <https://github.com/halo-dev/halo/issues/4755#issuecomment-1776391345>.

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

```release-note
修复摘要中包含特殊字符导致无法解析页面的问题
```
2024-01-29 08:58:48 +00:00
Ryan Wang 9137d50a31
chore: add vue dev tools (#5134)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.12.x

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

为 Console 和 UC 添加 Vue 社区新的 [Dev Tools](https://github.com/vuejs/devtools-next)。

可以不再需要依赖浏览器插件。

<img width="1920" alt="图片" src="https://github.com/halo-dev/halo/assets/21301288/8b0af197-b795-4ca2-ba4b-cb7895e1e409">
<img width="1920" alt="图片" src="https://github.com/halo-dev/halo/assets/21301288/e447c99d-a150-4f0d-9e50-b5fdddccf378">

#### Special notes for your reviewer:

后续也可以尝试为 Halo 的 UI 部分的插件机制适配 Dev Tools,参考:https://devtools-next.vuejs.org/plugins/api

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

```release-note
为 Console 和 UC 添加 Vue 社区新的 [Dev Tools](https://github.com/vuejs/devtools-next)。
```
2024-01-29 08:50:42 +00:00
Ryan Wang 192b238e37
fix: it cannot be re-uploaded when the user's avatar cannot be obtained (#5270)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

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

修复当头像因为后端服务无法正常变更时,前端因为一直处于 refetch 状态导致无法重新上传的问题。

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

Fixes https://github.com/halo-dev/halo/issues/4852

#### Special notes for your reviewer:

1. 使用 https://github.com/AirboZH/plugin-uposs 存储服务创建一个存储策略。
2. 用户设置中的头像存储位置改为此存储策略。
3. 上传头像,观测是否一直处于重新获取的状态。

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

```release-note
优化头像上传,防止因为后端服务异常导致无法重新上传。
```
2024-01-29 08:06:02 +00:00
Ryan Wang cf72cbccbd
fix: unable to request session keep-alive API when browser tabs are inactive (#5266)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.12.x

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

修复当浏览器标签页不活跃时,文章编辑页面的 health 接口没有定时请求的问题。

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

Fixes #5265 

#### Special notes for your reviewer:

测试方式:

1. 可以在本地先将 refetchInterval 改为 1000 以方便测试。
2. 进入文章编辑页面。
3. 切换至其他标签页。
4. 返回之后查看浏览器开发者工具的 Network ,观察 health 接口是否有请求。

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

```release-note
修复当浏览器标签页不活跃时,文章编辑页面的 health 接口没有定时请求的问题。
```
2024-01-29 08:05:35 +00:00
John Niang 82d2afc6ad
Fix the problem of starting reconcilers in plugin before registering scheme (#5271)
#### What type of PR is this?

/kind bug
/area core
/area plugin
/milestone 2.12.0

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

This PR adjusts the order of starting reconcilers in plugin, or it will be stuck in starting synchronizer and no reconcilers will be executed.

The problem may be introduced by <https://github.com/halo-dev/halo/pull/5251>.

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

```release-note
None
```
2024-01-29 07:18:20 +00:00
John Niang e2b8d6e1f9
Upgrade Resilience4j to 2.2.0 (#5262)
#### What type of PR is this?

/kind improvement
/area core

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

This PR upgrades Resilience4J to 2.2.0. See https://github.com/resilience4j/resilience4j/blob/v2.2.0/RELEASENOTES.adoc for more.

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

```release-note
升级依赖 Resilience4j 至 2.2.0
```
2024-01-29 05:59:51 +00:00
John Niang 9ae7323404
Upgrade Lucene to 9.9.1 (#5261)
#### What type of PR is this?

/kind improvement
/area core

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

This PR upgrades Lucene to 9.9.1. See https://lucene.apache.org/core/corenews.html#apache-lucenetm-991-available for more.

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

```release-note
升级依赖 Lucene 至 9.9.1
```
2024-01-29 02:58:50 +00:00
Ryan Wang 3bb81d852e
chore: update links in preset post (#5258)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.12.x

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

更新预设文章中的链接地址。

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

```release-note
None
```
2024-01-27 09:54:13 +00:00
John Niang 1be470a4f7
Fix the problem of resolving logo starting with slash (#5256)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.12.x

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

This PR treats logo as a path when building logo HTTP URL instead of a path segment. The concrete rules of logo is described [here](https://github.com/halo-dev/halo/issues/5253#issuecomment-1911729063).

See https://github.com/halo-dev/halo/issues/5253 for more.

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

Fixes https://github.com/halo-dev/halo/issues/5253

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

```release-note
None
```
2024-01-26 11:24:11 +00:00
John Niang 8288e4edf8
Simplify halo plugin manager (#5251)
#### What type of PR is this?

/kind improvement
/area core
/area plugin
/milestone 2.12.x

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

This PR mainly simplifies halo plugin manager. Before this,
- we have too many repeat code from super class, which is uncessary
- we maintain plugin application context in ExtensionComponentsFinder, which is uncessary and is hard to manage
- we fire halo plugin event in halo plugin manager, which is complicated and leads to too many repeat code

This PR does:
- refactor halo plugin manager
- wrap base plugin with spring plugin which contains application context
- remove ExtensionComponentsFinder
- bridge halo plugin event and spring plugin event
- wait extensions fully deleted when stopping

Meanwhile, this PR will supersede PR <https://github.com/halo-dev/halo/pull/5236>.

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

Fixes https://github.com/halo-dev/halo/issues/5226

#### Special notes for your reviewer:

Test installing, enabing, disabling, upgrading, reloading and deleting plugins.

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

```release-note
None
```
2024-01-26 09:08:11 +00:00
guqing 17a0fb9e05
feat: optimized post reconciliation process for enhanced performance and resource utilization (#5250)
#### What type of PR is this?
/kind feature
/milestone 2.12.x
/area core

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

我们为文章自定义模型的数据调协过程引入了重要的优化。
在以前,当数据量大(例如,50,000篇文章)的情况下,每次系统重启都会触发耗时且资源密集的所有数据的协调过程,即使大部分数据并不需要调协。这导致了不必要的数据库查询和高资源消耗。

为了解决这个问题,我们在文章自定义模型的 status 中添加了一个新的 `Long observedVersion` 属性。
每次协调后,此属性将更新为 `metadata.version`,还调整了 `syncAllOnStart` 条件,只有当 `status.observedVersion < metadata.version` 时才会调协数据。

这个改变确保了只有在启动时需要的数据会被协调,从而减少了资源使用和不必要的协调过程。
因此,Halo 的数据承载能力得到了显著提高。

**how to test it?**
使用此 PR 测试:启动时文章只有首次会执行 reconcile,再次重启时则不会再执行,如果直接修改数据去除掉 `status.observedVersion` 来模拟迁移或漏 reconcile 的过程则启动时该数据会被再次执行 reconcile

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

#### Does this PR introduce a user-facing change?
```release-note
优化文章数据的调协过程以降低 Halo 启动时文章的调协耗时同时提高性能和资源利用率
```
2024-01-26 09:02:10 +00:00
Ryan Wang 22104fe636
feat: add tools page for console (#5252)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.12.x

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

为 Console 提供工具页面和菜单项,方便插件集成。

<img width="1920" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/9b63284f-7bdb-4eed-bc6e-cbe2c78359db">

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

Fixes https://github.com/halo-dev/halo/issues/5249

#### Special notes for your reviewer:

可以使用以下插件进行测试:

1. [plugin-umami-1.0.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/halo/files/14049119/plugin-umami-1.0.0-SNAPSHOT.jar.zip)
2. [plugin-metrics-graph-1.0.0-beta.1.jar.zip](https://github.com/halo-dev/halo/files/14049127/plugin-metrics-graph-1.0.0-beta.1.jar.zip)
3. [NotifyMe-1.1.0.jar.zip](https://github.com/halo-dev/halo/files/14049131/NotifyMe-1.1.0.jar.zip)

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

```release-note
为 Console 提供工具页面和菜单项,方便插件集成。
```
2024-01-26 02:40:08 +00:00
guqing 3f27f6f262
refactor: using indexes to query post lists (#5230)
#### What type of PR is this?
/kind feature
/area core
/area console
/milestone 2.12.x

#### What this PR does / why we need it:
使用索引功能来查询文章列表

how to test it?
1. 测试文章列表的筛选条件是否正确
2. 测试文章列表中关联的标签和分类信息是否正确
3. 测试仪表盘的文章数量统计是否正确
4. 测试分类关联文章的数量是否正确
5. 测试标签关联文章的文章是否正确
6. 测试主题端文章列表是否正确

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

#### Does this PR introduce a user-facing change?
```release-note
使用高级索引功能检索文章以显著降低资源消耗并提供更快、更高效的文章检索体验
```
2024-01-25 12:17:12 +08:00
Takagi cecdb3f9ef
fix: resolve the issue of the bubble menu being obscured (#5246)
#### What type of PR is this?

/kind bug
/area console
/area editor

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

将默认编辑器的父级容器移除。用于解决冒泡菜单被遮挡的问题。
由于修改后默认编辑器自身可滚动,因此可以使默认编辑器容器内的绝对定位元素获取到当前滚动的位置。

#### How to test it?

输入超过一屏宽度的内容,按 `MOD + A` 全选,查看冒泡菜单是否被顶部菜单遮挡。

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

Fixes #4869

#### Does this PR introduce a user-facing change?
```release-note
解决冒泡菜单会被顶部工具栏遮挡的问题
```
2024-01-25 04:00:13 +00:00
Ryan Wang 138af65d0c
refactor: improve effect of menu expand (#5244)
#### What type of PR is this?

/area console
/milestone 2.12.x
/kind improvement

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

优化 Console 左侧菜单的展开逻辑,改为可以通过点击展开图标来展开子菜单。

<img width="323" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/6f9a4d2c-1141-424e-b5cd-4e0a9991c67d">

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

```release-note
优化 Console 左侧菜单的展开逻辑,支持通过点击图标来展开子菜单。
```
2024-01-25 03:40:48 +00:00
guqing 29bd0590ca
fix: resolve unequal schemes built from same Extension blocking unregister (#5245)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
修复同一个自定义模型构建出的 Scheme 不相等导致无法正确从 SchemeManager 中移除的问题

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

#### Does this PR introduce a user-facing change?
```release-note
修复同一个自定义模型构建出的 Scheme 不相等导致无法正确从 SchemeManager 中移除的问题
```
2024-01-25 03:27:52 +00:00
Takagi 0faa8a89ff
pref: resolve horizontal scrollbar display issue in table (#5191)
#### What type of PR is this?

/kind improvement

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

为溢出的表格增加鼠标滚动功能,当光标在溢出的表格上时,滚动鼠标则可以使表格左右滚动。
当表格可以左右滚动时,增加侧边阴影用于提示用户。

#### How to test it?

测试具有滚动条的表格是否有侧边阴影用于提示用户,并且用鼠标滚动是否可以使表格左右滚动。

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

Fixes #5182 

#### Does this PR introduce a user-facing change?
```release-note
优化富文本编辑器中表格组件可滚动时的显示效果
```
2024-01-25 03:05:50 +00:00
Takagi 38465253c8
feat: provide find and replace functionality for the default rich text editor (#5206)
#### What type of PR is this?

/kind feature

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

为默认富文本编辑器添加查找与搜索的功能扩展。

快捷键:

当焦点处于编辑器中时,可以使用 `Mod+f` 来唤起查找与搜索框,或者点击顶部工具栏来打开。
当焦点处于查找与搜索框时,按下 `Ecs` 可进行关闭。

<img width="1920" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/03a54bb8-2cc4-4cb0-9a18-fd0e9aede564">

#### How to test it?

测试查找与搜索功能是否正常

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

Fixes #5195 

#### Does this PR introduce a user-facing change?
```release-note
为默认富文本编辑器添加查找与搜索的功能扩展。
```
2024-01-24 07:07:21 +00:00
Takagi ddbc73b079
fix: text selected after resolving the table cannot be deleted (#5234)
#### What type of PR is this?

/kind bug

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

当表格后存在选中的内容时,按下退格键或删除键不再执行选中表格的操作,而是继续向下执行。

#### How to test it?

在表格后紧跟着文本,从文本开头选中文本,然后按下退格键,查看文本是否能够被删除。

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

Fixes #5193 

#### Does this PR introduce a user-facing change?
```release-note
解决默认富文本编辑器中表格后的文本选中后无法删除的问题
```
2024-01-24 04:33:56 +00:00
John Niang 7e8df339a3
Revert: refresh the plugin wrapper when starting the plugin (#5238)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.12.x

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

This PR reverts changes in PR <https://github.com/halo-dev/halo/pull/4023>, mainly thanks to PR <https://github.com/halo-dev/halo/pull/5148>.

We don't need to refresh the plugin wrapper on every startup, because we entirely disable the plugin in plugin manager when disabling plugin at console.

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

Fixes https://github.com/halo-dev/halo/issues/4016

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

```release-note
None
```
2024-01-24 02:36:11 +00:00
Ryan Wang 28ee0bf0e0
refactor: improve role dependency-related functions and i18n (#5227)
#### What type of PR is this?

/area console
/area core
/milestone 2.12.x

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

优化角色模板依赖的相关功能:

1. 修复勾选某个角色模板之后,其下依赖模板没有选中的问题。
2. 修复编辑角色时,模板其下依赖模板没有选中的问题。
3. 修复角色管理列表中,权限数量显示有误的问题。
4. 移除 **允许管理所有文章** 的角色模板,此角色模板与文章管理重复。
5. 优化 i18n。

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

Fixes https://github.com/halo-dev/halo/issues/5222

#### Special notes for your reviewer:

需要测试上诉问题是否还存在。

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

```release-note
优化角色模板依赖的相关功能,优化文章相关角色的翻译。
```
2024-01-24 02:34:11 +00:00
guqing 57fb644173
refactor: optimize the implementation of indexed query engine through query index view (#5233)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
通过重构 QueryIndexView 的实现方式来优化 IndexedQueryEngine 的逻辑并简化排序过程

how to test it?
单元测试通过即可,此 PR 的修改都是基于单元测试的基础上对原代码做的重构

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-01-24 02:27:44 +00:00
guqing 8523a67e06
refactor: logic for subList method when retrieving all data (#5235)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
重构 ListResult.subList 方法在获取所有数据时的处理逻辑,只要 size 为 0 就返回所有数据

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-01-23 08:19:19 +00:00
John Niang 9d9b1527bc
Upgrade Spring Boot to 3.2.2 (#5232)
#### What type of PR is this?

/kind improvement
/area core

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

See https://github.com/spring-projects/spring-boot/releases/tag/v3.2.2 for more.

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

```release-note
升级依赖 Spring Boot 至 3.2.2
```
2024-01-23 05:11:41 +00:00
Ryan Wang 95878b3bb8
refactor: update chinese display name of post editor role (#5224)
#### What type of PR is this?

/area core
/milestone 2.12.x

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

修改文章编辑角色的显示名称为**文章管理员**,这样会更加直观。

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

Fixes #5221 

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

```release-note
修改文章编辑角色的显示名称为**文章管理员**。
```
2024-01-22 07:20:10 +00:00
Takagi 14580b96b0
feat: refactor editor image block upload logic (#5159)
* feat: refactor editor image block upload logic
2024-01-19 17:39:06 +08:00
Ryan Wang df8bb3399a
chore: bump tiptap version to 2.1.16 (#5210)
#### What type of PR is this?

/area console
/area editor
/milestone 2.12.x
/kind bug

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

升级 tiptap 相关依赖,解决代码块中换行的问题。

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

Fixes https://github.com/halo-dev/halo/issues/5207

#### Special notes for your reviewer:

测试方式:

1. 进入 console/packages/editor,更新依赖
2. 使用 pnpm dev 启动编辑器服务
3. 插入一个代码块,然后刷新页面,观察代码块是否显示正常

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

```release-note
None
```
2024-01-19 08:14:10 +00:00
guqing 6a37df07a8
feat: add index mechanism for extension (#5121)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.12.x

#### What this PR does / why we need it:
新增自定义模型索引机制

默认为所有的自定义模型都添加了以下索引:
- metadata.name
- metadata.labels
- metadata.creationTimestamp
- metadata.deletionTimestamp

**how to test it?**
1. 测试应用的启动和停止
2. 测试 Reconciler 被正确执行,如创建文章发布文章,测试删除文章的某个 label 数据启动后能被 PostReconciler 恢复(即Reconciler 被正确执行)
3. 测试自定义模型自动生成的 list APIs
	1. 能根据 labels 正确过滤数据和分页
	2. 能根据 creationTimestamp 正确排序
	3. 测试插件启用后也能正确使用 list APIs 根据 labels 过滤数据和 creationTimestamp 排序
4. 能正确删除数据(则表示 GcReconciler 使用索引正确)
5. 测试在插件中为自定义模型注册索引
```java
public class DemoPlugin extension BasePlugin {
    private final SchemeManager schemeManager;

    public MomentsPlugin(PluginContext pluginContext, SchemeManager schemeManager) {
        super(pluginContext);
        this.schemeManager = schemeManager;
    }

    @Override
    public void start() {
        schemeManager.register(Moment.class, indexSpecs -> {
            indexSpecs.add(new IndexSpec()
                .setName("spec.tags")
                .setIndexFunc(multiValueAttribute(Moment.class, moment -> {
                    var tags = moment.getSpec().getTags();
                    return tags == null ? Set.of() : tags;
                }))
            );
            indexSpecs.add(new IndexSpec()
                .setName("spec.owner")
                .setIndexFunc(simpleAttribute(Moment.class,
                    moment -> moment.getSpec().getOwner())
                )
            );
            indexSpecs.add(new IndexSpec()
                .setName("spec.releaseTime")
                .setIndexFunc(simpleAttribute(Moment.class, moment -> {
                    var releaseTime = moment.getSpec().getReleaseTime();
                    return releaseTime == null ? null : releaseTime.toString();
                }))
            );

            indexSpecs.add(new IndexSpec()
                .setName("spec.visible")
                .setIndexFunc(simpleAttribute(Moment.class, moment -> {
                    var visible = moment.getSpec().getVisible();
                    return visible == null ? null : visible.toString();
                }))
            );
        });
    }

    @Override
    public void stop() {
        // unregister scheme 即可,不需要手动删除索引
    }
}
```
可以正确在自动生成的 list APIs 使用 fieldSelector 来过滤 `spec.slug` 和排序,可以自己添加其他的 indexSpec 测试
6. 测试唯一索引并添加重复数据,期望无法添加进去

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

#### Does this PR introduce a user-facing change?
```release-note
新增自定义模型索引机制
```
2024-01-19 06:36:09 +00:00
Ryan Wang 3ebb45c266
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
Takagi b42e046d54
pref: add additional attributes and colgroup for tables (#5176)
#### What type of PR is this?

/kind improvmenet
/area editor
/milestone 2.12.x

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

为默认编辑器 table 组件渲染后的结果中增加 `colgroup`,并为 table 增加 `width` 与 `minWidth` 属性。
用于解决渲染完成之后的 table html 宽度与编辑时不一致的问题。

#### How to test it?

拖拽修改默认编辑器表格列宽,查看生成后的 html 列宽是否同样发生了变化,并且查看生成的 html 结构下是否具有 `colgroup` html 元素。

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

Fixes #5138 

#### Does this PR introduce a user-facing change?
```release-note
为默认富文本编辑器 table 组件渲染后的 html 增加 colgroup 元素与 width 属性
```
2024-01-18 08:40:08 +00:00
John Niang 86e688a15d
Disable Swagger cache in development environment (#5200)
#### What type of PR is this?

/kind improvement
/area  core

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

When we are developing a plugin in development environment, APIs in plugin are frequently changed. But they are not reflected in Swagger UI instantly unless we restart Halo entirely.

This PR disables Swagger cache in that case.

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

```release-note
None
```
2024-01-18 02:52:06 +00:00