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/07/12 22:20:39 UTC

svn commit: r1690521 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/webapp/ solr/webapp/web/index.html solr/webapp/web/js/angular/controllers/cores.js solr/webapp/web/partials/cores.html

Author: upayavira
Date: Sun Jul 12 20:20:39 2015
New Revision: 1690521

URL: http://svn.apache.org/r1690521
Log:
SOLR-7778 Resolve admin UI behaviour when no cores present

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/index.html
    lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js
    lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/index.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/index.html?rev=1690521&r1=1690520&r2=1690521&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/index.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/index.html Sun Jul 12 20:20:39 2015
@@ -156,7 +156,7 @@ limitations under the License.
           </ul>
 
           <div id="core-selector">
-            <div id="has-cores" ng-show="cores">
+            <div id="has-cores" ng-show="cores.length!=0">
               <select data-placeholder="Core Selector"
                       ng-model="currentCore"
                       chosen

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js?rev=1690521&r1=1690520&r2=1690521&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/js/angular/controllers/cores.js Sun Jul 12 20:20:39 2015
@@ -28,7 +28,7 @@ solrAdminApp.controller('CoreAdminContro
           for (_obj in data.status) coreCount++;
           $scope.hasCores = coreCount >0;
           if (!$scope.currentCore && coreCount==0) {
-            // @todo Do something if no cores defined
+            $scope.showAddCore();
             return;
           } else if (!$scope.currentCore) {
             for (firstCore in data.status) break;
@@ -50,9 +50,11 @@ solrAdminApp.controller('CoreAdminContro
         $scope.newCore = {
           name: "new_core",
           dataDir: "data",
-          instanceDir: "",
+          instanceDir: "new_core",
           config: "solrconfig.xml",
-          schema: "schema.xml"
+          schema: "schema.xml",
+          collection: "",
+          shard: ""
         };
       };
 
@@ -62,15 +64,20 @@ solrAdminApp.controller('CoreAdminContro
         } else if (false) { //@todo detect whether core exists
           $scope.AddMessage = "A core with that name already exists";
         } else {
-          Cores.add({
+          var params = {
             name: $scope.newCore.name,
             instanceDir: $scope.newCore.instanceDir,
             config: $scope.newCore.config,
-            scheme: $scope.newCore.schema,
+            schema: $scope.newCore.schema,
             dataDir: $scope.newCore.dataDir
-          }, function(data) {
-            $scope.cancelAddCore();
+          };
+          if ($scope.isCloud) {
+            params.collection = $scope.newCore.collection;
+            params.shard = $scope.newCore.shard;
+          }
+          Cores.add(params, function(data) {
             $location.path("/~cores/" + $scope.newCore.name);
+            $scope.cancelAddCore();
           });
         }
       };
@@ -100,7 +107,6 @@ solrAdminApp.controller('CoreAdminContro
           $scope.renameMessage = "New name must be different from the current one";
         } else {
           Cores.rename({core:$scope.currentCore, other: $scope.other}, function(data) {
-            console.log("RENAME2");
             $location.path("/~cores/" + $scope.other);
             $scope.cancelRename();
           });

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html?rev=1690521&r1=1690520&r2=1690521&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/partials/cores.html Sun Jul 12 20:20:39 2015
@@ -23,13 +23,14 @@ limitations under the License.
     <div id="actions" class="actions clearfix">
 
       <button id="add" class="action" ng-click="showAddCore()"><span>Add Core</span></button>
+      <span ng-show="hasCores">
       <button id="unload" class="warn requires-core" ng-click="unloadCore()"><span>Unload</span></button>
       <button id="rename" class="action requires-core" ng-click="showRenameCore()"><span>Rename</span></button>
       <button id="swap" class="action requires-core" ng-click="showSwapCores()"><span>Swap</span></button>
       <button id="reload" class="requires-core" ng-click="reloadCore()"
          ng-class="{success: reloadSuccess, warn: reloadFailure}"><span>Reload</span></button>
       <button id="optimize" class="requires-core" ng-click="optimizeCore()" ng-show="core.hasDeletions"><span>Optimize</span></button>
-
+      </span>
       <div class="action add" data-rel="add" ng-show="showAdd" style="display:block;left:0px;">
 
         <form>
@@ -49,7 +50,7 @@ limitations under the License.
           <p class="clearfix"><label for="add_schema">schema:</label>
           <input type="text" name="schema" id="add_schema" ng-model="newCore.schema"></p>
 
-          <div class="cloud">
+          <div class="cloud" ng-show="isCloud">
 
             <p class="clearfix"><label for="add_collection">collection:</label>
             <input type="text" name="collection" id="add_collection" ng-model="newCore.collection"></p>
@@ -125,7 +126,7 @@ limitations under the License.
 
     </div>
 
-    <div id="data" class="requires-core">
+    <div id="data" class="requires-core" ng-show="hasCore">
 
       <div class="block" id="core-data">
 
@@ -159,7 +160,7 @@ limitations under the License.
         </div>
       </div>
 
-      <div class="block" id="index-data">
+      <div class="block" id="index-data" ng-show="hasCore">
 
           <h2><span>Index</span></h2>
 
@@ -220,7 +221,7 @@ limitations under the License.
 
   </div>
 
-  <div id="navigation" class="requires-core clearfix">
+  <div id="navigation" class="requires-core clearfix" ng-show="hasCore">
     <ul>
       <li ng-repeat="c in cores" ng-class="{current: core.name == c.name}"><a href="#~cores/{{c.name}}">{{c.name}}</a></li>
     </ul>