mirror of https://github.com/rancher/api-ui.git
Remove bootstrap, use CDN
This commit is contained in:
parent
d782e5fbf7
commit
f103b1108d
|
|
@ -9,13 +9,11 @@
|
||||||
"base": {
|
"base": {
|
||||||
"saveOutput": false,
|
"saveOutput": false,
|
||||||
"css": [
|
"css": [
|
||||||
"bootstrap",
|
|
||||||
"main"
|
"main"
|
||||||
],
|
],
|
||||||
|
|
||||||
"js": [
|
"js": [
|
||||||
"jquery",
|
"jquery",
|
||||||
"bootstrap",
|
|
||||||
"async", "json2", "polyfill",
|
"async", "json2", "polyfill",
|
||||||
"JSONFormatter", "URLParse", "Cookie",
|
"JSONFormatter", "URLParse", "Cookie",
|
||||||
"handlebars.runtime", "template"
|
"handlebars.runtime", "template"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gdapi-ui",
|
"name": "gdapi-ui",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"description": "HTML UI for GDAPI-compliant APIs",
|
"description": "HTML UI for GDAPI-compliant APIs",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Vincent Fiduccia",
|
"name": "Vincent Fiduccia",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -15,7 +15,7 @@ Cookie.set = function(name,value,expire,path,domain,secure)
|
||||||
else if ( expire )
|
else if ( expire )
|
||||||
expire_date = new Date( (new Date()).getTime() + (86400000 * expire));
|
expire_date = new Date( (new Date()).getTime() + (86400000 * expire));
|
||||||
|
|
||||||
var str = name +'=' + escape(value);
|
var str = name +'=' + value.replace(/ /g,'%20').replace(/,/g,'%2C').replace(/;/g,'%3B');
|
||||||
|
|
||||||
if ( expire )
|
if ( expire )
|
||||||
str += ';expires=' + expire_date.toGMTString();
|
str += ';expires=' + expire_date.toGMTString();
|
||||||
|
|
|
||||||
|
|
@ -585,14 +585,22 @@ HTMLApi.prototype.filterInit = function(cb)
|
||||||
$('#filters').html(html);
|
$('#filters').html(html);
|
||||||
|
|
||||||
var $elem;
|
var $elem;
|
||||||
|
var options;
|
||||||
for ( var i = 0 ; i < filters.length ; i++ )
|
for ( var i = 0 ; i < filters.length ; i++ )
|
||||||
{
|
{
|
||||||
v = filters[i];
|
v = filters[i];
|
||||||
|
|
||||||
|
if ( schema.collectionFilters[v.name] && schema.collectionFilters[v.name].options )
|
||||||
|
options = schema.collectionFilters[v.name].options;
|
||||||
|
else if ( schema.resourceFields[v.name] && schema.resourceFields[v.name].options )
|
||||||
|
options = schema.resourceFields[v.name].options;
|
||||||
|
else
|
||||||
|
options = null;
|
||||||
|
|
||||||
html = Handlebars.templates['filter']({
|
html = Handlebars.templates['filter']({
|
||||||
allFilterSchema: schema.collectionFilters,
|
allFilterSchema: schema.collectionFilters,
|
||||||
thisFilterSchema: schema.collectionFilters[v.name],
|
thisFilterSchema: schema.collectionFilters[v.name],
|
||||||
options: schema.collectionFilters[v.name].options || schema.resourceFields[v.name].options,
|
options: options,
|
||||||
cur: v
|
cur: v
|
||||||
});
|
});
|
||||||
$elem = $(html);
|
$elem = $(html);
|
||||||
|
|
@ -628,10 +636,18 @@ HTMLApi.prototype.filterAdd = function(name, modifier, value, before)
|
||||||
value: value || ''
|
value: value || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var options = null;
|
||||||
|
if ( schema.collectionFilters[name] && schema.collectionFilters[name].options )
|
||||||
|
options = schema.collectionFilters[name].options;
|
||||||
|
else if ( schema.resourceFields[name] && schema.resourceFields[name].options )
|
||||||
|
options = schema.resourceFields[name].options;
|
||||||
|
else
|
||||||
|
options = null;
|
||||||
|
|
||||||
var html = Handlebars.templates['filter']({
|
var html = Handlebars.templates['filter']({
|
||||||
allFilterSchema: schemaFilters,
|
allFilterSchema: schemaFilters,
|
||||||
thisFilterSchema: schemaFilters[name],
|
thisFilterSchema: schemaFilters[name],
|
||||||
options: schemaFilters[name].options || schema.resourceFields[name].options,
|
options: options,
|
||||||
cur: cur
|
cur: cur
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1774,3 +1790,16 @@ HTMLApi.prototype.switchToTextarea = function(button)
|
||||||
$textarea.on('keydown', function(e) { if ( e.keyCode == 13 ) { e.stopPropagation(); return true; } });
|
$textarea.on('keydown', function(e) { if ( e.keyCode == 13 ) { e.stopPropagation(); return true; } });
|
||||||
$button.hide();
|
$button.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HTMLApi.prototype.setLocalCookie = function(on) {
|
||||||
|
if ( on === false )
|
||||||
|
{
|
||||||
|
Cookie.remove('js.url');
|
||||||
|
Cookie.remove('css.url');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Cookie.set('js.url','http://localhost:3000/ui.js',3650);
|
||||||
|
Cookie.set('css.url','http://localhost:3000/ui.css',3650);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -6,10 +6,26 @@ var explorer;
|
||||||
{
|
{
|
||||||
jQuery(window).load(jQueryReady);
|
jQuery(window).load(jQueryReady);
|
||||||
|
|
||||||
function jQueryReady() {
|
function jQueryReady()
|
||||||
|
{
|
||||||
if ( window.autoInit === false )
|
if ( window.autoInit === false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( window.bootstrap === false )
|
||||||
|
{
|
||||||
|
boostrapReady();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var url = (window.bootstrap || '//netdna.bootstrapcdn.com/bootstrap/3.1.1').replace(/\/+$/,'');
|
||||||
|
|
||||||
|
$('head').append('<link rel="stylesheet" href="'+url+'/css/bootstrap.min.css" type="text/css" />');
|
||||||
|
$.getScript(url+'/js/bootstrap.min.js', boostrapReady);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function boostrapReady()
|
||||||
|
{
|
||||||
document.body.innerHTML = '<div class="loading"></div>';
|
document.body.innerHTML = '<div class="loading"></div>';
|
||||||
try {
|
try {
|
||||||
htmlapi = new HTMLApi({
|
htmlapi = new HTMLApi({
|
||||||
|
|
@ -28,12 +44,8 @@ var explorer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiError(err)
|
function apiReady(err)
|
||||||
{
|
{
|
||||||
document.body.innerHTML = 'Error loading UI: '+ Handlebars.Utils.escapeExpression(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
function apiReady(err) {
|
|
||||||
var view = Cookie.get('apiview') || 'browse';
|
var view = Cookie.get('apiview') || 'browse';
|
||||||
if ( err )
|
if ( err )
|
||||||
view = 'browse';
|
view = 'browse';
|
||||||
|
|
@ -46,5 +58,11 @@ var explorer;
|
||||||
htmlapi.show();
|
htmlapi.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function apiError(err)
|
||||||
|
{
|
||||||
|
document.body.innerHTML = 'Error loading UI: '+ Handlebars.Utils.escapeExpression(err);
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ Handlebars.registerHelper('displayModifier', function(context, options) {
|
||||||
case "notnull": str = 'Not NULL'; break;
|
case "notnull": str = 'Not NULL'; break;
|
||||||
case "like" : str = 'Like'; break;
|
case "like" : str = 'Like'; break;
|
||||||
case "notlike": str = 'Not like'; break;
|
case "notlike": str = 'Not like'; break;
|
||||||
case "prefix" : str = 'starts with'; break;
|
case "prefix" : str = 'Starts with'; break;
|
||||||
case "suffix" : str = 'ends with'; break;
|
case "suffix" : str = 'Ends with'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Handlebars.SafeString(str);
|
return new Handlebars.SafeString(str);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue