aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/swagger-ui/index.html
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 12:35:04 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 12:35:04 +0200
commitf5f13c4f6b6fe3b4d98e349dfd7db59339803436 (patch)
tree72caffc93fab394ffa3b761505775331f1c559b9 /openecomp-be/tools/swagger-ui/index.html
parent451a3400b76511393c62a444f588a4ed15f4a549 (diff)
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/tools/swagger-ui/index.html')
-rw-r--r--openecomp-be/tools/swagger-ui/index.html328
1 files changed, 328 insertions, 0 deletions
diff --git a/openecomp-be/tools/swagger-ui/index.html b/openecomp-be/tools/swagger-ui/index.html
new file mode 100644
index 0000000000..fe0c8ad7c7
--- /dev/null
+++ b/openecomp-be/tools/swagger-ui/index.html
@@ -0,0 +1,328 @@
+<!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-2.0.0.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'))
+ }
+ url += "/api-docs/api.json";
+ log('API URL: ' + url);
+
+ // Pre load translate...
+ if(window.SwaggerTranslator) {
+ window.SwaggerTranslator.translate();
+ }
+ 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);
+ }
+ }
+ });
+ </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 {
+
+ 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;
+ }
+
+ .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>
+ 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);
+ };
+
+ var headersList = document.querySelector('.custom-headers .headers-list');
+ headersList.appendChild(headerItem);
+
+ 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>
+</html>