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() {
|
initialize: function() {
|
||||||
this.swaggerUi = new SwaggerUi({
|
this.swaggerUi = new SwaggerUi({
|
||||||
discoveryUrl:"../aardvark/swagger",
|
discoveryUrl:"../aardvark/docus",
|
||||||
|
|
||||||
apiKey: false,
|
apiKey: false,
|
||||||
dom_id:"swagger-ui-container",
|
dom_id:"swagger-ui-container",
|
||||||
supportHeaderParams: true,
|
supportHeaderParams: true,
|
||||||
|
|
|
@ -76,26 +76,31 @@
|
||||||
required: true,
|
required: true,
|
||||||
allowMultiple: false
|
allowMultiple: false
|
||||||
}).nickname("foxxes")
|
}).nickname("foxxes")
|
||||||
.summary("List of all foxxes.")
|
.summary("Update a foxx.")
|
||||||
.notes("This function simply returns the list of all running"
|
.notes("Used to either activate/deactivate a foxx, or change the mount point.");
|
||||||
+ " foxxes and supplies the paths for the swagger documentation");
|
|
||||||
|
|
||||||
|
|
||||||
app.get('/foxxes', function (req, res) {
|
app.get('/foxxes', function (req, res) {
|
||||||
res.json(repositories.foxxes.viewAll());
|
res.json(repositories.foxxes.viewAll());
|
||||||
}).nickname("foxxes")
|
}).nickname("foxxes")
|
||||||
.summary("Update a foxx.")
|
.summary("List of all foxxes.")
|
||||||
.notes("Used to either activate/deactivate a foxx, or change the mount point.");
|
.notes("This function simply returns the list of all running foxxes");
|
||||||
|
|
||||||
app.get('/docus', function (req, res) {
|
app.get('/docus', function (req, res) {
|
||||||
res.json(repositories.docus.list());
|
res.json(repositories.docus.list("http://" + req.headers.host + req.path + "/"));
|
||||||
}).nickname("swaggers")
|
}).nickname("swaggers")
|
||||||
.summary("List of all foxxes.")
|
.summary("List documentation of all foxxes.")
|
||||||
.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/:appname', function(req, res) {
|
app.get('/docus/*', function(req, res) {
|
||||||
res.json(repositories.docus.show(req.params("appname")))
|
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", {
|
}).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",
|
||||||
dataType: "string",
|
dataType: "string",
|
||||||
|
|
|
@ -41,16 +41,23 @@
|
||||||
exports.Repository = Foxx.Repository.extend({
|
exports.Repository = Foxx.Repository.extend({
|
||||||
|
|
||||||
// Get the overview of all installed foxxes.
|
// Get the overview of all installed foxxes.
|
||||||
list: function() {
|
list: function(basePath) {
|
||||||
var result = {},
|
var result = {},
|
||||||
apis = [],
|
apis = [],
|
||||||
routes = db._collection("_routing"),
|
routes = db._collection("_routing"),
|
||||||
res = db._collection("_aal").byExample({"type": "mount"});
|
res = db._collection("_aal").byExample({"type": "mount"});
|
||||||
result.swaggerVersion = "1.1";
|
result.swaggerVersion = "1.1";
|
||||||
result.basePath = "http://127.0.0.1:8529/aardvark/docus/";
|
result.basePath = basePath;
|
||||||
result.apis = apis;
|
result.apis = apis;
|
||||||
while (res.hasNext()) {
|
while (res.hasNext()) {
|
||||||
apis.push({path: res.next().mount});
|
var m = res.next().mount;
|
||||||
|
if (m === "/aardvark") {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
apis.push({
|
||||||
|
path: m
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
@ -59,7 +66,6 @@
|
||||||
show: function(appname) {
|
show: function(appname) {
|
||||||
var result = {},
|
var result = {},
|
||||||
apis = [],
|
apis = [],
|
||||||
key,
|
|
||||||
pathes,
|
pathes,
|
||||||
regex = /(:)([^\/]*)/,
|
regex = /(:)([^\/]*)/,
|
||||||
i,
|
i,
|
||||||
|
@ -67,7 +73,7 @@
|
||||||
api,
|
api,
|
||||||
ops,
|
ops,
|
||||||
routes = db._collection("_routing"),
|
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});
|
app = routes.firstExample({"foxxMount": key});
|
||||||
result.swaggerVersion = "1.1";
|
result.swaggerVersion = "1.1";
|
||||||
result.basePath = app.urlPrefix;
|
result.basePath = app.urlPrefix;
|
||||||
|
|
Loading…
Reference in New Issue