mirror of https://gitee.com/bigwinds/arangodb
Frontend: The Documentation of the Applications can now be accessed per application. And If there is an error useful info is printed
This commit is contained in:
parent
3d66aac371
commit
2238f0db0f
|
@ -18,7 +18,7 @@ $(document).ready(function() {
|
||||||
"application/available/:key" : "applicationInstall",
|
"application/available/:key" : "applicationInstall",
|
||||||
"applications/installed" : "applicationsInstalled",
|
"applications/installed" : "applicationsInstalled",
|
||||||
"applications/available" : "applicationsAvailable",
|
"applications/available" : "applicationsAvailable",
|
||||||
"applications/documentation" : "applicationsDocumentation",
|
"application/documentation/:key" : "appDocumentation",
|
||||||
"graph" : "graph"
|
"graph" : "graph"
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -223,12 +223,9 @@ $(document).ready(function() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
appDocumentation: function(key) {
|
||||||
applicationsDocumentation: function() {
|
var docuView = new window.AppDocumentationView({key: key});
|
||||||
if (this.appDocuView === undefined) {
|
docuView.render();
|
||||||
this.appDocuView = new window.AppDocumentationView();
|
|
||||||
}
|
|
||||||
this.appDocuView.render();
|
|
||||||
this.naviView.selectMenuItem('applications-menu');
|
this.naviView.selectMenuItem('applications-menu');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="#applications/installed">Installed</a></li>
|
<li><a href="#applications/installed">Installed</a></li>
|
||||||
<li><a href="#applications/available">Available</a></li>
|
<li><a href="#applications/available">Available</a></li>
|
||||||
<li><a href="#applications/documentation">Documentation</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<li class="collections-menu"><a href="#">Collections</a></li>
|
<li class="collections-menu"><a href="#">Collections</a></li>
|
||||||
<li class="query-menu"><a href="#query">AQL Editor</a></li>
|
<li class="query-menu"><a href="#query">AQL Editor</a></li>
|
||||||
|
|
|
@ -5,25 +5,23 @@ window.AppDocumentationView = Backbone.View.extend({
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.swaggerUi = new SwaggerUi({
|
this.swaggerUi = new SwaggerUi({
|
||||||
discoveryUrl:"../aardvark/docus",
|
discoveryUrl:"../aardvark/docu/" + this.options.key,
|
||||||
|
|
||||||
apiKey: false,
|
apiKey: false,
|
||||||
dom_id:"swagger-ui-container",
|
dom_id:"swagger-ui-container",
|
||||||
supportHeaderParams: true,
|
supportHeaderParams: true,
|
||||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch', 'head'],
|
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch', 'head'],
|
||||||
onComplete: function(swaggerApi, swaggerUi){
|
onComplete: function(swaggerApi, swaggerUi){
|
||||||
if(console) {
|
|
||||||
console.log("Loaded SwaggerUI")
|
|
||||||
console.log(swaggerApi);
|
|
||||||
console.log(swaggerUi);
|
|
||||||
}
|
|
||||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||||
},
|
},
|
||||||
onFailure: function(data) {
|
onFailure: function(data) {
|
||||||
if(console) {
|
var div = document.createElement("div"),
|
||||||
console.log("Unable to Load SwaggerUI");
|
strong = document.createElement("strong");
|
||||||
console.log(data);
|
strong.appendChild(document.createTextNode("Sorry the code is not documented properly"));
|
||||||
}
|
div.appendChild(strong);
|
||||||
|
div.appendChild(document.createElement("br"));
|
||||||
|
div.appendChild(document.createTextNode(JSON.stringify(data)));
|
||||||
|
$("#swagger-ui-container").append(div);
|
||||||
},
|
},
|
||||||
docExpansion: "none"
|
docExpansion: "none"
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,6 @@ var FoxxActiveListView = Backbone.View.extend({
|
||||||
self.render();
|
self.render();
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
console.log("Erroreoror!!");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.render();
|
this.render();
|
||||||
|
|
|
@ -4,7 +4,8 @@ window.FoxxActiveView = Backbone.View.extend({
|
||||||
template: new EJS({url: 'js/templates/foxxActiveView.ejs'}),
|
template: new EJS({url: 'js/templates/foxxActiveView.ejs'}),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .icon-edit': 'editFoxx'
|
'click .icon-edit': 'editFoxx',
|
||||||
|
'click' : 'showDocu'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
|
@ -16,6 +17,11 @@ window.FoxxActiveView = Backbone.View.extend({
|
||||||
window.App.navigate("application/installed/" + encodeURIComponent(this.model.get("_key")), {trigger: true});
|
window.App.navigate("application/installed/" + encodeURIComponent(this.model.get("_key")), {trigger: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showDocu: function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
window.App.navigate("application/documentation/" + encodeURIComponent(this.model.get("_key")), {trigger: true});
|
||||||
|
},
|
||||||
|
|
||||||
render: function(){
|
render: function(){
|
||||||
$(this.el).html(this.template.render(this.model));
|
$(this.el).html(this.template.render(this.model));
|
||||||
return $(this.el);
|
return $(this.el);
|
||||||
|
|
|
@ -93,7 +93,14 @@
|
||||||
app.get("/foxxes/thumbnail/:app", function (req, res) {
|
app.get("/foxxes/thumbnail/:app", function (req, res) {
|
||||||
res.transformations = [ "base64decode" ];
|
res.transformations = [ "base64decode" ];
|
||||||
res.body = repositories.foxxes.thumbnail(req.params("app"));
|
res.body = repositories.foxxes.thumbnail(req.params("app"));
|
||||||
});
|
}).pathParam("app", {
|
||||||
|
description: "The appname which is used to identify the foxx in the list of available foxxes.",
|
||||||
|
dataType: "string",
|
||||||
|
required: true,
|
||||||
|
allowMultiple: false
|
||||||
|
}).nickname("thumbnails")
|
||||||
|
.summary("Get the thumbnail of a foxx.")
|
||||||
|
.notes("Used to request the thumbnail of the given Foxx in order to display it on the screen.");
|
||||||
|
|
||||||
|
|
||||||
app.get('/foxxes', function (req, res) {
|
app.get('/foxxes', function (req, res) {
|
||||||
|
@ -109,13 +116,22 @@
|
||||||
.notes("This function simply returns the list of all running"
|
.notes("This function simply returns the list of all running"
|
||||||
+ " foxxes and supplies the paths for the swagger documentation");
|
+ " foxxes and supplies the paths for the swagger documentation");
|
||||||
|
|
||||||
app.get('/docus/*', function(req, res) {
|
app.get("/docu/:key",function (req, res) {
|
||||||
|
var subPath = req.path.substr(0,req.path.lastIndexOf("[")-1),
|
||||||
|
key = req.params("key"),
|
||||||
|
path = "http://" + req.headers.host + subPath + "/" + key + "/";
|
||||||
|
res.json(repositories.docus.listOne(path, key));
|
||||||
|
}).nickname("swaggers")
|
||||||
|
.summary("List documentation of all foxxes.")
|
||||||
|
.notes("This function simply returns one specific"
|
||||||
|
+ " foxx and supplies the paths for the swagger documentation");
|
||||||
|
|
||||||
|
|
||||||
|
app.get('/docu/:key/*', function(req, res) {
|
||||||
var mountPoint = "";
|
var mountPoint = "";
|
||||||
require("underscore").each(req.suffix, function(part) {
|
require("underscore").each(req.suffix, function(part) {
|
||||||
mountPoint += "/" + part;
|
mountPoint += "/" + part;
|
||||||
});
|
});
|
||||||
|
|
||||||
//require("console").log(JSON.stringify(req));
|
|
||||||
res.json(repositories.docus.show(mountPoint))
|
res.json(repositories.docus.show(mountPoint))
|
||||||
}).pathParam("appname", {
|
}).pathParam("appname", {
|
||||||
description: "The mount point of the App the documentation should be requested for",
|
description: "The mount point of the App the documentation should be requested for",
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
|
|
||||||
"apps": {
|
"apps": {
|
||||||
"/": "aardvark.js"
|
"/": "aardvark.js"
|
||||||
}
|
},
|
||||||
|
"lib": "."
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,17 +67,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
install: function (name, mount, version) {
|
install: function (name, mount, version) {
|
||||||
require("console").log(name);
|
|
||||||
require("console").log(mount);
|
|
||||||
require("console").log(version);
|
|
||||||
|
|
||||||
|
|
||||||
return foxxmanager.installApp(name, mount, version);
|
return foxxmanager.installApp(name, mount, version);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Define the functionality to uninstall an installed foxx
|
// Define the functionality to uninstall an installed foxx
|
||||||
uninstall: function (key) {
|
uninstall: function (key) {
|
||||||
return Foxx.uninstallApp(key);
|
return foxxmanager.uninstallApp(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Define the functionality to deactivate an installed foxx.
|
// Define the functionality to deactivate an installed foxx.
|
||||||
|
|
|
@ -62,8 +62,20 @@
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
listOne: function(basePath, key) {
|
||||||
|
var result = {},
|
||||||
|
res = db._collection("_aal").document(key);
|
||||||
|
result.swaggerVersion = "1.1";
|
||||||
|
result.basePath = basePath;
|
||||||
|
result.apis = [
|
||||||
|
{path: res.mount}
|
||||||
|
];
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
// Get details of one specific installed foxx.
|
// Get details of one specific installed foxx.
|
||||||
show: function(appname) {
|
show: function(appname) {
|
||||||
|
require("console").log(appname);
|
||||||
var result = {},
|
var result = {},
|
||||||
apis = [],
|
apis = [],
|
||||||
pathes,
|
pathes,
|
||||||
|
|
Loading…
Reference in New Issue