mirror of https://github.com/rancher/api-ui.git
More bootstrap
This commit is contained in:
parent
cb7e158b6a
commit
17e62c4f7a
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
"view": [
|
"view": [
|
||||||
"body",
|
"body",
|
||||||
"filters", "filter", "actions",
|
"filters", "filter",
|
||||||
"request", "response",
|
"request", "response",
|
||||||
"edit", "field",
|
"edit", "field",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,27 +28,6 @@ FIELDSET, IMG {
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUT, TEXTAREA, SELECT {
|
|
||||||
font-family: inherit;
|
|
||||||
font-weight: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
INPUT, A {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEXTAREA,
|
|
||||||
INPUT[type=text],
|
|
||||||
INPUT[type=number],
|
|
||||||
INPUT[type=password] {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #C0C0C0;
|
|
||||||
}
|
|
||||||
|
|
||||||
INPUT.fixie {
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LABEL {
|
LABEL {
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-khtml-user-select: none;
|
-khtml-user-select: none;
|
||||||
|
|
@ -224,6 +203,14 @@ H1 {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#header .btn {
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header .input-group .btn {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
TH {
|
TH {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
@ -232,14 +219,6 @@ text-align: left;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUT {
|
|
||||||
margin: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
INPUT[type="button"] {
|
|
||||||
min-width: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#request-input TD {
|
#request-input TD {
|
||||||
border: 1px solid #f8f8f8;
|
border: 1px solid #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ HTMLApi.prototype.show = function(cb)
|
||||||
var self = this;
|
var self = this;
|
||||||
async.auto({
|
async.auto({
|
||||||
render: this.render.bind(this) ,
|
render: this.render.bind(this) ,
|
||||||
actions: ['render', this.actionInit.bind(this) ],
|
|
||||||
filters: ['render', this.filterInit.bind(this) ],
|
filters: ['render', this.filterInit.bind(this) ],
|
||||||
}, showDone);
|
}, showDone);
|
||||||
|
|
||||||
|
|
@ -338,6 +337,13 @@ HTMLApi.prototype.render = function(cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actions = {};
|
||||||
|
var allActions = ( data.type == 'collection' ? schema.collectionActions : schema.resourceActions ) || {};
|
||||||
|
Object.keys(allActions).sort().forEach(function(key) {
|
||||||
|
// Set the action to true if it's available on this object or false if it isn't
|
||||||
|
actions[key] = !!data.actions[key];
|
||||||
|
});
|
||||||
|
|
||||||
var tpl = {
|
var tpl = {
|
||||||
data: this._data,
|
data: this._data,
|
||||||
docsPage: this._docsPage,
|
docsPage: this._docsPage,
|
||||||
|
|
@ -346,6 +352,7 @@ HTMLApi.prototype.render = function(cb)
|
||||||
error: this._error,
|
error: this._error,
|
||||||
schema: schema,
|
schema: schema,
|
||||||
operations: operations,
|
operations: operations,
|
||||||
|
actions: actions,
|
||||||
explorer: Cookie.get('debug') || false
|
explorer: Cookie.get('debug') || false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -354,7 +361,6 @@ HTMLApi.prototype.render = function(cb)
|
||||||
|
|
||||||
this._addCollapsers();
|
this._addCollapsers();
|
||||||
|
|
||||||
$('#actions').html('<span class="inactive">None</span>');
|
|
||||||
$('#filters').html('<span class="inactive">None</span>');
|
$('#filters').html('<span class="inactive">None</span>');
|
||||||
|
|
||||||
return async.nextTick(cb);
|
return async.nextTick(cb);
|
||||||
|
|
@ -405,19 +411,9 @@ HTMLApi.prototype.getSchema = function(type, obj)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
HTMLApi.prototype.actionInit = function(cb)
|
HTMLApi.prototype.showAction = function(button)
|
||||||
{
|
{
|
||||||
var data = this._data;
|
this.actionLoad(button.getAttribute('data-action'), undefined, {});
|
||||||
|
|
||||||
if ( !data.actions || !Object.keys(data.actions).length )
|
|
||||||
return async.nextTick(cb);
|
|
||||||
|
|
||||||
var html = Handlebars.templates['actions']({
|
|
||||||
actions: data.actions
|
|
||||||
});
|
|
||||||
$('#actions').html(html);
|
|
||||||
|
|
||||||
async.nextTick(cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLApi.prototype.actionLoad = function(name, obj, body)
|
HTMLApi.prototype.actionLoad = function(name, obj, body)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<select name="action" id="action">
|
|
||||||
{{#eachProperty actions}}
|
|
||||||
<option value="{{key}}">{{key}}</option>
|
|
||||||
{{/eachProperty}}
|
|
||||||
</select>
|
|
||||||
<br/>
|
|
||||||
<input type="submit" name="go" value="Go"/>
|
|
||||||
|
|
@ -3,26 +3,28 @@
|
||||||
<div iv="header-body">
|
<div iv="header-body">
|
||||||
<label>Operations</label>
|
<label>Operations</label>
|
||||||
<div id="operations">
|
<div id="operations">
|
||||||
<p>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.up()" {{#unless operations.up}}disabled="disabled"{{/unless}}><span class="glyphicon glyphicon-arrow-up"></span> Up</button>
|
||||||
<button class="btn btn-primary btn-sm" onclick="htmlapi.up()" {{#unless operations.up}}disabled="disabled"{{/unless}}><i class="glyphicon glyphicon-arrow-up"></i> Up</button>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.reload()"><span class="glyphicon glyphicon-refresh"></span> Reload</button>
|
||||||
<button class="btn btn-primary btn-sm" onclick="htmlapi.reload()"><i class="glyphicon glyphicon-refresh"></i> Reload</button>
|
|
||||||
</p>
|
|
||||||
{{#if operations.post}}
|
{{#if operations.post}}
|
||||||
<button class="btn btn-primary btn-sm" onclick="htmlapi.create()"><i class="glyphicon glyphicon-plus"></i> Create</button>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.create()"><span class="glyphicon glyphicon-plus"></span> Create</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if operations.put}}
|
{{#if operations.put}}
|
||||||
<button class="btn btn-primary btn-sm" onclick="htmlapi.update()"><i class="glyphicon glyphicon-edit"></i> Edit</button>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.update()"><span class="glyphicon glyphicon-edit"></span> Edit</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if operations.delete}}
|
{{#if operations.delete}}
|
||||||
<button class="btn btn-primary btn-sm" onclick="htmlapi.delete()"><i class="glyphicon glyphicon-trash"></i> Delete</button>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.delete()"><span class="glyphicon glyphicon-trash"></span> Delete</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<label>Actions</label>
|
<label>Actions</label>
|
||||||
<form onsubmit="htmlapi.actionLoad($('#action').val(),undefined,{}); return false;">
|
<div>
|
||||||
<div id="actions">{{! Set based on schema }}</div>
|
{{#eachProperty actions}}
|
||||||
</form>
|
<button type="button" class="btn btn-success btn-sm" data-action="{{key}}" {{#if value}}onclick="htmlapi.showAction(this);"{{else}}disabled="disabled"{{/if}}>{{key}}</button>
|
||||||
|
{{else}}
|
||||||
|
<span class="inactive">None</span>
|
||||||
|
{{/eachProperty}}
|
||||||
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<label>Filter</label>
|
<label>Filter</label>
|
||||||
|
|
@ -31,63 +33,85 @@
|
||||||
</form>
|
</form>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<label>Sort</label>
|
|
||||||
{{#if data.sortLinks }}
|
{{#if data.sortLinks }}
|
||||||
<form>
|
<form>
|
||||||
<select id="sortBy" onchange="htmlapi.sortChange(this)">
|
<div class="row">
|
||||||
<option value="">(None)</option>
|
<div class="col-xs-7">
|
||||||
{{#eachProperty data.sortLinks}}
|
<label>Sort By</label>
|
||||||
<option value="{{key}}"{{#ifEqual ../../data.sort.name key}} SELECTED{{/ifEqual}}>{{key}}</option>
|
<select id="sortBy" class="form-control" onchange="htmlapi.sortChange(this)">
|
||||||
{{/eachProperty}}
|
{{#unless data.sort.name}}<option value="">(Not Sorted)</option>{{/unless}}
|
||||||
</select>
|
{{#eachProperty data.sortLinks}}
|
||||||
{{#if data.sort.name }}
|
<option value="{{key}}"{{#ifEqual ../../data.sort.name key}} SELECTED{{/ifEqual}}>{{key}}</option>
|
||||||
<input type="button" value="{{#ifEqual data.sort.order "desc"}}↑{{else}}↓{{/ifEqual}}" onclick="htmlapi.sortOrderChange();"/>
|
{{/eachProperty}}
|
||||||
{{/if}}
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<label>Direction</label>
|
||||||
|
{{#if data.sort.name }}
|
||||||
|
<div class="btn-group btn-group-sm">
|
||||||
|
{{#ifEqual data.sort.order "desc"}}
|
||||||
|
<button type="button" class="btn btn-default btn-sm active"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span></button>
|
||||||
|
<button type="button" class="btn btn-default btn-sm" onclick="htmlapi.sortOrderChange();"><span class="glyphicon glyphicon-sort-by-attributes"></span></button>
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="btn btn-default btn-sm" onclick="htmlapi.sortOrderChange();"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span></button>
|
||||||
|
<button type="button" class="btn btn-default btn-sm active"><span class="glyphicon glyphicon-sort-by-attributes"></span></button>
|
||||||
|
{{/ifEqual}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<span class="inactive">
|
|
||||||
{{#if data.sort.name}}
|
|
||||||
{{data.sort.name}} {{#ifEqual data.sort.order "desc"}}↑{{else}}↓{{/ifEqual}}
|
|
||||||
{{else}}
|
|
||||||
Not Sorted
|
|
||||||
{{/if}}
|
|
||||||
</span>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="inactive">Not available</span>
|
<label>Sort</label>
|
||||||
|
<p class="inactive">Not available</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<label>Pagination</label>
|
<label>Pagination</label>
|
||||||
{{#if data.pagination}}
|
{{#if data.pagination}}
|
||||||
<div>
|
|
||||||
<form>
|
|
||||||
<input type="number" min="0" step="100" id="limit" name="limit" style="width: 50px" value="{{data.pagination.limit}}"/>/page
|
|
||||||
<input type="submit" value="Set" onclick="htmlapi.setLimit($('limit').val())">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
{{#if data.pagination.partial}}
|
{{#if data.pagination.partial}}
|
||||||
{{#if data.pagination.first}}
|
{{#if data.pagination.first}}
|
||||||
{{#ifEqual data.links.self data.pagination.first}}
|
{{#ifEqual data.links.self data.pagination.first}}
|
||||||
{{! Nothing }}
|
<button type="button" class="btn btn-success btn-sm" disabled="disabled"><span class="glyphicon glyphicon-step-backward"></span></button>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="{{data.pagination.first}}">First</a>
|
<a class="btn btn-success btn-sm" href="{{data.pagination.first}}"><span class="glyphicon glyphicon-step-backward"></span></a>
|
||||||
{{/ifEqual}}
|
{{/ifEqual}}
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="btn btn-success btn-sm" disabled="disabled"><span class="glyphicon glyphicon-step-backward"></span></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if data.pagination.prev}}
|
{{#if data.pagination.prev}}
|
||||||
<a href="{{data.pagination.prev}}">Prev</a>
|
<a class="btn btn-success btn-sm" href="{{data.pagination.prev}}"><span class="glyphicon glyphicon-chevron-left"></span></a>
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="btn btn-success btn-sm" disabled="disabled"><span class="glyphicon glyphicon-chevron-left"></span></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if data.pagination.next}}
|
{{#if data.pagination.next}}
|
||||||
<a href="{{data.pagination.next}}">Next</a>
|
<a class="btn btn-success btn-sm" href="{{data.pagination.next}}"><span class="glyphicon glyphicon-chevron-right"></span></a>
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="btn btn-success btn-sm" disabled="disabled"><span class="glyphicon glyphicon-chevron-right"></span></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if data.pagination.last}}
|
{{#if data.pagination.last}}
|
||||||
<a href="{{data.pagination.last}}">Last</a>
|
<a class="btn btn-success btn-sm" href="{{data.pagination.last}}"><span class="glyphicon glyphicon-step-forward"></span></a>
|
||||||
|
{{else}}
|
||||||
|
<button type="button" class="btn btn-success btn-sm" disabled="disabled"><span class="glyphicon glyphicon-step-forward"></span></button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="inactive">Full result</span>
|
<p class="inactive">Full result</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<span class="input-group-addon">Limit:</span>
|
||||||
|
<input class="form-control" type="number" min="0" step="100" id="limit" name="limit" value="{{data.pagination.limit}}"/>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm" onclick="htmlapi.setLimit($('limit').val())"><span class="glyphicon glyphicon-signal"></span> Set</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="inactive">Not available</span>
|
<p class="inactive">Not available</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="no-filters" class="inactive" {{#if hasFilters}}style="display: none;"{{/if}}>None</div>
|
<div id="no-filters" class="inactive" {{#if hasFilters}}style="display: none;"{{/if}}>None</div>
|
||||||
{{#if canFilter}}
|
{{#if canFilter}}
|
||||||
<input type="button" onclick="htmlapi.filterAdd()" value="+">
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.filterClear();"><span class="glyphicon glyphicon-ban-circle"></span> Clear</button>
|
||||||
<input type="button" value="Clear" onclick="htmlapi.filterClear(); return false;"/>
|
<button type="button" class="btn btn-primary btn-sm" onclick="htmlapi.filterAdd();"><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
|
||||||
<input type="submit" value="Apply"/>
|
<button type="submit" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-filter"></span> Apply</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue