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",
|
||||
"applications/installed" : "applicationsInstalled",
|
||||
"applications/available" : "applicationsAvailable",
|
||||
"applications/documentation" : "applicationsDocumentation",
|
||||
"application/documentation/:key" : "appDocumentation",
|
||||
"graph" : "graph"
|
||||
|
||||
},
|
||||
|
@ -223,12 +223,9 @@ $(document).ready(function() {
|
|||
|
||||
},
|
||||
|
||||
|
||||
applicationsDocumentation: function() {
|
||||
if (this.appDocuView === undefined) {
|
||||
this.appDocuView = new window.AppDocumentationView();
|
||||
}
|
||||
this.appDocuView.render();
|
||||
appDocumentation: function(key) {
|
||||
var docuView = new window.AppDocumentationView({key: key});
|
||||
docuView.render();
|
||||
this.naviView.selectMenuItem('applications-menu');
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<ul class="dropdown-menu">
|
||||
<li><a href="#applications/installed">Installed</a></li>
|
||||
<li><a href="#applications/available">Available</a></li>
|
||||
<li><a href="#applications/documentation">Documentation</a></li>
|
||||
</ul>
|
||||
<li class="collections-menu"><a href="#">Collections</a></li>
|
||||
<li class="query-menu"><a href="#query">AQL Editor</a></li>
|
||||
|
|
|
@ -5,25 +5,23 @@ window.AppDocumentationView = Backbone.View.extend({
|
|||
|
||||
initialize: function() {
|
||||
this.swaggerUi = new SwaggerUi({
|
||||
discoveryUrl:"../aardvark/docus",
|
||||
discoveryUrl:"../aardvark/docu/" + this.options.key,
|
||||
|
||||
apiKey: false,
|
||||
dom_id:"swagger-ui-container",
|
||||
supportHeaderParams: true,
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch', 'head'],
|
||||
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)});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
if(console) {
|
||||
console.log("Unable to Load SwaggerUI");
|
||||
console.log(data);
|
||||
}
|
||||
var div = document.createElement("div"),
|
||||
strong = document.createElement("strong");
|
||||
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"
|
||||
});
|
||||
|
|
|
@ -18,7 +18,6 @@ var FoxxActiveListView = Backbone.View.extend({
|
|||
self.render();
|
||||
},
|
||||
error: function() {
|
||||
console.log("Erroreoror!!");
|
||||
}
|
||||
});
|
||||
this.render();
|
||||
|
|
|
@ -4,7 +4,8 @@ window.FoxxActiveView = Backbone.View.extend({
|
|||
template: new EJS({url: 'js/templates/foxxActiveView.ejs'}),
|
||||
|
||||
events: {
|
||||
'click .icon-edit': 'editFoxx'
|
||||
'click .icon-edit': 'editFoxx',
|
||||
'click' : 'showDocu'
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
|
@ -15,6 +16,11 @@ window.FoxxActiveView = Backbone.View.extend({
|
|||
event.stopPropagation();
|
||||
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(){
|
||||
$(this.el).html(this.template.render(this.model));
|
||||
|
|
|
@ -93,7 +93,14 @@
|
|||
app.get("/foxxes/thumbnail/:app", function (req, res) {
|
||||
res.transformations = [ "base64decode" ];
|
||||
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) {
|
||||
|
@ -109,13 +116,22 @@
|
|||
.notes("This function simply returns the list of all running"
|
||||
+ " 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 = "";
|
||||
require("underscore").each(req.suffix, function(part) {
|
||||
mountPoint += "/" + part;
|
||||
});
|
||||
|
||||
//require("console").log(JSON.stringify(req));
|
||||
res.json(repositories.docus.show(mountPoint))
|
||||
}).pathParam("appname", {
|
||||
description: "The mount point of the App the documentation should be requested for",
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
|
||||
"apps": {
|
||||
"/": "aardvark.js"
|
||||
}
|
||||
},
|
||||
"lib": "."
|
||||
}
|
||||
|
|
|
@ -66,18 +66,13 @@
|
|||
return thumb;
|
||||
},
|
||||
|
||||
install: function (name, mount, version) {
|
||||
require("console").log(name);
|
||||
require("console").log(mount);
|
||||
require("console").log(version);
|
||||
|
||||
|
||||
install: function (name, mount, version) {
|
||||
return foxxmanager.installApp(name, mount, version);
|
||||
},
|
||||
|
||||
// Define the functionality to uninstall an installed foxx
|
||||
uninstall: function (key) {
|
||||
return Foxx.uninstallApp(key);
|
||||
return foxxmanager.uninstallApp(key);
|
||||
},
|
||||
|
||||
// Define the functionality to deactivate an installed foxx.
|
||||
|
|
|
@ -62,8 +62,20 @@
|
|||
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.
|
||||
show: function(appname) {
|
||||
require("console").log(appname);
|
||||
var result = {},
|
||||
apis = [],
|
||||
pathes,
|
||||
|
|
Loading…
Reference in New Issue