mirror of https://gitee.com/bigwinds/arangodb
Front-end: Changed documentation overview, basePath is now determined and apps with long pathes are shown, however only last segment of path is displayed, might be a Swagger issue
This commit is contained in:
parent
ab45b4aa3d
commit
a5f8b6fe92
|
@ -5,7 +5,8 @@ window.AppDocumentationView = Backbone.View.extend({
|
|||
|
||||
initialize: function() {
|
||||
this.swaggerUi = new SwaggerUi({
|
||||
discoveryUrl:"../aardvark/swagger",
|
||||
discoveryUrl:"../aardvark/docus",
|
||||
|
||||
apiKey: false,
|
||||
dom_id:"swagger-ui-container",
|
||||
supportHeaderParams: true,
|
||||
|
|
|
@ -76,26 +76,31 @@
|
|||
required: true,
|
||||
allowMultiple: false
|
||||
}).nickname("foxxes")
|
||||
.summary("List of all foxxes.")
|
||||
.notes("This function simply returns the list of all running"
|
||||
+ " foxxes and supplies the paths for the swagger documentation");
|
||||
.summary("Update a foxx.")
|
||||
.notes("Used to either activate/deactivate a foxx, or change the mount point.");
|
||||
|
||||
|
||||
app.get('/foxxes', function (req, res) {
|
||||
res.json(repositories.foxxes.viewAll());
|
||||
}).nickname("foxxes")
|
||||
.summary("Update a foxx.")
|
||||
.notes("Used to either activate/deactivate a foxx, or change the mount point.");
|
||||
.summary("List of all foxxes.")
|
||||
.notes("This function simply returns the list of all running foxxes");
|
||||
|
||||
app.get('/docus', function (req, res) {
|
||||
res.json(repositories.docus.list());
|
||||
res.json(repositories.docus.list("http://" + req.headers.host + req.path + "/"));
|
||||
}).nickname("swaggers")
|
||||
.summary("List of all foxxes.")
|
||||
.summary("List documentation of all foxxes.")
|
||||
.notes("This function simply returns the list of all running"
|
||||
+ " foxxes and supplies the paths for the swagger documentation");
|
||||
|
||||
app.get('/docus/:appname', function(req, res) {
|
||||
res.json(repositories.docus.show(req.params("appname")))
|
||||
app.get('/docus/*', 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",
|
||||
dataType: "string",
|
||||
|
|
|
@ -41,16 +41,23 @@
|
|||
exports.Repository = Foxx.Repository.extend({
|
||||
|
||||
// Get the overview of all installed foxxes.
|
||||
list: function() {
|
||||
list: function(basePath) {
|
||||
var result = {},
|
||||
apis = [],
|
||||
routes = db._collection("_routing"),
|
||||
res = db._collection("_aal").byExample({"type": "mount"});
|
||||
result.swaggerVersion = "1.1";
|
||||
result.basePath = "http://127.0.0.1:8529/aardvark/docus/";
|
||||
result.basePath = basePath;
|
||||
result.apis = apis;
|
||||
while (res.hasNext()) {
|
||||
apis.push({path: res.next().mount});
|
||||
var m = res.next().mount;
|
||||
if (m === "/aardvark") {
|
||||
|
||||
} else {
|
||||
apis.push({
|
||||
path: m
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
@ -59,7 +66,6 @@
|
|||
show: function(appname) {
|
||||
var result = {},
|
||||
apis = [],
|
||||
key,
|
||||
pathes,
|
||||
regex = /(:)([^\/]*)/,
|
||||
i,
|
||||
|
@ -67,7 +73,7 @@
|
|||
api,
|
||||
ops,
|
||||
routes = db._collection("_routing"),
|
||||
key = db._collection("_aal").firstExample({"mount": "/" + appname})._key,
|
||||
key = db._collection("_aal").firstExample({"mount": appname})._key,
|
||||
app = routes.firstExample({"foxxMount": key});
|
||||
result.swaggerVersion = "1.1";
|
||||
result.basePath = app.urlPrefix;
|
||||
|
|
Loading…
Reference in New Issue