Skip to content

Commit

Permalink
refactor(pages): 重构 API 文档页面布局和功能
Browse files Browse the repository at this point in the history
-移除了 searchConfig 中的 selectFirst 属性
- 调整了 aside 的最小和最大宽度- 重新组织了页面结构,增加了基本属性和详细描述的分离
- 添加了属性、类型和描述的单独展示区域
-增加了翻译内容的展示
- 优化了 markdown 渲染选项
  • Loading branch information
weibaohui committed Jan 12, 2025
1 parent e1acba3 commit 67b1b5f
Show file tree
Hide file tree
Showing 43 changed files with 2,283 additions and 477 deletions.
64 changes: 53 additions & 11 deletions assets/pages/cluster/api_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,28 @@
"searchConfig": {
"sticky": true
},
"selectFirst": true,
"heightAuto": true,
"inputClassName": "no-border no-padder mt-1",
"source": "get:/k8s/doc/gvk/${apiVersion|base64Encode}/$kind",
"onEvent": {
"change": {
"actions": [
{
"componentId": "basic",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
},
{
"componentId": "detail",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}"
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
}
]
Expand All @@ -612,11 +622,16 @@
"body": [
{
"type": "service",
"api": "post:/k8s/doc/detail",
"id": "basic",
"body": [
{
"type": "tpl",
"tpl": "<br><strong>属性:</strong> ${id}",
"visibleOn": "${id}"
},
{
"type": "button",
"label": "${id}-属性用法举例",
"label": "示例",
"level": "link",
"icon": "fas fa-lightbulb text-warning",
"actionType": "drawer",
Expand All @@ -634,20 +649,47 @@
"kind": "${kind}",
"group": "${group}",
"version": "${version}",
"id": "${id}"
"field": "${id}"
}
}
]
}
},
"visibleOn": "${id}"
},
{
"type": "tpl",
"tpl": "<br><strong>类型:</strong> <span class='label label-primary'>${type}</span>",
"visibleOn": "${type}"
},
{
"type": "tpl",
"tpl": "属性:${id}[${type}]<br><br>描述:${description}</br><br>翻译:${translate?translate:''}",
"wrapperComponent": "",
"inline": false
"tpl": "<br><strong>描述:</strong> ${description}",
"visibleOn": "${description}"
}
],
"id": "detail"
]
},
{
"type": "service",
"id": "detail",
"api": "post:/k8s/doc/detail",
"body": [
{
"type": "divider",
"title": "描述翻译",
"titlePosition": "center",
"visibleOn": "${translate}"
},
{
"type": "markdown",
"value": "${translate|raw}",
"options": {
"linkify": true,
"html": true,
"breaks": true
},
"visibleOn": "${translate}"
}
]
}
]
}
Expand Down
64 changes: 53 additions & 11 deletions assets/pages/cluster/cluster_role.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,28 @@
"searchConfig": {
"sticky": true
},
"selectFirst": true,
"heightAuto": true,
"inputClassName": "no-border no-padder mt-1",
"source": "get:/k8s/doc/gvk/${apiVersion|base64Encode}/$kind",
"onEvent": {
"change": {
"actions": [
{
"componentId": "basic",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
},
{
"componentId": "detail",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}"
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
}
]
Expand All @@ -612,11 +622,16 @@
"body": [
{
"type": "service",
"api": "post:/k8s/doc/detail",
"id": "basic",
"body": [
{
"type": "tpl",
"tpl": "<br><strong>属性:</strong> ${id}",
"visibleOn": "${id}"
},
{
"type": "button",
"label": "${id}-属性用法举例",
"label": "示例",
"level": "link",
"icon": "fas fa-lightbulb text-warning",
"actionType": "drawer",
Expand All @@ -634,20 +649,47 @@
"kind": "${kind}",
"group": "${group}",
"version": "${version}",
"id": "${id}"
"field": "${id}"
}
}
]
}
},
"visibleOn": "${id}"
},
{
"type": "tpl",
"tpl": "<br><strong>类型:</strong> <span class='label label-primary'>${type}</span>",
"visibleOn": "${type}"
},
{
"type": "tpl",
"tpl": "属性:${id}[${type}]<br><br>描述:${description}</br><br>翻译:${translate?translate:''}",
"wrapperComponent": "",
"inline": false
"tpl": "<br><strong>描述:</strong> ${description}",
"visibleOn": "${description}"
}
],
"id": "detail"
]
},
{
"type": "service",
"id": "detail",
"api": "post:/k8s/doc/detail",
"body": [
{
"type": "divider",
"title": "描述翻译",
"titlePosition": "center",
"visibleOn": "${translate}"
},
{
"type": "markdown",
"value": "${translate|raw}",
"options": {
"linkify": true,
"html": true,
"breaks": true
},
"visibleOn": "${translate}"
}
]
}
]
}
Expand Down
64 changes: 53 additions & 11 deletions assets/pages/cluster/cluster_role_binding.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,28 @@
"searchConfig": {
"sticky": true
},
"selectFirst": true,
"heightAuto": true,
"inputClassName": "no-border no-padder mt-1",
"source": "get:/k8s/doc/gvk/${apiVersion|base64Encode}/$kind",
"onEvent": {
"change": {
"actions": [
{
"componentId": "basic",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
},
{
"componentId": "detail",
"actionType": "reload",
"data": {
"description": "${event.data.item.description}"
"description": "${event.data.item.description}",
"id": "${event.data.item.id}",
"type": "${event.data.item.type}"
}
}
]
Expand All @@ -612,11 +622,16 @@
"body": [
{
"type": "service",
"api": "post:/k8s/doc/detail",
"id": "basic",
"body": [
{
"type": "tpl",
"tpl": "<br><strong>属性:</strong> ${id}",
"visibleOn": "${id}"
},
{
"type": "button",
"label": "${id}-属性用法举例",
"label": "示例",
"level": "link",
"icon": "fas fa-lightbulb text-warning",
"actionType": "drawer",
Expand All @@ -634,20 +649,47 @@
"kind": "${kind}",
"group": "${group}",
"version": "${version}",
"id": "${id}"
"field": "${id}"
}
}
]
}
},
"visibleOn": "${id}"
},
{
"type": "tpl",
"tpl": "<br><strong>类型:</strong> <span class='label label-primary'>${type}</span>",
"visibleOn": "${type}"
},
{
"type": "tpl",
"tpl": "属性:${id}[${type}]<br><br>描述:${description}</br><br>翻译:${translate?translate:''}",
"wrapperComponent": "",
"inline": false
"tpl": "<br><strong>描述:</strong> ${description}",
"visibleOn": "${description}"
}
],
"id": "detail"
]
},
{
"type": "service",
"id": "detail",
"api": "post:/k8s/doc/detail",
"body": [
{
"type": "divider",
"title": "描述翻译",
"titlePosition": "center",
"visibleOn": "${translate}"
},
{
"type": "markdown",
"value": "${translate|raw}",
"options": {
"linkify": true,
"html": true,
"breaks": true
},
"visibleOn": "${translate}"
}
]
}
]
}
Expand Down
Loading

0 comments on commit 67b1b5f

Please sign in to comment.