mirror of https://github.com/rancher/api-ui.git
Asset reorganization
This commit is contained in:
parent
d82ea4b071
commit
836c38226e
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"base": {
|
||||
"css": [
|
||||
"main"
|
||||
],
|
||||
|
||||
"js": [
|
||||
"async", "json2", "polyfill",
|
||||
"JSONFormatter", "URLParse", "Cookie",
|
||||
"handlebars.runtime", "template"
|
||||
]
|
||||
},
|
||||
|
||||
"ui": {
|
||||
"group": [
|
||||
"base"
|
||||
],
|
||||
|
||||
"css": [
|
||||
"explorer"
|
||||
],
|
||||
|
||||
"view": [
|
||||
"body",
|
||||
"filters", "filter", "actions",
|
||||
"request", "response",
|
||||
"edit", "field",
|
||||
|
||||
"explorer",
|
||||
"column",
|
||||
"column-links",
|
||||
"column-collection",
|
||||
"column-resource"
|
||||
],
|
||||
|
||||
"js": [
|
||||
"HTMLApi",
|
||||
"Explorer",
|
||||
"init"
|
||||
]
|
||||
}
|
||||
}
|
||||
2
compile
2
compile
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var assets = require('gd-assets');
|
||||
|
||||
var groups = assets.groups(__dirname+'/groups.json');
|
||||
var groups = assets.groups.load(__dirname+'/assets.json');
|
||||
var pkg = require('./package.json');
|
||||
var outputDir = __dirname+'/compiled';
|
||||
|
||||
|
|
|
|||
35
groups.json
35
groups.json
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"ui": {
|
||||
"css": [
|
||||
"main.css",
|
||||
"explorer.css"
|
||||
],
|
||||
|
||||
"js": [
|
||||
"async.js",
|
||||
"json2.js",
|
||||
"polyfill.js",
|
||||
"JSONFormatter.js",
|
||||
"URLParse.js",
|
||||
"Cookie.js",
|
||||
"handlebars.runtime.js",
|
||||
"template.js",
|
||||
"view:body.hbs",
|
||||
"view:filters.hbs",
|
||||
"view:filter.hbs",
|
||||
"view:actions.hbs",
|
||||
"view:request.hbs",
|
||||
"view:response.hbs",
|
||||
"view:edit.hbs",
|
||||
"view:field.hbs",
|
||||
"view:explorer.hbs",
|
||||
"view:column.hbs",
|
||||
"view:column-links.hbs",
|
||||
"view:column-collection.hbs",
|
||||
"view:column-resource.hbs",
|
||||
"init.js",
|
||||
"HTMLApi.js",
|
||||
"Explorer.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "gdapi-ui",
|
||||
"version": "0.0.1",
|
||||
"version": "1.1.1",
|
||||
"dependencies": {
|
||||
"gd-assets": "0.0.x"
|
||||
"gd-assets": "1.0.x"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Explorer.prototype.show = function(cb)
|
|||
var tpl = {
|
||||
};
|
||||
|
||||
document.body.innerHTML = Handlebars.templates['explorer.hbs'](tpl);
|
||||
document.body.innerHTML = Handlebars.templates['explorer'](tpl);
|
||||
$('#explorer').css('top', $('#header')[0].offsetHeight + 'px');
|
||||
|
||||
this.rootColumn();
|
||||
|
|
@ -79,7 +79,7 @@ Explorer.prototype.addPlaceholder = function()
|
|||
num: this._columns.length + 1
|
||||
};
|
||||
|
||||
var html = Handlebars.templates['column.hbs'](tpl);
|
||||
var html = Handlebars.templates['column'](tpl);
|
||||
$('#explorer').append(html);
|
||||
|
||||
var elem = $('#column_'+ id);
|
||||
|
|
@ -134,7 +134,7 @@ Explorer.prototype.populateColumn = function(idOrElem, obj)
|
|||
links: links,
|
||||
};
|
||||
|
||||
var html = Handlebars.templates['column-collection.hbs'](tpl);
|
||||
var html = Handlebars.templates['column-collection'](tpl);
|
||||
col.html(html);
|
||||
|
||||
col.on('click', $.proxy(this.followLink, this));
|
||||
|
|
@ -152,7 +152,7 @@ Explorer.prototype.populateColumn = function(idOrElem, obj)
|
|||
links: links,
|
||||
};
|
||||
|
||||
var html = Handlebars.templates['column-resource.hbs'](tpl);
|
||||
var html = Handlebars.templates['column-resource'](tpl);
|
||||
col.html(html);
|
||||
|
||||
$('.column-links',col).on('click', $.proxy(this.followLink, this));
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ HTMLApi.prototype.render = function(cb)
|
|||
docs: this._docs
|
||||
};
|
||||
|
||||
document.body.innerHTML = Handlebars.templates['body.hbs'](tpl);
|
||||
document.body.innerHTML = Handlebars.templates['body'](tpl);
|
||||
$('#json').html(jsonHtml);
|
||||
|
||||
this._addCollapsers();
|
||||
|
|
@ -330,7 +330,7 @@ HTMLApi.prototype.actionInit = function(cb)
|
|||
if ( !data.actions )
|
||||
return async.nextTick(cb);
|
||||
|
||||
var html = Handlebars.templates['actions.hbs']({
|
||||
var html = Handlebars.templates['actions']({
|
||||
actions: data.actions
|
||||
});
|
||||
$('#actions').html(html);
|
||||
|
|
@ -385,7 +385,7 @@ HTMLApi.prototype.actionLoad = function(name, obj, body)
|
|||
self.actionLoad(name, obj);
|
||||
}
|
||||
|
||||
var html = Handlebars.templates['edit.hbs'](tpl);
|
||||
var html = Handlebars.templates['edit'](tpl);
|
||||
var popinActions = [
|
||||
{id: 'ok', text: 'Show Request', /*on_enter: true, */ onClick: function() { self.showRequest('POST',actionInput,retry,url); }.bind(self) },
|
||||
{id: 'cancel', text: 'Cancel', cancel: true }
|
||||
|
|
@ -437,7 +437,7 @@ HTMLApi.prototype.filterInit = function(cb)
|
|||
}
|
||||
}
|
||||
|
||||
var html = Handlebars.templates['filters.hbs']({
|
||||
var html = Handlebars.templates['filters']({
|
||||
canFilter: canFilter,
|
||||
hasFilters: (filters.length > 0)
|
||||
});
|
||||
|
|
@ -447,7 +447,7 @@ HTMLApi.prototype.filterInit = function(cb)
|
|||
{
|
||||
v = filters[i];
|
||||
|
||||
html = Handlebars.templates['filter.hbs']({
|
||||
html = Handlebars.templates['filter']({
|
||||
allFilterSchema: schema.collectionFilters,
|
||||
thisFilterSchema: schema.collectionFilters[v.name],
|
||||
cur: v
|
||||
|
|
@ -475,7 +475,7 @@ HTMLApi.prototype.filterAdd = function(name, modifier, value, before)
|
|||
value: value || ''
|
||||
};
|
||||
|
||||
html = Handlebars.templates['filter.hbs']({
|
||||
html = Handlebars.templates['filter']({
|
||||
allFilterSchema: schemaFilters,
|
||||
thisFilterSchema: schemaFilters[name],
|
||||
cur: cur
|
||||
|
|
@ -773,7 +773,7 @@ HTMLApi.prototype.request = function(method,body,opt,really)
|
|||
tpl.contentType = 'application/json';
|
||||
}
|
||||
|
||||
var html = Handlebars.templates['request.hbs'](tpl);
|
||||
var html = Handlebars.templates['request'](tpl);
|
||||
|
||||
self._setupModal(html);
|
||||
|
||||
|
|
@ -823,7 +823,7 @@ HTMLApi.prototype.requestDone = function(err, body, res)
|
|||
tpl.responseHeaders = headers;
|
||||
}
|
||||
|
||||
var html = Handlebars.templates['response.hbs'](tpl);
|
||||
var html = Handlebars.templates['response'](tpl);
|
||||
|
||||
var out = '';
|
||||
var selfUrl = false;
|
||||
|
|
@ -1026,7 +1026,7 @@ HTMLApi.prototype.showEdit = function(data,update,schema,url)
|
|||
}
|
||||
|
||||
var title = (update ? 'Edit' : 'Create') +' '+ schema.id;
|
||||
var html = Handlebars.templates['edit.hbs'](tpl);
|
||||
var html = Handlebars.templates['edit'](tpl);
|
||||
var method = (update ? 'PUT' : 'POST');
|
||||
var popinActions = [
|
||||
{id: 'ok', text: 'Show Request', /*on_enter: true, */ onClick: function() { self.showRequest(method,schema,retry,url); }.bind(self) },
|
||||
|
|
@ -1389,7 +1389,7 @@ HTMLApi.prototype.subAdd = function(button, name)
|
|||
var field = this._flattenField('update',name,schemaField,'',1);
|
||||
field.parentIsMap = parentField.type == 'map';
|
||||
|
||||
var html = Handlebars.templates['field.hbs'](field);
|
||||
var html = Handlebars.templates['field'](field);
|
||||
|
||||
html = '<div><input type="button" onclick="htmlapi.subRemove(this);" value="-">' + html + '</div>';
|
||||
$(button).before(html);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Collection
|
||||
</div>
|
||||
|
||||
{{>column-links.hbs}}
|
||||
{{>column-links}}
|
||||
|
||||
<div class="collection-rows">
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Resource
|
||||
</div>
|
||||
|
||||
{{>column-links.hbs}}
|
||||
{{>column-links}}
|
||||
|
||||
<table class="resource-fields">
|
||||
{{#eachProperty data}}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</td>
|
||||
<td>
|
||||
{{#if writable}}
|
||||
{{>field.hbs}}
|
||||
{{>field}}
|
||||
{{else}}
|
||||
<span class="inactive">
|
||||
{{#if value}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{{#ifInList type 'array,map'}}
|
||||
<div>
|
||||
{{#each children}}
|
||||
{{>field.hbs}}
|
||||
{{>field}}
|
||||
{{/each}}
|
||||
{{/ifInList}}
|
||||
|
||||
|
|
|
|||
4
serve
4
serve
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var assets = require('gd-assets');
|
||||
|
||||
var groups = assets.groups(__dirname+'/groups.json');
|
||||
var groups = assets.groups.load(__dirname+'/assets.json');
|
||||
var pkg = require('./package.json');
|
||||
|
||||
assets.server(groups, pkg, 3000);
|
||||
assets.server(groups, pkg, process.argv[2] || 3000);
|
||||
|
|
|
|||
Loading…
Reference in New Issue