Michael Lando | f5f13c4 | 2017-02-19 12:35:04 +0200 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <title>API Docs</title> |
| 6 | <link rel="SHORTCUT ICON" href="images/favicon.ico"/> |
| 7 | <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> |
| 8 | <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> |
| 9 | <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> |
| 10 | <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> |
| 11 | <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/> |
| 12 | <!--Custom: Take from application\frontend\nfv-client\dist\optimize\resources\nfv\css\style.css--> |
| 13 | <link href='css/ncso-style.css' rel='stylesheet' type='text/css'/> |
| 14 | <!--/Custom: Take from application\frontend\nfv-client\dist\optimize\resources\nfv\css\style.css--> |
| 15 | |
| 16 | <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script> |
| 17 | <script src='lib/jquery.slideto.min.js' type='text/javascript'></script> |
| 18 | <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script> |
| 19 | <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script> |
| 20 | <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script> |
| 21 | <script src='lib/underscore-min.js' type='text/javascript'></script> |
| 22 | <script src='lib/backbone-min.js' type='text/javascript'></script> |
| 23 | <script src='swagger-ui.js' type='text/javascript'></script> |
| 24 | <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script> |
| 25 | <script src='lib/marked.js' type='text/javascript'></script> |
| 26 | <script src='lib/swagger-oauth.js' type='text/javascript'></script> |
| 27 | |
| 28 | <!-- Some basic translations --> |
| 29 | <!-- <script src='lang/translator.js' type='text/javascript'></script> --> |
| 30 | <!-- <script src='lang/ru.js' type='text/javascript'></script> --> |
| 31 | <!-- <script src='lang/en.js' type='text/javascript'></script> --> |
| 32 | |
| 33 | <script type="text/javascript"> |
| 34 | $(function () { |
| 35 | var url = window.location.protocol + "//" + window.location.host; |
| 36 | if (window.location.pathname.indexOf('/api-docs') > 0) { |
| 37 | url += window.location.pathname.substring(0, window.location.pathname.indexOf('/api-docs')) |
| 38 | } |
| 39 | url += "/api-docs/api.json"; |
| 40 | log('API URL: ' + url); |
| 41 | |
| 42 | // Pre load translate... |
| 43 | if(window.SwaggerTranslator) { |
| 44 | window.SwaggerTranslator.translate(); |
| 45 | } |
| 46 | window.swaggerUi = new SwaggerUi({ |
| 47 | url: url, |
| 48 | dom_id: "swagger-ui-container", |
| 49 | supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], |
| 50 | onComplete: function(swaggerApi, swaggerUi){ |
| 51 | if(typeof initOAuth == "function") { |
| 52 | initOAuth({ |
| 53 | clientId: "your-client-id", |
| 54 | clientSecret: "your-client-secret", |
| 55 | realm: "your-realms", |
| 56 | appName: "your-app-name", |
| 57 | scopeSeparator: "," |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | if(window.SwaggerTranslator) { |
| 62 | window.SwaggerTranslator.translate(); |
| 63 | } |
| 64 | |
| 65 | $('pre code').each(function(i, e) { |
| 66 | hljs.highlightBlock(e) |
| 67 | }); |
| 68 | |
| 69 | }, |
| 70 | onFailure: function(data) { |
| 71 | log("Unable to Load SwaggerUI"); |
| 72 | }, |
| 73 | docExpansion: "none", |
| 74 | apisSorter: "alpha", |
| 75 | showRequestHeaders: false |
| 76 | }); |
| 77 | |
| 78 | |
| 79 | window.swaggerUi.load(); |
| 80 | |
| 81 | function log() { |
| 82 | if ('console' in window) { |
| 83 | console.log.apply(console, arguments); |
| 84 | } |
| 85 | } |
| 86 | }); |
| 87 | </script> |
| 88 | |
| 89 | <!-- Hide the swagger io --> |
| 90 | <style> |
| 91 | .footer a, .footer img{ |
| 92 | display: none !important; |
| 93 | } |
| 94 | </style> |
| 95 | </head> |
| 96 | |
| 97 | <body class="swagger-section"> |
| 98 | |
| 99 | <!--NCSO script--> |
| 100 | <script> |
| 101 | |
| 102 | //SET TITLE - START |
| 103 | function pollData() { |
| 104 | if(!(document.querySelector('#api_info .info_title') && document.querySelector('#api_info .info_title').innerText)) { |
| 105 | setTimeout(pollData, 50); |
| 106 | } |
| 107 | else { |
| 108 | setData(); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | function setData() { |
| 113 | document.querySelector('[data-uxf-point="main-title"]').innerText = document.querySelector('#api_info .info_title').innerText; |
| 114 | document.querySelector('#api_info .info_title').innerText = ''; |
| 115 | } |
| 116 | |
| 117 | pollData(); |
| 118 | //SET TITLE - END |
| 119 | |
| 120 | var __LOGIN_REST_STATUS = {OPEN: 'OPEN', SEND: 'SEND'}; |
| 121 | var __loginPath = '/auth/tokens', __isLoginInProcess, __xAuthToken; |
| 122 | |
| 123 | function isAuthanticationRest(path) { |
| 124 | return path.endsWith(__loginPath); |
| 125 | } |
| 126 | |
| 127 | //Proxy requests - START |
| 128 | |
| 129 | //Proxy Open Method |
| 130 | (function() { |
| 131 | var proxiedOpen = window.XMLHttpRequest.prototype.open; |
| 132 | window.XMLHttpRequest.prototype.open = function(method, path) { |
| 133 | if(isAuthanticationRest(path)) { |
| 134 | __isLoginInProcess = true; |
| 135 | } |
| 136 | else { |
| 137 | __isLoginInProcess = false; |
| 138 | } |
| 139 | return proxiedOpen.apply(this, Array.prototype.slice.call(arguments)); |
| 140 | }; |
| 141 | })(); |
| 142 | |
| 143 | //Proxy Send Method - X-AUTH-STUFF |
| 144 | (function() { |
| 145 | var proxiedSend = window.XMLHttpRequest.prototype.send; |
| 146 | window.XMLHttpRequest.prototype.send = function() { |
| 147 | if(__isLoginInProcess) { |
| 148 | proxyAuthanticationCallback(this); |
| 149 | } |
| 150 | return proxiedSend.apply(this, Array.prototype.slice.call(arguments)); |
| 151 | }; |
| 152 | })(); |
| 153 | |
| 154 | //Proxy Authantication Callback Method - X-AUTH-STUFF |
| 155 | function proxyAuthanticationCallback(xhrObject) { |
| 156 | var proxy = xhrObject.onreadystatechange; |
| 157 | xhrObject.onreadystatechange = function() { |
| 158 | if (xhrObject.readyState == 4) { |
| 159 | if(xhrObject.status == 200 || xhrObject.status == 401) { |
| 160 | window.swaggerUi.api.clientAuthorizations.remove('X-AUTH-TOKEN'); |
| 161 | if(xhrObject.status == 200) { |
| 162 | var key = xhrObject.getResponseHeader('x-auth-token'); |
| 163 | if(key && key.trim() != "") { |
| 164 | var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("X-AUTH-TOKEN", key, "header"); |
| 165 | window.swaggerUi.api.clientAuthorizations.add("X-AUTH-TOKEN", apiKeyAuth); |
| 166 | console.log("added x-auth-key ", key); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | return proxy.apply(xhrObject, Array.prototype.slice.call(arguments)); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | //Proxy Send Method - CUSTOM HEADERS STUFF |
| 176 | (function () { |
| 177 | var proxiedSend = window.XMLHttpRequest.prototype.send; |
| 178 | window.XMLHttpRequest.prototype.send = function () { |
| 179 | var headerItems = document.querySelectorAll('.custom-headers .headers-list .header-item'); |
| 180 | if (headerItems) { |
| 181 | Array.prototype.forEach.call(headerItems, function (header) { |
| 182 | var headerName = header.querySelector('.header-name').value; |
| 183 | var headerValue = header.querySelector('.header-value').value; |
| 184 | if (headerName && headerValue) { |
| 185 | this.setRequestHeader(headerName, headerValue); |
| 186 | } |
| 187 | }, this); |
| 188 | } |
| 189 | return proxiedSend.apply(this, Array.prototype.slice.call(arguments)); |
| 190 | }; |
| 191 | })(); |
| 192 | |
| 193 | //Proxy requests - END |
| 194 | |
| 195 | </script> |
| 196 | |
| 197 | <div data-uxf-point="nfv-header" class="nfv-header"> |
| 198 | <div class="header-content-wrapper"> |
| 199 | <div data-uxf-point="nfv-logo" class="nfv-logo"><a href="../ncso/landingpage.html">VENDOR</a></div> |
| 200 | <div data-uxf-point="header-title" class="header-title"> |
| 201 | <div data-uxf-point="main-title" class="main-title"></div> |
| 202 | <div data-uxf-point="version-controller" class="version-select"></div> |
| 203 | <div data-uxf-point="sub-title" class="sub-title"></div> |
| 204 | </div> |
| 205 | </div> |
| 206 | </div> |
| 207 | |
| 208 | <div class="custom-headers"> |
| 209 | <style> |
| 210 | .custom-headers { |
| 211 | margin-left: 124px; |
| 212 | width: 500px; |
| 213 | border: 1px solid #419EF1; |
| 214 | } |
| 215 | |
| 216 | .custom-headers .headers-title { |
| 217 | background-color: #0F6AB4; |
| 218 | height: 24px; |
| 219 | color: white; |
| 220 | text-align: center; |
| 221 | font-size: 1.2em; |
| 222 | } |
| 223 | |
| 224 | .custom-headers .headers-list .header-item { |
| 225 | display: flex; |
| 226 | justify-content: space-around; |
| 227 | padding: 10px 5px 0 5px; |
| 228 | } |
| 229 | |
| 230 | .custom-headers .headers-list .header-item.default-item .header-col.header-delete { |
| 231 | visibility: hidden; |
| 232 | } |
| 233 | |
| 234 | .custom-headers .headers-list .header-item.default-item .header-col.header-name { |
| 235 | pointer-events: none; |
| 236 | } |
| 237 | |
| 238 | .custom-headers .headers-list .header-item .header-col.header-delete { |
| 239 | cursor: pointer; |
| 240 | align-self: center; |
| 241 | } |
| 242 | |
| 243 | .custom-headers .add-header { |
| 244 | text-align: right; |
| 245 | padding: 5px; |
| 246 | border-top: 1px solid #0F6AB4; |
| 247 | margin-top: 10px; |
| 248 | background-color: #E7F6EC; |
| 249 | } |
| 250 | |
| 251 | .custom-headers .add-header .add-header-button, .custom-headers .add-header .reset-header-button { |
| 252 | |
| 253 | text-decoration: none; |
| 254 | color: white; |
| 255 | display: inline-block; |
| 256 | width: 50px; |
| 257 | font-size: 0.9em; |
| 258 | text-align: center; |
| 259 | padding: 7px 0 4px; |
| 260 | -moz-border-radius: 2px; |
| 261 | -webkit-border-radius: 2px; |
| 262 | -o-border-radius: 2px; |
| 263 | -ms-border-radius: 2px; |
| 264 | -khtml-border-radius: 2px; |
| 265 | border-radius: 2px; |
| 266 | background-color: #0f6ab4; |
| 267 | cursor: pointer; |
| 268 | } |
| 269 | |
| 270 | .custom-headers .add-header .reset-header-button { |
| 271 | |
| 272 | } |
| 273 | </style> |
| 274 | <div class="headers-title">Custom Headers</div> |
| 275 | <div class="headers-list"> |
| 276 | <!--Dynamically add headers using addHeaderItem function--> |
| 277 | </div> |
| 278 | <div class="add-header"> |
| 279 | <span class="reset-header-button" onclick="resetHeaderItems();">Reset</span> |
| 280 | <span class="add-header-button" onclick="addHeaderItem();">Add</span> |
| 281 | </div> |
| 282 | <script> |
| 283 | function addHeaderItem(defaultName, defaultValue) { |
| 284 | |
| 285 | var headerItemName = document.createElement('input'); |
| 286 | headerItemName.type = 'text'; |
| 287 | headerItemName.value = defaultName || ''; |
| 288 | headerItemName.classList.add('header-col', 'header-name'); |
| 289 | |
| 290 | var headerItemValue = document.createElement('input'); |
| 291 | headerItemValue.type = 'text'; |
| 292 | headerItemValue.value = defaultValue || ''; |
| 293 | headerItemValue.classList.add('header-col', 'header-value'); |
| 294 | |
| 295 | var headerItemDelete = document.createElement('div'); |
| 296 | headerItemDelete.innerHTML = '✖'; |
| 297 | headerItemDelete.classList.add('header-col', 'header-delete'); |
| 298 | |
| 299 | var headerItem = document.createElement('div'); |
| 300 | headerItem.classList.add('header-item'); |
| 301 | headerItem.appendChild(headerItemName); |
| 302 | headerItem.appendChild(headerItemValue); |
| 303 | headerItem.appendChild(headerItemDelete); |
| 304 | |
| 305 | headerItemDelete.onclick = function () { |
| 306 | headersList.removeChild(headerItem); |
| 307 | }; |
| 308 | |
| 309 | var headersList = document.querySelector('.custom-headers .headers-list'); |
| 310 | headersList.appendChild(headerItem); |
| 311 | |
| 312 | return headerItem; |
| 313 | } |
| 314 | function resetHeaderItems() { |
| 315 | var headersList = document.querySelector('.custom-headers .headers-list'); |
| 316 | while (headersList.firstChild) { |
| 317 | headersList.removeChild(headersList.firstChild); |
| 318 | } |
| 319 | var defaultHeaderItem = addHeaderItem('USER_ID'); |
| 320 | defaultHeaderItem.classList.add('default-item'); |
| 321 | } |
| 322 | resetHeaderItems(); |
| 323 | </script> |
| 324 | </div> |
| 325 | <div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div> |
| 326 | <div id="swagger-ui-container" class="swagger-ui-wrap"></div> |
| 327 | </body> |
| 328 | </html> |