lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r1684555 - in /lucene/dev/branches/lucene_solr_5_2: ./ solr/ solr/webapp/ solr/webapp/web/css/angular/ solr/webapp/web/js/angular/ solr/webapp/web/js/angular/controllers/ solr/webapp/web/partials/
Date Wed, 10 Jun 2015 02:43:47 GMT
Author: ehatcher
Date: Wed Jun 10 02:43:47 2015
New Revision: 1684555

URL: http://svn.apache.org/r1684555
Log:
SOLR-7638: Fix new (Angular-based) admin UI Cloud pane (merged from branch_5x r1684554)

Modified:
    lucene/dev/branches/lucene_solr_5_2/   (props changed)
    lucene/dev/branches/lucene_solr_5_2/solr/   (props changed)
    lucene/dev/branches/lucene_solr_5_2/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_2/solr/webapp/   (props changed)
    lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/css/angular/cloud.css
    lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/app.js
    lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/controllers/cloud.js
    lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/partials/cloud.html

Modified: lucene/dev/branches/lucene_solr_5_2/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/CHANGES.txt?rev=1684555&r1=1684554&r2=1684555&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/CHANGES.txt Wed Jun 10 02:43:47 2015
@@ -42,7 +42,7 @@ Bug Fixes
 * SOLR-7512: SolrOutputFormat creates an invalid solr.xml in the solr home zip for MapReduceIndexerTool.
   (Mark Miller, Adam McElwee)
 
-* SOLR-7652: Fix example/files update-script.js to work with Java 7 (ehatcher)
+* SOLR-7638: Fix new (Angular-based) admin UI Cloud pane (Upayavira via ehatcher)
   
 Other Changes
 ----------------------

Modified: lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/css/angular/cloud.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/css/angular/cloud.css?rev=1684555&r1=1684554&r2=1684555&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/css/angular/cloud.css (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/css/angular/cloud.css Wed Jun 10 02:43:47
2015
@@ -389,3 +389,10 @@ limitations under the License.
 {
   stroke: #fff;
 }
+
+#cloudGraphPaging
+{
+  display: inline-block;
+  padding-top: 15px;
+  padding-bottom: 15px;
+}

Modified: lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/app.js?rev=1684555&r1=1684554&r2=1684555&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/app.js (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/app.js Wed Jun 10 02:43:47
2015
@@ -337,7 +337,7 @@ solrAdminApp.controller('MainController'
       }
     });
     System.get(function(data) {
-      $scope.isCloudEnabledCloud = data.mode.match( /solrcloud/i )
+      $scope.isCloudEnabled = data.mode.match( /solrcloud/i )
     });
   };
   $scope.refresh();

Modified: lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/controllers/cloud.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/controllers/cloud.js?rev=1684555&r1=1684554&r2=1684555&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/controllers/cloud.js (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/js/angular/controllers/cloud.js Wed
Jun 10 02:43:47 2015
@@ -67,7 +67,6 @@ var treeSubController = function($scope,
     $scope.initTree = function() {
       Zookeeper.simple(function(data) {
         $scope.tree = data.tree;
-        //$scope.jstree.json_data.data = data.tree;
       });
     };
 
@@ -78,6 +77,8 @@ var graphSubController = function ($scop
     $scope.showTree = false;
     $scope.showGraph = true;
 
+    $scope.filterType = "status";
+
     $scope.helperData = {
         protocol: [],
         host: [],
@@ -86,98 +87,158 @@ var graphSubController = function ($scop
         pathname: []
     };
 
+    $scope.next = function() {
+        $scope.pos += $scope.rows;
+        $scope.initGraph();
+    }
+
+    $scope.previous = function() {
+        $scope.pos = Math.max(0, $scope.pos - $scope.rows);
+        $scope.initGraph();
+    }
+
+    $scope.resetGraph = function() {
+        $scope.pos = 0;
+        $scope.initGraph();
+    }
+
+    $scope.initGraph = function() {
+        Zookeeper.liveNodes(function (data) {
+            var live_nodes = {};
+            for (var c in data.tree[0].children) {
+                live_nodes[data.tree[0].children[c].data.title] = true;
+            }
 
-    Zookeeper.liveNodes(function (data) {
-        var live_nodes = {};
-        for (var c in data.tree[0].children) {
-            live_nodes[data.tree[0].children[c].data.title] = true;
-        }
-        Zookeeper.clusterState(function (data) {
-            eval("var state=" + data.znode.data); // @todo fix horrid means to parse JSON
-
-            var leaf_count = 0;
-            var graph_data = {
-                name: null,
-                children: []
-            };
+            var params = {view: "graph"};
+            if ($scope.rows) {
+                params.start = $scope.pos;
+                params.rows = $scope.rows;
+            }
 
-            for (var c in state) {
-                var shards = [];
-                for (var s in state[c].shards) {
-                    var nodes = [];
-                    for (var n in state[c].shards[s].replicas) {
-                        leaf_count++;
-                        var replica = state[c].shards[s].replicas[n]
-
-                        var uri = replica.base_url;
-                        var parts = uri.match(/^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/);
-                        var uri_parts = {
-                            protocol: parts[1],
-                            host: parts[2],
-                            hostname: parts[3],
-                            port: parseInt(parts[5] || 80, 10),
-                            pathname: parts[6]
-                        };
+            var filter = ($scope.filterType=='status') ? $scope.pagingStatusFilter : $scope.pagingFilter;
 
-                        $scope.helperData.protocol.push(uri_parts.protocol);
-                        $scope.helperData.host.push(uri_parts.host);
-                        $scope.helperData.hostname.push(uri_parts.hostname);
-                        $scope.helperData.port.push(uri_parts.port);
-                        $scope.helperData.pathname.push(uri_parts.pathname);
+            if (filter) {
+                params.filterType = $scope.filterType;
+                params.filter = filter;
+            }
 
-                        var status = replica.state;
+            Zookeeper.clusterState(params, function (data) {
+                    eval("var state=" + data.znode.data); // @todo fix horrid means to parse
JSON
 
-                        if (!live_nodes[replica.node_name]) {
-                            status = 'gone';
+                    var leaf_count = 0;
+                    var graph_data = {
+                        name: null,
+                        children: []
+                    };
+
+                    for (var c in state) {
+                        var shards = [];
+                        for (var s in state[c].shards) {
+                            var nodes = [];
+                            for (var n in state[c].shards[s].replicas) {
+                                leaf_count++;
+                                var replica = state[c].shards[s].replicas[n]
+
+                                var uri = replica.base_url;
+                                var parts = uri.match(/^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/);
+                                var uri_parts = {
+                                    protocol: parts[1],
+                                    host: parts[2],
+                                    hostname: parts[3],
+                                    port: parseInt(parts[5] || 80, 10),
+                                    pathname: parts[6]
+                                };
+
+                                $scope.helperData.protocol.push(uri_parts.protocol);
+                                $scope.helperData.host.push(uri_parts.host);
+                                $scope.helperData.hostname.push(uri_parts.hostname);
+                                $scope.helperData.port.push(uri_parts.port);
+                                $scope.helperData.pathname.push(uri_parts.pathname);
+
+                                var status = replica.state;
+
+                                if (!live_nodes[replica.node_name]) {
+                                    status = 'gone';
+                                }
+
+                                var node = {
+                                    name: uri,
+                                    data: {
+                                        type: 'node',
+                                        state: status,
+                                        leader: 'true' === replica.leader,
+                                        uri: uri_parts
+                                    }
+                                };
+                                nodes.push(node);
+                            }
+
+                            var shard = {
+                                name: s,
+                                data: {
+                                    type: 'shard'
+                                },
+                                children: nodes
+                            };
+                            shards.push(shard);
                         }
 
-                        var node = {
-                            name: uri,
+                        var collection = {
+                            name: c,
                             data: {
-                                type: 'node',
-                                state: status,
-                                leader: 'true' === replica.leader,
-                                uri: uri_parts
-                            }
+                                type: 'collection'
+                            },
+                            children: shards
                         };
-                        nodes.push(node);
+                        graph_data.children.push(collection);
                     }
 
-                    var shard = {
-                        name: s,
-                        data: {
-                            type: 'shard'
-                        },
-                        children: nodes
-                    };
-                    shards.push(shard);
-                }
-
-                var collection = {
-                    name: c,
-                    data: {
-                        type: 'collection'
-                    },
-                    children: shards
-                };
-                graph_data.children.push(collection);
-            }
-
-            $scope.helperData.protocol = $.unique($scope.helperData.protocol);
-            $scope.helperData.host = $.unique($scope.helperData.host);
-            $scope.helperData.hostname = $.unique($scope.helperData.hostname);
-            $scope.helperData.port = $.unique($scope.helperData.port);
-            $scope.helperData.pathname = $.unique($scope.helperData.pathname);
-
-
-            $scope.graphData = graph_data;
-            $scope.leafCount = leaf_count;
-            $scope.isRadial = isRadial;
-            console.log("AFTER PREPARE GRAPH:");
-            console.dir(data);
-            console.log("LEAF COUNT: " + leaf_count);
+                    $scope.helperData.protocol = $.unique($scope.helperData.protocol);
+                    $scope.helperData.host = $.unique($scope.helperData.host);
+                    $scope.helperData.hostname = $.unique($scope.helperData.hostname);
+                    $scope.helperData.port = $.unique($scope.helperData.port);
+                    $scope.helperData.pathname = $.unique($scope.helperData.pathname);
+
+                    if (!isRadial && data.znode && data.znode.paging) {
+                        $scope.showPaging = true;
+
+                        var parr = data.znode.paging.split('|');
+                        if (parr.length < 3) {
+                            $scope.showPaging = false;
+                        } else {
+                            $scope.start = Math.max(parseInt(parr[0]), 0);
+                            $scope.prevEnabled = ($scope.start > 0);
+                            $scope.rows = parseInt(parr[1]);
+                            $scope.total = parseInt(parr[2]);
+
+                            if ($scope.rows == -1) {
+                                $scope.showPaging = false;
+                            } else {
+                                var filterType = parr.length > 3 ? parr[3] : '';
+
+                                if (filterType == '' || filterType == 'none') filterType
= 'status';
+
+                                +$('#cloudGraphPagingFilterType').val(filterType);
+
+                                var filter = parr.length > 4 ? parr[4] : '';
+                                var page = Math.floor($scope.start / $scope.rows) + 1;
+                                var pages = Math.ceil($scope.total / $scope.rows);
+                                $scope.last = Math.min($scope.start + $scope.rows, $scope.total);
+                                $scope.nextEnabled = ($scope.last < $scope.total);
+                            }
+                        }
+                    }
+                    else {
+                        $scope.showPaging = false;
+                    }
+                    $scope.graphData = graph_data;
+                    $scope.leafCount = leaf_count;
+                    $scope.isRadial = isRadial;
+                });
         });
-    });
+    };
+
+    $scope.initGraph();
 };
 
 solrAdminApp.directive('graph', function() {
@@ -244,7 +305,6 @@ solrAdminApp.directive('graph', function
 
             scope.$watch("data", function(newValue, oldValue) {
                 if (newValue) {
-                    console.log("NEW VALUE");
                     if (scope.isRadial) {
                         radialGraph(element, scope.data, scope.leafCount);
                     } else {
@@ -263,6 +323,7 @@ solrAdminApp.directive('graph', function
                     return [d.y, d.x];
                 });
 
+                d3.select('#canvas', element).html('');
                 var vis = d3.select('#canvas', element).append('svg')
                     .attr('width', w)
                     .attr('height', h)
@@ -319,6 +380,7 @@ solrAdminApp.directive('graph', function
                         return [d.y, d.x / 180 * Math.PI];
                     });
 
+                d3.select('#canvas', element).html('');
                 var vis = d3.select('#canvas').append('svg')
                     .attr('width', r * 2)
                     .attr('height', r * 2)

Modified: lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/partials/cloud.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/partials/cloud.html?rev=1684555&r1=1684554&r2=1684555&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/partials/cloud.html (original)
+++ lucene/dev/branches/lucene_solr_5_2/solr/webapp/web/partials/cloud.html Wed Jun 10 02:43:47
2015
@@ -19,7 +19,7 @@ limitations under the License.
   <div id="frame">
 
     <div id="tree-content" class="content clearfix" ng-show="showTree">
-    <jstree class="tree" on-select="showTreeLink(url)" id="tree"></jstree>
+    <jstree class="tree" on-select="showTreeLink(url)" id="tree" data="tree"></jstree>
 
       <div id="file-content" class="clearfix">
 
@@ -61,6 +61,33 @@ limitations under the License.
           <li class="gone"><svg width="15" height="15"><g transform="translate(5,2)"><g
transform="translate(0,5)"><circle r="4.5"></circle></g></g></svg>
Gone</li>
         </ul>
       </div>
+      <div style="width: 100%; text-align: center;" ng-show="showPaging">
+        <div id="cloudGraphPaging">
+         <button ng-show="prevEnabled" ng-click="previous()" id="cloudGraphPagingPrev">&lt;
Previous</button>
+         <span ng-show="total==0">No collections found.</span>
+         <span ng-hide="total==0">Collections {{start}} - {{last}} of {{total}}.</span>&nbsp;
+
+         Filter by:&nbsp;<select ng-model="filterType" ng-change="initGraph()" id="cloudGraphPagingFilterType">
+           <option value="status">Status</option>
+           <option value="name">Name</option>
+         </select>&nbsp;T:{{filterType}}
+
+         <span ng-show="filterType=='status'">
+           <select ng-model="pagingStatusFilter" id="cloudGraphPagingStatusFilter" ng-change="resetGraph()">
+             <option value=""> - Any - </option>
+             <option value="healthy">Healthy</option>
+             <option value="degraded">Degraded</option>
+             <option value="downed_shard">Downed Shard</option>
+             <option value="recovering">Replica in Recovery</option>
+           </select>
+         </span>
+         <span ng-show="filterType=='name'">
+           <input ng-model="pagingFilter" type="text" size="10" name="filter" ng-change="resetGraph()"/>&nbsp;
+         </span>
+         Show <input ng-model="rows" ng-change="resetGraph()" type="text" size="2" name="rows"
/> per page.
+         <button ng-show="nextEnabled" ng-click="next()">Next &gt;</button>
+        </div>
+      </div>
 
     </div>
 



Mime
View raw message