New variable creation adds the first namespace in your available list at variable creation time (#13991)

* New variable creation adds the first namespace in your available list at variable creation time

* Changelog
This commit is contained in:
Phil Renaud
2022-08-03 15:09:25 -04:00
committed by GitHub
parent e16ec6ec7a
commit dc0bac7f5b
2 changed files with 9 additions and 2 deletions

3
.changelog/13991.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
ui: when creating a secure variable, check against your namespaces rather than assuming default
```

View File

@@ -1,8 +1,12 @@
import Route from '@ember/routing/route';
export default class VariablesNewRoute extends Route {
model(params) {
return this.store.createRecord('variable', { path: params.path });
async model(params) {
const namespaces = await this.store.peekAll('namespace');
return this.store.createRecord('variable', {
path: params.path,
namespace: namespaces.objectAt(0)?.id,
});
}
resetController(controller, isExiting) {
// If the user navigates away from /new, clear the path