Skip to content

Add some apis for group obtain theme configurations and setting items

Created by: guqing

What this PR does?

  • 支持分组获取主题设置表单配置项和值
  • 支持根据主题id查询主题所有分组名称 合并后 SDK需要在admin-apiThemeClient中添加这三个接口对应的方法

Why we need it?

如果设置项过多,可能会导致渲染卡顿,因为目前是将所有设置项表单都渲染出来。如果能通过分组名按需调用设置项, 则可以有效改善此问题 相关Issue 主题设置项列表根据 group 获取

How to test it?

安装一个halo并测试三个接口的功能是否符合期望值,以默认主题caicai_anatole 为例调用三接口期望值如下:

  1. /api/admin/themes/caicai_anatole/configurations/groups/sns
{
    "status": 200,
    "message": "OK",
    "devMessage": null,
    "data": [
        {
            "name": "rss",
            "label": "RSS",
            "type": "RADIO",
            "dataType": "BOOL",
            "defaultValue": true,
            "placeholder": "",
            "description": "",
            "options": [
                {
                    "label": "开启",
                    "value": true
                },
                {
                    "label": "关闭",
                    "value": false
                }
            ]
        },
        {
            "name": "twitter",
            "label": "Twitter",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Twitter 用户名即可",
            "description": "",
            "options": []
        },
        {
            "name": "facebook",
            "label": "Facebook",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Facebook 用户名即可",
            "description": "",
            "options": []
        },
        {
            "name": "instagram",
            "label": "Instagram",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Instagram 用户名即可",
            "description": "",
            "options": []
        },
        {
            "name": "dribbble",
            "label": "Dribbble",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Dribbble 用户名即可",
            "description": "",
            "options": []
        },
        {
            "name": "weibo",
            "label": "微博",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入微博 Id 即可",
            "description": "",
            "options": []
        },
        {
            "name": "email",
            "label": "Email",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入邮箱地址即可",
            "description": "",
            "options": []
        },
        {
            "name": "github",
            "label": "Github",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Github 用户名即可",
            "description": "",
            "options": []
        },
        {
            "name": "qq",
            "label": "QQ",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 QQ 号即可",
            "description": "",
            "options": []
        },
        {
            "name": "telegram",
            "label": "Telegram",
            "type": "TEXT",
            "dataType": "STRING",
            "defaultValue": null,
            "placeholder": "只需填入 Telegram Id 即可",
            "description": "",
            "options": []
        }
    ]
}
  1. /api/admin/themes/caicai_anatole/groups/sns/settings
{
    "status": 200,
    "message": "OK",
    "devMessage": null,
    "data": {
        "rss": true
    }
}
  1. /api/admin/themes/caicai_anatole/configurations/groups
{
    "status": 200,
    "message": "OK",
    "devMessage": null,
    "data": [
        "sns",
        "style"
    ]
}

合并请求报告

加载中