Commit Graph

4237 Commits (ec5599068c9041d1b6da9bbe873b8dfe9bbf7733)

Author SHA1 Message Date
John Niang 9676ccee0e
Bump version to 2.2.0-SNAPSHOT for next iteration (#3087)
#### What type of PR is this?

/kind cleanup
/area core

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

Bump version to 2.2.0-SNAPSHOT for next iteration.

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

```release-note
None
```
2022-12-30 04:52:37 +00:00
Ryan Wang 9245e8e7c9
chore: bump theme-earth to 1.1.1 (#3082)
#### What type of PR is this?

/kind improvement

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

将 theme-earth 默认主题升级到 1.1.1

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


```release-note
None
```
2022-12-30 02:36:34 +00:00
Ryan Wang cd3ac7b351 chore: release 2.1.0 (halo-dev/console#811)
#### What type of PR is this?

/kind improvement

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

发布 Console 2.1.0

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

Ref https://github.com/halo-dev/halo/issues/3077

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

```release-note
None
```
2022-12-30 02:32:33 +00:00
Ryan Wang 036fe91e8f feat: add target attribute setting for menu item (halo-dev/console#805)
#### What type of PR is this?

/kind feature

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

支持为菜单项设置链接打开方式。 适配:https://github.com/halo-dev/halo/pull/3072

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

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

#### Screenshots:

<img width="714" alt="image" src="https://user-images.githubusercontent.com/21301288/209922511-120bc82c-4d13-4dd8-9829-0ba173cdc377.png">


#### Special notes for your reviewer:

测试方式:

1. Halo 需要切换到 https://github.com/halo-dev/halo/pull/3072 的分支。
2. Console 需要 `pnpm install`
3. 创建若干菜单项,并设置打开方式。
4. 检查是否设置正确。

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

```release-note
菜单项支持设置打开方式
```
2022-12-29 13:50:33 +00:00
Ryan Wang a8d3072a15 refactor: editor provider switching (halo-dev/console#803)
#### What type of PR is this?

/kind improvement

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

重构编辑器的选择方式,改为在编辑页面选择,并支持缓存上一次的选择。

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

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

#### Screenshots:

<img width="1662" alt="image" src="https://user-images.githubusercontent.com/21301288/209756212-b14725da-3d89-4416-8860-e75cdb270b75.png">

#### Special notes for your reviewer:

测试方式:

1. 此改动针对文章和自定义页面的编辑。
2. 测试新建页面选择编辑器是否正常。
3. 测试重新进入新建页面,编辑器是否自动选择为了上一次的编辑器。
4. 测试发布文章或者自定义页面之后,重新编辑时,是否选择了正确的编辑器。

编辑器插件可使用:

1. https://github.com/halo-sigs/plugin-bytemd
2. https://github.com/halo-sigs/plugin-stackedit

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

```release-note
重构 Console 端选择编辑器的方式,支持记住上一次的选择。
```
2022-12-29 13:46:34 +00:00
Ryan Wang 3e10162d22 fix: preferred-editor annotation is not set when editing old posts (halo-dev/console#806)
#### What type of PR is this?

/kind bug

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

修复编辑旧文章时,没有为文章设置 `content.halo.run/preferred-editor` 的元数据的问题。

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

Ref https://github.com/halo-dev/halo/issues/3080

#### Special notes for your reviewer:

测试方式:

1. 在有旧数据的情况下切换到此 PR。
2. 编辑一篇旧的文章后保存。
3. 打开文章设置,检查元数据中是否包含了 `content.halo.run/preferred-editor`

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


```release-note
None
```
2022-12-29 13:42:34 +00:00
guqing cc891d6655
feat: add annotations expression object for thymeleaf (#3076)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.1.x
#### What this PR does / why we need it:
新增操作 annotations 的表达式对象
在 thymeleaf 模板中使用示例:
```html
<p th:text="${#annotations.get(user, 'background')}"></p>
<p th:text="${#annotations.getOrDefault(user, 'background', 'default-value')}"></p>
<p th:text="${#annotations.contains(user, 'background')}"></p>
```
#### Which issue(s) this PR fixes:

Fixes #3073

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
新增 Annotations 表达式对象用于在 thymeleaf 中操作自定义模型的 annotations
```
2022-12-29 13:30:34 +00:00
Ryan Wang 955d5bf27b fix: login in safari browser has no effect (halo-dev/console#804)
#### What type of PR is this?

/kind bug

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

修复在 Safari 浏览器登录之后无反应的问题。

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

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

#### Special notes for your reviewer:

测试方式:

1. 在 Safari 浏览器上测试登录之后是否有跳转到仪表盘即可。

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

```release-note
修复 Console 端在 Safari 浏览器登录之后无反应的问题
```
2022-12-29 13:28:33 +00:00
Ryan Wang 69ab794b6d fix: saving an post causes the publish time to be lost (halo-dev/console#807)
#### What type of PR is this?

/kind bug

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

修复保存文章设置导致发布时间丢失的问题。

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

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

#### Special notes for your reviewer:

测试方式:

1. 创建若干文章。
2. 返回到文章管理列表。
3. 打开任意文章的设置。
4. 检查发布时间是否回显,然后保存。
5. 保存之后检查发布时间是否还存在。

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

```release-note
修复 Console 端保存文章设置导致发布时间丢失的问题。
```
2022-12-29 13:10:33 +00:00
Ryan Wang 9abdee50b4 fix: logged-in users cannot access the profile page (halo-dev/console#796)
#### What type of PR is this?

/kind bug

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

修复已登录用户无法访问个人资料页面的问题。

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

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

#### Special notes for your reviewer:

/hold

等待 https://github.com/halo-dev/halo/issues/3035 解决。

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


```release-note
修复 Console 端已登录用户无法访问个人资料页面的问题。
```
2022-12-29 13:04:32 +00:00
John Niang 77dd5b24dd
Cache static resources, including plugin, theme, console, attachment (#3074)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.1.x

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

Add cache control and last modified headers for responses of static resources.

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

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

#### Special notes for your reviewer:

We can check the response header of statis resources to know if the cache control is working correctly.

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

```release-note
完善静态资源的缓存策略
```
2022-12-29 10:14:32 +00:00
guqing 9d0ad5de26
refactor: remove finalizer when resources deleted completely (#3065)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
主题卸载时等待删除关联资源后再清除 Finalizer
see #2967 for more detail.
https://github.com/halo-dev/halo/issues/2967#issuecomment-1354384978

#### Which issue(s) this PR fixes:
how to test it?
- 在主题中多添加一个 AnnotationSetting 资源 yaml,测试主题删除是否正常。
- 对包 `org.springframework.retry` 开启 debug 日志后能在删除主题时看到类似如下日志:
```
16:33:02.822 [Test worker] DEBUG org.springframework.retry.support.RetryTemplate - Retry: count=0
16:33:03.128 [Test worker] DEBUG org.springframework.retry.support.RetryTemplate - Checking for rethrow: count=1
```
Fixes #2967
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
主题卸载时等待删除关联资源后再清除 Finalizer
```
2022-12-29 10:12:36 +00:00
Ryan Wang b667e988df
feat: add target attribute for menu item (#3072)
#### What type of PR is this?

/kind feature

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

为 MenuItem 模型添加 a 标签的 target 属性设置。

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

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

#### Special notes for your reviewer:

测试方式请看:https://github.com/halo-dev/console/pull/805

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

```release-note
菜单项支持设置打开方式
```
2022-12-29 10:10:33 +00:00
guqing 5dbd5a06ed
Avoid NPE problems when querying the list of posts in the console (#3068)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.1.x

#### What this PR does / why we need it:
迁移后文章过多,当文章的 Reconciler 还没有执行完时访问 Console 端文章列表会因为 post.status  为 Null 出现 NPE 问题
使用文章的 status 时需要对其进行判空

/cherry-pick release-2.0
#### Which issue(s) this PR fixes:

Fixes #3066

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-12-29 09:42:33 +00:00
John Niang 313605d52c
Provide an endpoint to update user profile (#3067)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.1.x

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

Provide an endpoint to update current user profile instead of whole user data.

##### Request example

```bash
curl -X 'PUT' \
  'http://localhost:8090/apis/api.console.halo.run/v1alpha1/users/-' \
  -H 'accept: */*' \
  -H 'Content-Type: */*' \
  -d '{
  "spec": {
    "displayName": "JohnNiang",
    "email": "johnniang@halo.run",
    "password": "xxx",
    "registeredAt": "2022-12-19T03:46:54.809770900Z",
    "twoFactorAuthEnabled": false,
    "disabled": false
  },
  "status": {
    "permalink": "http://localhost:8090/authors/admin"
  },
  "apiVersion": "v1alpha1",
  "kind": "User",
  "metadata": {
    "finalizers": [
      "user-protection"
    ],
    "name": "admin",
    "annotations": {
      "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
    },
    "version": 3,
    "creationTimestamp": "2022-12-19T03:46:54.911951800Z"
  }
}'
```

##### Response example

```json
{
  "spec": {
    "displayName": "JohnNiang",
    "email": "johnniang@halo.run",
    "password": "{bcrypt}$2a$10$IBV8/q7Q6Fj78Ls5AG1eBO0bCQ.rM6vli5pAVexf/gqu.hNfjJxaq",
    "registeredAt": "2022-12-19T03:46:54.809770900Z",
    "twoFactorAuthEnabled": false,
    "disabled": false
  },
  "status": {
    "permalink": "http://localhost:8090/authors/admin"
  },
  "apiVersion": "v1alpha1",
  "kind": "User",
  "metadata": {
    "finalizers": [
      "user-protection"
    ],
    "name": "admin",
    "annotations": {
      "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
    },
    "version": 5,
    "creationTimestamp": "2022-12-19T03:46:54.911951800Z"
  }
}
```

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

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

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

```release-note
提供更新当前登录用户信息功能
```
2022-12-29 03:16:33 +00:00
Ryan Wang eb80400ade chore: release 2.1.0-rc.1 (halo-dev/console#802)
#### What type of PR is this?

/kind improvement

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

发布 Console 2.1.0-rc.1

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

Ref https://github.com/halo-dev/halo/issues/3050

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


```release-note
None
```
2022-12-26 15:50:31 +00:00
Ryan Wang 93f8a6caff feat: add annotations form for more extension (halo-dev/console#801)
#### What type of PR is this?

/kind feature

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

为更多模型添加 Annotation Form 的支持。此 PR 包括:

1. 自定义页面。
2. 文章分类。
3. 文章标签。
4. 菜单项。
5. 用户。

此 PR 是对 https://github.com/halo-dev/console/pull/770 的补充。

#### Special notes for your reviewer:

测试方式:

1. 将一下内容放到任意一个主题下,后缀为 `yaml`,文件名随意。
    ```yaml
    spec:
      targetRef:
        group: content.halo.run
        kind: Post
      formSchema:
        - $formkit: "text"
          name: "download"
          label: "下载地址"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-
    ---
    spec:
      targetRef:
        group: content.halo.run
        kind: SinglePage
      formSchema:
        - $formkit: "text"
          name: "download"
          label: "下载地址"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-
    
    ---
    spec:
      targetRef:
        group: content.halo.run
        kind: Category
      formSchema:
        - $formkit: "text"
          name: "download"
          label: "下载地址"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-
    ---
    spec:
      targetRef:
        group: content.halo.run
        kind: Tag
      formSchema:
        - $formkit: "text"
          name: "download"
          label: "下载地址"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-
    ---
    spec:
      targetRef:
        group: ""
        kind: MenuItem
      formSchema:
        - $formkit: "text"
          name: "icon"
          label: "图标"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-

    ```
3. 后端需要使用 https://github.com/halo-dev/halo/pull/3028
4. 测试上述提到的模型的 Annotations 表单。
5. 检查是否可以设置正常。

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

```release-note
None
```
2022-12-26 15:32:31 +00:00
John Niang da55532777
Refine exception detail with i18n (#3042)
#### What type of PR is this?

/kind feature
/kind api-change
/area core
/milestone 2.1.x

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

- Configuring message source location and name enables i18n message resolution.
- Simple global error handler.
- Refactor some exceptions with `ResponseStatusException` to control what HTTP status and problem detail need to be returned.

**TODO**

- [x] Add more UTs.
#### Which issue(s) this PR fixes:

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

#### Special notes for your reviewer:

Steps to test:

1. Try to refine `src/main/resources/config/i18n/messages_zh.properties` and switch Browser language with Chinese.
2. Delibrately make a mistake as you wish and see the error tips in console.
3. Try to access one page which doesn't exist and see the rendered result.

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

```release-note
完成系统异常的国际化
```
2022-12-26 14:10:31 +00:00
Ryan Wang edd2d90c5b feat: add AnnotationsForm Component to edit extension annotations (halo-dev/console#770)
#### What type of PR is this?

/kind feature

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

提供一个 Annotations 编辑组件,支持由主题或者插件提供表单定义,也支持使用者自定义 key-value,用于扩展资源字段。

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

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

#### Screenshots:

<img width="789" alt="image" src="https://user-images.githubusercontent.com/21301288/209517622-80111fd2-8e79-480f-8ca0-9f7073300b2b.png">


#### Special notes for your reviewer:

测试方式:

1. 将一下内容放到任意一个主题下,后缀为 `yaml`,文件名随意。
    ```yaml
    spec:
      targetRef:
        group: content.halo.run
        kind: Post
      formSchema:
        - $formkit: "text"
          name: "download"
          label: "下载地址"
        - $formkit: "text"
          name: "version"
          label: "版本"
    apiVersion: v1alpha1
    kind: AnnotationSetting
    metadata:
      generateName: annotation-
    ```
3. 后端需要使用 https://github.com/halo-dev/halo/pull/3028
4. 测试为文章设置 Annotations 和自定义的 Annotations。
5. 检查是否可以设置正常。


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

```release-note
文章设置支持设置元数据。
```
2022-12-26 14:08:32 +00:00
Ryan Wang 3a1c264afb
chore: update default theme package (#3051)
#### What type of PR is this?

/kind improvement

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

更新默认主题。 https://github.com/halo-dev/theme-earth/releases/tag/v1.1.0

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

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

#### Special notes for your reviewer:

None

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

```release-note
更新默认主题的版本
```
2022-12-26 13:56:31 +00:00
guqing ddf47f6600
feat: add annotation setting extension (#3028)
#### What type of PR is this?
/kind feature
/milestone 2.1.x
/area core

#### What this PR does / why we need it:
新增 AnnotationSetting 自定义模型以扩展自定义元数据设置表单

主题安装/更新/重载时都会重新加载与 theme.yaml 同层级的其他 yaml,但只会保存 kind 为 Setting 和 AnnotationSetting的,主题卸载时会删除这些 yaml 资源

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

Fixes #3005

#### Special notes for your reviewer:
how to test it?
- 修改影响到了主题安装、更新、重载和删除,需要检查这些功能是否正确加载了 Setting 和 AnnotationSetting
- 插件启动时初始化的 AnnotationSetting 在插件停止时会被删除
- 主题添加了 annotation setting 资源,使用非超级管理员也可以获取

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
新增 AnnotationSetting 以扩展自定义元数据设置表单
```
2022-12-26 13:54:36 +00:00
Ryan Wang fb1465484a perf: asynchronously load the default editor (halo-dev/console#800)
#### What type of PR is this?

/kind improvement

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

默认编辑器改为异步的形式加载。

优化前后对比:

优化前编译:

<img width="480" alt="image" src="https://user-images.githubusercontent.com/21301288/209529091-07216f42-8668-46fc-80e6-03db5504e576.png">

优化后编译:

<img width="510" alt="image" src="https://user-images.githubusercontent.com/21301288/209529001-31537104-cada-4e3c-b521-8849b53281ce.png">

优化前首次加载:

<img width="1069" alt="image" src="https://user-images.githubusercontent.com/21301288/209529285-a62cfe92-5aa0-47f6-ad7e-9f0210ca97b6.png">

优化后首次加载:

<img width="1067" alt="image" src="https://user-images.githubusercontent.com/21301288/209529349-24aa99b9-5b52-4d44-8144-60028332e9cd.png">

最终会在打开文章编辑页面的时候加载编辑器资源:

![2022-12-26 17 06 45](https://user-images.githubusercontent.com/21301288/209529486-d579b51c-cb14-4a30-a3be-649bfe284300.gif)

> 这个 Gif 的演示做了节流处理来模拟服务器带宽的情况。在带宽不良的情况下会显示加载动画以提示使用者正在加载编辑器。

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

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

#### Special notes for your reviewer:

测试方式:

1. 插件默认编辑器是否正常加载以及功能是否正常即可。

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

```release-note
Console 端的默认编辑器改为异步加载,优化整体的加载性能。
```
2022-12-26 13:34:32 +00:00
Ryan Wang b46b003283 refactor: remove the ability to edit user using yaml (halo-dev/console#799)
#### What type of PR is this?

/kind improvement

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

移除使用 yaml 编辑用户信息的功能。

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

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

#### Special notes for your reviewer:

None

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

```release-note
移除 Console 端使用 yaml 编辑用户信息的功能
```
2022-12-26 10:36:32 +00:00
Ryan Wang 4879d31d61 refactor: attachment upload component (halo-dev/console#784)
#### What type of PR is this?

/kind improvement

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

优化上传附件的组件和附件库选择组件。

1. 附件上传支持缓存选择的分组和策略。
2. 附件上传支持选择分组。
3. 移除附件选择组件的上传 tab,改为和附件库管理中一样的上传组件。

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

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

#### Screenshots:

<img width="722" alt="image" src="https://user-images.githubusercontent.com/21301288/208612167-c7082be4-0fb8-4caa-b246-d15bac525e86.png">

#### Special notes for your reviewer:

测试方式:

1. 测试在附件管理中上传附件的功能是否正常。
2. 测试在附件选择组件中上传附件的功能是否正常。

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

```release-note
优化 Console 端上传附件的功能,支持缓存选择的分组和策略。
```
2022-12-26 06:32:32 +00:00
John Niang 9b9a57b427
Fix invalid attachment role templates (#3024)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.1.x

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

- Add missing resources `"policies", "policytemplates", "groups"` in policy rules in attachment role templates.
- Correct `nonResourceURLs` and `verbs`

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

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

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

#### Special notes for your reviewer:

Steps to test:

1. Start Halo and login with `admin`
2. Create a Role with `Attachment Manage` permission only
3. Create an user and assign the role to the user
4. Set password for the user
5. Log out current user and log in as the user created just now
6. Try to do various operations in attachment tab
    - Create and list policy
    - Create and list group
    - Upload and list attachments

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

```release-note
修复附件权限定义的错误
```
2022-12-26 06:26:32 +00:00
Ryan Wang 07298a48a5 perf: asynchronously load the emoji data of the comment reply component (halo-dev/console#798)
#### What type of PR is this?

/kind improvement

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

优化评论回复组件的 emoji 数据加载,改为异步的方式。

构建结果对比:

优化前:

<img width="475" alt="image" src="https://user-images.githubusercontent.com/21301288/209430764-25e42624-25d7-4466-a184-4fc82d310e12.png">

优化后:

<img width="473" alt="image" src="https://user-images.githubusercontent.com/21301288/209430752-1bc064e5-f3bd-42f4-b93c-8f2e200a00e3.png">

首次请求对比:

优化前:

<img width="1067" alt="image" src="https://user-images.githubusercontent.com/21301288/209430904-79c9c403-a627-44ea-a97b-13e653230b23.png">

优化后:

<img width="1066" alt="image" src="https://user-images.githubusercontent.com/21301288/209430936-e446659c-a20a-437c-bd9f-4408279410af.png">

最终会在打开 emoji 组件的时候才加载 emoji 数据:

<img width="1460" alt="image" src="https://user-images.githubusercontent.com/21301288/209430963-f2cb66c6-c0e3-4cc5-8906-66db94d40ca8.png">


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

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

#### Special notes for your reviewer:

测试方式:

1. 检查回复组件的 Emoji 选择功能是否正常即可。

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

```release-note
Console 端的评论回复 Emoji 组件数据改为异步加载,优化整体的加载性能。
```
2022-12-26 06:20:32 +00:00
Ryan Wang b95e6a7613 refactor: layouts of role editing form (halo-dev/console#795)
#### What type of PR is this?

/kind improvement
/milestone 2.1.x

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

重构角色编辑的表单,取消多选项卡的设计。

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

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

#### Screenshots:

![2022-12-23 12 09 52](https://user-images.githubusercontent.com/21301288/209269275-6cb4f729-1549-423f-bd45-74e3241e68a7.gif)

#### Special notes for your reviewer:

测试方式:

1. 测试新建和编辑角色。
2. 检查功能是否符合预期。

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

```release-note
重构 Console 端角色编辑的表单,取消多选项卡的设计。
```
2022-12-26 06:10:31 +00:00
codychau fcfc7113f5
Support MariaDB Native Driver (#2787)
#### What type of PR is this?
/kind improvement


#### What this PR does / why we need it:
引入对R2DBC的MariaDB的支持,增加例子配置

#### Special notes for your reviewer:
现在,Halo可以使用MariaDB数据库原生驱动了,摆脱MySQL驱动带来的连接问题。

- [x] 支持首次启动执行SQL脚本创建表

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

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
支持 MariaDB 数据库连接
```
2022-12-26 04:02:31 +00:00
Ryan Wang 7a9f7dc8f8 perf: automatic refresh of the list of users and roles (halo-dev/console#797)
#### What type of PR is this?

/kind improvement
/milestone 2.1.x

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

优化用户和角色列表,如果包含正在删除的内容会自动刷新。

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

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


#### Special notes for your reviewer:

测试方式:

1. 创建若干角色和用户。
2. 测试删除之后是否会自动刷新列表。

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


```release-note
优化 Console 端的用户和角色列表,如果包含正在删除的内容会自动刷新。
```
2022-12-25 05:04:31 +00:00
Ryan Wang bd79d7f11c refactor: add validation for post and singlePage settings form (halo-dev/console#791)
#### What type of PR is this?

/kind improvement

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

重构文章和自定义页面的设置表单,支持提交时验证表单。

> 因为之前的多选项卡设计导致无法同时验证所有表单,所以这个 PR 重构了表单的布局。

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

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

#### Screenshots:

![2022-12-21 17 23 22](https://user-images.githubusercontent.com/21301288/208870059-5039a565-def2-4622-9a78-de30dceb4d65.gif)

#### Special notes for your reviewer:

测试方式:

1. 测试在内容编辑页面和列表打开文章和自定义页面的设置表单。
2. 检查表单验证是否有效。

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


```release-note
重构 Console 端文章和自定义页面的设置表单布局,支持提交时验证表单。
```
2022-12-24 04:14:30 +00:00
will 3601acfa0a
Upgrade to spring boot 3.0.1 (#3031)
#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
Upgrade to spring boot 3.0.1

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

Fixes #3030 

#### Special notes for your reviewer:

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

```release-note
NONE
```
2022-12-23 03:14:30 +00:00
Ryan Wang 8d8087daf0 perf: improve the layout of the post list (halo-dev/console#789)
#### What type of PR is this?

/kind improvement

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

优化文章管理列表的布局,修复当分类设置过多时的样式问题。

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

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

#### Screenshots:

<img width="717" alt="image" src="https://user-images.githubusercontent.com/21301288/208836747-c6f97d7f-487a-4984-aa54-ee0d3c5b535a.png">

#### Special notes for your reviewer:

测试方式:

1. 添加若干个文字数量较多的分类。
2. 观察文章列表的样式是否有问题。

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

```release-note
优化 Console 端文章管理列表的布局,修复当分类设置过多时的样式问题。
```
2022-12-22 08:42:30 +00:00
chengfeiyue d4e6d52492 Differentiate the title of adding and editing menu and menu item (halo-dev/console#794)
#### What type of PR is this?

/kind improvement

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

新增和修改菜单时,标题都为编辑菜单,存在歧义

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

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

#### Special notes for your reviewer:

测试方式:新增菜单和菜单项。然后再编辑菜单和菜单项,查看title是否一样

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

```release-note
None
```
2022-12-22 08:04:29 +00:00
Ryan Wang be4be851da feat: add support for setting console's favicon (halo-dev/console#788)
#### What type of PR is this?

/kind feature

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

Console 支持使用系统设置中的 Favicon。

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

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

#### Screenshots:

![2022-12-20 19 40 48](https://user-images.githubusercontent.com/21301288/208658754-d62f9d46-7f15-412f-80e2-17fd9729ca8f.gif)


#### Special notes for your reviewer:

测试方式:

1. 进入系统设置。
2. 设置任意一个图片为 Favicon。
3. 观察 Console 的站标是否被修改。

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

```release-note
Console 端支持设置 Favicon
```
2022-12-22 07:58:31 +00:00
Ryan Wang 99b9a35fcb fix: activated theme not loaded after initialization (halo-dev/console#790)
#### What type of PR is this?

/kind bug

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

修复首次初始化之后,Console 没有加载已激活主题的问题。

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

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

#### Special notes for your reviewer:

测试方式:

1. 使用全新的环境
2. 参考 https://docs.halo.run/developer-guide/core/build 构建可执行 JAR。
3. 运行 Halo,初始化之后检查 Console 主题页面是否已经加载了已经激活的主题。

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

```release-note
修复首次初始化之后,Console 没有加载已激活主题的问题。
```
2022-12-22 04:16:30 +00:00
Ryan Wang ea6e0aeda1 feat: add editor extension point (halo-dev/console#781)
#### What type of PR is this?

/kind feature

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

添加编辑器的扩展点,用于扩展集成其他编辑器。

定义一个扩展点的方式:

```ts
export default definePlugin({
  extensionPoints: {
    "editor:create": () => {
      return [
        {
          name: "stackedit",
          displayName: "StackEdit",
          component: markRaw(StackEdit),
          rawType: "markdown",
        },
      ];
    },
  },
});
```

其中 `component` 字段即编辑器组件对象,需要包含 `raw`、`content` 的 prop。

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

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

#### Screenshots:

<img width="1664" alt="image" src="https://user-images.githubusercontent.com/21301288/208406097-60258cba-cff6-436f-bd50-6d8c27ea9a53.png">
<img width="1662" alt="image" src="https://user-images.githubusercontent.com/21301288/208406174-d4649365-3448-4581-a452-f9781502eac6.png">
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/208407570-db10e956-cd6a-4e0d-801e-b794ad0261bc.png">
<img width="1920" alt="image" src="https://user-images.githubusercontent.com/21301288/208407607-fd595957-5278-40c2-a3b5-fb73c1de429c.png">

#### Special notes for your reviewer:

目前可用于测试的插件:

1. [plugin-stackedit-1.0.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/console/files/10258488/plugin-stackedit-1.0.0-SNAPSHOT.jar.zip)
2. [plugin-bytemd-1.0.0-SNAPSHOT.jar.zip](https://github.com/halo-dev/console/files/10258490/plugin-bytemd-1.0.0-SNAPSHOT.jar.zip)

测试方式:

1. Console 需要 `pnpm build:packages`。
2. 在 Console 的插件管理上传以上插件。
3. 新建若干文章,使用不同的编辑器。
4. 检查是否能够正常发布和编辑。
5. 检查编辑的时候,是否正确使用了之前的编辑器。
6. 检查主题端是否渲染正常。

一些实现细节:

1. 为了支持更新文章时能够选择发布时的编辑器,会在 post 的 `metadata.annotations` 添加一条 `content.halo.run/preferred-editor` 用于标记使用的什么编辑器。如果编辑器不存在,会使用 content 的 `rawType` 来匹配。
2. 目前没有全局默认编辑器设置,只能在新建文章的时候选择。

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

```release-note
Console 端支持扩展集成其他编辑器
```
2022-12-22 04:14:29 +00:00
Ryan Wang 934a00a0a8 perf: remove permalink of deleted single page (halo-dev/console#792)
#### What type of PR is this?

/kind improvement

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

移除自定义页面回收站中自定义页面的固定链接跳转入口。

#### Screenshots:

<img width="515" alt="image" src="https://user-images.githubusercontent.com/21301288/209045397-14a63c58-5f9f-49a4-8d4b-ed0e78496cda.png">


#### Special notes for your reviewer:

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


```release-note
None
```
2022-12-22 04:12:30 +00:00
chengfeiyue a7da2c0d76
Support querying sub-categories of any level (#2995)
What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

添加一个方法可以根据分类树的任意一层级的名称查询子树

Which issue(s) this PR fixes:

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

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

```release-note
CategoryFinder 添加根据分类查询子分类树结构的方法
```
2022-12-22 03:56:29 +00:00
John Niang 77da761a13
Persist and archive historical logs (#3021)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.1.x

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

Provide a default configuration for logging system. Default log filename is `${halo.work-dir}/logs/halo.log`.

References:
- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.file-output
- https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.file-rotation

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

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

#### Special notes for your reviewer:

Start Halo and check the log file `${halo.work-dir}/logs/halo.log`.

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

```release-note
持久化并归档历史日志
```
2022-12-21 09:56:29 +00:00
John Niang 082aa309f8
Clean up unnecessary code in GlobalErrorWebExceptionHandler (#3012)
#### What type of PR is this?

/kind cleanup
/area core

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

Because these code has already defined in [here](28f9f20d39/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java (L310-L339)). Printing error twice in development mode is completely unnecessary.

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

```release-note
None
```
2022-12-21 02:18:30 +00:00
guqing 9d6bcdf072
fix: page stats does not subscribe in finder (#3003)
#### What type of PR is this?
/kind bug
/area core
#### What this PR does / why we need it:
修复自定义页面 Finder 中 getByName 方法没有返回访问量的问题
此问题为重构 #2918 时引入。

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

Fixes #2992

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
None
```
2022-12-20 14:56:29 +00:00
Ryan Wang 4b3406237c fix: system settings form could not be loaded (halo-dev/console#787)
#### What type of PR is this?

/kind bug

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

修复系统设置页面切换选项卡无法正常加载表单的问题。

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试系统设置页面的选项卡切换和保存功能。

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

```release-note
修复 Console 端系统设置页面切换选项卡无法正常加载表单的问题。
```
2022-12-20 11:44:29 +00:00
Ryan Wang 654c22081d perf: add more operation feedback prompt (halo-dev/console#785)
#### What type of PR is this?

/kind improvement

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

为部分关键操作添加反馈提示。

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试 Console 端所有页面的操作。
2. 观察是否有反馈。

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

```release-note
完善 Console 端的部分操作反馈提示
```
2022-12-20 11:04:29 +00:00
Ryan Wang ad1f7d484f fix: the flickering issue of tooltip (halo-dev/console#782)
#### What type of PR is this?

/kind improvement

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

修复 `v-tooltip` 指令的元素闪烁问题。

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

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

#### Screenshots:

![2022-12-19 21 52 11](https://user-images.githubusercontent.com/21301288/208441007-2bffe6f6-0b48-4a90-86a0-31ce622f04bf.gif)

#### Special notes for your reviewer:

测试方式:

1. 创建一篇文章,仅保存不发布。
2. 回到文章管理列表,可以看到标题旁边有一个状态点,鼠标移入会显示提示。
3. 观察是否出现闪烁的问题。

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

```release-note
优化 Console 端状态提示的样式
```
2022-12-20 02:25:42 +00:00
will dee496b349
fix: default theme cannot be initialized in the jar distribution (#2991)
#### What type of PR is this?
/kind bug

#### What this PR does / why we need it:
To fix that default earth theme file not found in system initialization.

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

Fixes #2910 

#### Special notes for your reviewer:

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

```release-note
NONE
```
2022-12-19 15:00:16 +00:00
Ryan Wang 9e2d02c1da feat: add support for resetting configmap of plugin and theme (halo-dev/console#777)
#### What type of PR is this?

/kind feature

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

支持重置主题和插件的设置选项。适配 https://github.com/halo-dev/halo/pull/2964

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

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

#### Screenshots:

<img width="366" alt="image" src="https://user-images.githubusercontent.com/21301288/208022668-288fb8c5-ddd1-456c-9633-ec8865f3b1ba.png">

#### Special notes for your reviewer:

测试方式:

1. 安装若干带有设置选项主题和插件。
2. 进入主题和插件设置,改变部分设置并保存。
3. 重置主题和插件的设置,然后进入设置表单,检查是否已经恢复为了默认。

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

```release-note
支持重置主题和插件的设置选项。
```
2022-12-19 08:25:47 +00:00
Ryan Wang ce2e00cbad perf: merge plugin uninstallation options button (halo-dev/console#779)
#### What type of PR is this?

/kind improvement

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

合并卸载插件的选项。

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

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

#### Screenshots:

before:

![image](https://user-images.githubusercontent.com/21301288/208060524-fa9de196-ccd2-43dc-82e7-21eefddec44b.png)


after:

<img width="466" alt="image" src="https://user-images.githubusercontent.com/21301288/208060456-77514178-1935-43f4-9d50-13bc606d5573.png">


#### Special notes for your reviewer:

测试方式:

1. 测试插件卸载的两种选项是否功能正常。

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

```release-note
优化 Console 端的插件卸载选项布局
```
2022-12-19 03:26:10 +00:00
Ryan Wang f98c359428 perf: optimize the operation button style of the entity component (halo-dev/console#780)
#### What type of PR is this?

/kind improvement

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

优化 Entity 组件(数据列表)的操作按钮样式。

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

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

#### Screenshots:

before:

![image](https://user-images.githubusercontent.com/21301288/208065926-9e0fb332-4075-43cf-b75f-4d040c80ccfa.png)


after:

<img width="1658" alt="image" src="https://user-images.githubusercontent.com/21301288/208066185-a48d5f84-e451-4fc7-9eea-b152ddb8db86.png">



#### Special notes for your reviewer:

None

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


```release-note
优化 Console 端数据列表的操作按钮样式
```
2022-12-19 03:10:12 +00:00
guqing 27775c9ac9
feat: add reset config API for theme and plugin (#2964)
#### What type of PR is this?
/kind feature
/kind api-change
/area core

#### What this PR does / why we need it:
为主题和插件提供重置设置项 API

此 PR 会重新读取配置对应的 Setting 资源,从其中读取默认值后更新到现有的 ConfigMap 中替换其 data
see #2789 for more details
#### Which issue(s) this PR fixes:

Fixes #2789

#### Special notes for your reviewer:
how to test it?
1. 在主题设置或插件设置配置一些设置项后保存
2. 执行重置配置
3. 配置恢复为了 Setting 中指定的默认值

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
为主题和插件提供重置设置项 API
```
2022-12-19 02:28:10 +00:00
will efc940df99
fix: not clearing the template engine cache after upgrading the theme (#2970)
#### What type of PR is this?

/kind improvement

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

通过在模板引擎管理器里添加clearCache方法,在升级主题后进行缓存刷新,让新模板内容生效。

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

Fixes #2953 

#### Special notes for your reviewer:

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

```release-note
NONE
```
2022-12-19 02:24:10 +00:00