Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/dashboard: disable 'Add Capability' button in rgw user edi… #32610

Merged

Conversation

alfonsomthd
Copy link
Contributor

@alfonsomthd alfonsomthd commented Jan 13, 2020

Disable 'Add Capability' button when rgw user alreasy has all capabilities added.

Fixes: https://tracker.ceph.com/issues/43564
Signed-off-by: Alfonso Martínez almartin@redhat.com

43564-rgw-disable-capability-button

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@votdev
Copy link
Member

votdev commented Jan 13, 2020

What about using a tooltip to display that all capabilities have been added?

Peek 2020-01-13 14-48

--- src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html	(date 1578728569000)
+++ src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html	(date 1578923311873)
@@ -415,15 +415,14 @@
                   <button type="button"
                           class="btn btn-light float-right tc_addCapButton"
                           [disabled]="hasCapabilityButtonToBeDisabled()"
+                          i18n-tooltip
+                          tooltip="All capabilities are already added."
+                          [isDisabled]="!hasCapabilityButtonToBeDisabled()"
                           (click)="showCapabilityModal()">
                     <i [ngClass]="[icons.add]"></i>
                     <ng-container i18n>{{ actionLabels.ADD | titlecase }}
                       {{ capabilityLabel | upperFirst }}</ng-container>
                   </button>
-                  <ng-container *ngIf="hasCapabilityButtonToBeDisabled()"
-                                i18n>
-                    All capabilities are already added.
-                  </ng-container>
                 </div>
               </div>
               <span class="help-block"></span>

@alfonsomthd
Copy link
Contributor Author

What about using a tooltip to display that all capabilities have been added?

I agree.

@alfonsomthd alfonsomthd force-pushed the 43564-rgw-disable-capability-button branch from db1009f to d615359 Compare January 14, 2020 09:09
@alfonsomthd alfonsomthd force-pushed the 43564-rgw-disable-capability-button branch from d615359 to f907a8a Compare January 14, 2020 11:15
@@ -414,6 +414,10 @@
<div class="col-12">
<button type="button"
class="btn btn-light float-right tc_addCapButton"
[disabled]="hasAllCapabilities()"
i18n-tooltip
tooltip="All capabilities are already added."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tooltip seems to not work in a disabled button, in Chrome.
https://getbootstrap.com/docs/4.4/components/tooltips/#disabled-elements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tspmelo The issue here explained:
https://jakearchibald.com/2017/events-and-disabled-form-fields/
mouse events don't fire when the pointer is over disabled form elements, except in Firefox

As we are using ngx-bootstrap (not plain bootstrap) for tooltips,
it seems appropriate to me to keep tooltip in button and trigger the required events
(tested and it works):

triggers="pointerenter pointerleave"

…ies are added

Fixes: https://tracker.ceph.com/issues/43564
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
@alfonsomthd alfonsomthd force-pushed the 43564-rgw-disable-capability-button branch from f907a8a to 4ef0e2c Compare January 22, 2020 15:05
@alfonsomthd
Copy link
Contributor Author

jenkins test docs

Copy link
Contributor

@tspmelo tspmelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its working now in chrome.

Copy link
Member

@callithea callithea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@LenzGr LenzGr changed the title mgr/dashboard: disable 'Add Capability' button in rgw user edit form. mgr/dashboard: disable 'Add Capability' button in rgw user edi… Jan 28, 2020
@LenzGr LenzGr merged commit f604e7c into ceph:master Jan 28, 2020
@alfonsomthd alfonsomthd deleted the 43564-rgw-disable-capability-button branch April 9, 2020 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants