1
0
Fork 0

Admin-UI: Added the complete swagger output under applications/swagger

This commit is contained in:
Michael Hackstein 2013-03-26 10:28:27 +01:00
parent 0f473605c0
commit 3952d6c2ce
3 changed files with 54 additions and 1 deletions

View File

@ -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');
}
});

View File

@ -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">
&nbsp;
</div>
<div id="swagger-ui-container" class="swagger-ui-wrap">
</div>

View File

@ -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;
}
});