mirror of https://gitee.com/bigwinds/arangodb
added transformation
This commit is contained in:
parent
ca15e530c0
commit
8ed7a0115b
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<!-- NO EXTERNAL LINKS 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'/>
|
||||
<script src='js/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<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'/>
|
||||
<!-- NO EXTERNAL LINKS! link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'-->
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
|
|
@ -1148,9 +1148,11 @@ function require (path) {
|
|||
/// @brief loadAppScript
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoApp.prototype.loadAppScript = function (appModule, file, appContext, context) {
|
||||
ArangoApp.prototype.loadAppScript = function (appModule, file, appContext, options) {
|
||||
'use strict';
|
||||
|
||||
options = options || {};
|
||||
|
||||
var fileContent;
|
||||
var full;
|
||||
var key;
|
||||
|
@ -1158,6 +1160,10 @@ function require (path) {
|
|||
try {
|
||||
full = fs.join(this._root, this._path, file);
|
||||
fileContent = fs.read(full);
|
||||
|
||||
if (options.hasOwnProperty('transform')) {
|
||||
fileContent = options.transform(fileContent);
|
||||
}
|
||||
}
|
||||
catch (err1) {
|
||||
throw "cannot read file '" + full + "': " + err1 + " - " + err1.stack;
|
||||
|
@ -1165,7 +1171,9 @@ function require (path) {
|
|||
|
||||
var sandbox = {};
|
||||
|
||||
if (context !== undefined) {
|
||||
if (options.hasOwnProperty('context')) {
|
||||
var context = options.context;
|
||||
|
||||
for (key in context) {
|
||||
if (context.hasOwnProperty(key) && key !== "__myenv__") {
|
||||
sandbox[key] = context[key];
|
||||
|
|
|
@ -35,6 +35,7 @@ var fs = require("fs");
|
|||
|
||||
var executeGlobalContextFunction = require("internal").executeGlobalContextFunction;
|
||||
var checkParameter = arangodb.checkParameter;
|
||||
var transformScript = require("org/arangodb/foxx/transformer").transform;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
|
@ -517,7 +518,7 @@ function routingAalApp (app, mount, options) {
|
|||
|
||||
extendContext(context, app, root);
|
||||
|
||||
app.loadAppScript(context.appModule, file, context);
|
||||
app.loadAppScript(context.appModule, file, context, { transform: transformScript });
|
||||
|
||||
// .............................................................................
|
||||
// routingInfo
|
||||
|
|
Loading…
Reference in New Issue