Commit Graph

4094 Commits (ce9c33c8163a3078aca12f3efaee41401970f7fa)

Author SHA1 Message Date
Ryan Wang 66c1cb69b2 feat: handling front-end plugin loading failure exceptions
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 20:02:52 +08:00
Ryan Wang 28367a0c81 feat: display plugin started error reason
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 19:53:27 +08:00
Ryan Wang c3875c0671 refactor: disabled dashboard widgets responsive option
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 17:41:15 +08:00
Ryan Wang 0a087d3956 refactor: basic components styles
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 16:48:37 +08:00
Ryan Wang a9e4b6018d chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 16:26:26 +08:00
Ryan Wang d0746def44 chore: bump @halo-dev/api-client version
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 13:55:27 +08:00
John Niang 71f9209006
Refine Swagger API with group (#2273)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

1. Add grouped OpenAPI

    <img width="505" alt="image" src="https://user-images.githubusercontent.com/16865714/180638783-acd5f437-b5d0-4701-9ebb-3221540f167c.png">

3. Enable basic authentication on API endpoints.

    ```bash
    curl -s -u admin:iY4PcvZLN4Dm0woV --basic 'http://localhost:8090/api/v1alpha1/users'
    ```

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

```release-note
None
```
2022-07-25 04:24:10 +00:00
Ryan Wang 88b64c985c feat: add base url config support
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 11:23:46 +08:00
Ryan Wang 20612642e8 chore: update the base url of the plugin resources
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-25 10:41:24 +08:00
Ryan Wang f130c8769e perf: retrieve the plugin before updating its status
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-24 22:15:30 +08:00
Ryan Wang e7022a072b feat: add support for uploading plugins (halo-dev/console#590)
Signed-off-by: Ryan Wang <i@ryanc.cc>

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?

<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind optimization

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

/kind feature
/milestone 2.0

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

添加上传插件的支持。

see https://github.com/halo-dev/halo/pull/2271

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

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
None

#### Screenshots:

<img width="1156" alt="image" src="https://user-images.githubusercontent.com/21301288/180416186-49c56971-c0b9-4761-ae9e-8531e433a9c0.png">
<img width="1156" alt="image" src="https://user-images.githubusercontent.com/21301288/180416203-e4b35266-3645-497b-9d08-d6407b2dd7f7.png">


<!--
如果此 PR 有 UI 的改动,最好截图说明这个 PR 的改动。
If there are UI changes to this PR, it is best to take a screenshot to illustrate the changes to this PR.

eg.

Before:

![screenshot-before](https://user-images.githubusercontent.com/screenshot.png)

After:

![screenshot-after](https://user-images.githubusercontent.com/screenshot.png)
-->

#### Special notes for your reviewer:

可以使用以下插件仓库中 Actions 构建的 JAR 测试:

- https://github.com/halo-sigs/plugin-links/actions
- https://github.com/halo-sigs/plugin-meilisearch/actions
- https://github.com/halo-sigs/plugin-template/actions

/cc @halo-dev/sig-halo-admin 
/cc @halo-dev/sig-halo 

#### 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
None
```
2022-07-23 12:42:13 +00:00
guqing d85c83bf6e
refactor: plugin components finder to avoid cannot be started after installing the plugin (#2272)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind improvement
/milestone 2.0
/area core
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
使用 SpringComponentsFinder 覆盖 pf4j 默认实现的插件组件类缓存逻辑,以解决插件安装后缓存没有更新导致插件类加载不正确问题
原问题浮现步骤:
1. 先删除插件目录的所有插件
2. 通过接口上传一个插件`apis/api.halo.run/v1alpha1/plugins/install`
3. 启动它
4. 再上传另一个插件并启动它就会发现这个插件无法启动

现在修复过后可以重复测试上述步骤并观察日志显示的插件组件是否被正确加载,再此之前你可能需要配置以下日志级别
```
logging:
  level:
    org.pf4j.AbstractExtensionFinder: DEBUG
```
启动插件时观察这样的日志是否符合预期:
```
r.h.app.plugin.SpringComponentsFinder    : Read 'META-INF/plugin-components.idx'
org.pf4j.AbstractExtensionFinder         : Found possible 2 extensions:
org.pf4j.AbstractExtensionFinder         :    run.halo.template.TemplatePlugin
org.pf4j.AbstractExtensionFinder         :    run.halo.template.ApplesController
r.h.app.plugin.SpringComponentsFinder    : Load [2] component names into storage cache for plugin [PluginTemplate].
```
可以结合此 PR 上传插件进行测试 https://github.com/halo-dev/halo-admin/pull/590
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### 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
None
```
2022-07-23 12:40:10 +00:00
Ryan Wang b737637a21 refactor: UserEditingModal component
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-22 21:37:27 +08:00
John Niang 0b4b1c321b
Provide an endpoint to install plugin using Jar file (#2271)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

Provide an endpoint to install plugin using Jar file.

#### Special notes for your reviewer:

Currently, you could login and open the swagger ui to test against this feature.

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

```release-note
None
```
2022-07-22 10:11:51 +00:00
Ryan Wang 51c87c1519 feat: user editing support using yaml
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-22 17:04:30 +08:00
Ryan Wang e218818a59 feat: add codemirror component
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-22 16:12:28 +08:00
Ryan Wang c5d0656608 feat: show the number of permissions under the role
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-22 12:49:06 +08:00
John Niang 4cb94d3752
Upgrade Spring Boot to 3.0.0-M4 (#2269)
#### What type of PR is this?

/kind flake
/area core
/milestone 2.0

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

Upgrade Spring Boot to 3.0.0-M4. Please see <https://github.com/spring-projects/spring-boot/releases/tag/v3.0.0-M4>.

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

```release-note
None
```
2022-07-22 03:13:50 +00:00
Ryan Wang d90838f4cb chore: bump packages version
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-21 15:10:46 +08:00
Ryan Wang 5862db903f perf: improve user detail page style
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-21 15:03:30 +08:00
John Niang 50932fc2a9
Refactor deletion of Extension in Extension client (#2267)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0

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

Do not delete directly when invoking ExtensionClient#delete. We just flag it by setting metadata.deletionTimestamp.

The rest should be done by garbage collector.

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

```release-note
None
```
2022-07-21 06:29:52 +00:00
Ryan Wang 0b0220e30d fix: @halo-dev/shared packages import location
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-21 14:26:55 +08:00
Ryan Wang 1a3492bd1e refactor: plugin detail page
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-21 14:16:51 +08:00
Ryan Wang 6e3ebacd8e feat: create labels and annotations enumeration types
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 22:47:10 +08:00
Ryan Wang e3b5abc529 chore: update themes data mock
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 16:54:20 +08:00
Ryan Wang 931c0eb8be feat: add plugin status tooltip
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 15:51:21 +08:00
Ryan Wang 3ab60a4bbf feat: plugin details support display of included roles
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 15:24:35 +08:00
guqing bb0b5b26e2
feat: add plugin initial resource cleanup when plugin stop (#2262)
* refactor: the way of plugin extension update

* feat: add plugin initial resource cleanup when plugin stop

* refactor: remove role delete watcher
2022-07-20 14:35:24 +08:00
guqing ba20f71504
feat: add role templates for system (#2260)
* feat: add role templates for system

* fix: permissions manage config

* feat: add hidden labels

* feat: add ui permissions for role template

* fix: user password change definition
2022-07-20 14:35:07 +08:00
Ryan Wang eaf64c5bc2 perf: refine basic layout component styles
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 14:28:33 +08:00
Ryan Wang a1774ded3d fix: role page route on the user details page
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 12:33:38 +08:00
Ryan Wang 6400f8593e fix: production api url env
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 11:46:48 +08:00
Ryan Wang 15b8aed601 Merge branch 'next' of github.com:halo-dev/halo-admin into next 2022-07-20 10:57:30 +08:00
Ryan Wang a5b13f7d4c feat: add set api url support
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-20 10:56:40 +08:00
John Niang 9ed0dcafcc
Change image name to halo-dev (#2264) 2022-07-19 23:47:36 +08:00
John Niang d7743d149a Refactor GitHub workflow configuration (halo-dev/console#589) 2022-07-19 19:31:11 +08:00
John Niang b1586f3cdd Add dockerignore file to ignore node_modules folder while building docker image (halo-dev/console#588)
#### What type of PR is this?

/kind optimization
/milestone 2.0

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

As I mentioned in the title, this PR mainly ignore the `node_modules` folder while copying current files into Docker daemon context. Because it is huge and unnecessary. Please see the size below:

```bash
--- /home/johnniang/workspaces/halo-dev/halo-admin ------------------------------------
  736.4 MiB S 388.8 MiB [###################] /node_modules
   12.2 MiB             [                   ] /.git
  892.0 KiB             [                   ] /packages
  616.0 KiB             [                   ] /src
  292.0 KiB             [                   ]  pnpm-lock.yaml
   48.0 KiB             [                   ] /cypress
   40.0 KiB             [                   ] /.github
   36.0 KiB             [                   ]  LICENSE
   20.0 KiB             [                   ] /.husky
   16.0 KiB             [                   ] /.changeset
   12.0 KiB             [                   ] /public
```

- Before

    ```bash
    Sending build context to Docker daemon  740MB
    Step 1/15 : FROM node:lts-alpine as build-stage
     ---> b0cbdedc1b9d
    Step 2/15 : ENV PNPM_VERSION 7.5.0
     ---> Using cache
     ---> 6184c581a0af
    Step 3/15 : RUN apk --no-cache add curl
     ---> Using cache
     ---> 74b030c17e7b
    Step 4/15 : RUN curl -sL https://unpkg.com/@pnpm/self-installer | node
    ```

- After

    ```bash
    Sending build context to Docker daemon  12.59MB
    Step 1/15 : FROM node:lts-alpine as build-stage
     ---> b0cbdedc1b9d
    Step 2/15 : ENV PNPM_VERSION 7.5.0
     ---> Using cache
     ---> 6184c581a0af
    Step 3/15 : RUN apk --no-cache add curl
     ---> Using cache
     ---> 74b030c17e7b
    Step 4/15 : RUN curl -sL https://unpkg.com/@pnpm/self-installer | node
    ```

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

```release-note
None
```
2022-07-19 07:50:05 +00:00
Ryan Wang 8cd7091d04 fix: package import name of lodash.isequal
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 15:41:39 +08:00
Ryan Wang e7dcdd46f1 chore: update github actions
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 15:36:44 +08:00
Ryan Wang 3744d2b731 chore: fix @halo-dev/api-client dependency location
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 15:08:20 +08:00
Ryan Wang 64b8619bca fix: the issue of redirection after login
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 14:56:30 +08:00
Ryan Wang 99ad35e97f docs: update readme
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 14:11:45 +08:00
Ryan Wang ca4e4bbeae feat: ui permission binding
see https://github.com/halo-dev/halo/pull/2260
2022-07-19 14:07:28 +08:00
Ryan Wang 1cded7a581 feat: refine roles management
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 11:41:05 +08:00
Ryan Wang 84e4cae994 feat: refine roles management
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-19 11:18:47 +08:00
guqing 275df33d75
refactor: scanning of the jsBundleRule for plugins (#2249)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
重构 JsBundle 获取方式,增加对 js entry 的文件校验如果不存在,则启用插件时不生成反向代理 APIs
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### 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
None
```
2022-07-18 14:42:04 +00:00
Ryan Wang 82d966cba6 perf: add type support to usePluginStore
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-18 16:12:54 +08:00
Ryan Wang c15330f1e8 chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-18 12:35:34 +08:00
Ryan Wang 0f3b17baa9 chore: cleanup type definition
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-18 12:23:14 +08:00
John Niang 1571b9bcf8
Add an API to change password of user (#2250)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

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

This PR provides an API to change password of user. If the username is equal to `-`, we will change the password of current login user. Otherwise, we update the password according the request URI.

Here is an example:

- Request

```bash
curl -X 'PUT' \
  'http://localhost:8090/apis/api.halo.run/v1alpha1/users/-/password' \
  -H 'accept: */*' \
  -H 'Content-Type: */*' \
  -d '{
  "password": "openhalo"
}'
```

- Response

```json
{
  "spec": {
    "displayName": "Administrator",
    "email": "admin@halo.run",
    "password": "{bcrypt}$2a$10$/v8/nbxoUFGBDoWfOF2NHOHk.2RS0OFfS5AtN2g/mCGjScX19KvSG",
    "registeredAt": "2022-07-15T07:50:25.151513387Z",
    "twoFactorAuthEnabled": false,
    "disabled": false
  },
  "apiVersion": "v1alpha1",
  "kind": "User",
  "metadata": {
    "name": "admin",
    "annotations": {
      "rbac.authorization.halo.run/role-names": "[\"super-role\"]"
    },
    "version": 5,
    "creationTimestamp": "2022-07-15T07:50:25.255909669Z"
  }
}
```
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Special notes for your reviewer:

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

```release-note
None
```
2022-07-18 04:18:11 +00:00