You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/07/02 13:44:58 UTC

incubator-ignite git commit: # IGNITE-843 Add monitoring page (cherry picked from commit 9ad600f)

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843_monitor [created] 6bfe68899


# IGNITE-843 Add monitoring page
(cherry picked from commit 9ad600f)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6bfe6889
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6bfe6889
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6bfe6889

Branch: refs/heads/ignite-843_monitor
Commit: 6bfe68899026dbee26bde76518472e7807333d4c
Parents: f3a402e
Author: sevdokimov <se...@gridgain.com>
Authored: Thu Jul 2 14:16:55 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu Jul 2 14:44:33 2015 +0300

----------------------------------------------------------------------
 .../public/javascripts/controllers/common.js    |  2 +-
 .../monitor/clustersListController.js           | 96 ++++++++++++++++++++
 .../nodejs/public/stylesheets/monitor.css       | 15 +++
 .../web-control-center/nodejs/routes/pages.js   |  5 +
 .../nodejs/views/includes/header.jade           |  2 +
 .../nodejs/views/monitor/cluster.jade           | 27 ++++++
 .../nodejs/views/monitor/cluster_content.html   | 57 ++++++++++++
 .../nodejs/views/monitor/monitor-layout.jade    | 30 ++++++
 8 files changed, 233 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/public/javascripts/controllers/common.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/public/javascripts/controllers/common.js b/modules/web-control-center/nodejs/public/javascripts/controllers/common.js
index 8fec94d..a3da203 100644
--- a/modules/web-control-center/nodejs/public/javascripts/controllers/common.js
+++ b/modules/web-control-center/nodejs/public/javascripts/controllers/common.js
@@ -133,7 +133,7 @@ configuratorModule.filter('compact', function () {
 
 configuratorModule.controller('activeLink', ['$scope', function ($scope) {
     $scope.isActive = function (path) {
-        return window.location.pathname.substr(0, path.length) == path;
+        return window.location.pathname.endsWith(path);
     };
 }]);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/public/javascripts/controllers/monitor/clustersListController.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/public/javascripts/controllers/monitor/clustersListController.js b/modules/web-control-center/nodejs/public/javascripts/controllers/monitor/clustersListController.js
new file mode 100644
index 0000000..b495f44
--- /dev/null
+++ b/modules/web-control-center/nodejs/public/javascripts/controllers/monitor/clustersListController.js
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var dummyNodes = [
+    {   id: '234a-443e-0d2a-44912258c290',
+        client: false,
+        addresses: ['127.0.0.1'],
+        hostNames: ['localhost'],
+        discoveryPort: 47000,
+        caches: [],
+        order: 0
+    },
+
+    {   id: '382a-4cae-0d2a-44912258c332',
+        client: false,
+        addresses: ['127.0.0.1'],
+        hostNames: ['localhost'],
+        caches: ['aaa', 'bbb'],
+        discoveryPort: 47001,
+        order: 1
+    },
+
+    {   id: '162d-4cae-0d2a-1491c253c03a',
+        client: false,
+        addresses: ['127.0.0.1'],
+        hostNames: ['localhost'],
+        caches: ['aaa', 'bbb'],
+        discoveryPort: 47001,
+        order: 2
+    },
+
+    {   id: 'c39d-4cae-8dca-7481b213c006',
+        client: true,
+        addresses: ['127.0.0.1'],
+        caches: ['aaa', 'bbb'],
+        hostNames: ['localhost'],
+        order: 3
+    }
+];
+
+configuratorModule.controller('clustersListController', ['$scope', '$http', 'commonFunctions', function ($scope, $http, commonFunctions) {
+    $scope.nodes = function() {
+        var nodes = dummyNodes;
+
+        var res = [];
+
+        for (var i = 0; i < nodes.length; i++) {
+            if ($scope.showClients || !nodes[i].client) {
+                res.push(nodes[i]);
+            }
+        }
+
+        return res;
+    };
+
+    $scope.showClients = true;
+
+    $scope.hostname = function (node) {
+        for (var i = 0; i < node.hostNames.length; i++) {
+            if (node.hostNames[i].length > 0)
+                return node.hostNames[i];
+        }
+
+        for (i = 0; i < node.addresses.length; i++) {
+            if (node.addresses[i].length > 0)
+                return node.addresses[i];
+        }
+
+        return 'unknown';
+    };
+
+    $scope.nodeAddr = function (node) {
+        var host = $scope.hostname(node);
+
+        if (!node.client && node.discoveryPort) {
+            return host + ':' + node.discoveryPort;
+        }
+
+        return host;
+    }
+
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/public/stylesheets/monitor.css
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/public/stylesheets/monitor.css b/modules/web-control-center/nodejs/public/stylesheets/monitor.css
new file mode 100644
index 0000000..96330e3
--- /dev/null
+++ b/modules/web-control-center/nodejs/public/stylesheets/monitor.css
@@ -0,0 +1,15 @@
+.cluster-node {
+    padding: 3px;
+    margin-top: 20px;
+
+    border-radius: 4px;
+}
+
+.cluster-node .uuid {
+    color: gray;
+    font-size: smaller;
+}
+
+.nodeAddr {
+    font-weight: bold;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/routes/pages.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/routes/pages.js b/modules/web-control-center/nodejs/routes/pages.js
index 7b6c24e..e60f9b4 100644
--- a/modules/web-control-center/nodejs/routes/pages.js
+++ b/modules/web-control-center/nodejs/routes/pages.js
@@ -65,4 +65,9 @@ router.get('/summary', function(req, res) {
     res.render('summary', { user: req.user });
 });
 
+/* GET monitor page. */
+router.get('/monitor/cluster', function(req, res) {
+    res.render('monitor/cluster', { user: req.user });
+});
+
 module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/views/includes/header.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/includes/header.jade b/modules/web-control-center/nodejs/views/includes/header.jade
index 33ee064..0442ca1 100644
--- a/modules/web-control-center/nodejs/views/includes/header.jade
+++ b/modules/web-control-center/nodejs/views/includes/header.jade
@@ -22,6 +22,8 @@ header.header(id='header')
             ul.nav.navbar-nav(ng-controller='activeLink')
                 li
                     a(ng-class="{active: isActive('/clusters')}" href='/clusters') Configuration
+                li
+                    a(ng-class="{active: isActive('/monitor')}" href='/monitor/cluster') Monitoring
                 //li
                 //    a(ng-class="{active: isActive('/sql')}" href='/sql') SQL
             ul.nav.navbar-nav.pull-right(ng-init='user = #{JSON.stringify(user)}')

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/views/monitor/cluster.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/monitor/cluster.jade b/modules/web-control-center/nodejs/views/monitor/cluster.jade
new file mode 100644
index 0000000..0642a27
--- /dev/null
+++ b/modules/web-control-center/nodejs/views/monitor/cluster.jade
@@ -0,0 +1,27 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+extends monitor-layout
+
+append scripts
+    script(src='/javascripts/controllers/monitor/clustersListController.js')
+    script(src='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js')
+
+append css
+    link(rel='stylesheet', href='/stylesheets/monitor.css')
+
+block content
+    include cluster_content.html

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/views/monitor/cluster_content.html
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/monitor/cluster_content.html b/modules/web-control-center/nodejs/views/monitor/cluster_content.html
new file mode 100644
index 0000000..e7e8b7c
--- /dev/null
+++ b/modules/web-control-center/nodejs/views/monitor/cluster_content.html
@@ -0,0 +1,57 @@
+<div class="docs-header">
+    <h1>Cluster state</h1>
+    <p>
+        Nodes in the cluster
+    </p>
+    <hr>
+</div>
+
+<div class="docs-body">
+    <div class="row" ng-controller="clustersListController">
+        <div class="col-md-6">
+            <div class="cluster-node" ng-repeat="node in nodes()">
+                <span ng-class="{glyphicon: true, 'glyphicon-phone': node.client, 'glyphicon-hdd': !node.client}"
+                      aria-hidden="true"
+                      title="{{node.client ? 'Client node' : 'Server node'}}"></span>
+
+                &nbsp;<span class="nodeAddr">{{nodeAddr(node)}}</span>
+
+                <br>
+                <small><span class="uuid">{{node.id}}</span></small>
+
+
+            </div>
+        </div>
+
+        <div class="col-md-2">
+
+        </div>
+
+        <div class="col-md-4">
+            <div class="panel panel-default">
+                <div class="panel-heading">Node filters</div>
+                <div class="panel-body">
+                    <form role="form">
+                        <div class="form-group">
+                            <label for="cachesSelect">Caches</label>
+
+                            <div class="input-tip">
+                                <button id="cachesSelect" bs-select="bs-select" class="form-control" data-multiple="1"
+                                        data-placeholder="Choose cache" bs-options="" ng-model="selectedCaches">
+
+                                </button>
+                            </div>
+                        </div>
+
+                        <div class="checkbox">
+                            <label>
+                                <input type="checkbox" name="showClients" ng-model="showClients">
+                                Show clients
+                            </label>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bfe6889/modules/web-control-center/nodejs/views/monitor/monitor-layout.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/nodejs/views/monitor/monitor-layout.jade b/modules/web-control-center/nodejs/views/monitor/monitor-layout.jade
new file mode 100644
index 0000000..979af7d
--- /dev/null
+++ b/modules/web-control-center/nodejs/views/monitor/monitor-layout.jade
@@ -0,0 +1,30 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+extends ../layout
+
+block container
+    .row
+        .col-sm-2.border-right.section-left.greedy
+            .sidebar-nav
+                ul.menu(ng-controller='activeLink')
+                    li
+                        a(ng-class="{active: isActive('/cluster')}" href='cluster') Cluster
+                    li
+                        a(ng-class="{active: isActive('/data')}" href='data') Data explorer
+        .col-sm-10.border-left.section-right
+            .docs-content
+                block content
\ No newline at end of file