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

Swap text-based on and off toggles to non-text based #4425

Merged
merged 3 commits into from
Aug 7, 2019

Conversation

mabashian
Copy link
Member

SUMMARY

Our text-based toggles are particularly problematic when translated to other languages. This is a proposal to use toggles that look like Patternfly's switches. The non-disabled versions would look like this:

Screen Shot 2019-08-05 at 11 09 15 AM

The disabled versions would look like this:

Screen Shot 2019-08-05 at 11 09 31 AM

Here's an example screenshot of the poor behavior:
53660789-b6866780-3c2c-11e9-9a30-07ab3bfa4c10

A lot of the code removal here has to do with old job submission code. Some of this old code referenced the ScheduleToggle class(es) which is what led me down that path. This PR should replace all of the old on/off toggles with these new toggles. Most, if not all, of these toggles appear in lists and forms throughout the application. They are particularly pervasive in the settings forms and host lists but they also appear in the Job Template form, Notifications list and Survey Maker amongst others.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • UI
AWX VERSION

6.1.0

ADDITIONAL INFORMATION

Manually tested as many of the toggles as I could reasonably locate. I also cruised through the UI with a system auditor user to make sure that toggles were properly disabled. I did find that the survey maker toggle has never been disabled for users that cannot edit the JT so I fixed that.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@ryanpetrello
Copy link
Contributor

👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍

html += " class='ScheduleToggle-switch' ng-click='" + field.ngClick + "' translate>" + i18n._("OFF") + "</button></div></div>";
html += `
<div class="Field-header--${key} ${field['class']} ${field.columnClass}">
<span class="awxSwitch-outer" ng-class="{'awxSwitch-on': ${"flag" in field} ? ${form.iterator}.${field.flag} : ${form.iterator}.enabled, 'awxSwitch-disabled': ${"ngDisabled" in field} ? ${field.ngDisabled} : false}" aw-tool-tip="${field.awToolTip}" data-placement="${field.dataPlacement ? field.dataPlacement : 'right'}" data-tip-watch="${field.dataTipWatch}">
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't seen a ternary with an in iterator like this before. is this an angular thing? I'm not sure how it works.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea you can have a ternary inside of the ng-class directive. We use this same syntax in a couple of other places.

@softwarefactory-project-zuul
Copy link
Contributor

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@ansible-zuul
Copy link

ansible-zuul bot commented Aug 7, 2019

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Contributor

@jlmitch5 jlmitch5 left a comment

Choose a reason for hiding this comment

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

looking awesome! great job on this

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit d7c15a7 into ansible:devel Aug 7, 2019
@mabashian mabashian deleted the toggles branch September 27, 2019 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants