Apache Lucene open-source search software
SOLR-7778 Resolve admin UI behaviour when no cores present
Upayavira86cc47d2651c
diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.htmlindex c7a6b743e12..4adbe529f86 100644--- a/solr/webapp/web/index.html+++ b/solr/webapp/web/index.html@@ -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"chosendiff --git a/solr/webapp/web/js/angular/controllers/cores.js b/solr/webapp/web/js/angular/controllers/cores.jsindex 3e019015dc2..263c9596e3a 100644--- a/solr/webapp/web/js/angular/controllers/cores.js+++ b/solr/webapp/web/js/angular/controllers/cores.js@@ -28,7 +28,7 @@ solrAdminApp.controller('CoreAdminController',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('CoreAdminController',$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('CoreAdminController',} 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('CoreAdminController',$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();});diff --git a/solr/webapp/web/partials/cores.html b/solr/webapp/web/partials/cores.htmlindex 2c527531382..db9b93eb98d 100644--- a/solr/webapp/web/partials/cores.html+++ b/solr/webapp/web/partials/cores.html@@ -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>