8000 Merge branch '3.3' of https://github.com/arangodb/arangodb into 3.3 · Sandychuang/arangodb@73e6840 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73e6840

Browse files
committed
Merge branch '3.3' of https://github.com/arangodb/arangodb into 3.3
2 parents 5ff22ba + 63048a3 commit 73e6840

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3198
-145
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.3.4 (2018-02-28)
22
-------------------
33

4+
* Vastly improved the Foxx Store UI
5+
46
* fix issue #4677: AQL WITH with bind parameters results in "access after data-modification"
57
for two independent UPSERTs
68

js/apps/system/_admin/aardvark/APP/GruntFile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"frontend/js/lib/bootstrap-min.js",
2020
"frontend/js/lib/d3.min.js",
2121
"frontend/js/lib/nv.d3.min.js",
22-
"frontend/js/lib/dygraph-combined.min.js",
22+
"frontend/js/lib/dygraph-combined.min.js"
2323
],
2424
css: [
2525
"frontend/css/swagger/hightlight.default.css",
@@ -89,10 +89,11 @@
8989
"frontend/js/lib/d3.fisheye.min.js",
9090
"frontend/js/lib/bootstrap-pagination.min.js",
9191
"frontend/js/lib/jqconsole.min.js",
92-
"frontend/js/lib/highlight.7.3.pack.min.js",
92+
"frontend/js/lib/highlight.js",
9393
"frontend/js/lib/joi.browser.js",
9494
"frontend/js/lib/md5.min.js",
9595
"frontend/js/lib/pretty-bytes.js",
96+
"frontend/js/lib/marked.min.js",
9697
"frontend/src/ace.js",
9798
"frontend/src/theme-textmate.js",
9899
"frontend/src/mode-json.js",

js/apps/system/_admin/aardvark/APP/foxxes.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ const joi = require('joi');
2929
const dd = require('dedent');
3030
const internal = require('internal');
3131
const crypto = require('@arangodb/crypto');
32-
const marked = require('marked');
33-
const highlightAuto = require('highlightjs').highlightAuto;
3432
const errors = require('@arangodb').errors;
3533
const FoxxManager = require('@arangodb/foxx/manager');
3634
const store = require('@arangodb/foxx/store');
@@ -148,6 +146,18 @@ installer.put('/git', function (req) {
148146
Install a Foxx with user/repository and version.
149147
`);
150148

149+
installer.put('/url', function (req) {
150+
req.body = `${req.body.url}`;
151+
})
152+
.body(joi.object({
153+
url: joi.string().required(),
154+
version: joi.string().default('master')
155+
}).required(), '')
156+
.summary('Install a Foxx from URL')
157+
.description(dd`
158+
Install a Foxx from URL.
159+
`);
160+
151161
installer.put('/generate', (req, res) => {
152162
const tempDir = fs.getTempFile('aardvark', false);
153163
const generated = FoxxGenerator.generate(req.body);
@@ -230,9 +240,7 @@ router.get('/', function (req, res) {
230240
config: service.getConfiguration(),
231241
deps: service.getDependencies(),
232242
scripts: service.getScripts(),
233-
readme: service.readme && marked(service.readme, {
234-
highlight: (code) => highlightAuto(code).value
235-
})
243+
readme: service.readme
236244
})));
237245
})
238246
.summary('List all Foxxes')
Loading
Loading

js/apps/system/_admin/aardvark/APP/frontend/js/arango/arango.js

Lines changed: 151 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* jshint unused: false */
2-
/* global Blob, window, sigma, $, Tippy, document, _, arangoHelper, frontendConfig, arangoHelper, sessionStorage, localStorage */
2+
/* global Blob, window, Joi, sigma, $, Tippy, document, _, arangoHelper, frontendConfig, arangoHelper, sessionStorage, localStorage */
33

44
(function () {
55
'use strict';
@@ -248,13 +248,6 @@
248248

249249
fixTooltips: function (selector, placement) {
250250
arangoHelper.createTooltips(selector, placement);
251-
/*
252-
$(selector).tooltip({
253-
placement: placement,
254-
hide: false,
255-
show: false
256-
});
257-
*/
258251
},
259252

260253
currentDatabase: function (callback) {
@@ -454,6 +447,32 @@
454447
this.buildSubNavBar(menus);
455448
},
456449

450+
buildServicesSubNav: function (activeKey, disabled) {
451+
var menus = {
452+
Store: {
453+
route: '#services/install'
454+
},
455+
Upload: {
456+
route: '#services/install/upload'
457+
},
458+
New: {
459+
route: '#services/install/new'
460+
},
461+
GitHub: {
462+
route: '#services/install/github'
463+
},
464+
Remote: {
465+
route: '#services/install/remote'
466+
}
467+
};
468+
469+
menus[activeKey].active = true;
470+
if (disabled) {
471+
menus[disabled].disabled = true;
472+
}
473+
this.buildSubNavBar(menus);
474+
},
475+
457476
scaleability: undefined,
458477

459478
/*
@@ -1080,7 +1099,130 @@
10801099
arangoHelper.arangoError('User', 'Could not fetch collection permissions.');
10811100
}
10821101
});
1083-
}
1102+
},
1103+
1104+
getFoxxFlag: function () {
1105+
var flag;
1106+
1107+
if ($('#new-app-replace').prop('checked')) {
1108+
flag = true;
1109+
} else {
1110+
if ($('#new-app-teardown').prop('checked')) {
1111+
flag = false;
1112+
}
1113+
}
1114+
1115+
return flag;
1116+
},
1117+
1118+
createMountPointModal: function (callback, mode, mountpoint) {
1119+
var buttons = []; var tableContent = [];
10841120

1121+
var mountPoint;
1122+
1123+
if (window.App.replaceApp) {
1124+
mountPoint = window.App.replaceAppData.mount;
1125+
mountPoint = mountPoint.substr(1, mountPoint.length);
1126+
}
1127+
1128+
tableContent.push(
1129+
window.modalView.createTextEntry(
1130+
'new-app-mount',
1131+
'Mountpoint',
1132+
mountPoint,
1133+
'The path the app will be mounted. Is not allowed to start with _',
1134+
'mountpoint',
1135+
false,
1136+
[
1137+
{
1138+
rule: Joi.string().required(),
1139+
msg: ''
1140+
}
1141+
]
1142+
)
1143+
);
1144+
1145+
tableContent.push(
1146+
window.modalView.createCheckboxEntry(
1147+
'new-app-teardown',
1148+
'Run setup?',
1149+
true,
1150+
"Should this app's setup script be executed after installing the app?",
1151+
true
1152+
)
1153+
);
1154+
1155+
if (window.App.replaceApp) {
1156+
tableContent.push(
1157+
window.modalView.createCheckboxEntry(
1158+
'new-app-replace',
1159+
'Keep configuration and dependency files?',
1160+
true,
1161+
"Should this app's configuration be saved before replacing the app?",
1162+
false
1163+
)
1164+
);
1165+
1166+
buttons.push(
1167+
window.modalView.createSuccessButton('Replace', callback)
1168+
);
1169+
} else {
1170+
buttons.push(
1171+
window.modalView.createSuccessButton('Install', callback)
1172+
);
1173+
}
1174+
1175+
var titleString = 'Create Foxx Service';
1176+
if (window.App.replaceApp) {
1177+
titleString = 'Replace Foxx Service (' + window.App.replaceAppData.mount + ')';
1178+
}
1179+
1180+
window.modalView.show(
1181+
'modalTable.ejs',
1182+
titleString,
1183+
buttons,
1184+
tableContent
1185+
);
1186+
1187+
if (!window.App.replaceApp) {
1188+
window.modalView.modalBindValidation({
1189+
id: 'new-app-mount',
1190+
validateInput: function () {
1191+
return [
1192+
{
1193+
rule: Joi.string().regex(/^((APP[^/]+|(?!APP)[a-zA-Z0-9_\-%]+))+$/i),
1194+
msg: 'May not contain /APP'
1195+
},
1196+
{
1197+
rule: Joi.string().regex(/^([a-zA-Z0-9_\-%]+)+$/),
1198+
msg: 'Can only contain [a-zA-Z0-9_-%]'
1199+
},
1200+
{
1201+
rule: Joi.string().regex(/([^_]|_open\/)/),
1202+
msg: 'Mountpoints with _ are reserved for internal use'
1203+
},
1204+
{
1205+
rule: Joi.string().regex(/[^/]$/),
1206+
msg: 'May not end with /'
1207+
},
1208+
{
1209+
rule: Joi.string().required().min(1),
1210+
msg: 'Has to be non-empty'
1211+
}
1212+
];
1213+
}
1214+
});
1215+
} else {
1216+
$('#new-app-mount').attr('disabled', 'true');
1217+
$('#new-app-replace').attr('checked', false);
1218+
$('#new-app-replace').on('click', function () {
1219+
if ($('#new-app-replace').prop('checked')) {
1220+
$('#new-app-teardown').attr('disabled', true);
1221+
} else {
1222+
$('#new-app-teardown').attr('disabled', false);
1223+
}
1224+
});
1225+
}
1226+
}
10851227
};
10861228
}());

js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoUsers.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ window.ArangoUsers = Backbone.Collection.extend({
2222

2323
fetch: function (options) {
2424
if (window.App.currentUser && window.App.currentDB.get('name') !== '_system' && frontendConfig.authenticationEnabled) {
25-
this.url = frontendConfig.basePath + '/_api/user/' + encodeURIComponent(window.App.currentUser);
25+
this.url = arangoHelper.databaseUrl(frontendConfig.basePath + '/_api/user/' + encodeURIComponent(window.App.currentUser));
2626
} else {
2727
if (this.authOptions.ro) {
28-
this.url = frontendConfig.basePath + '/_api/user/' + encodeURIComponent(window.App.currentUser);
28+
this.url = arangoHelper.databaseUrl(frontendConfig.basePath + '/_api/user/' + encodeURIComponent(window.App.currentUser));
2929
} else {
30-
this.url = frontendConfig.basePath + '/_api/user';
30+
this.url = arangoHelper.databaseUrl(frontendConfig.basePath + '/_api/user/');
3131
}
3232
}
3333
return Backbone.Collection.prototype.fetch.call(this, options);
@@ -106,7 +106,6 @@ window.ArangoUsers = Backbone.Collection.extend({
106106
loadUserSettings: function (callback) {
107107
var self = this;
108108

109-
console.log(frontendConfig.authenticationEnabled);
110109
var url;
111110
if (!frontendConfig.authenticationEnabled) {
112111
url = arangoHelper.databaseUrl('/_api/user/root');

js/apps/system/_admin/aardvark/APP/frontend/js/collections/foxxCollection.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,36 @@
5858
});
5959
},
6060

61+
// Install Foxx from public url
62+
// info is expected to contain: "url" and "version"
63+
installFromUrl: function (info, mount, callback, isLegacy, flag) {
64+
var url = arangoHelper.databaseUrl('/_admin/aardvark/foxxes/url?mount=' + encodeURIComponent(mount));
65+
if (isLegacy) {
66+
url += '&legacy=true';
67+
}
68+
if (flag !== undefined) {
69+
if (flag) {
70+
url += '&replace=true';
71+
} else {
72+
url += '&upgrade=true';
73+
}
74+
}
75+
$.ajax({
76+
cache: false,
77+
type: 'PUT',
78+
url: url,
79+
data: JSON.stringify(info),
80+
contentType: 'application/json',
81+
processData: false,
82+
success: function (data) {
83+
callback(data);
84+
},
85+
error: function (err) {
86+
callback(err);
87+
}
88+
});
89+
},
90+
6191
// Install Foxx from arango store
6292
// info is expected to contain: "name" and "version"
6393
installFromStore: function (info, mount, callback, flag) {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/* jshint browser: true */
2+
/* jshint unused: false */
3+
/* global window, _, Backbone */
4+
(function () {
5+
'use strict';
6+
window.FoxxRepository = Backbone.Collection.extend({
7+
model: window.FoxxRepoModel,
8+
9+
sortOptions: {
10+
desc: false
11+
},
12+
13+
url: 'foxxes/fishbowl',
14+
15+
parse: function (response) {
16+
var foxxes = [];
17+
_.each(response, function (foxx) {
18+
// hide legacy applications
19+
if (!foxx.legacy) {
20+
foxxes.push(foxx);
21+
}
22+
// }
23+
});
24+
return foxxes;
25+
},
26+
27+
comparator: function (item, item2) {
28+
var a, b;
29+
if (this.sortOptions.desc === true) {
30+
a = item.get('mount');
31+
b = item2.get('mount');
32+
return a < b ? 1 : a > b ? -1 : 0;
33+
}
34+
a = item.get('mount');
35+
b = item2.get('mount');
36+
return a > b ? 1 : a < b ? -1 : 0;
37+
},
38+
39+
setSortingDesc: function (val) {
40+
this.sortOptions.desc = val;
41+
}
42+
43+
});
44+
}());

js/apps/system/_admin/aardvark/APP/frontend/js/lib/highlight.7.3.pack.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)
0