feat : 修改 swagger-ui 的路径

This commit is contained in:
wangzhengkun
2022-06-14 14:46:36 +08:00
parent 86136d7c54
commit e9269e706d
6 changed files with 434 additions and 160 deletions

View File

@@ -49,7 +49,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -79,7 +79,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/internal_api_v1_cluster.Cluster"
}
}
],
@@ -87,7 +87,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/internal_api_v1_cluster.Cluster"
}
}
}
@@ -652,7 +652,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -731,7 +731,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -1484,59 +1484,6 @@ const docTemplate = `{
}
}
},
"cluster.Cluster": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"cluster.Connect": {
"type": "object",
"properties": {
@@ -1562,6 +1509,35 @@ const docTemplate = `{
}
}
},
"cluster.ExtraClusterInfo": {
"type": "object",
"properties": {
"cpuAllocatable": {
"type": "number"
},
"cpuRequested": {
"type": "number"
},
"health": {
"type": "boolean"
},
"memoryAllocatable": {
"type": "number"
},
"memoryRequested": {
"type": "number"
},
"message": {
"type": "string"
},
"readyNodeNum": {
"type": "integer"
},
"totalNodeNum": {
"type": "integer"
}
}
},
"cluster.Forward": {
"type": "object",
"properties": {
@@ -1749,6 +1725,59 @@ const docTemplate = `{
}
}
},
"github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"imagerepo.Credential": {
"type": "object",
"properties": {
@@ -1902,6 +1931,80 @@ const docTemplate = `{
}
}
},
"internal_api_v1_cluster.Cluster": {
"type": "object",
"properties": {
"accessable": {
"type": "boolean"
},
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"caDataStr": {
"type": "string"
},
"certDataStr": {
"type": "string"
},
"configContentStr": {
"type": "string"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"extraClusterInfo": {
"$ref": "#/definitions/cluster.ExtraClusterInfo"
},
"keyDataStr": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"memberCount": {
"type": "integer"
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"role.PolicyRule": {
"type": "object",
"properties": {

View File

@@ -39,7 +39,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -69,7 +69,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/internal_api_v1_cluster.Cluster"
}
}
],
@@ -77,7 +77,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/internal_api_v1_cluster.Cluster"
}
}
}
@@ -642,7 +642,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -721,7 +721,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cluster.Cluster"
"$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
}
}
}
@@ -1474,59 +1474,6 @@
}
}
},
"cluster.Cluster": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"cluster.Connect": {
"type": "object",
"properties": {
@@ -1552,6 +1499,35 @@
}
}
},
"cluster.ExtraClusterInfo": {
"type": "object",
"properties": {
"cpuAllocatable": {
"type": "number"
},
"cpuRequested": {
"type": "number"
},
"health": {
"type": "boolean"
},
"memoryAllocatable": {
"type": "number"
},
"memoryRequested": {
"type": "number"
},
"message": {
"type": "string"
},
"readyNodeNum": {
"type": "integer"
},
"totalNodeNum": {
"type": "integer"
}
}
},
"cluster.Forward": {
"type": "object",
"properties": {
@@ -1739,6 +1715,59 @@
}
}
},
"github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"imagerepo.Credential": {
"type": "object",
"properties": {
@@ -1892,6 +1921,80 @@
}
}
},
"internal_api_v1_cluster.Cluster": {
"type": "object",
"properties": {
"accessable": {
"type": "boolean"
},
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"caCertificate": {
"$ref": "#/definitions/cluster.Certificate"
},
"caDataStr": {
"type": "string"
},
"certDataStr": {
"type": "string"
},
"configContentStr": {
"type": "string"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"extraClusterInfo": {
"$ref": "#/definitions/cluster.ExtraClusterInfo"
},
"keyDataStr": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"memberCount": {
"type": "integer"
},
"name": {
"type": "string"
},
"privateKey": {
"type": "array",
"items": {
"type": "integer"
}
},
"spec": {
"$ref": "#/definitions/cluster.Spec"
},
"status": {
"$ref": "#/definitions/cluster.Status"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"role.PolicyRule": {
"type": "object",
"properties": {

View File

@@ -30,41 +30,6 @@ definitions:
type: integer
type: array
type: object
cluster.Cluster:
properties:
apiVersion:
type: string
builtIn:
type: boolean
caCertificate:
$ref: '#/definitions/cluster.Certificate'
createAt:
type: string
createdBy:
type: string
description:
type: string
kind:
type: string
labels:
items:
type: string
type: array
name:
type: string
privateKey:
items:
type: integer
type: array
spec:
$ref: '#/definitions/cluster.Spec'
status:
$ref: '#/definitions/cluster.Status'
updateAt:
type: string
uuid:
type: string
type: object
cluster.Connect:
properties:
direction:
@@ -81,6 +46,25 @@ definitions:
type: string
type: array
type: object
cluster.ExtraClusterInfo:
properties:
cpuAllocatable:
type: number
cpuRequested:
type: number
health:
type: boolean
memoryAllocatable:
type: number
memoryRequested:
type: number
message:
type: string
readyNodeNum:
type: integer
totalNodeNum:
type: integer
type: object
cluster.Forward:
properties:
apiServer:
@@ -202,6 +186,41 @@ definitions:
type: string
type: array
type: object
github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster:
properties:
apiVersion:
type: string
builtIn:
type: boolean
caCertificate:
$ref: '#/definitions/cluster.Certificate'
createAt:
type: string
createdBy:
type: string
description:
type: string
kind:
type: string
labels:
items:
type: string
type: array
name:
type: string
privateKey:
items:
type: integer
type: array
spec:
$ref: '#/definitions/cluster.Spec'
status:
$ref: '#/definitions/cluster.Status'
updateAt:
type: string
uuid:
type: string
type: object
imagerepo.Credential:
properties:
password:
@@ -303,6 +322,55 @@ definitions:
type: string
type: array
type: object
internal_api_v1_cluster.Cluster:
properties:
accessable:
type: boolean
apiVersion:
type: string
builtIn:
type: boolean
caCertificate:
$ref: '#/definitions/cluster.Certificate'
caDataStr:
type: string
certDataStr:
type: string
configContentStr:
type: string
createAt:
type: string
createdBy:
type: string
description:
type: string
extraClusterInfo:
$ref: '#/definitions/cluster.ExtraClusterInfo'
keyDataStr:
type: string
kind:
type: string
labels:
items:
type: string
type: array
memberCount:
type: integer
name:
type: string
privateKey:
items:
type: integer
type: array
spec:
$ref: '#/definitions/cluster.Spec'
status:
$ref: '#/definitions/cluster.Status'
updateAt:
type: string
uuid:
type: string
type: object
role.PolicyRule:
properties:
resource:
@@ -822,7 +890,7 @@ paths:
description: OK
schema:
items:
$ref: '#/definitions/cluster.Cluster'
$ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
type: array
security:
- ApiKeyAuth: []
@@ -839,14 +907,14 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/cluster.Cluster'
$ref: '#/definitions/internal_api_v1_cluster.Cluster'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/cluster.Cluster'
$ref: '#/definitions/internal_api_v1_cluster.Cluster'
security:
- ApiKeyAuth: []
summary: Create Cluster
@@ -1205,7 +1273,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/cluster.Cluster'
$ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
security:
- ApiKeyAuth: []
summary: Delete cluster by name
@@ -1227,7 +1295,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/cluster.Cluster'
$ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
security:
- ApiKeyAuth: []
summary: Get cluster by name

View File

@@ -121,9 +121,9 @@ func (e *KubePiServer) setUpRootRoute() {
ctx.Redirect("/kubepi")
})
c := swagger.Config{
URL: "/swagger/doc.json",
URL: "/kubepi/swagger/doc.json",
}
e.app.Get("/swagger/{any:path}", swagger.CustomWrapHandler(&c, swaggerFiles.Handler))
e.app.Get("/kubepi/swagger/{any:path}", swagger.CustomWrapHandler(&c, swaggerFiles.Handler))
e.rootRoute = e.app.Party("/kubepi")
}

View File

@@ -58,7 +58,7 @@ export default {
window.open("https://kubeoperator.io/docs/kubepi/", "_blank")
break
case "api":
window.open("/swagger/index.html", "_blank");
window.open("/kubepi/swagger/index.html", "_blank");
break
default:
this.aboutDialogVisible = true

View File

@@ -35,7 +35,7 @@ export default {
},
methods: {
openApi(){
window.open("/swagger/index.html", "_blank");
window.open("/kubepi/swagger/index.html", "_blank");
}
},
computed: {