Skip to content

Commit 2db6723

Browse files
committed
Merge branch '123-docs-update-swagger-ui' into 'master'
chore: update SwaggerUI specs and dist (docs#123) Closes #123 See merge request postgres-ai/database-lab!632
2 parents f069ae4 + da08065 commit 2db6723

20 files changed

+266
-69
lines changed

engine/.gitlab-ci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,15 @@ build-image-rc-client:
397397
DOCKER_FILE: "Dockerfile.dblab-cli"
398398
DOCKER_NAME: "postgresai/dblab"
399399

400-
build-image-swagger-latest:
400+
build-image-swagger-release:
401401
<<: *build_image_definition
402402
<<: *only_tag_release
403403
variables:
404404
DOCKER_FILE: "Dockerfile.swagger-ui"
405-
DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
405+
DOCKER_IMAGE_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
406406
before_script:
407407
- export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
408-
- export LATEST_TAG=$(echo ${CLEAN_TAG%.*}-latest)
409-
- export TAGS="${DOCKER_NAME}:${LATEST_TAG}"
408+
- export TAGS="${DOCKER_IMAGE_NAME}:${CLEAN_TAG}"
410409

411410
.bash-test: &bash_test
412411
stage: integration-test
@@ -483,3 +482,24 @@ integration-test:
483482
script:
484483
- cd engine
485484
- make test-ci-integration
485+
486+
## Deploy
487+
.deploy-definition: &deploy_definition
488+
stage: deploy
489+
image: dtzar/helm-kubectl:2.14.1
490+
script:
491+
- bash ./engine/scripts/do.sh subs_envs ./engine/deploy/swagger-ui.yaml /tmp/swagger-ui.yaml
492+
- kubectl apply --filename /tmp/swagger-ui.yaml -n $NAMESPACE
493+
494+
deploy-swagger-ui-tag-release:
495+
<<: *only_tag_release
496+
<<: *deploy_definition
497+
environment:
498+
name: production
499+
variables:
500+
ENV: production
501+
NAMESPACE: production
502+
DOCKER_IMAGE_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
503+
before_script:
504+
- export CLEAN_TAG=$(echo ${CI_COMMIT_TAG#"v"})
505+
- export TAG="${DOCKER_IMAGE_NAME}:${CLEAN_TAG}"

engine/api/swagger-spec/dblab_server_swagger.yaml

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
swagger: "2.0"
22
info:
33
description: "This is a Database Lab Engine sample server."
4-
version: "2.5.0"
5-
title: "Database Lab"
4+
version: "3.2.0"
5+
title: "Database Lab Engine API"
66
contact:
77
88
license:
@@ -461,6 +461,30 @@ paths:
461461
schema:
462462
$ref: "#/definitions/Error"
463463

464+
/instance/retrieval:
465+
get:
466+
tags:
467+
- "instance"
468+
summary: "Report state of retrieval subsystem"
469+
description: ""
470+
operationId: "instanceRetrieval"
471+
produces:
472+
- "application/json"
473+
parameters:
474+
- in: header
475+
name: Verification-Token
476+
type: string
477+
required: true
478+
responses:
479+
200:
480+
description: "Successful operation"
481+
schema:
482+
$ref: "#/definitions/Retrieving"
483+
500:
484+
description: "Internal server error"
485+
schema:
486+
$ref: "#/definitions/Error"
487+
464488
/healthz:
465489
get:
466490
tags:
@@ -592,6 +616,30 @@ paths:
592616
schema:
593617
$ref: "#/definitions/Error"
594618

619+
/admin/ws-auth:
620+
post:
621+
tags:
622+
- "config"
623+
summary: "Test source database"
624+
description: ""
625+
operationId: "testDBConnection"
626+
consumes:
627+
- "application/json"
628+
parameters:
629+
- in: header
630+
name: Verification-Token
631+
type: string
632+
required: true
633+
responses:
634+
200:
635+
description: "Successful operation"
636+
schema:
637+
$ref: "#/definitions/WSToken"
638+
500:
639+
description: "Internal server error"
640+
schema:
641+
$ref: "#/definitions/Error"
642+
595643
definitions:
596644
Instance:
597645
type: "object"
@@ -710,6 +758,34 @@ definitions:
710758
nextRefresh:
711759
type: "string"
712760
format: "date-time"
761+
activity:
762+
$ref: "#/definitions/Activity"
763+
764+
Activity:
765+
type: "object"
766+
properties:
767+
source:
768+
type: "array"
769+
items:
770+
$ref: "#/definitions/PGActivityEvent"
771+
target:
772+
type: "array"
773+
items:
774+
$ref: "#/definitions/PGActivityEvent"
775+
776+
PGActivityEvent:
777+
type: "object"
778+
properties:
779+
user:
780+
type: "string"
781+
query:
782+
type: "string"
783+
duration:
784+
type: "number"
785+
waitEventType:
786+
type: "string"
787+
waitEvent:
788+
type: "string"
713789

714790
Provisioner:
715791
type: "object"
@@ -1020,6 +1096,17 @@ definitions:
10201096
type: "string"
10211097
password:
10221098
type: "string"
1099+
db_list:
1100+
type: "array"
1101+
items:
1102+
type: "string"
1103+
1104+
WSToken:
1105+
type: "object"
1106+
properties:
1107+
token:
1108+
type: "string"
1109+
description: "WebSocket token"
10231110

10241111

10251112
externalDocs:

engine/api/swagger-ui/index.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
html {
2+
box-sizing: border-box;
3+
overflow: -moz-scrollbars-vertical;
4+
overflow-y: scroll;
5+
}
6+
7+
*,
8+
*:before,
9+
*:after {
10+
box-sizing: inherit;
11+
}
12+
13+
body {
14+
margin: 0;
15+
background: #fafafa;
16+
}

engine/api/swagger-ui/index.html

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,15 @@
55
<meta charset="UTF-8">
66
<title>Swagger UI</title>
77
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
8+
<link rel="stylesheet" type="text/css" href="index.css" />
89
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
910
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
10-
<style>
11-
html
12-
{
13-
box-sizing: border-box;
14-
overflow: -moz-scrollbars-vertical;
15-
overflow-y: scroll;
16-
}
17-
18-
*,
19-
*:before,
20-
*:after
21-
{
22-
box-sizing: inherit;
23-
}
24-
25-
body
26-
{
27-
margin:0;
28-
background: #fafafa;
29-
}
30-
</style>
3111
</head>
3212

3313
<body>
3414
<div id="swagger-ui"></div>
35-
3615
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
3716
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
38-
<script>
39-
window.onload = function() {
40-
// Begin Swagger UI call region
41-
const ui = SwaggerUIBundle({
42-
url: "api/swagger-spec/dblab_server_swagger.yaml",
43-
dom_id: '#swagger-ui',
44-
deepLinking: true,
45-
presets: [
46-
SwaggerUIBundle.presets.apis,
47-
SwaggerUIStandalonePreset
48-
],
49-
plugins: [
50-
SwaggerUIBundle.plugins.DownloadUrl
51-
],
52-
layout: "StandaloneLayout"
53-
});
54-
// End Swagger UI call region
55-
56-
window.ui = ui;
57-
};
58-
</script>
17+
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
5918
</body>
6019
</html>

engine/api/swagger-ui/oauth2-redirect.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
var isValid, qp, arr;
1414

1515
if (/code|token|error/.test(window.location.hash)) {
16-
qp = window.location.hash.substring(1);
16+
qp = window.location.hash.substring(1).replace('?', '&');
1717
} else {
1818
qp = location.search.substring(1);
1919
}
@@ -38,7 +38,7 @@
3838
authId: oauth2.auth.name,
3939
source: "auth",
4040
level: "warning",
41-
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
41+
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
4242
});
4343
}
4444

@@ -58,7 +58,7 @@
5858
authId: oauth2.auth.name,
5959
source: "auth",
6060
level: "error",
61-
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
61+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
6262
});
6363
}
6464
} else {
@@ -67,9 +67,13 @@
6767
window.close();
6868
}
6969

70-
window.addEventListener('DOMContentLoaded', function () {
71-
run();
72-
});
70+
if (document.readyState !== 'loading') {
71+
run();
72+
} else {
73+
document.addEventListener('DOMContentLoaded', function () {
74+
run();
75+
});
76+
}
7377
</script>
7478
</body>
7579
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
window.onload = function() {
2+
//<editor-fold desc="Changeable Configuration Block">
3+
4+
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
5+
window.ui = SwaggerUIBundle({
6+
url: "api/swagger-spec/dblab_server_swagger.yaml",
7+
dom_id: '#swagger-ui',
8+
deepLinking: true,
9+
presets: [
10+
SwaggerUIBundle.presets.apis,
11+
SwaggerUIStandalonePreset
12+
],
13+
plugins: [
14+
SwaggerUIBundle.plugins.DownloadUrl
15+
],
16+
layout: "StandaloneLayout"
17+
});
18+
19+
//</editor-fold>
20+
};

engine/api/swagger-ui/swagger-ui-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/api/swagger-ui/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/api/swagger-ui/swagger-ui-es-bundle-core.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/api/swagger-ui/swagger-ui-es-bundle-core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)