Skip to content

Commit

Permalink
GetCredentials Bug fix (#13336) (#13337)
Browse files Browse the repository at this point in the history
* the fix

* test coverage
  • Loading branch information
Monkeychip committed Dec 3, 2021
1 parent ab20565 commit 3d69cbb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/get-credentials-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class GetCredentialsCard extends Component {
@tracked secret = '';
@action
async transitionToCredential() {
transitionToCredential() {
const role = this.role;
const secret = this.secret;
if (role) {
Expand Down
3 changes: 1 addition & 2 deletions ui/app/templates/components/get-credentials-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
type="submit"
value={{@title}}
class="button is-secondary"
disabled={{buttonDisabled}}
disabled={{this.buttonDisabled}}
onclick={{action "transitionToCredential"}}
data-test-get-credentials
/>

</form>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
@searchLabel="Role to use"
@backend={{model.backend}}
@models={{array 'database/role'}}
@type="role"
/>
</div>
</div>
Expand Down
23 changes: 13 additions & 10 deletions ui/tests/acceptance/secrets/backend/database/secret-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { currentURL, settled, click, visit, fillIn } from '@ember/test-helpers';
import { currentURL, settled, click, visit, fillIn, typeIn } from '@ember/test-helpers';
import { create } from 'ember-cli-page-object';
import { selectChoose, clickTrigger } from 'ember-power-select/test-support/helpers';

Expand Down Expand Up @@ -408,15 +408,15 @@ module('Acceptance | secrets/database/*', function(hooks) {
assert.dom('[data-test-secret-create]').hasText('Add role', 'Add role button exists with correct text');
assert.dom('[data-test-edit-link]').hasText('Edit configuration', 'Edit button exists with correct text');
const CONNECTION_VIEW_ONLY = `
path "${backend}/*" {
capabilities = ["deny"]
}
path "${backend}/config" {
capabilities = ["list"]
}
path "${backend}/config/*" {
capabilities = ["read"]
}
path "${backend}/*" {
capabilities = ["deny"]
}
path "${backend}/config" {
capabilities = ["list"]
}
path "${backend}/config/*" {
capabilities = ["read"]
}
`;
await consoleComponent.runCommands([
`write sys/mounts/${backend} type=database`,
Expand All @@ -442,6 +442,9 @@ path "${backend}/config/*" {
.dom('[data-test-selectable-card="Roles"]')
.doesNotExist('Roles card does not exist on overview w/ policy');
assert.dom('.title-number').hasText('1', 'Lists the correct number of connections');
// confirm get credentials card is an option to select. Regression bug.
await typeIn('.ember-text-field', 'blah');
assert.dom('[data-test-get-credentials]').isEnabled();
});

test('Role create form', async function(assert) {
Expand Down

0 comments on commit 3d69cbb

Please sign in to comment.