From dc0d36184ce49b1bdb55964e48b811b436f92a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Fri, 11 Sep 2020 12:49:33 +0200 Subject: [PATCH] refs meta#143 swagger-ui + omorganisering --- .gitlab-ci.yml | 5 +-- api_static/{ => api}/index.html | 4 +-- api_static/api/swagger-ui.html | 60 +++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 6 deletions(-) rename api_static/{ => api}/index.html (58%) create mode 100644 api_static/api/swagger-ui.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee9ee0ae..147fc00b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,10 +28,7 @@ deploy: --capabilities CAPABILITY_IAM - aws s3 rm "s3://${STACK_NAME}.aws.uib.no" --recursive - aws s3 sync dist/ "s3://${STACK_NAME}.aws.uib.no" --delete - - aws s3api put-object --bucket "${STACK_NAME}.aws.uib.no" - --key api/index.html - --body api_static/index.html - --content-type "text/html;charset=UTF-8" + - aws s3 sync api-static/ "s3://${STACK_NAME}.aws.uib.no" --delete - DISTRO_ID=$(aws cloudformation describe-stack-resource --stack-name ${STACK_NAME} --logical-resource-id Distribution diff --git a/api_static/index.html b/api_static/api/index.html similarity index 58% rename from api_static/index.html rename to api_static/api/index.html index bb54903f..7a003537 100644 --- a/api_static/index.html +++ b/api_static/api/index.html @@ -1,4 +1,3 @@ -<! <!DOCTYPE html> <!DOCTYPE html> <html lang="en" dir="ltr"> <head> @@ -6,6 +5,7 @@ <title></title> </head> <body> - Halloen! + <h1>Beta - REST-API for ordbok.uib.no</h1> + <a href="swagger-ui.html">Utforsk APIen</a> </body> </html> diff --git a/api_static/api/swagger-ui.html b/api_static/api/swagger-ui.html new file mode 100644 index 00000000..e2a0e175 --- /dev/null +++ b/api_static/api/swagger-ui.html @@ -0,0 +1,60 @@ +<!-- HTML for static distribution bundle build --> +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> + <title>Swagger UI</title> + <link rel="stylesheet" type="text/css" href="https://unpkg.com/browse/swagger-ui-dist@3.23.5/swagger-ui.css" > + <link rel="icon" type="image/png" href="https://unpkg.com/browse/swagger-ui-dist@3.23.5/favicon-32x32.png" sizes="32x32" /> + <link rel="icon" type="image/png" href="https://unpkg.com/browse/swagger-ui-dist@3.23.5/favicon-16x16.png" sizes="16x16" /> + <style> + html + { + box-sizing: border-box; + overflow: -moz-scrollbars-vertical; + overflow-y: scroll; + } + + *, + *:before, + *:after + { + box-sizing: inherit; + } + + body + { + margin:0; + background: #fafafa; + } + </style> + </head> + + <body> + <div id="swagger-ui"></div> + + <script src="https://unpkg.com/browse/swagger-ui-dist@3.23.5/swagger-ui-bundle.js"> </script> + <script src="https://unpkg.com/browse/swagger-ui-dist@3.23.5/swagger-ui-standalone-preset.js"> </script> + <script> + window.onload = function() { + // Begin Swagger UI call region + const ui = SwaggerUIBundle({ + url: "./swagger.json", + dom_id: '#swagger-ui', + deepLinking: true, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl + ], + layout: "StandaloneLayout" + }) + // End Swagger UI call region + + window.ui = ui + } + </script> + </body> +</html> -- GitLab