1
0
Fork 0

scss, views

This commit is contained in:
hkernbach 2016-04-19 13:15:16 +02:00
parent 26f7898fac
commit 179e5ee7a5
6 changed files with 97 additions and 21 deletions

View File

@ -230,6 +230,10 @@
_.each(menuItems, function(menu, name) {
if (menu.active) {
cssClass += ' active';
if (menu.disabled) {
cssClass += ' disabled';
}
}
else {
cssClass = '';
@ -243,6 +247,21 @@
});
},
buildNodeSubNav: function(node, activeKey, disabled) {
var menus = {
Dashboard: {
route: '#node/' + encodeURIComponent(node)
},
Logs: {
route: '#nLogs/' + encodeURIComponent(node)
}
};
menus[activeKey].active = true;
menus[disabled].disabled = true;
this.buildSubNavBar(menus);
},
//nav for collection view
buildCollectionSubNav: function(collectionName, activeKey) {

View File

@ -37,6 +37,7 @@
"cluster": "cluster",
"nodes": "nodes",
"node/:name": "node",
"nLogs/:name": "nLogs",
"logs": "logs",
"helpus": "helpUs"
},
@ -230,6 +231,7 @@
this.nodeView = new window.NodeView({
coordname: name,
coordinators: this.coordinatorCollection,
dbServers: this.dbServers
});
}
this.nodeView.render();
@ -254,7 +256,7 @@
if (!this.nodesView) {
this.nodesView = new window.NodesView({
coordinators: this.coordinatorCollection,
dbServers: this.dbServers
dbServers: this.dbServers[0]
});
}
this.nodesView.render();
@ -308,6 +310,37 @@
this.logsView.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) {
@ -746,7 +779,7 @@
host: coordinator.get('address')
})
);
});
});
_.each(this.dbServers, function(dbservers) {
dbservers.fetch();
});

View File

@ -5,11 +5,15 @@
<li class="cluster-menu"><a id="cluster" class="tab" href="#cluster"><i class="fa fa-circle-o"></i>Cluster</a></li>
<li class="nodes-menu"><a id="nodes" class="tab" href="#nodes"><i class="fa fa-server"></i>Nodes</a></li>
<% } else { %>
<li class="navbar-spacer big"></li>
<li class="dashboard-menu"><a id="dashboard" class="tab" href="#dashboard"><i class="fa fa-dashboard"></i>Dashboard</a></li>
<% } %>
<li class="navbar-spacer big"></li>
<!-- <li id="dbSelect" class="dropdown databases-menu disabled"></li> -->
<li class="collections-menu"><a id="collections" class="tab" href="#collections"><i class="fa fa-folder"></i>Collections</a></li>
<% if (currentDB.get('isSystem')) { %>
<li class="databases-menu"><a id="databases" class="tab" href="#databases"><i class="fa fa-database"></i>Databases</a></li>
<% } %>
<li class="queries-menu"><a id="queries" class="tab" href="#queries"><i class="fa fa-bolt"></i>Queries</a></li>
<li class="graphs-menu"><a id="graphs" class="tab" href="#graphs"><i class="fa fa-area-chart"></i>Graphs</a></li>
<li class="services-menu">
@ -19,10 +23,12 @@
<% if (!isCluster) { %>
<li class="logs-menu"><a id="logs" class="tab" href="#manage"><i class="fa fa-file-text"></i>Logs</a></li>
<% } %>
<!--
<% if (currentDB.get('isSystem')) { %>
<li class="navbar-spacer big"></li>
<li class="settings-menu"><a id="settings" class="tab" href="#settings"><i class="fa fa-cog"></i>Settings</a></li>
<% } %>
-->
<li class="helpus-menu" style="position: absolute; bottom: 0;"><a id="helpus" class="tab" href="#helpus"><i class="fa fa-heart"></i>Help Us</a></li>
<!--
<li class="navbar-spacer big"></li>

View File

@ -63,7 +63,6 @@
isCluster: this.isCluster
}));
console.log(this.currentDB);
$(this.subEl).html(this.templateSub.render({
currentDB: this.currentDB.toJSON()
}));
@ -194,20 +193,6 @@
view: undefined,
}
],
node: [
{
name: 'Dashboard',
view: undefined,
active: true
},
{
name: 'Logs',
route: 'nodeLogs',
params: {
node: undefined
}
}
],
queries: [
{
name: 'Editor',

View File

@ -18,6 +18,7 @@
if (window.App.isCluster) {
this.coordinators = options.coordinators;
this.dbServers = options.dbServers;
this.coordname = options.coordname;
this.updateServerTime();
@ -43,17 +44,27 @@
var callback = function() {
this.continueRender();
this.breadcrumb(this.coordname);
window.arangoHelper.buildNodeSubNav(this.coordname, 'Dashboard', 'Logs');
$(window).trigger('resize');
}.bind(this);
if (!this.initDone) {
this.waitForCoordinators(callback);
var cb =function() {
console.log("dummy");
};
if (!this.initCoordDone) {
this.waitForCoordinators(cb);
}
if (!this.initDBDone) {
this.waitForDBServers(callback);
}
else {
this.coordname = window.location.hash.split('/')[1];
this.coordinator = this.coordinators.findWhere({name: this.coordname});
callback();
}
},
continueRender: function() {
@ -84,7 +95,30 @@
}
else {
self.coordinator = self.coordinators.findWhere({name: self.coordname});
self.initDone = true;
self.initCoordDone = true;
callback();
}
}, 200);
},
waitForDBServers: function(callback) {
var self = this;
window.setTimeout(function() {
if (self.dbServers[0].length === 0) {
self.waitForDBServers(callback);
}
else {
self.initDBDone = true;
self.dbServer = self.dbServers[0];
self.dbServer.each(function(model) {
if (model.get("name") === 'DBServer1') {
self.dbServer = model;
}
});
console.log(self.dbServer.toJSON());
callback();
}
}, 200);

View File

@ -133,7 +133,6 @@ main {
background-color: $c-white;
border: 1px solid $c-content-border;
border-radius: 3px;
margin-top: 220px;
.app-info {
@include border-radius(3px);