mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Updating swagger-ui code to the latest version and removing the 'Try it out' buttons
This commit is contained in:
parent
0474c49b07
commit
6684d962df
20130
pkg/ui/datafile.go
20130
pkg/ui/datafile.go
File diff suppressed because one or more lines are too long
1
third_party/swagger-ui/README.md
vendored
1
third_party/swagger-ui/README.md
vendored
@ -16,6 +16,7 @@ https://github.com/swagger-api/swagger-ui#how-to-use-it
|
||||
- Updated the url to "../../swaggerapi" as per instructions at:
|
||||
https://github.com/swagger-api/swagger-ui#how-to-use-it
|
||||
- Modified swagger-ui.js to list resources and operations in sorted order.
|
||||
- Set supportedSubmitMethods: [] in index.html to remove "Try it out" buttons.
|
||||
|
||||
LICENSE file has been created for compliance purposes.
|
||||
Not included in original distribution.
|
||||
|
34
third_party/swagger-ui/css/screen.css
vendored
34
third_party/swagger-ui/css/screen.css
vendored
@ -294,7 +294,13 @@
|
||||
.swagger-section .swagger-ui-wrap .message-fail {
|
||||
color: #cc0000;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_contact {
|
||||
.swagger-section .swagger-ui-wrap .info_url {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_email {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_description {
|
||||
@ -391,6 +397,32 @@
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper {
|
||||
border-spacing: 0;
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #bbbbbb;
|
||||
display: none;
|
||||
font-size: 11px;
|
||||
max-width: 400px;
|
||||
line-height: 30px;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th {
|
||||
text-align: center;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #bbbbbb;
|
||||
font-size: 11px;
|
||||
color: #666666;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
line-height: 15px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName {
|
||||
font-weight: bold;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .model-signature .propName {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
13
third_party/swagger-ui/index.html
vendored
13
third_party/swagger-ui/index.html
vendored
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<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'/>
|
||||
@ -12,13 +12,13 @@
|
||||
<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-1.0.0.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='lib/swagger.js' type='text/javascript'></script>
|
||||
<script src='lib/swagger-client.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>
|
||||
|
||||
<!-- enabling this will enable oauth2 implicit scope support -->
|
||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||
@ -26,16 +26,15 @@
|
||||
$(function () {
|
||||
var url = window.location.search.match(/url=([^&]+)/);
|
||||
if (url && url.length > 1) {
|
||||
url = url[1];
|
||||
url = decodeURIComponent(url[1]);
|
||||
} else {
|
||||
url = "../../swaggerapi/";
|
||||
url = "../../swaggerapi";
|
||||
}
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
url: url,
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
supportedSubmitMethods: [],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
log("Loaded SwaggerUI");
|
||||
if(typeof initOAuth == "function") {
|
||||
/*
|
||||
initOAuth({
|
||||
|
51
third_party/swagger-ui/lib/backbone-min.js
vendored
51
third_party/swagger-ui/lib/backbone-min.js
vendored
File diff suppressed because one or more lines are too long
6
third_party/swagger-ui/lib/shred.bundle.js
vendored
6
third_party/swagger-ui/lib/shred.bundle.js
vendored
@ -1723,7 +1723,7 @@ var zlib = null;
|
||||
try {
|
||||
zlib = require('zlib');
|
||||
} catch (e) {
|
||||
console.warn("no zlib library");
|
||||
// console.warn("no zlib library");
|
||||
}
|
||||
|
||||
// Iconv doesn't work in browser
|
||||
@ -1731,7 +1731,7 @@ var Iconv = null;
|
||||
try {
|
||||
Iconv = require('iconv-lite');
|
||||
} catch (e) {
|
||||
console.warn("no iconv library");
|
||||
// console.warn("no iconv library");
|
||||
}
|
||||
|
||||
// Construct a `Response` object. You should never have to do this directly. The
|
||||
@ -2207,7 +2207,7 @@ module.exports = {
|
||||
constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
|
||||
constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
|
||||
constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
2155
third_party/swagger-ui/lib/swagger-client.js
vendored
2155
third_party/swagger-ui/lib/swagger-client.js
vendored
File diff suppressed because it is too large
Load Diff
48
third_party/swagger-ui/lib/swagger-oauth.js
vendored
48
third_party/swagger-ui/lib/swagger-oauth.js
vendored
@ -3,6 +3,7 @@ var popupMask;
|
||||
var popupDialog;
|
||||
var clientId;
|
||||
var realm;
|
||||
var oauth2KeyName;
|
||||
|
||||
function handleLogin() {
|
||||
var scopes = [];
|
||||
@ -14,6 +15,7 @@ function handleLogin() {
|
||||
for(key in defs) {
|
||||
var auth = defs[key];
|
||||
if(auth.type === 'oauth2' && auth.scopes) {
|
||||
oauth2KeyName = key;
|
||||
var scope;
|
||||
if(Array.isArray(auth.scopes)) {
|
||||
// 1.2 support
|
||||
@ -86,6 +88,7 @@ function handleLogin() {
|
||||
popupDialog = [];
|
||||
});
|
||||
|
||||
$('button.api-popup-authbtn').unbind();
|
||||
popupDialog.find('button.api-popup-authbtn').click(function() {
|
||||
popupMask.hide();
|
||||
popupDialog.hide();
|
||||
@ -98,10 +101,13 @@ function handleLogin() {
|
||||
|
||||
for (var key in authSchemes) {
|
||||
if (authSchemes.hasOwnProperty(key)) {
|
||||
if(authSchemes[key].type === 'oauth2' && authSchemes[key].flow === 'implicit') {
|
||||
var flow = authSchemes[key].flow;
|
||||
|
||||
if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
|
||||
var dets = authSchemes[key];
|
||||
url = dets.authorizationUrl + '?response_type=token';
|
||||
window.swaggerUi.tokenName = dets.tokenUrl || 'access_token';
|
||||
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
|
||||
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
|
||||
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
|
||||
}
|
||||
else if(authSchemes[key].grantTypes) {
|
||||
// 1.2 support
|
||||
@ -113,6 +119,12 @@ function handleLogin() {
|
||||
url = dets.loginEndpoint.url + '?response_type=token';
|
||||
window.swaggerUi.tokenName = dets.tokenName;
|
||||
}
|
||||
else if (o.hasOwnProperty(t) && t === 'accessCode') {
|
||||
var dets = o[t];
|
||||
var ep = dets.tokenRequestEndpoint.url;
|
||||
url = dets.tokenRequestEndpoint.url + '?response_type=code';
|
||||
window.swaggerUi.tokenName = dets.tokenName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,7 +133,10 @@ function handleLogin() {
|
||||
var o = $('.api-popup-scopes').find('input:checked');
|
||||
|
||||
for(k =0; k < o.length; k++) {
|
||||
scopes.push($(o[k]).attr('scope'));
|
||||
var scope = $(o[k]).attr('scope');
|
||||
|
||||
if (scopes.indexOf(scope) === -1)
|
||||
scopes.push(scope);
|
||||
}
|
||||
|
||||
window.enabledScopes=scopes;
|
||||
@ -169,6 +184,7 @@ function initOAuth(opts) {
|
||||
}
|
||||
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
$('.api-ic').unbind();
|
||||
$('.api-ic').click(function(s) {
|
||||
if($(s.target).hasClass('ic-off'))
|
||||
handleLogin();
|
||||
@ -179,6 +195,28 @@ function initOAuth(opts) {
|
||||
});
|
||||
}
|
||||
|
||||
function processOAuthCode(data) {
|
||||
var params = {
|
||||
'client_id': clientId,
|
||||
'code': data.code,
|
||||
'grant_type': 'authorization_code'
|
||||
}
|
||||
$.ajax(
|
||||
{
|
||||
url : window.swaggerUi.tokenUrl,
|
||||
type: "POST",
|
||||
data: params,
|
||||
success:function(data, textStatus, jqXHR)
|
||||
{
|
||||
onOAuthComplete(data);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
onOAuthComplete("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onOAuthComplete(token) {
|
||||
if(token) {
|
||||
if(token.error) {
|
||||
@ -230,7 +268,7 @@ function onOAuthComplete(token) {
|
||||
}
|
||||
}
|
||||
});
|
||||
window.authorizations.add('oauth2', new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
||||
window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
third_party/swagger-ui/lib/underscore-min.js
vendored
38
third_party/swagger-ui/lib/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
5
third_party/swagger-ui/o2c.html
vendored
5
third_party/swagger-ui/o2c.html
vendored
@ -10,6 +10,11 @@ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
|
||||
function(key, value) {
|
||||
return key===""?value:decodeURIComponent(value) }
|
||||
):{}
|
||||
|
||||
if (window.opener.swaggerUi.tokenUrl)
|
||||
window.opener.processOAuthCode(qp);
|
||||
else
|
||||
window.opener.onOAuthComplete(qp);
|
||||
|
||||
window.close();
|
||||
</script>
|
2555
third_party/swagger-ui/swagger-ui.js
vendored
2555
third_party/swagger-ui/swagger-ui.js
vendored
File diff suppressed because it is too large
Load Diff
3
third_party/swagger-ui/swagger-ui.min.js
vendored
3
third_party/swagger-ui/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user