fix: 🐛 modal bubbling up when user has not updated model (#2227)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13106
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2024-04-09 12:05:15 -07:00
1 parent c8839d6db1
commit 0b4fd6765e
2 files changed
+6 -6

No files matched your search

+5 -1
View File
@@ -4,7 +4,11 @@
}}
<Rose::Dropdown
@text={{this.scope.org.displayName}}
@text={{if
this.scope.org.isGlobal
(t 'titles.global')
this.scope.org.displayName
}}
@icon={{if
this.scope.org.isGlobal
'flight-icons/svg/globe-16'
+1 -5
View File
@@ -33,17 +33,13 @@ export default class ScopesScopeRoute extends Route {
* @param {string} params.scope_id
* @return {Promise{ScopeModel}}
*/
model({ scope_id: id }) {
async model({ scope_id: id }) {
// Since only global and org scopes are authenticatable, we can infer type
// from ID because global has a fixed ID.
const type = id === 'global' ? 'global' : 'org';
return this.store.findRecord('scope', id).catch(() => {
const maybeExistingScope = this.store.peekRecord('scope', id);
const scopeOptions = { id, type };
/* istanbul ignore else */
if (type === 'global') {
scopeOptions.name = this.intl.t('titles.global');
}
return (
maybeExistingScope || this.store.createRecord('scope', scopeOptions)
);