This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 39e4ac310a3 SOLR-15928 Dim add collection buttons in Admin UI when no
permission (#1371)
39e4ac310a3 is described below
commit 39e4ac310a3f31b73b8806a3e2d0bb6c8a9f5d9c
Author: Jan Høydahl <[email protected]>
AuthorDate: Tue Feb 21 14:17:44 2023 +0100
SOLR-15928 Dim add collection buttons in Admin UI when no permission (#1371)
---
solr/CHANGES.txt | 2 ++
solr/webapp/web/css/angular/collections.css | 6 ++++++
solr/webapp/web/partials/collections.html | 19 +++++++++++--------
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index efd6f853924..cbd52a1adb7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -264,6 +264,8 @@ Other Changes
* SOLR-15733: Separate out a solrj-streaming module (Joel Bernstein, Kevin
Risden)
+* SOLR-15928: Dim 'Add Collection' and 'Create Alias' buttons when user lacks
proper permissions (janhoy)
+
================== 9.1.1 ==================
Bug Fixes
diff --git a/solr/webapp/web/css/angular/collections.css
b/solr/webapp/web/css/angular/collections.css
index 880a76d4c60..41707493667 100644
--- a/solr/webapp/web/css/angular/collections.css
+++ b/solr/webapp/web/css/angular/collections.css
@@ -148,6 +148,12 @@ limitations under the License.
background-image: url( ../../img/ico/cross.png );
}
+button.disabled
+{
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
#content #collections #navigation #add span
{
background-image: url( ../../img/ico/plus-button.png );
diff --git a/solr/webapp/web/partials/collections.html
b/solr/webapp/web/partials/collections.html
index 3f924d31055..a05ebe7198f 100644
--- a/solr/webapp/web/partials/collections.html
+++ b/solr/webapp/web/partials/collections.html
@@ -84,7 +84,9 @@ limitations under the License.
</p>
<p class="clearfix buttons">
- <button type="submit" class="submit"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="addCollection()"><span>Add Collection</span></button>
+ <button type="submit"
ng-class="{submit,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="addCollection()">
+ <span>Add Collection</span>
+ </button>
<button type="reset" class="reset"
ng-click="cancelAddCollection()"><span>Cancel</span></button>
</p>
@@ -110,7 +112,7 @@ limitations under the License.
</p>
<p class="clearfix buttons">
- <button class="submit" ng-click="createAlias()"><span>Create
Alias</span></button>
+ <button
ng-class="{submit,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="createAlias()"><span>Create Alias</span></button>
<button type="reset" class="reset"
ng-click="cancelCreateAlias()"><span>Cancel</span></button>
</p>
</form>
@@ -122,10 +124,11 @@ limitations under the License.
<div id="actions" class="actions clearfix" ng-show="collection">
- <button id="delete-collection" class="warn requires-core"
ng-click="showDeleteCollection()" ng-show="collection && collection.type ===
'collection'"><span>Delete collection</span></button>
- <button id="delete-alias" class="action requires-core"
ng-click="toggleDeleteAlias()" ng-show="collection && collection.type ===
'alias'"><span>Delete alias</span></button>
- <button id="reload" class="requires-core" ng-click="reloadCollection()"
ng-show="collection && collection.type === 'collection'"
- ng-class="{success: reloadSuccess, warn:
reloadFailure}"><span>Reload</span></button>
+ <button id="delete-collection"
ng-class="{warn,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="showDeleteCollection()" ng-show="collection && collection.type ===
'collection'"><span>Delete collection</span></button>
+ <button id="delete-alias"
ng-class="{action,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="toggleDeleteAlias()" ng-show="collection && collection.type ===
'alias'"><span>Delete alias</span></button>
+ <button id="reload" ng-click="reloadCollection()" ng-show="collection &&
collection.type === 'collection'"
+ ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
+ ng-class="{success: reloadSuccess, warn: reloadFailure,
disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"><span>Reload</span></button>
<div class="action delete" ng-show="showDelete">
@@ -395,12 +398,12 @@ limitations under the License.
</div>
<div id="navigation" class="requires-core clearfix">
- <button id="add" class="action"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="showAddCollection()"><span>Add Collection</span></button>
+ <button id="add"
ng-class="{action,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-disabled="!isPermitted(permissions.COLL_EDIT_PERM)"
ng-click="showAddCollection()"><span>Add Collection</span></button>
<ul>
<li ng-repeat="c in collections" ng-class="{current: collection.name ==
c.name && collection.type === 'collection'}"><a
href="#~collections/{{c.name}}">{{c.name}}</a></li>
</ul>
<hr/>
- <button id="create-alias" class="action requires-core"
ng-click="toggleCreateAlias()" ng-disabled="collections.length ==
0"><span>Create Alias</span></button>
+ <button id="create-alias"
ng-class="{action,disabled:!isPermitted(permissions.COLL_EDIT_PERM)}"
ng-click="toggleCreateAlias()" ng-disabled="collections.length == 0 ||
!isPermitted(permissions.COLL_EDIT_PERM)"><span>Create Alias</span></button>
<ul>
<li ng-repeat="c in aliases" ng-class="{current: collection.name ==
c.name && collection.type === 'alias'}"><a
href="#~collections/alias_{{c.name}}">{{c.name}}</a></li>
</ul>