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: add annotation setting extension #3028

Merged
merged 8 commits into from
Dec 26, 2022
Merged

Conversation

guqing
Copy link
Member

@guqing guqing commented Dec 22, 2022

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?

新增 AnnotationSetting 以扩展自定义元数据设置表单

@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/core Issues or PRs related to the Halo Core labels Dec 22, 2022
@f2c-ci-robot f2c-ci-robot bot added this to the 2.1.x milestone Dec 22, 2022
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 22, 2022

@guqing: The label(s) kind/feature/ cannot be applied, because the repository doesn't have them.

In response to this:

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 在插件停止时会被删除

/cc @halo-dev/sig-halo

Does this PR introduce a user-facing change?

新增 AnnotationSetting 以扩展自定义元数据设置表单

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@guqing
Copy link
Member Author

guqing commented Dec 22, 2022

/kind feature

@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 22, 2022
@guqing guqing changed the title [WIP] feat: add annotation setting extension feat: add annotation setting extension Dec 26, 2022
@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 Dec 26, 2022
@ruibaby
Copy link
Member

ruibaby commented Dec 26, 2022

等待这个 PR 合并之后,期望可以添加一些内置的。目前我能想到的是菜单项还缺少 icon 和 target 的设置,可以默认提供一下。

Copy link
Member

@ruibaby ruibaby 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 Dec 26, 2022
@f2c-ci-robot f2c-ci-robot bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2022
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 Dec 26, 2022
Copy link
Member

@ruibaby ruibaby 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 Dec 26, 2022
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang, ruibaby

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 ddf47f6 into halo-dev:main Dec 26, 2022
@ruibaby ruibaby modified the milestones: 2.1.x, 2.1.0 Dec 26, 2022
f2c-ci-robot bot pushed a commit to halo-dev/console that referenced this pull request Dec 26, 2022
#### 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 halo-dev/halo#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. 后端需要使用 halo-dev/halo#3028
4. 测试为文章设置 Annotations 和自定义的 Annotations。
5. 检查是否可以设置正常。


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

```release-note
文章设置支持设置元数据。
```
f2c-ci-robot bot pushed a commit to halo-dev/console that referenced this pull request Dec 26, 2022
#### 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 是对 #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. 后端需要使用 halo-dev/halo#3028
4. 测试上述提到的模型的 Annotations 表单。
5. 检查是否可以设置正常。

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

```release-note
None
```
JohnNiang pushed a commit to JohnNiang/halo that referenced this pull request Mar 2, 2023
…lo-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 halo-dev#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. 后端需要使用 halo-dev#3028
4. 测试为文章设置 Annotations 和自定义的 Annotations。
5. 检查是否可以设置正常。


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

```release-note
文章设置支持设置元数据。
```
JohnNiang pushed a commit to JohnNiang/halo that referenced this pull request Mar 2, 2023
#### 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 是对 halo-dev/console#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. 后端需要使用 halo-dev#3028
4. 测试上述提到的模型的 Annotations 表单。
5. 检查是否可以设置正常。

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

```release-note
None
```
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/core Issues or PRs related to the Halo Core 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