mirror of https://gitee.com/bigwinds/arangodb
Admin-UI: Added the complete swagger output under applications/swagger
This commit is contained in:
parent
0f473605c0
commit
3952d6c2ce
|
@ -166,7 +166,11 @@ $(document).ready(function() {
|
|||
},
|
||||
|
||||
swagger: function() {
|
||||
alert("Sorry not yet linked");
|
||||
if (this.swaggerView === undefined) {
|
||||
this.swaggerView = new window.SwaggerView();
|
||||
}
|
||||
this.swaggerView.render();
|
||||
this.naviView.selectMenuItem('applications-menu');
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<div id='header'>
|
||||
<div class="swagger-ui-wrap">
|
||||
<a id="logo" href="http://www.arangodb.org">REST-API</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="message-bar" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="swagger-ui-container" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
|
@ -0,0 +1,36 @@
|
|||
window.SwaggerView = Backbone.View.extend({
|
||||
|
||||
el: '#content',
|
||||
template: new EJS({url: '/_admin/html/js/templates/swaggerView.ejs'}),
|
||||
|
||||
initialize: function() {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
discoveryUrl:"api-docs.json",
|
||||
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);
|
||||
}
|
||||
},
|
||||
docExpansion: "none"
|
||||
});
|
||||
},
|
||||
|
||||
render: function(){
|
||||
$(this.el).html(this.template.render({}));
|
||||
window.swaggerUi.load();
|
||||
return this;
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue