You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/08 04:20:19 UTC
ignite git commit: ignite-1257 Agent monitoring
Repository: ignite
Updated Branches:
refs/heads/ignite-843 37d127a3b -> 0c24bfc13
ignite-1257 Agent monitoring
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0c24bfc1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0c24bfc1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0c24bfc1
Branch: refs/heads/ignite-843
Commit: 0c24bfc13025fb33ed93af9793c4b72670340f1f
Parents: 37d127a
Author: Andrey <an...@gridgain.com>
Authored: Thu Oct 8 09:20:03 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Oct 8 09:20:03 2015 +0700
----------------------------------------------------------------------
.../src/main/js/controllers/common-module.js | 56 +++++++++++++-------
.../src/main/js/controllers/sql-controller.js | 11 +++-
.../main/js/views/templates/agent-download.jade | 4 +-
3 files changed, 50 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0c24bfc1/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index c977dbc..720ac3c 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -110,7 +110,7 @@ consoleModule.service('$common', [
return 'Internal server error.';
}
- function showError(msg, placement, container) {
+ function showError(msg, placement, container, persistent) {
if (msgModal)
msgModal.hide();
@@ -120,6 +120,9 @@ consoleModule.service('$common', [
container: container ? container : 'body'
});
+ if (persistent)
+ msgModal.$options.duration = false;
+
return false;
}
@@ -618,6 +621,10 @@ consoleModule.service('$common', [
isEmptyArray: isEmptyArray,
isEmptyString: isEmptyString,
errorMessage: errorMessage,
+ hideAlert: function () {
+ if (msgModal)
+ msgModal.hide();
+ },
showError: showError,
showInfo: function (msg) {
if (msgModal)
@@ -1878,21 +1885,25 @@ consoleModule.controller('auth', [
// Download agent controller.
consoleModule.controller('agent-download', [
- '$common', '$scope', '$timeout', '$modal', '$window', function ($common, $scope, $timeout, $modal, $window) {
+ '$common', '$scope', '$interval', '$modal', '$window', function ($common, $scope, $interval, $modal, $window) {
// Pre-fetch modal dialogs.
var _agentDownloadModal = $modal({scope: $scope, templateUrl: '/agent/download', show: false});
var _agentDownloadHide = _agentDownloadModal.hide;
_agentDownloadModal.hide = function () {
- $timeout.cancel(_agentDownloadModal.checker);
+ if (_agentDownloadModal.$isShown)
+ $common.hideAlert();
+
+ if (!$scope.checkConnection)
+ $interval.cancel(_agentDownloadModal.updatePromise);
_agentDownloadHide();
};
- $scope.goBackAndHide = function () {
- if ($scope.backLink)
- $window.location = $scope.backLink;
+ $scope.goHome = function () {
+ if ($scope.checkConnection)
+ $window.location = '/';
_agentDownloadModal.hide()
};
@@ -1911,24 +1922,33 @@ consoleModule.controller('agent-download', [
};
var _handleException = function (errMsg, status) {
- if (status == 503) {
- if (!_agentDownloadModal.$isShown)
- _agentDownloadModal.$promise.then(_agentDownloadModal.show);
+ if (!_agentDownloadModal.$isShown)
+ _agentDownloadModal.$promise.then(_agentDownloadModal.show);
- _agentDownloadModal.checker = $timeout(function () {
- _agentDownloadModal.checkFn(_agentDownloadModal.hide, _handleException);
- }, 3000);
- }
- else
- $common.showError(errMsg);
+ if (status != 503)
+ $common.showError(errMsg, 'top-right', 'body', true);
};
- $scope.awaitAgent = function (checkFn, backLink) {
+ $scope.awaitAgent = function (checkFn) {
_agentDownloadModal.checkFn = checkFn;
- $scope.backLink = backLink;
+ _agentDownloadModal.updatePromise = $interval(function () {
+ checkFn(_agentDownloadModal.hide, _handleException);
+ }, 5000, 0, false);
+
+ checkFn(_agentDownloadModal.hide, _handleException);
+ };
+
+ $scope.checkNodeConnection = function (checkFn) {
+ _agentDownloadModal.checkFn = checkFn;
+
+ $scope.checkConnection = true;
+
+ _agentDownloadModal.$options.backdrop = 'static';
- _agentDownloadModal.$options.backdrop = $common.isDefined(backLink) ? 'static' : true;
+ _agentDownloadModal.updatePromise = $interval(function () {
+ checkFn(_agentDownloadModal.hide, _handleException);
+ }, 5000, 0, false);
checkFn(_agentDownloadModal.hide, _handleException);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0c24bfc1/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index acc4329..c304c3e 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -340,8 +340,17 @@ consoleModule.controller('sqlController',
.success(function (caches) {
onSuccess();
+ var oldCaches = $scope.caches;
+
$scope.caches = _.sortBy(caches, 'name');
+ _.forEach(caches, function (cache) {
+ var old = _.find(oldCaches, { name: cache.name });
+
+ if (old && old.metadata)
+ cache.metadata = old.metadata;
+ });
+
_setActiveCache();
})
.error(function (err, status) {
@@ -349,7 +358,7 @@ consoleModule.controller('sqlController',
});
}
- $scope.awaitAgent(getTopology, '/');
+ $scope.checkNodeConnection(getTopology);
var _columnFilter = function(paragraph) {
return paragraph.disabledSystemColumns || paragraph.systemColumns ? _allColumn : _hideColumn;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0c24bfc1/modules/control-center-web/src/main/js/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/agent-download.jade b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
index 7246238..ea99515 100644
--- a/modules/control-center-web/src/main/js/views/templates/agent-download.jade
+++ b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
@@ -16,7 +16,7 @@
.modal-dialog
.modal-content
#errors-container.modal-header.header
- button.close(ng-if='!backLink' ng-click='$hide()') ×
+ button.close(ng-if='!checkConnection' ng-click='$hide()') ×
h4.modal-title Connection to Ignite Web Agent is not established
.agent-download
p Please download and run
@@ -45,5 +45,5 @@
i.tipLabel.fa.fa-clipboard(ng-click-copy='{{user.token}}' bs-tooltip='' data-title='Copy security token to clipboard')
i.tipLabel.fa.fa-question-circle(ng-if=lines bs-tooltip='' data-title='The security token is used for authorization of web agent')
.modal-footer
- button.btn.btn-default(ng-if='backLink' ng-click='goBackAndHide()') Home
+ button.btn.btn-default(ng-if='checkConnection' ng-click='goHome()') Home
button.btn.btn-primary(ng-click='downloadAgent()') Download zip