From dc0bac7f5b7829e577a67d1113bef9be506611f3 Mon Sep 17 00:00:00 2001 From: Phil Renaud Date: Wed, 3 Aug 2022 15:09:25 -0400 Subject: [PATCH] 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 --- .changelog/13991.txt | 3 +++ ui/app/routes/variables/new.js | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changelog/13991.txt diff --git a/.changelog/13991.txt b/.changelog/13991.txt new file mode 100644 index 000000000..ec57024a4 --- /dev/null +++ b/.changelog/13991.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: when creating a secure variable, check against your namespaces rather than assuming default +``` diff --git a/ui/app/routes/variables/new.js b/ui/app/routes/variables/new.js index e8415f802..dd8bac3b3 100644 --- a/ui/app/routes/variables/new.js +++ b/ui/app/routes/variables/new.js @@ -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