You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by up...@apache.org on 2015/09/16 12:14:14 UTC

svn commit: r1703380 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/webapp/ solr/webapp/web/js/angular/ solr/webapp/web/js/angular/controllers/ solr/webapp/web/partials/

Author: upayavira
Date: Wed Sep 16 10:14:14 2015
New Revision: 1703380

URL: http://svn.apache.org/r1703380
Log:
SOLR-7666 A motley collection of bugs in angular UI

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/dataimport.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/documents.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/logging.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/query.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/replication.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/schema-browser.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/segments.js
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js
    lucene/dev/branches/branch_5x/solr/webapp/web/partials/collection_overview.html
    lucene/dev/branches/branch_5x/solr/webapp/web/partials/query.html

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/app.js Wed Sep 16 10:14:14 2015
@@ -194,10 +194,8 @@ solrAdminApp.config([
             browser.locale = match[1] + '_' + match[3];
         }
 
-        var result= ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
+        return ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
             sep[ browser.locale ] || sep[ browser.language ] || sep['_']);
-        console.log(result);
-        return result;
     };
 })
 .filter('orderObjectBy', function() {

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/dataimport.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/dataimport.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/dataimport.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/dataimport.js Wed Sep 16 10:14:14 2015
@@ -192,6 +192,11 @@ solrAdminApp.controller('DataImportContr
             $cookies.dataimport_autorefresh = $scope.autorefresh ? true : null;
             if ($scope.autorefresh) {
                 $scope.refreshTimeout = $interval($scope.refreshStatus, dataimport_timeout);
+                var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+                    $interval.cancel($scope.refreshTimeout);
+                    onRouteChangeOff();
+                });
+
             } else if ($scope.refreshTimeout) {
                 $interval.cancel($scope.refreshTimeout);
             }

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/documents.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/documents.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/documents.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/documents.js Wed Sep 16 10:14:14 2015
@@ -116,7 +116,7 @@ solrAdminApp.controller('DocumentsContro
                     $scope.responseStatus = failure;
                 };
                 if (contentType == "json") {
-                  Update.postJson(params, postData, callack, failure);
+                  Update.postJson(params, postData, callback, failure);
                 } else if (contentType == "xml") {
                   Update.postXml(params, postData, callback, failure);
                 } else if (contentType == "csv") {

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/logging.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/logging.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/logging.js Wed Sep 16 10:14:14 2015
@@ -71,7 +71,11 @@ solrAdminApp.controller('LoggingControll
         }
       */
       });
-      $timeout($scope.refresh, 10000);
+      $scope.timeout = $timeout($scope.refresh, 10000);
+      var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+        $timeout.cancel($scope.timeout);
+        onRouteChangeOff();
+      });
     };
     $scope.refresh();
 

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/query.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/query.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/query.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/query.js Wed Sep 16 10:14:14 2015
@@ -20,16 +20,20 @@ solrAdminApp.controller('QueryController
     $scope.resetMenu("query", Constants.IS_COLLECTION_PAGE);
 
     // @todo read URL parameters into scope
-    $scope.query = {wt: 'json', q:'*:*', indent:'on'};
+    $scope.query = {wt: 'json', q:'*:*', indent:'true'};
     $scope.filters = [{fq:""}];
     $scope.dismax = {defType: "dismax"};
     $scope.edismax = {defType: "edismax", stopwords: true, lowercaseOperators: true};
-    $scope.hl = {hl:"on"};
-    $scope.facet = {facet: "on"};
+    $scope.hl = {hl:"true"};
+    $scope.facet = {facet: "true"};
     $scope.spatial = {};
-    $scope.spellcheck = {spellcheck:"on"};
+    $scope.spellcheck = {spellcheck:"true"};
     $scope.qt = "/select";
 
+    if ($location.search().q) {
+      $scope.query.q = $location.search()["q"];
+    }
+
     $scope.doQuery = function() {
       var params = {};
 
@@ -74,7 +78,7 @@ solrAdminApp.controller('QueryController
       params.doNotIntercept=true;
       params.core = $routeParams.core;
       params.handler = qt;
-      var url = "/solr/" + $routeParams.core + qt + "?" + Query.url(params);
+      var url = Query.url(params);
       Query.query(params, function(data) {
         $scope.lang = $scope.query.wt;
         $scope.response = data;

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/replication.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/replication.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/replication.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/replication.js Wed Sep 16 10:14:14 2015
@@ -23,6 +23,8 @@ solrAdminApp.controller('ReplicationCont
 
         $scope.refresh = function() {
             Replication.details({core:$routeParams.core}, function(response) {
+                var timeout;
+                var interval;
                 if ($scope.interval) $interval.cancel($scope.interval);
                 $scope.isSlave = (response.details.isSlave === 'true');
                 if ($scope.isSlave) {
@@ -31,17 +33,23 @@ solrAdminApp.controller('ReplicationCont
                     $scope.versions = getSlaveVersions(response.details);
                     $scope.settings = getSlaveSettings(response.details);
                     if ($scope.settings.isReplicating) {
-                        $timeout($scope.refresh, 1000);
+                        timeout = $timeout($scope.refresh, 1000);
                     } else if(!$scope.settings.isPollingDisabled && $scope.settings.pollInterval) {
-                        $scope.interval = $interval(function() {
+                        interval = $scope.interval = $interval(function() {
                             $scope.settings.tick--;
                         }, 1000, $scope.settings.tick);
-                        $timeout($scope.refresh, 1000*(1+$scope.settings.tick));
+                        timeout = $timeout($scope.refresh, 1000*(1+$scope.settings.tick));
                     }
                 } else {
                     $scope.versions = getMasterVersions(response.details);
                 }
                 $scope.master = getMasterSettings(response.details, $scope.isSlave);
+
+                var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+                    if (interval) $interval.cancel(interval);
+                    if (timeout) $timeout.cancel(timeout);
+                    onRouteChangeOff();
+                });
             });
 
         };

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/schema-browser.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/schema-browser.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/schema-browser.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/schema-browser.js Wed Sep 16 10:14:14 2015
@@ -125,25 +125,28 @@ solrAdminApp.controller('SchemaBrowserCo
 
 var getFieldsAndTypes = function(data) {
     var fieldsAndTypes = [];
-    for (var field in data.fields) {
+    var fields = Object.keys(data.fields).sort();
+    for (var i in fields) {
         fieldsAndTypes.push({
             group: "Fields",
-            value: "field=" + field,
-            label: field
+            value: "field=" + fields[i],
+            label: fields[i]
         });
     }
-    for (var field in data.dynamic_fields) {
+    var dynamic_fields = Object.keys(data.dynamic_fields).sort();
+    for (var i in dynamic_fields) {
         fieldsAndTypes.push({
             group: "Dynamic Fields",
-            value: "dynamic-field=" + field,
-            label: field
+            value: "dynamic-field=" + dynamic_fields[i],
+            label: dynamic_fields[i]
         });
     }
-    for (var type in data.types) {
+    var types = Object.keys(data.types).sort();
+    for (var i in types) {
         fieldsAndTypes.push({
             group: "Types",
-            value: "type=" + type,
-            label: type
+            value: "type=" + types[i],
+            label: types[i]
         });
     }
     return fieldsAndTypes;

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/segments.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/segments.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/segments.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/segments.js Wed Sep 16 10:14:14 2015
@@ -59,6 +59,11 @@ solrAdminApp.controller('SegmentsControl
         $scope.autorefresh = !$scope.autorefresh;
         if ($scope.autorefresh) {
             $scope.interval = $interval($scope.refresh, 1000);
+            var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
+              $interval.cancel($scope.interval);
+              onRouteChangeOff();
+            });
+
         } else if ($scope.interval) {
             $interval.cancel($scope.interval);
         }

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/services.js Wed Sep 16 10:14:14 2015
@@ -21,6 +21,21 @@ solrAdminServices.factory('System',
   ['$resource', function($resource) {
     return $resource('/solr/admin/info/system', {"wt":"json", "_":Date.now()});
   }])
+.factory('Collections',
+  ['$resource', function($resource) {
+    return $resource('/solr/admin/collections',
+    {'wt':'json', '_':Date.now()}, {
+    "list": {params:{action: "LIST"}},
+    "status": {params:{action: "CLUSTERSTATUS"}},
+    "add": {params:{action: "CREATE"}},
+    "delete": {params:{action: "DELETE"}},
+    "rename": {params:{action: "RENAME"}},
+    "createAlias": {params:{action: "CREATEALIAS"}},
+    "deleteAlias": {params:{action: "DELETEALIAS"}},
+    "reload": {method: "GET", params:{action:"RELOAD", core: "@core"}},
+    "optimize": {params:{}}
+    });
+  }])
 .factory('Cores',
   ['$resource', function($resource) {
     return $resource('/solr/admin/cores',
@@ -35,15 +50,6 @@ solrAdminServices.factory('System',
     "optimize": {params:{}}
     });
   }])
-.factory('Collections',
-  ['$resource', function($resource) {
-    return $resource('/solr/admin/collections',
-      {wt: 'json', _:Date.now()}, {
-        "list": {params:{action: "LIST"}},
-        "status": {params:{action: "CLUSTERSTATUS"}}
-      }
-    )
-  }])
 .factory('Logging',
   ['$resource', function($resource) {
     return $resource('/solr/admin/info/logging', {'wt':'json', '_':Date.now()}, {
@@ -59,7 +65,16 @@ solrAdminServices.factory('System',
       "dump": {params: {dump: "true"}},
       "liveNodes": {params: {path: '/live_nodes'}},
       "clusterState": {params: {detail: "true", path: "/clusterstate.json"}},
-      "detail": {params: {detail: "true", path: "@path"}}
+      "detail": {params: {detail: "true", path: "@path"}},
+      "configs": {params: {detail:false, path: "/configs/"}},
+      "aliases": {params: {detail: "true", path: "/aliases.json"}, transformResponse:function(data) {
+        var znode = $.parseJSON(data).znode;
+        if (znode.data) {
+          return {aliases: $.parseJSON(znode.data).collection};
+        } else {
+          return {aliases: {}};
+        }
+      }}
     });
   }])
 .factory('Properties',
@@ -194,7 +209,7 @@ solrAdminServices.factory('System',
   }])
 .factory('Query',
     ['$resource', function($resource) {
-       var resource = $resource('/solr/:core:handler', {core: '@core', handler: '@handler'}, {
+       var resource = $resource('/solr/:core:handler', {core: '@core', handler: '@handler', '_':Date.now()}, {
            "query": {
                method: "GET", transformResponse: function (data) {
                    return {data: data}
@@ -210,7 +225,7 @@ solrAdminServices.factory('System',
                    }
                }
            }
-           return "/solr/" + params.core + params.handler + "?" + qs.join("&");
+           return "/solr/" + params.core + params.handler + "?" + qs.sort().join("&");
        }
        return resource;
     }])

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/partials/collection_overview.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/partials/collection_overview.html?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/partials/collection_overview.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/partials/collection_overview.html Wed Sep 16 10:14:14 2015
@@ -68,8 +68,10 @@ limitations under the License.
                 <dl ng-show="replica.show">
                   <dt>Base URL: </dt><dd>{{replica.base_url}}</dd>
                   <dt>Core: </dt><dd><a href="{{replica.base_url}}/{{replica.core}}">{{replica.core}}</a></dd>
+                  <dt>Active: </dt>
+                    <dd class="ico value" ng-class="replica.state == 'active' ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
                   <dt>Leader: </dt>
-                    <dd class="ico value" ng-class="selectedCollection.autoAddReplicas ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
+                    <dd class="ico value" ng-class="replica.leader == 'true' ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
                 </dl>
               </div>
 

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/partials/query.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/partials/query.html?rev=1703380&r1=1703379&r2=1703380&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/partials/query.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/partials/query.html Wed Sep 16 10:14:14 2015
@@ -48,7 +48,7 @@ limitations under the License.
         <label for="sort" title="Sort field or function with asc|desc.">
           <a rel="help">sort</a>
         </label>
-        <input type="text" id="sort" name="sort" title="Sort field or function with asc|desc.">
+        <input type="text" ng-model="query.sort" id="sort" name="sort" title="Sort field or function with asc|desc.">
 
         <label for="start" title="Number of leading documents to skip and number of documents to return after 'start'. (Integers)">
           <a rel="help">start</a>,
@@ -87,12 +87,12 @@ limitations under the License.
         </select>
 
         <label for="indent" class="checkbox" title="Indent results.">
-          <input type="checkbox" ng-model="query.indent" name="indent" id="indent" value="true" title="Indent results." checked="checked">
+          <input type="checkbox" ng-model="query.indent" name="indent" id="indent" title="Indent results." ng-true-value="'true'" ng-false-value="'false'">
           <a rel="help">indent</a>
         </label>
 
         <label for="debugQuery" class="checkbox" title="Show timing and diagnostics.">
-          <input type="checkbox" ng-model="query.debugQuery" name="debugQuery" id="debugQuery" value="true" title="Show timing and diagnostics.">
+          <input type="checkbox" ng-model="query.debugQuery" name="debugQuery" id="debugQuery" title="Show timing and diagnostics." ng-true-value="'true'" ng-false-value="'false'">
           <a rel="help">debugQuery</a>
         </label>