summaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/swagger-ui/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/tools/swagger-ui/index.html')
-rw-r--r--openecomp-be/tools/swagger-ui/index.html368
1 files changed, 53 insertions, 315 deletions
diff --git a/openecomp-be/tools/swagger-ui/index.html b/openecomp-be/tools/swagger-ui/index.html
index fc8c48ceea..2aefcd2fb5 100644
--- a/openecomp-be/tools/swagger-ui/index.html
+++ b/openecomp-be/tools/swagger-ui/index.html
@@ -1,328 +1,66 @@
+<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>API Docs</title>
- <link rel="SHORTCUT ICON" href="images/favicon.ico"/>
- <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
- <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
- <!--Custom: Take from application\frontend\nfv-client\dist\optimize\resources\nfv\css\style.css-->
- <link href='css/ncso-style.css' rel='stylesheet' type='text/css'/>
- <!--/Custom: Take from application\frontend\nfv-client\dist\optimize\resources\nfv\css\style.css-->
-
- <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
- <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
- <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
- <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
- <script src='lib/handlebars-4.7.7.js' type='text/javascript'></script>
- <script src='lib/underscore-min.js' type='text/javascript'></script>
- <script src='lib/backbone-min.js' type='text/javascript'></script>
- <script src='swagger-ui.js' type='text/javascript'></script>
- <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
- <script src='lib/marked.js' type='text/javascript'></script>
- <script src='lib/swagger-oauth.js' type='text/javascript'></script>
-
- <!-- Some basic translations -->
- <!-- <script src='lang/translator.js' type='text/javascript'></script> -->
- <!-- <script src='lang/ru.js' type='text/javascript'></script> -->
- <!-- <script src='lang/en.js' type='text/javascript'></script> -->
-
- <script type="text/javascript">
- $(function () {
- var url = window.location.protocol + "//" + window.location.host;
- if (window.location.pathname.indexOf('/api-docs') > 0) {
- url += window.location.pathname.substring(0, window.location.pathname.indexOf('/api-docs'))
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>API Docs</title>
+ <link rel="stylesheet" type="text/css" href="./css/swagger-ui.css" />
+ <link rel="icon" type="image/png" href="./images/favicon-32x32.png" sizes="32x32" />
+ <link rel="icon" type="image/png" href="./images/favicon-16x16.png" sizes="16x16" />
+ <style>
+ html
+ {
+ box-sizing: border-box;
+ overflow: -moz-scrollbars-vertical;
+ overflow-y: scroll;
}
- url += "/api-docs/api.json";
- log('API URL: ' + url);
- // Pre load translate...
- if(window.SwaggerTranslator) {
- window.SwaggerTranslator.translate();
+ *,
+ *:before,
+ *:after
+ {
+ box-sizing: inherit;
}
- window.swaggerUi = new SwaggerUi({
- url: url,
- dom_id: "swagger-ui-container",
- supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
- onComplete: function(swaggerApi, swaggerUi){
- if(typeof initOAuth == "function") {
- initOAuth({
- clientId: "your-client-id",
- clientSecret: "your-client-secret",
- realm: "your-realms",
- appName: "your-app-name",
- scopeSeparator: ","
- });
- }
- if(window.SwaggerTranslator) {
- window.SwaggerTranslator.translate();
- }
-
- $('pre code').each(function(i, e) {
- hljs.highlightBlock(e)
- });
-
- },
- onFailure: function(data) {
- log("Unable to Load SwaggerUI");
- },
- docExpansion: "none",
- apisSorter: "alpha",
- showRequestHeaders: false
- });
-
-
- window.swaggerUi.load();
-
- function log() {
- if ('console' in window) {
- console.log.apply(console, arguments);
- }
+ body
+ {
+ margin:0;
+ background: #fafafa;
}
- });
- </script>
-
- <!-- Hide the swagger io -->
- <style>
- .footer a, .footer img{
- display: none !important;
- }
</style>
-</head>
-
-<body class="swagger-section">
-
-<!--NCSO script-->
-<script>
-
- //SET TITLE - START
- function pollData() {
- if(!(document.querySelector('#api_info .info_title') && document.querySelector('#api_info .info_title').innerText)) {
- setTimeout(pollData, 50);
- }
- else {
- setData();
- }
- }
-
- function setData() {
- document.querySelector('[data-uxf-point="main-title"]').innerText = document.querySelector('#api_info .info_title').innerText;
- document.querySelector('#api_info .info_title').innerText = '';
- }
-
- pollData();
- //SET TITLE - END
-
- var __LOGIN_REST_STATUS = {OPEN: 'OPEN', SEND: 'SEND'};
- var __loginPath = '/auth/tokens', __isLoginInProcess, __xAuthToken;
-
- function isAuthanticationRest(path) {
- return path.endsWith(__loginPath);
- }
-
- //Proxy requests - START
-
- //Proxy Open Method
- (function() {
- var proxiedOpen = window.XMLHttpRequest.prototype.open;
- window.XMLHttpRequest.prototype.open = function(method, path) {
- if(isAuthanticationRest(path)) {
- __isLoginInProcess = true;
- }
- else {
- __isLoginInProcess = false;
- }
- return proxiedOpen.apply(this, Array.prototype.slice.call(arguments));
- };
- })();
-
- //Proxy Send Method - X-AUTH-STUFF
- (function() {
- var proxiedSend = window.XMLHttpRequest.prototype.send;
- window.XMLHttpRequest.prototype.send = function() {
- if(__isLoginInProcess) {
- proxyAuthanticationCallback(this);
- }
- return proxiedSend.apply(this, Array.prototype.slice.call(arguments));
- };
- })();
-
- //Proxy Authantication Callback Method - X-AUTH-STUFF
- function proxyAuthanticationCallback(xhrObject) {
- var proxy = xhrObject.onreadystatechange;
- xhrObject.onreadystatechange = function() {
- if (xhrObject.readyState == 4) {
- if(xhrObject.status == 200 || xhrObject.status == 401) {
- window.swaggerUi.api.clientAuthorizations.remove('X-AUTH-TOKEN');
- if(xhrObject.status == 200) {
- var key = xhrObject.getResponseHeader('x-auth-token');
- if(key && key.trim() != "") {
- var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("X-AUTH-TOKEN", key, "header");
- window.swaggerUi.api.clientAuthorizations.add("X-AUTH-TOKEN", apiKeyAuth);
- console.log("added x-auth-key ", key);
- }
- }
- }
- }
- return proxy.apply(xhrObject, Array.prototype.slice.call(arguments));
- }
- }
-
- //Proxy Send Method - CUSTOM HEADERS STUFF
- (function () {
- var proxiedSend = window.XMLHttpRequest.prototype.send;
- window.XMLHttpRequest.prototype.send = function () {
- var headerItems = document.querySelectorAll('.custom-headers .headers-list .header-item');
- if (headerItems) {
- Array.prototype.forEach.call(headerItems, function (header) {
- var headerName = header.querySelector('.header-name').value;
- var headerValue = header.querySelector('.header-value').value;
- if (headerName && headerValue) {
- this.setRequestHeader(headerName, headerValue);
- }
- }, this);
- }
- return proxiedSend.apply(this, Array.prototype.slice.call(arguments));
- };
- })();
-
- //Proxy requests - END
-
-</script>
-
-<div data-uxf-point="nfv-header" class="nfv-header">
- <div class="header-content-wrapper">
- <div data-uxf-point="nfv-logo" class="nfv-logo"><a href="../ncso/landingpage.html">VENDOR</a></div>
- <div data-uxf-point="header-title" class="header-title">
- <div data-uxf-point="main-title" class="main-title"></div>
- <div data-uxf-point="version-controller" class="version-select"></div>
- <div data-uxf-point="sub-title" class="sub-title"></div>
- </div>
- </div>
-</div>
-
-<div class="custom-headers">
- <style>
- .custom-headers {
- margin-left: 124px;
- width: 500px;
- border: 1px solid #419EF1;
- }
-
- .custom-headers .headers-title {
- background-color: #0F6AB4;
- height: 24px;
- color: white;
- text-align: center;
- font-size: 1.2em;
- }
-
- .custom-headers .headers-list .header-item {
- display: flex;
- justify-content: space-around;
- padding: 10px 5px 0 5px;
- }
-
- .custom-headers .headers-list .header-item.default-item .header-col.header-delete {
- visibility: hidden;
- }
-
- .custom-headers .headers-list .header-item.default-item .header-col.header-name {
- pointer-events: none;
- }
-
- .custom-headers .headers-list .header-item .header-col.header-delete {
- cursor: pointer;
- align-self: center;
- }
-
- .custom-headers .add-header {
- text-align: right;
- padding: 5px;
- border-top: 1px solid #0F6AB4;
- margin-top: 10px;
- background-color: #E7F6EC;
- }
-
- .custom-headers .add-header .add-header-button, .custom-headers .add-header .reset-header-button {
+ </head>
- text-decoration: none;
- color: white;
- display: inline-block;
- width: 50px;
- font-size: 0.9em;
- text-align: center;
- padding: 7px 0 4px;
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- -o-border-radius: 2px;
- -ms-border-radius: 2px;
- -khtml-border-radius: 2px;
- border-radius: 2px;
- background-color: #0f6ab4;
- cursor: pointer;
- }
+ <body>
+ <div id="swagger-ui"></div>
- .custom-headers .add-header .reset-header-button {
-
- }
- </style>
- <div class="headers-title">Custom Headers</div>
- <div class="headers-list">
- <!--Dynamically add headers using addHeaderItem function-->
- </div>
- <div class="add-header">
- <span class="reset-header-button" onclick="resetHeaderItems();">Reset</span>
- <span class="add-header-button" onclick="addHeaderItem();">Add</span>
- </div>
+ <script src="./lib/swagger-ui-bundle.js" charset="UTF-8"> </script>
+ <script src="./lib/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
- function addHeaderItem(defaultName, defaultValue) {
-
- var headerItemName = document.createElement('input');
- headerItemName.type = 'text';
- headerItemName.value = defaultName || '';
- headerItemName.classList.add('header-col', 'header-name');
-
- var headerItemValue = document.createElement('input');
- headerItemValue.type = 'text';
- headerItemValue.value = defaultValue || '';
- headerItemValue.classList.add('header-col', 'header-value');
-
- var headerItemDelete = document.createElement('div');
- headerItemDelete.innerHTML = '&#10006;';
- headerItemDelete.classList.add('header-col', 'header-delete');
-
- var headerItem = document.createElement('div');
- headerItem.classList.add('header-item');
- headerItem.appendChild(headerItemName);
- headerItem.appendChild(headerItemValue);
- headerItem.appendChild(headerItemDelete);
-
- headerItemDelete.onclick = function () {
- headersList.removeChild(headerItem);
- };
+ window.onload = function() {
+ let url = window.location.protocol + "//" + window.location.host;
+ if (window.location.pathname.indexOf('/api-docs') > 0) {
+ url += window.location.pathname.substring(0, window.location.pathname.indexOf('/api-docs'))
+ }
+ url += "/api-docs/swagger-sdce-1.json";
- var headersList = document.querySelector('.custom-headers .headers-list');
- headersList.appendChild(headerItem);
+ // Begin Swagger UI call region
+ const ui = SwaggerUIBundle({
+ url: url,
+ dom_id: '#swagger-ui',
+ deepLinking: true,
+ presets: [
+ SwaggerUIBundle.presets.apis,
+ SwaggerUIStandalonePreset
+ ],
+ plugins: [
+ SwaggerUIBundle.plugins.DownloadUrl
+ ],
+ layout: "StandaloneLayout"
+ });
+ // End Swagger UI call region
- return headerItem;
- }
- function resetHeaderItems() {
- var headersList = document.querySelector('.custom-headers .headers-list');
- while (headersList.firstChild) {
- headersList.removeChild(headersList.firstChild);
- }
- var defaultHeaderItem = addHeaderItem('USER_ID');
- defaultHeaderItem.classList.add('default-item');
- }
- resetHeaderItems();
- </script>
-</div>
-<div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
-<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
-</body>
+ window.ui = ui;
+ };
+ </script>
+ </body>
</html>