1
0
Fork 0

Merge branch 'engine-api' of github.com:arangodb/arangodb into engine-api

This commit is contained in:
hkernbach 2017-04-18 10:11:53 +02:00
commit 266042649b
30 changed files with 971 additions and 259 deletions

View File

@ -1335,3 +1335,13 @@
* GitHub: https://github.com/softwaretailoring/wheelnav
* License: [MIT License](https://github.com/softwaretailoring/wheelnav/blob/master/LICENSE)
#### Moment.js
* GitHub: https://github.com/moment/moment/
* License: [MIT License](https://github.com/moment/moment/blob/develop/LICENSE)
#### tippyjs.js
* GitHub: https://github.com/atomiks/tippyjs
* License: [MIT License](https://github.com/atomiks/tippyjs/blob/master/LICENSE)

View File

@ -19,7 +19,7 @@
"frontend/js/lib/bootstrap-min.js",
"frontend/js/lib/d3.min.js",
"frontend/js/lib/nv.d3.min.js",
"frontend/js/lib/dygraph-combined.min.js"
"frontend/js/lib/dygraph-combined.min.js",
],
css: [
"frontend/css/swagger/hightlight.default.css",
@ -34,6 +34,7 @@
"frontend/css/highlightjs.css",
"frontend/css/jsoneditor.css",
"frontend/css/grids-responsive-min.css",
"frontend/css/tippy.css",
"frontend/ttf/arangofont/style.css"
]
},
@ -53,6 +54,8 @@
"frontend/js/lib/select2.min.js",
"frontend/js/lib/typeahead.bundle.min.js",
"frontend/js/lib/numeral.min.js",
"frontend/js/lib/moment.min.js",
"frontend/js/lib/tippy.js",
// START SIGMA LIBRARIES
"frontend/js/lib/sigma.min.js",
"frontend/js/lib/sigma.renderers.halo.js",

File diff suppressed because one or more lines are too long

View File

@ -53,6 +53,9 @@
<div id="graphSettingsContent" style="display: none">
</div>
<div id="filterSelectDiv" style="display:none">
</div>
<div id="offlinePlaceholder" style="display:none">
<div class="offline-div">

View File

@ -1,5 +1,5 @@
/* jshint unused: false */
/* global Blob, window, sigma, $, document, _, arangoHelper, frontendConfig, arangoHelper, localStorage */
/* global Blob, window, sigma, $, Tippy, document, _, arangoHelper, frontendConfig, arangoHelper, localStorage */
(function () {
'use strict';
@ -44,6 +44,44 @@
};
window.arangoHelper = {
alphabetColors: {
a: 'rgb(0,0,180)',
b: 'rgb(175,13,102)',
c: 'rgb(146,248,70)',
d: 'rgb(255,200,47)',
e: 'rgb(255,118,0)',
f: 'rgb(185,185,185)',
g: 'rgb(235,235,222)',
h: 'rgb(100,100,100)',
i: 'rgb(255,255,0)',
j: 'rgb(55,19,112)',
k: 'rgb(255,255,150)',
l: 'rgb(202,62,94)',
m: 'rgb(205,145,63)',
n: 'rgb(12,75,100)',
o: 'rgb(255,0,0)',
p: 'rgb(175,155,50)',
q: 'rgb(0,0,0)',
r: 'rgb(37,70,25)',
s: 'rgb(121,33,135)',
t: 'rgb(83,140,208)',
u: 'rgb(0,154,37)',
v: 'rgb(178,220,205)',
w: 'rgb(255,152,213)',
x: 'rgb(0,0,74)',
y: 'rgb(175,200,74)',
z: 'rgb(63,25,12)'
},
statusColors: {
fatal: '#ad5148',
info: 'rgb(88, 214, 141)',
error: 'rgb(236, 112, 99)',
warning: '#ffb075',
debug: 'rgb(64, 74, 83)'
},
getCurrentJwt: function () {
return localStorage.getItem('jwt');
},
@ -158,12 +196,49 @@
return windowHeight - footer - navigation - 110;
},
createTooltips: function (selector, position) {
var self = this;
var settings = {
arrow: true,
animation: 'fade',
animateFill: false,
multiple: false,
hideDuration: 1
};
if (position) {
settings.position = position;
}
if (!selector) {
selector = '.tippy';
}
if (typeof selector === 'object') {
_.each(selector, function (elem) {
self.lastTooltips = new Tippy(elem, settings);
});
} else {
if (selector.indexOf(',') > -1) {
var selectors = selector.split(',');
_.each(selectors, function (elem) {
self.lastTooltips = new Tippy(elem, settings);
});
}
this.lastTooltips = new Tippy(selector, settings);
}
},
fixTooltips: function (selector, placement) {
arangoHelper.createTooltips(selector, placement);
/*
$(selector).tooltip({
placement: placement,
hide: false,
show: false
});
*/
},
currentDatabase: function (callback) {

View File

@ -15,6 +15,7 @@
myResponse.push({
level: response.level[i],
lid: val,
topic: response.topic[i],
text: response.text[i],
timestamp: response.timestamp[i],
totalAmount: response.totalAmount
@ -56,6 +57,7 @@
type = 'level';
}
rtnStr = '/_admin/log?' + type + '=' + this.loglevel + '&size=' + size + '&offset=' + inverseOffset;
this.lastInverseOffset = inverseOffset;
return arangoHelper.databaseUrl(rtnStr);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@
'nodes': 'nodes',
'shards': 'shards',
'node/:name': 'node',
'logs': 'logs',
'logs': 'logger',
'helpus': 'helpUs',
'graph/:name': 'graph',
'graph/:name/settings': 'graphSettings',
@ -57,6 +57,15 @@
d3.selectAll('svg > *').remove();
}
if (this.lastRoute === '#logger') {
if (this.loggerView.logLevelView) {
this.loggerView.logLevelView.remove();
}
if (this.loggerView.logTopicView) {
this.loggerView.logTopicView.remove();
}
}
this.lastRoute = window.location.hash;
// this function executes before every route call
$('#subNavigationBar .breadcrumb').html('');
@ -442,72 +451,23 @@
xhr.setRequestHeader('Authorization', 'Basic ' + btoa(token));
},
logs: function (name, initialized) {
logger: function (name, initialized) {
this.checkUser();
if (!initialized) {
this.waitForInit(this.logs.bind(this), name);
this.waitForInit(this.logger.bind(this), name);
return;
}
if (!this.logsView) {
var newLogsAllCollection = new window.ArangoLogs(
if (!this.loggerView) {
var co = new window.ArangoLogs(
{upto: true, loglevel: 4}
);
var newLogsDebugCollection = new window.ArangoLogs(
{loglevel: 4}
);
var newLogsInfoCollection = new window.ArangoLogs(
{loglevel: 3}
);
var newLogsWarningCollection = new window.ArangoLogs(
{loglevel: 2}
);
var newLogsErrorCollection = new window.ArangoLogs(
{loglevel: 1}
);
this.logsView = new window.LogsView({
logall: newLogsAllCollection,
logdebug: newLogsDebugCollection,
loginfo: newLogsInfoCollection,
logwarning: newLogsWarningCollection,
logerror: newLogsErrorCollection
this.loggerView = new window.LoggerView({
collection: co
});
}
this.logsView.render();
this.loggerView.render();
},
/*
nLogs: function (nodename, initialized) {
this.checkUser()
if (!initialized) {
this.waitForInit(this.nLogs.bind(this), nodename)
return
}
var newLogsAllCollection = new window.ArangoLogs(
{upto: true, loglevel: 4}
),
newLogsDebugCollection = new window.ArangoLogs(
{loglevel: 4}
),
newLogsInfoCollection = new window.ArangoLogs(
{loglevel: 3}
),
newLogsWarningCollection = new window.ArangoLogs(
{loglevel: 2}
),
newLogsErrorCollection = new window.ArangoLogs(
{loglevel: 1}
)
this.nLogsView = new window.LogsView({
logall: newLogsAllCollection,
logdebug: newLogsDebugCollection,
loginfo: newLogsInfoCollection,
logwarning: newLogsWarningCollection,
logerror: newLogsErrorCollection
})
this.nLogsView.render()
},
*/
applicationDetail: function (mount, initialized) {
this.checkUser();
if (!initialized) {

View File

@ -5,9 +5,8 @@
<input type="hidden" id="newEdgeDefinitions<%= number%>" value="" placeholder="Edge definitions" tabindex="-1" class="select2-offscreen">
<button id="remove_newEdgeDefinitions<%= number%>" class="graphViewer-icon-button gv_internal_remove_line gv-icon-small delete"></button>
</th><th>
<a class="modalTooltips" title="Some info for edge definitions">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Some info for edge definitions">
</span>
</th>
</tr>
<tr class="tableRow" id="row_fromCollections<%= number%>">
@ -15,9 +14,8 @@
<th class="collectionTh">
<input type="hidden" id="fromCollections<%= number%>" value="" placeholder="fromCollections" tabindex="-1" class="select2-offscreen">
</th><th>
<a class="modalTooltips" title="The collection that contain the start vertices of the relation.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="The collection that contain the start vertices of the relation.">
</span>
</th>
</tr>
<tr class="tableRow" id="row_toCollections<%= number%>">
@ -25,9 +23,8 @@
<th class="collectionTh">
<input type="hidden" id="toCollections<%= number%>" value="" placeholder="toCollections" tabindex="-1" class="select2-offscreen">
</th><th>
<a class="modalTooltips" title="The collection that contain the end vertices of the relation.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="The collection that contain the end vertices of the relation.">
</span>
</th>
</tr>
</script>

View File

@ -0,0 +1,36 @@
<script id="filterSelect.ejs" type="text/template">
<div class="filterSelectBox">
<div class="filterLabel"><%=name%><span><i class="fa fa-close" id="closeFilter"></i></span></div>
<div class="filterInput">
<input type="text" id="<%=name%>-filter" placeholder="Filter <%=name%>" aria-label="Filter labels" autocomplete="off">
</div>
<div class="filterOptions">
<div id="showAll"><strong>Show all</strong></div>
<% var cssClass; %>
<% _.each(options, function (option) { %>
<% if (option.active) { %>
<% cssClass = 'active'; %>
<% } else { %>
<% cssClass = 'inactive'; %>
<% } %>
<div class="<%=cssClass%>" name="<%=option.name%>" id="<%=option.name%>-option">
<% var color = option.color || '#f6f8fa'; %>
<% if (cssClass === 'active') { %>
<span class="marked"><i class="fa fa-check"/></span>
<% } else { %>
<span style="visibility: hidden;" class="marked"><i class="fa fa-check"/></span>
<% } %>
<span class="color" style="background-color: <%=color%>">&nbsp;</span>
<span class="name"><%=option.name%></span>
</div>
<% }); %>
</div>
</div>
</script>

View File

@ -18,7 +18,7 @@
<tr>
<th class="collectionTh">Mount:</th>
<th class="collectionTh"><input type="text" id="change-mount-point" name="mountpoint" value="<%=attributes.mount%>"/></th>
<th><a class="modalTooltips" title="The path where the app can be reached."><i class="arangoicon icon_arangodb_info"></i></a></th>
<th><span class="modalTooltips arangoicon icon_arangodb_info" title="The path where the app can be reached."></span></th>
</tr>
<tr>
<th class="collectionTh">Version:</th>

View File

@ -0,0 +1,59 @@
<script id="loggerView.ejs" type="text/template">
<div id="loggerContent" class="logger-content-id innerContent">
<div class="arangoToolbar arangoToolbarTop">
<div class="pull-left">
</div>
<div class="pull-right">
<button id="logTopicSelection" class="button-default filterSelect">Topic <i class="fa fa-caret-down"></i></button>
<button id="logLevelSelection" class="button-default filterSelect">Level <i class="fa fa-caret-down"></i></button>
<button style="display: none" class="button-default filterSelect" id="logFilters">
<i class="fa fa-close"></i>Clear current <a id="filterDesc"></a> filter
</button>
</div>
</div>
<div id="noLogEntries" style="display: none">
<span>No suitable log entries found </span>
</div>
<div id="logEntries">
</div>
<div class="actions">
<button id="loadMoreEntries" class="button-success">Load older entries</button>
</div>
</div>
</script>
<script id="loggerViewEntries.ejs" type="text/template">
<% _.each(entries, function (entry) { %>
<div class="pure-g" level="<%=entry.status.toLowerCase()%>" topic="<%=entry.topic.toLowerCase()%>">
<div class="pure-u-1-24">
<p class="labels">
<% var lcolor = arangoHelper.statusColors[entry.status.toLowerCase()];%>
<% var tcolor = arangoHelper.alphabetColors[entry.topic.charAt(0).toLowerCase()];%>
<span class="tippy level" title="Level: <%=entry.status%>" style="background: <%=lcolor%>"></span>
<span class="tippy topic" title="Topic: <%=entry.topic%>" style="background: <%=tcolor%>"></span>
</p>
</div>
<div class="pure-u-19-24 desc">
<p class="msg"><%=entry.msg%></p>
</div>
<div class="pure-u-4-24 date">
<p>
<% var x = moment(entry.timestamp, "X").fromNow() %>
<i class="fa fa-clock-o" aria-hidden="true"></i>
<span class="tippy" title="<%=entry.date%>"><%= x %></span>
</p>
</div>
<div class="logBorder"></div>
</div>
<% }); %>
</script>

View File

@ -1,5 +0,0 @@
<script id="logsView.ejs" type="text/template">
<div id="logContent" class="log-content-id innerContent">
</div>
<!-- <div id="logPaginationDiv" class="pagination-line"></div> -->
</script>

View File

@ -16,9 +16,8 @@
<input type="text" id="new-app-mount" value="" placeholder="/my/foxx"></input>
</th>
<th>
<a class="modalTooltips" title="The path the app will be mounted. Has to start with /. Is not allowed to start with /_">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="The path the app will be mounted. Has to start with /. Is not allowed to start with /_">
</span>
</th>
<% } %>
</tr>
@ -85,9 +84,8 @@
<input type="hidden" id="new-app-document-collections" value="" placeholder="Document Collections"></input>
</th>
<th>
<a class="modalTooltips" title="A list of document collections that will be created specifically for this Service. A CRUD API for these will be generated.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="A list of document collections that will be created specifically for this Service. A CRUD API for these will be generated.">
</span>
</th>
</tr>
<tr class="tableRow">
@ -98,9 +96,8 @@
<input type="hidden" id="new-app-edge-collections" value="" placeholder="Edge Collections"></input>
</th>
<th>
<a class="modalTooltips" title="A list of edge collections that will be created specifically for this Service. A CRUD API for these will be generated.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="A list of edge collections that will be created specifically for this Service. A CRUD API for these will be generated.">
</span>
</th>
</tr>
</table>
@ -144,9 +141,8 @@
<input type="checkbox" id="github-app-islegacy" value="true">
</th>
<th>
<a class="modalTooltips" title="Legacy Compatibility Mode allows mounting some Foxx services written for ArangoDB 2.8 or older. This overrides the ArangoDB version specified in the service manifest. See the Foxx documentation for more information on running legacy services in ArangoDB 3.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Legacy Compatibility Mode allows mounting some Foxx services written for ArangoDB 2.8 or older. This overrides the ArangoDB version specified in the service manifest. See the Foxx documentation for more information on running legacy services in ArangoDB 3.">
</span>
</th>
</tr>
</table>
@ -170,9 +166,8 @@
<input type="checkbox" id="zip-app-islegacy" value="true">
</th>
<th>
<a class="modalTooltips" title="Legacy Compatibility Mode allows mounting some Foxx services written for ArangoDB 2.8 or older. This overrides the ArangoDB version specified in the service manifest. See the Foxx documentation for more information on running legacy services in ArangoDB 3.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Legacy Compatibility Mode allows mounting some Foxx services written for ArangoDB 2.8 or older. This overrides the ArangoDB version specified in the service manifest. See the Foxx documentation for more information on running legacy services in ArangoDB 3.">
</span>
</th>
</tr>
</table>

View File

@ -14,9 +14,8 @@
</th>
<th class="tooltipInfoTh">
<div>
<a class="modalTooltips" data-toggle="tooltip" data-placement="left" title="The maximal size of a journal or datafile (in MB). Must be at least 1.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="The maximal size of a journal or datafile (in MB). Must be at least 1.">
</span>
</div>
</th>
</tr>
@ -29,9 +28,8 @@
</th>
<th class="tooltipInfoTh">
<div>
<a class="modalTooltips" data-toggle="tooltip" data-placement="left" title="Synchronize to disk before returning from a create or update of a document.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Synchronize to disk before returning from a create or update of a document.">
</span>
</div>
</th>
</tr>
@ -153,9 +151,8 @@
</th>
<th class="modal-text"> -</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Total number and size of all living documents.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Total number and size of all living documents.">
</span>
</th>
</tr>
<tr>
@ -168,9 +165,8 @@
<th class="tooltipInfoTh">
<div>
<a class="modalTooltips" title="Total number and size of all dead documents.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Total number and size of all dead documents.">
</span>
</div>
</th>
@ -195,9 +191,8 @@
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<div>
<a class="modalTooltips" data-toggle="tooltip" data-placement="left" title="Number and total size of active datafiles.">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" data-toggle="tooltip" data-placement="left" title="Number and total size of active datafiles.">
</span>
</div>
</th>
</tr>
@ -209,8 +204,8 @@
</th>
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Number and total size of journal files.">
<span class="arangoicon icon_arangodb_info"></span></a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Number and total size of journal files.">
</span>
</th>
</tr>
<tr>
@ -221,8 +216,7 @@
</th>
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Number and total size of compactor files.">
<span class="arangoicon icon_arangodb_info"></span></a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Number and total size of compactor files."></span>
</th>
</tr>
<tr>
@ -233,8 +227,7 @@
</th>
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Number and total memory usage of indexes.">
<span class="arangoicon icon_arangodb_info"></span></a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Number and total memory usage of indexes."></span>
</th>
</tr>
</table>
@ -253,8 +246,8 @@
<th class="modal-text">&nbsp;</th>
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Total number of uncollected WAL entries">
<span class="arangoicon icon_arangodb_info"></span></a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Total number of uncollected WAL entries">
</span>
</th>
</tr>
<tr>
@ -263,8 +256,8 @@
<th class="modal-text">&nbsp;</th>
<th class="modal-text">&nbsp;</th>
<th class="tooltipInfoTh">
<a class="modalTooltips" title="Total number of objects pointing to documents in collection datafiles">
<span class="arangoicon icon_arangodb_info"></span></a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="Total number of objects pointing to documents in collection datafiles">
</span>
</th>
</tr>
</table>

View File

@ -111,9 +111,8 @@
if (row.info) {
%>
<th>
<a class="modalTooltips" title="<%=row.info%>">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="<%=row.info%>">
</span>
</th>
<%
}

View File

@ -69,9 +69,8 @@
<% if (row.info) { %>
</th>
<th>
<a class="modalTooltips" title="<%=row.info%>">
<span class="arangoicon icon_arangodb_info"></span>
</a>
<span class="modalTooltips arangoicon icon_arangodb_info" title="<%=row.info%>">
</span>
<% } %>
</th>
</tr>

View File

@ -256,8 +256,6 @@
}
model = JSON.stringify(model);
console.log(model);
console.log(this.type);
if (this.type === 'edge' || this.type._from) {
var callbackE = function (error, data) {

View File

@ -958,10 +958,7 @@
this.uploadSetup();
$('[data-toggle=tooltip]').tooltip();
$('.upload-info').tooltip();
arangoHelper.fixTooltips('.icon_arangodb, .arangoicon', 'top');
arangoHelper.fixTooltips(['.icon_arangodb', '.arangoicon', 'top', '[data-toggle=tooltip]', '.upload-info']);
this.renderPaginationElements();
this.selectActivePagesize();
this.markFilterToggle();

View File

@ -0,0 +1,127 @@
/* jshint browser: true */
/* jshint unused: false */
/* global Backbone, templateEngine, window, arangoHelper, $, _ */
(function () {
'use strict';
window.FilterSelectView = Backbone.View.extend({
el: '#filterSelectDiv',
filterOptionsEl: '.filterOptions',
initialize: function (options) {
this.name = options.name;
this.options = options.options;
this.position = options.position;
this.callback = options.callback;
this.multiple = options.multiple;
},
/* options arr elem
* option: {
* name: <string>,
* active: <boolean,
* color: <string>
* }
*/
template: templateEngine.createTemplate('filterSelect.ejs'),
events: {
'click .filterOptions .inactive': 'changeState',
'click .filterOptions .active': 'changeState',
'click #showAll': 'showAll',
'click #closeFilter': 'hide',
'keyup .filterInput input': 'filter'
},
remove: function () {
this.$el.empty().off(); /* off to unbind the events */
this.stopListening();
this.unbind();
delete this.el;
return this;
},
changeState: function (e) {
var self = this;
var name = $(e.currentTarget).attr('name');
if ($(e.currentTarget).hasClass('active')) {
self.options[name].active = false;
$(e.currentTarget).removeClass('active').addClass('inactive');
$(e.currentTarget).find('.marked').css('visibility', 'hidden');
} else {
self.options[name].active = true;
$(e.currentTarget).removeClass('inactive').addClass('active');
$(e.currentTarget).find('.marked').css('visibility', 'visible');
}
if (this.callback) {
this.callback(this.options);
}
},
filter: function () {
var value = $('#' + this.name + '-filter').val();
_.each(this.options, function (option) {
if (option.name.search(value) > -1) {
$('#' + option.name + '-option').css('display', 'block');
} else {
$('#' + option.name + '-option').css('display', 'none');
}
});
},
clearFilter: function () {
$('#' + this.name + '-filter').val('');
this.filter();
},
showAll: function () {
this.clearFilter();
_.each(this.options, function (option) {
option.active = false;
$('#' + option.name + '-option').removeClass('active').addClass('inactive');
$('#' + option.name + '-option').find('.marked').css('visibility', 'hidden');
});
this.callback(this.options);
},
render: function () {
var self = this;
$('#filterSelectDiv').on('click', function (e) {
if (e.target.id === 'filterSelectDiv') {
self.hide();
}
});
_.each(self.options, function (option) {
if (!option.color) {
option.color = arangoHelper.alphabetColors[option.name.charAt(0).toLowerCase()];
}
});
this.$el.html(this.template.render({
name: self.name,
options: self.options
}));
$('#filterSelectDiv > div').css('right', this.position.right + 'px');
$('#filterSelectDiv > div').css('top', this.position.top + 30);
this.show();
$('#' + this.name + '-filter').focus();
},
show: function () {
$(this.el).show();
},
hide: function () {
$('#filterSelectDiv').unbind('click');
$(this.el).hide();
this.remove();
}
});
}());

View File

@ -0,0 +1,371 @@
/* jshint browser: true */
/* jshint unused: false */
/* global Backbone, arangoHelper, $, _, window, templateEngine */
(function () {
'use strict';
window.LoggerView = Backbone.View.extend({
el: '#content',
logsel: '#logEntries',
id: '#logContent',
initDone: false,
pageSize: 20,
currentPage: 0,
logTopics: {},
logLevels: [],
remove: function () {
this.$el.empty().off(); /* off to unbind the events */
this.stopListening();
this.unbind();
delete this.el;
return this;
},
initialize: function (options) {
var self = this;
if (options) {
this.options = options;
}
this.collection.setPageSize(this.pageSize);
if (!this.initDone) {
// first fetch all log topics + topics
$.ajax({
type: 'GET',
cache: false,
url: arangoHelper.databaseUrl('/_admin/log/level'),
contentType: 'application/json',
processData: false,
success: function (data) {
self.logTopics = data;
/*
_.each(self.logTopics, function (topic, name) {
if (self.logLevels.indexOf(topic.toLowerCase()) === -1) {
self.logLevels.push(topic.toLowerCase());
console.log(topic);
}
});
*/
_.each(['fatal', 'error', 'warning', 'info', 'debug'], function (level) {
self.logLevels.push(level);
});
self.initDone = true;
}
});
}
},
currentLoglevel: undefined,
defaultLoglevel: 'info',
events: {
'click #logLevelSelection': 'renderLogLevel',
'click #logTopicSelection': 'renderLogTopic',
'click #logFilters': 'resetFilters',
'click #loadMoreEntries': 'loadMoreEntries'
},
template: templateEngine.createTemplate('loggerView.ejs'),
templateEntries: templateEngine.createTemplate('loggerViewEntries.ejs'),
renderLogTopic: function (e) {
var self = this;
if (!this.logTopicOptions) {
this.logTopicOptions = {};
}
var active;
_.each(this.logTopics, function (topic, name) {
if (self.logTopicOptions[name]) {
active = self.logTopicOptions[name].active;
}
self.logTopicOptions[name] = {
name: name,
active: active || false
};
});
var pos = $(e.currentTarget).position();
pos.right = '30';
this.logTopicView = new window.FilterSelectView({
name: 'Topic',
options: self.logTopicOptions,
position: pos,
callback: self.logTopicCallbackFunction.bind(this),
multiple: true
});
this.logTopicView.render();
},
loadMoreEntries: function () {
this.convertModelToJSON();
},
logTopicCallbackFunction: function (options) {
console.log(options);
this.logTopicOptions = options;
this.applyFilter();
},
logLevelCallbackFunction: function (options) {
this.logLevelOptions = options;
this.applyFilter();
},
resetFilters: function () {
_.each(this.logTopicOptions, function (option) {
option.active = false;
});
_.each(this.logLevelOptions, function (option) {
option.active = false;
});
this.applyFilter();
},
isFilterActive: function (filterobj) {
var active = false;
_.each(filterobj, function (obj) {
if (obj.active) {
active = true;
}
});
return active;
},
changeButton: function (btn) {
if (!btn) {
$('#logTopicSelection').addClass('button-default').removeClass('button-success');
$('#logLevelSelection').addClass('button-default').removeClass('button-success');
$('#logFilters').hide();
$('#filterDesc').html('');
} else {
if (btn === 'level') {
$('#logLevelSelection').addClass('button-success').removeClass('button-default');
$('#logTopicSelection').addClass('button-default').removeClass('button-success');
$('#filterDesc').html(btn);
} else if (btn === 'topic') {
$('#logTopicSelection').addClass('button-success').removeClass('button-default');
$('#logLevelSelection').addClass('button-default').removeClass('button-success');
$('#filterDesc').html(btn);
} else if (btn === 'both') {
$('#logTopicSelection').addClass('button-success').removeClass('button-default');
$('#logLevelSelection').addClass('button-success').removeClass('button-default');
$('#filterDesc').html('level, topic');
}
$('#logFilters').show();
}
},
applyFilter: function () {
var self = this;
var isLevel = this.isFilterActive(this.logLevelOptions);
var isTopic = this.isFilterActive(this.logTopicOptions);
if (isLevel && isTopic) {
// both filters active
_.each($('#logEntries').children(), function (entry) {
if (self.logLevelOptions[$(entry).attr('level')].active === false || self.logTopicOptions[$(entry).attr('topic')].active === false) {
$(entry).hide();
} else if (self.logLevelOptions[$(entry).attr('level')].active && self.logTopicOptions[$(entry).attr('topic')].active) {
$(entry).show();
}
});
this.changeButton('both');
} else if (isLevel && !isTopic) {
// only level filter active
_.each($('#logEntries').children(), function (entry) {
if (self.logLevelOptions[$(entry).attr('level')].active === false) {
$(entry).hide();
} else {
$(entry).show();
}
});
this.changeButton('level');
} else if (!isLevel && isTopic) {
// only topic filter active
_.each($('#logEntries').children(), function (entry) {
if (self.logTopicOptions[$(entry).attr('topic')].active === false) {
$(entry).hide();
} else {
$(entry).show();
}
});
this.changeButton('topic');
} else if (!isLevel && !isTopic) {
_.each($('#logEntries').children(), function (entry) {
$(entry).show();
});
this.changeButton();
}
var count = 0;
_.each($('#logEntries').children(), function (elem) {
if ($(elem).css('display') === 'block') {
count++;
}
});
if (count === 1) {
$('.logBorder').css('visibility', 'hidden');
$('#noLogEntries').hide();
} else if (count === 0) {
$('#noLogEntries').show();
} else {
$('.logBorder').css('visibility', 'visible');
$('#noLogEntries').hide();
}
},
renderLogLevel: function (e) {
var self = this;
if (!this.logLevelOptions) {
this.logLevelOptions = {};
}
var active;
_.each(this.logLevels, function (name) {
if (self.logLevelOptions[name]) {
active = self.logLevelOptions[name].active;
}
self.logLevelOptions[name] = {
name: name,
active: active || false
};
var color = arangoHelper.statusColors[name];
if (color) {
self.logLevelOptions[name].color = color;
}
});
var pos = $(e.currentTarget).position();
pos.right = '115';
this.logLevelView = new window.FilterSelectView({
name: 'Level',
options: self.logLevelOptions,
position: pos,
callback: self.logLevelCallbackFunction.bind(this),
multiple: false
});
this.logLevelView.render();
},
setActiveLoglevel: function (e) {
},
initTotalAmount: function () {
var self = this;
this.collection.fetch({
data: $.param(
{test: true}
),
success: function () {
self.convertModelToJSON();
}
});
this.fetchedAmount = true;
},
invertArray: function (array) {
var rtnArr = [];
var counter = 0;
var i;
for (i = array.length - 1; i >= 0; i--) {
rtnArr[counter] = array[i];
counter++;
}
return rtnArr;
},
convertModelToJSON: function () {
if (!this.fetchedAmount) {
this.initTotalAmount();
return;
}
this.collection.page = this.currentPage;
this.currentPage++;
var self = this;
var date;
var entries = [];
this.collection.fetch({
success: function (settings) {
self.collection.each(function (model) {
date = new Date(model.get('timestamp') * 1000);
entries.push({
status: model.getLogStatus(),
date: arangoHelper.formatDT(date),
timestamp: model.get('timestamp'),
msg: model.get('text'),
topic: model.get('topic')
});
});
// invert order
self.renderLogs(self.invertArray(entries), settings.lastInverseOffset);
}
});
},
render: function () {
var self = this;
this.currentPage = 0;
if (this.initDone) {
// render static content
$(this.el).html(this.template.render({}));
// fetch dyn. content
this.convertModelToJSON();
} else {
window.setTimeout(function () {
self.render();
}, 100);
}
return this;
},
renderLogs: function (entries, offset) {
_.each(entries, function (entry) {
if (entry.msg.indexOf('{' + entry.topic + '}') > -1) {
entry.msg = entry.msg.replace('{' + entry.topic + '}', '');
}
});
if (this.currentPage === 0) {
// render initial
$(this.logsel).html(this.templateEntries.render({
entries: entries
}));
} else {
// append
$(this.logsel).append(this.templateEntries.render({
entries: entries
}));
}
if (offset <= 0) {
$('#loadMoreEntries').attr('disabled', true);
} else {
$('#loadMoreEntries').attr('disabled', false);
}
arangoHelper.createTooltips();
this.applyFilter();
}
});
}());

View File

@ -1,125 +0,0 @@
/* jshint browser: true */
/* jshint unused: false */
/* global arangoHelper, $, window, templateEngine */
(function () {
'use strict';
window.LogsView = window.PaginationView.extend({
el: '#content',
id: '#logContent',
paginationDiv: '#logPaginationDiv',
idPrefix: 'logTable',
fetchedAmount: false,
initialize: function (options) {
this.options = options;
this.convertModelToJSON();
},
currentLoglevel: 'logall',
events: {
'click #arangoLogTabbar button': 'setActiveLoglevel',
'click #logTable_first': 'firstPage',
'click #logTable_last': 'lastPage'
},
template: templateEngine.createTemplate('logsView.ejs'),
tabbar: templateEngine.createTemplate('arangoTabbar.ejs'),
table: templateEngine.createTemplate('arangoTable.ejs'),
tabbarElements: {
id: 'arangoLogTabbar',
titles: [
['All', 'logall'],
['Info', 'loginfo'],
['Error', 'logerror'],
['Warning', 'logwarning'],
['Debug', 'logdebug']
]
},
tableDescription: {
id: 'arangoLogTable',
titles: ['Loglevel', 'Date', 'Message'],
rows: []
},
convertedRows: null,
setActiveLoglevel: function (e) {
$('.arangodb-tabbar').removeClass('arango-active-tab');
if (this.currentLoglevel !== e.currentTarget.id) {
this.currentLoglevel = e.currentTarget.id;
this.convertModelToJSON();
}
},
initTotalAmount: function () {
var self = this;
this.collection = this.options[this.currentLoglevel];
this.collection.fetch({
data: $.param(
{test: true}
),
success: function () {
self.convertModelToJSON();
}
});
this.fetchedAmount = true;
},
invertArray: function (array) {
var rtnArr = [];
var counter = 0;
var i;
for (i = array.length - 1; i >= 0; i--) {
rtnArr[counter] = array[i];
counter++;
}
return rtnArr;
},
convertModelToJSON: function () {
if (!this.fetchedAmount) {
this.initTotalAmount();
return;
}
var self = this;
var date;
var rowsArray = [];
this.collection = this.options[this.currentLoglevel];
this.collection.fetch({
success: function () {
self.collection.each(function (model) {
date = new Date(model.get('timestamp') * 1000);
rowsArray.push([
model.getLogStatus(),
arangoHelper.formatDT(date),
model.get('text')]);
});
self.tableDescription.rows = self.invertArray(rowsArray);
// invert order
self.render();
}
});
},
render: function () {
$(this.el).html(this.template.render({}));
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
$(this.id).append(this.table.render({content: this.tableDescription}));
$('#' + this.currentLoglevel).addClass('arango-active-tab');
$('#logContent').append('<div id="logPaginationDiv" class="pagination-line"></div>');
this.renderPagination();
return this;
},
rerender: function () {
this.convertModelToJSON();
}
});
}());

View File

@ -1,5 +1,5 @@
/* jshint browser: true */
/* global Backbone, $, window, setTimeout, Joi, _ */
/* global Backbone, $, window, setTimeout, Joi, _, arangoHelper */
/* global templateEngine */
(function () {
@ -364,12 +364,7 @@
});
}
$('.createModalDialog .modalTooltips').tooltip({
position: {
my: 'left top',
at: 'right+55 top-1'
}
});
arangoHelper.createTooltips('.createModalDialog .modalTooltips', 'left');
var completeTableContent = tableContent || [];
if (advancedContent && advancedContent.content) {

View File

@ -113,6 +113,7 @@
url: arangoHelper.databaseUrl('/_api/aql-builtin'),
contentType: 'application/json',
success: function (data) {
console.log(data);
self.stringToArray();
self.updateDatasets();
_.each(data.functions, function (val) {

View File

@ -0,0 +1,95 @@
#filterSelectDiv {
height: 100%;
position: fixed;
width: 100%;
z-index: 1000;
}
.filterSelect {
float: right;
i.fa {
margin-left: 5px;
margin-right: 0;
}
}
.filterSelectBox {
background: $c-white;
border: 1px solid rgba(27, 31, 35, .15);
border-radius: 3px;
height: 400px;
position: absolute;
width: 300px;
.filterLabel {
background: rgba(246, 248, 250, 1);
border-bottom: 1px solid rgba(225, 228, 232, 1);
font-weight: 500;
span {
float: right;
font-size: 12pt;
opacity: .6;
&:hover {
cursor: pointer;
opacity: 1;
}
}
}
.filterInput,
.filterLabel {
padding: 5px;
}
.filterOptions {
height: 328px;
overflow-y: scroll;
div {
cursor: pointer;
line-height: 9px;
padding-bottom: 10px;
padding-left: 5px;
padding-right: 5px;
padding-top: 10px;
&:first-child {
padding-top: 15px;
}
strong {
margin-left: 21px;
}
.color,
.name {
margin-left: 5px;
}
.color {
border: 1px solid rgba(27, 31, 35, .15);
border-radius: 2px;
display: inline-block;
height: 10px;
width: 10px;
}
}
div:hover {
background: rgba(246, 248, 250, 1);
}
}
.filterInput {
background: rgba(246, 248, 250, 1);
border-bottom: 1px solid rgba(225, 228, 232, 1);
input {
margin-bottom: 0;
width: 275px;
}
}
}

View File

@ -0,0 +1,86 @@
#loggerContent {
#logEntries {
padding-top: 15px;
}
#logFilters {
font-weight: 500 !important;
opacity: .7;
text-align: right;
i {
font-size: 11pt;
margin-right: 5px;
top: 0;
}
}
#noLogEntries {
font-weight: 500;
opacity: .7;
padding: 20px;
text-align: center;
}
.arangoToolbarTop {
background-color: rgba(0, 0, 0, 0);
border: 0;
height: 62px;
margin-top: -74px;
button {
margin-right: 0;
}
}
.pure-g {
padding-bottom: 5px;
padding-left: 20px;
padding-right: 20px;
padding-top: 0;
&:last-child {
.logBorder {
opacity: 0;
}
}
.icon {
opacity: .6;
}
.msg {
line-height: 18px;
}
.labels {
span {
border: 1px solid rgba(27, 31, 35, .15);
border-radius: 2px;
display: inline-block;
height: 10px;
width: 10px;
}
}
.date {
opacity: .6;
.fa {
margin-right: 5px;
}
}
}
.logBorder {
border-bottom: 1px solid $c-black;
margin-bottom: 13px;
opacity: .2;
padding-top: 5px;
}
.actions {
margin-bottom: 20px;
text-align: center;
}
}

View File

@ -34,6 +34,10 @@
}
.tippy {
cursor: pointer;
}
.select2-drop-active {
border: 2px solid $c-info;
border-top: 0;

View File

@ -99,6 +99,10 @@
@import 'subNavbar';
//Help View
@import 'help';
//LoggerView
@import 'logger';
//FilterSelect
@import 'filterSelect';
//Support View
@import 'support';

View File

@ -468,7 +468,7 @@ void ApplicationServer::disableDependentFeatures() {
if (f == nullptr) {
LOG_TOPIC(TRACE, Logger::STARTUP) << "turning off feature '" << feature->name()
<< "' because it is enabled only in conjunction with non-existing feature '"
<< f->name() << "'";
<< other << "'";
feature->disable();
break;
} else if (!f->isEnabled()) {