UI: Connection "Add Role" automatically populates database in form (#11119)

* Database role create form sets url param itemKey as database on init

* add test for new functionality

* Add changelog
This commit is contained in:
Chelsea Shaw 2021-03-17 11:32:27 -05:00 committed by GitHub
parent 4ce8896b29
commit a17edd9d0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

3
changelog/11119.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Add role from database connection automatically populates the database for new role
```

View File

@ -19,6 +19,9 @@ export default class DatabaseRoleEdit extends Component {
) {
this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE', 'database');
}
if (this.args.initialKey) {
this.args.model.database = [this.args.initialKey];
}
}
@tracked loading = false;

View File

@ -60,7 +60,7 @@
@secret=''
@mode="create"
@type="add"
@queryParams={{query-params initialKey=(or filter baseKey.id) itemType="role"}}
@queryParams={{query-params initialKey=@model.name itemType="role"}}
@data-test-secret-create=true
>
Add role

View File

@ -139,6 +139,14 @@ module('Acceptance | secrets/database/*', function(hooks) {
assert
.dom(`[data-test-row-value="Write concern"]`)
.hasText('{ "wtimeout": 5000 }', 'Write concern is now showing on the table');
// click "Add Role"
await click('[data-test-secret-create="true"]');
await settled();
assert.equal(
searchSelectComponent.selectedOptions[0].text,
connectionDetails.id,
'Database connection is pre-selected on the form'
);
});
test('buttons show up for managing connection', async function(assert) {