1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Frank Celler 2013-03-26 13:58:20 +01:00
commit a8d9a14e7d
16 changed files with 146 additions and 25 deletions

View File

@ -132,6 +132,7 @@ WIKI = \
UserManualActions \
UserManualArangosh \
UserManualWebInterface \
UserManualFoxx \
jsUnity
## -----------------------------------------------------------------------------

View File

@ -65,6 +65,8 @@ This will require the file `wolf.js` in the libs folder you have defined and mak
### Handling Requests
If you do not redefine it, all requests that go to the root of your application will be redirected to `index.html`.
#### FoxxApplication#head
@copydetails JSF_foxx_application_head

View File

@ -221,7 +221,11 @@ ALIASES += \
"RESTQUERYPARAM{3}=@htmlonly<div class=\"restqueryparam\">@endhtmlonly\1 (\2,\3)@htmlonly</div>@endhtmlonly" \
"RESTRETURNCODES=@htmlonly<div class=\"restreturncodes\">Return Codes</div>@endhtmlonly" \
"RESTRETURNCODE{1}=@htmlonly<div class=\"restreturncode\">HTTP \1</div>@endhtmlonly" \
"RESTDESCRIPTION=@htmlonly<div class=\"restdescription\">Description</div>@endhtmlonly"
"RESTDESCRIPTION=@htmlonly<div class=\"restdescription\">Description</div>@endhtmlonly" \
"RESTURLPARAMETERS=@htmlonly<div class=\"resturlparameters\">URL parameters</div>@endhtmlonly" \
"RESTURLPARAM{3}=@htmlonly<div class=\"resturlparam\">URL parameter</div>@endhtmlonly" \
"RESTHEADERPARAMETERS=@htmlonly<div class=\"restheaderparameters\">HTTP header parameters</div>@endhtmlonly" \
"RESTHEADERPARAM{2}=@htmlonly<div class=\"restheaderparam\">HTTP header</div>@endhtmlonly"
# navigation
ALIASES += \

View File

@ -540,7 +540,7 @@ bool RestDocumentHandler::readDocument () {
/// assert(response.code === 304);
///
/// logJsonResponse(response);
// db._drop(cn);
/// db._drop(cn);
/// @END_EXAMPLE_ARANGOSH_RUN
///
/// Unknown document handle:

View File

@ -45,3 +45,7 @@ body, input, textarea, .page-title span, .pingback a.url {
height: 34px;
padding: 0 !important;
}
.applications-menu {
display: none;
}

View File

@ -138,12 +138,6 @@ div.heading_with_menu ul {
height: 100px;
}
p {
line-height: 1.4em;
padding: 0 0 10px 0;
color: #333333;
}
ol {
margin: 0px 0 10px 0;
padding: 0 0 0 18px;
@ -228,7 +222,6 @@ a.hider {
strong {
font-family: "Droid Sans", sans-serif;
font-weight: bold;
font-weight: bold;
}
.code {
@ -397,7 +390,7 @@ form.fullwidth ol li.string input, form.fullwidth ol li.url input, form.fullwidt
}
body {
font-family: "Droid Sans", sans-serif;
/* font-family: "Droid Sans", sans-serif; */
}
body #content_message {
@ -415,7 +408,7 @@ body #header a#logo {
font-size: 1.5em;
font-weight: bold;
text-decoration: none;
background: transparent url(../images/logo_small.png) no-repeat left center;
background: transparent url(../../img/swagger/logo_small.png) no-repeat left center;
padding: 20px 0 20px 40px;
color: white;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -7,6 +7,11 @@
<title>ArangoDB Web Interface</title>
<meta name="description" content="ArangoDB Admin Web Interface">
<meta name="author" content="Heiko Kernbach">
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link href='css/swagger/hightlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/swagger/screen.css' media='screen' rel='stylesheet' type='text/css'/>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/jquery-ui-1.9.2.custom.css" rel="stylesheet">
<link href="css/layout.css" rel="stylesheet">
@ -28,6 +33,9 @@
<link href="css/jquery.gritter.css" rel="stylesheet">
<link href="css/modal.css" rel="stylesheet">
<link href="css/ansi.css" rel="stylesheet">
</head>
<body>
@ -52,24 +60,39 @@
<!-- libs -->
<script src="js/lib/jquery-1.8.3.js"></script>
<script src="js/lib/jquery-ui-1.9.2.custom.js"></script>
<script src="js/lib/underscore.js"></script>
<script src="js/lib/backbone.js"></script>
<script src="js/lib/d3.v3.js"></script>
<script src="js/lib/nv.d3.js"></script>
<script src="js/lib/jquery.dataTables.js"></script>
<script src="js/lib/ColVis.js"></script>
<script src="js/lib/jquery.autogrow.js"></script>
<script src="js/lib/jquery.jeditable.js"></script>
<script src="js/lib/jquery.jeditable.autogrow.js"></script>
<script src="js/lib/jquery.jeditable.autogrow.js"></script>
<script src="js/lib/jquery.snippet.js"></script>
<script src="js/lib/jquery.gritter.js"></script>
<script src='js/lib/jquery.slideto.min.js' type='text/javascript'></script>
<script src='js/lib/jquery.wiggle.min.js' type='text/javascript'></script>
<script src='js/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
<script src='js/lib/handlebars-1.0.rc.1.js' type='text/javascript'></script>
<script src="js/lib/underscore.js"></script>
<script src="js/lib/backbone.js"></script>
<script src="js/lib/d3.v3.js"></script>
<script src="js/lib/nv.d3.js"></script>
<script src="js/lib/ColVis.js"></script>
<script src="js/lib/ejs_fulljslint.js"></script>
<script src="js/lib/ejs_0.9_alpha_1_production.js"></script>
<script src="js/lib/jquery.snippet.js"></script>
<script src="js/lib/bootstrap.js"></script>
<script src="js/lib/bootstrap-pagination.js"></script>
<script src="src/ace.js"></script>
<script src="js/lib/jqconsole.min.js"></script>
<script src="js/lib/jquery.gritter.js"></script>
<script src="js/lib/splitter.js"></script>
<script src='js/lib/swagger.js' type='text/javascript'></script>
<script src='js/lib/swagger-ui.js' type='text/javascript'></script>
<script src='js/lib/highlight.7.3.pack.js' type='text/javascript'></script>
<!-- arango -->
<script src="js/arango/arango.js"></script>
@ -132,6 +155,7 @@
<script src="js/views/logsView.js"></script>
<script src="js/views/foxxView.js"></script>
<script src="js/views/foxxListView.js"></script>
<script src="js/views/swaggerView.js"></script>
<!-- router -->
<script src="js/routers/router.js"></script>

View File

@ -637,7 +637,7 @@ function program11(depth0,data) {
function program13(depth0,data) {
return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";
return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='img/swagger/throbber.gif' style='display:none' />\n </div>\n ";
}
buffer += "\n <ul class='operations' >\n <li class='";

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

@ -10,7 +10,7 @@
<ul class="arango-nav nav pull-right">
<li class="dashboard-menu" style="visibility:hidden"><a href="#dashboard">Dashboard</a></li>
<li class="dropdown applications-menu" style="visibility:hidden"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Applications<b class="caret"></b></a>
<li class="dropdown applications-menu"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Applications<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#applications">Overview</a></li>
<li><a href="#applications/swagger">Swagger</a></li>

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

View File

@ -134,7 +134,15 @@ function SetRoutesFoxxApplicationSpec () {
var myFunc = function () {},
routes = app.routingInfo.routes;
app.delete('/simple/route', myFunc);
app['delete']('/simple/route', myFunc);
assertEqual(routes[0].url.methods, ["delete"]);
},
testSetMethodToDeleteViaAlias: function () {
var myFunc = function () {},
routes = app.routingInfo.routes;
app.del('/simple/route', myFunc);
assertEqual(routes[0].url.methods, ["delete"]);
},
@ -193,7 +201,7 @@ function SetRoutesFoxxApplicationSpec () {
assertEqual(action.callback, myFuncString);
},
testStart: function () {
testStartAddsRequiresAndContext: function () {
var myFunc = function () {},
routes = app.routingInfo.routes;
@ -209,6 +217,16 @@ function SetRoutesFoxxApplicationSpec () {
assertEqual(app.routingInfo.routes[0].action.context, "myContext");
assertEqual(app.routingInfo.routes[0].action.requiresLibs.a, 1);
assertEqual(app.routingInfo.routes[0].action.requiresModels.b, 2);
},
testStartAddsRequiresAndContext: function () {
app.get('/simple/route', function() {});
app.start("myContext");
assertEqual(app.routingInfo.routes[1].url, "/");
assertEqual(app.routingInfo.routes[1].action['do'], "org/arangodb/actions/redirectRequest");
assertEqual(app.routingInfo.routes[1].action.options.permanently, true);
assertEqual(app.routingInfo.routes[1].action.options.destination, "index.html");
}
};
}

View File

@ -145,6 +145,17 @@ _.extend(FoxxApplication.prototype, {
route.action.requiresModels = models;
});
this.routingInfo.routes.push({
"url" : "/",
"action" : {
"do" : "org/arangodb/actions/redirectRequest",
"options" : {
"permanently" : true,
"destination" : "index.html"
}
}
});
db._collection("_routing").save(this.routingInfo);
},
@ -276,18 +287,29 @@ _.extend(FoxxApplication.prototype, {
/// This handles requests from the HTTP verb `delete`.
/// See above for the arguments you can give.
/// **A word of warning:** Do not forget that `delete` is
/// a reserved word in JavaScript so call it as follows:
/// a reserved word in JavaScript and therefore needs to be
/// called as `app['delete']`. There is also an alias `del`
/// for this very reason.
///
/// @EXAMPLES
/// app['delete']('/gaense/stall', function (req, res) {
/// // Take this request and deal with it!
/// });
///
/// app.del('/gaense/stall', function (req, res) {
/// // Take this request and deal with it!
/// });
////////////////////////////////////////////////////////////////////////////////
'delete': function (route, argument1, argument2) {
'use strict';
this.handleRequest("delete", route, argument1, argument2);
},
del: function (route, argument1, argument2) {
'use strict';
this['delete'](route, argument1, argument2);
},
////////////////////////////////////////////////////////////////////////////////
/// @fn JSF_foxx_application_before
/// @brief Before