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": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
} }
} }
} }
@@ -79,7 +79,7 @@ const docTemplate = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/internal_api_v1_cluster.Cluster"
} }
} }
], ],
@@ -87,7 +87,7 @@ const docTemplate = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/internal_api_v1_cluster.Cluster"
} }
} }
} }
@@ -652,7 +652,7 @@ const docTemplate = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
} }
} }
} }
@@ -731,7 +731,7 @@ const docTemplate = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "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": { "cluster.Connect": {
"type": "object", "type": "object",
"properties": { "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": { "cluster.Forward": {
"type": "object", "type": "object",
"properties": { "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": { "imagerepo.Credential": {
"type": "object", "type": "object",
"properties": { "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": { "role.PolicyRule": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -39,7 +39,7 @@
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
} }
} }
} }
@@ -69,7 +69,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/internal_api_v1_cluster.Cluster"
} }
} }
], ],
@@ -77,7 +77,7 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/internal_api_v1_cluster.Cluster"
} }
} }
} }
@@ -642,7 +642,7 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/cluster.Cluster" "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster"
} }
} }
} }
@@ -721,7 +721,7 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "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": { "cluster.Connect": {
"type": "object", "type": "object",
"properties": { "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": { "cluster.Forward": {
"type": "object", "type": "object",
"properties": { "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": { "imagerepo.Credential": {
"type": "object", "type": "object",
"properties": { "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": { "role.PolicyRule": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -30,41 +30,6 @@ definitions:
type: integer type: integer
type: array type: array
type: object 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: cluster.Connect:
properties: properties:
direction: direction:
@@ -81,6 +46,25 @@ definitions:
type: string type: string
type: array type: array
type: object 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: cluster.Forward:
properties: properties:
apiServer: apiServer:
@@ -202,6 +186,41 @@ definitions:
type: string type: string
type: array type: array
type: object 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: imagerepo.Credential:
properties: properties:
password: password:
@@ -303,6 +322,55 @@ definitions:
type: string type: string
type: array type: array
type: object 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: role.PolicyRule:
properties: properties:
resource: resource:
@@ -822,7 +890,7 @@ paths:
description: OK description: OK
schema: schema:
items: items:
$ref: '#/definitions/cluster.Cluster' $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
type: array type: array
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
@@ -839,14 +907,14 @@ paths:
name: request name: request
required: true required: true
schema: schema:
$ref: '#/definitions/cluster.Cluster' $ref: '#/definitions/internal_api_v1_cluster.Cluster'
produces: produces:
- application/json - application/json
responses: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/cluster.Cluster' $ref: '#/definitions/internal_api_v1_cluster.Cluster'
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Create Cluster summary: Create Cluster
@@ -1205,7 +1273,7 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/cluster.Cluster' $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Delete cluster by name summary: Delete cluster by name
@@ -1227,7 +1295,7 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/cluster.Cluster' $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster'
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
summary: Get cluster by name summary: Get cluster by name

View File

@@ -121,9 +121,9 @@ func (e *KubePiServer) setUpRootRoute() {
ctx.Redirect("/kubepi") ctx.Redirect("/kubepi")
}) })
c := swagger.Config{ 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") e.rootRoute = e.app.Party("/kubepi")
} }

View File

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

View File

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