Skip to content

Commit

Permalink
Merge pull request ansible#771 from gconsidine/ui/fix/input-replace-r…
Browse files Browse the repository at this point in the history
…evert

Ui/fix/input replace revert
  • Loading branch information
gconsidine authored Dec 5, 2017
2 parents 13d84b8 + 3ad174b commit e1e225d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function EditCredentialsController (models, $state, $scope, strings, componentsS
};

$scope.$watch('$state.current.name', (value) => {
if (/credentials.edit($|\.organization$)/.test(value)) {
if (/credentials.edit($|\.organization$|\.credentialType$)/.test(value)) {
vm.tab.details._active = true;
vm.tab.permissions._active = false;
} else {
Expand Down
6 changes: 6 additions & 0 deletions awx/ui/client/lib/components/input/secret.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function AtInputSecretController (baseInputController) {
vm.check();
};

vm.toggleRevertReplace = () => {
scope.state._isBeingReplaced = !scope.state._isBeingReplaced;

vm.onRevertReplaceToggle();
};

vm.toggleShowHide = () => {
if (scope.type === 'password') {
scope.type = 'text';
Expand Down
24 changes: 24 additions & 0 deletions awx/ui/test/e2e/tests/test-credentials-add-edit-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,30 @@ module.exports = {

credentials.waitForElementNotPresent(`${row}:nth-of-type(2)`);
credentials.expect.element(row).text.contain(store.credential.name);
},
'change the password after saving': client => {
const credentials = client.page.credentials();
const { edit } = credentials.section;
const { machine } = edit.section.details.section;

machine.section.password.expect.element('@replace').visible;
machine.section.password.expect.element('@replace').enabled;
machine.section.password.expect.element('@revert').not.present;

machine.expect.element('@password').not.enabled;

machine.section.password.click('@replace');
machine.section.password.expect.element('@replace').not.present;
machine.section.password.expect.element('@revert').visible;

machine.expect.element('@password').enabled;
machine.setValue('@password', 'newpassword');

edit.section.details.click('@save');

credentials
.waitForElementVisible('div.spinny')
.waitForElementNotVisible('div.spinny');

client.end();
}
Expand Down

0 comments on commit e1e225d

Please sign in to comment.