提交 06d87213 编写于 作者: S Sercan

connect, and serverStatus commands fix

上级 ca08cc06
......@@ -47,7 +47,7 @@
</div>
<div class="modal-body">
{{> ReactiveDatatable tableData=reactiveDataFunction options=optionsObject }}
<button type="button" class="btn btn-block btn-outline btn-primary" data-toggle="modal"
<button id="btnCreateNewConnection" type="button" class="btn btn-block btn-outline btn-primary" data-toggle="modal"
data-target="#connectionCreateModal">Create New
</button>
</div>
......
......@@ -80,6 +80,15 @@ Template.topNavbar.helpers({
});
Template.topNavbar.events({
'click #btnCreateNewConnection': function (e) {
$('#inputConnectionName').val('');
$('#inputHost').val('');
$('#inputPort').val('27017');
$('#inputDatabaseName').val('');
$('#inputUser').val('');
$('#inputPassword').val('');
},
'click #btnConnectionList': function (e) {
if (!Session.get(Template.strSessionConnection)) {
$('#DataTables_Table_0').DataTable().$('tr.selected').removeClass('selected');
......
......@@ -2,7 +2,7 @@
* Created by RSercan on 10.1.2016.
*/
Template.adminQueries.onRendered(function () {
if (!Session.get(Template.strSessionConnection)) {
if (!Session.get(Template.strSessionCollectionNames)) {
Router.go('databaseStats');
return;
}
......
......@@ -2,7 +2,7 @@
* Created by RSercan on 17.1.2016.
*/
Template.databaseDumpRestore.onRendered(function () {
if (!Session.get(Template.strSessionConnection)) {
if (!Session.get(Template.strSessionCollectionNames)) {
Router.go('databaseStats');
return;
}
......
......@@ -149,7 +149,7 @@
</h1>
<small>
To see the statistics of your database, simply
<strong>enable</strong> <i>show database statistics</i> setting
<strong>enable</strong> <i>show database statistics</i> setting<div id="errorMessage"></div>
</small>
</div>
</div>
......
......@@ -54,7 +54,7 @@ Template.databaseStats.onRendered(function () {
// fetch stats only once.
Template.databaseStats.fetchStats();
}
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
toastr.info("It can take a few seconds to populate charts !");
}
});
......@@ -66,7 +66,7 @@ Template.databaseStats.onDestroyed(function () {
});
Template.databaseStats.initOperationCountersChart = function (data) {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
if (data == undefined || data.length == 0) {
$('#divOperationCountersChart').html('This feature is not supported on this platform (OS)');
return;
......@@ -103,7 +103,7 @@ Template.databaseStats.initOperationCountersChart = function (data) {
};
Template.databaseStats.initNetworkChart = function (data) {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
if (data == undefined || data.length == 0) {
$('#divNetworkChart').html('This feature is not supported on this platform (OS)');
return;
......@@ -145,7 +145,7 @@ Template.databaseStats.initNetworkChart = function (data) {
};
Template.databaseStats.initConnectionsChart = function (data, availableConnections) {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
if (data == undefined || data.length == 0) {
$('#divHeapMemoryChart').html('This feature is not supported on this platform (OS)');
return;
......@@ -181,7 +181,7 @@ Template.databaseStats.initConnectionsChart = function (data, availableConnectio
};
Template.databaseStats.initMemoryChart = function (data, text) {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
if (data == undefined || data.length == 0) {
$('#divHeapMemoryChart').html('This feature is not supported on this platform (OS)');
return;
......@@ -251,7 +251,7 @@ Template.databaseStats.helpers({
});
Template.databaseStats.fetchStats = function () {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
var connection = Connections.findOne({_id: Session.get(Template.strSessionConnection)});
Meteor.call("dbStats", connection, function (err, result) {
if (err || result.error) {
......@@ -266,7 +266,7 @@ Template.databaseStats.fetchStats = function () {
};
Template.databaseStats.fetchStatus = function () {
if (Session.get(Template.strSessionConnection)) {
if (Session.get(Template.strSessionCollectionNames)) {
var connection = Connections.findOne({_id: Session.get(Template.strSessionConnection)});
Meteor.call("serverStatus", connection, function (err, result) {
if (err || result.error) {
......@@ -278,8 +278,7 @@ Template.databaseStats.fetchStatus = function () {
}
Session.set(Template.strSessionServerStatus, undefined);
clearInterval(interval);
toastr.error("Couldn't fetch serverStatus, " + errorMessage);
$('#errorMessage').html("Couldn't fetch serverStatus, " + errorMessage);
}
else {
Session.set(Template.strSessionServerStatus, result.result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册