fix: 🐛 fix transition aborted error on storage bucket creation (#2119)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12402
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2024-01-29 12:00:07 -08:00
1 parent b63ddadf45
commit 3f17435507
2 files changed
+7 -4

No files matched your search

@@ -33,7 +33,7 @@ export default class ScopesScopeStorageBucketsStorageBucketRoute extends Route {
*/
redirect(storageBucket) {
const scope = this.modelFor('scopes.scope');
if (storageBucket.scopeID !== scope.id) {
if (!scope.isGlobal && storageBucket.scopeID !== scope.id) {
this.router.replaceWith(
'scopes.scope.storage-buckets.storage-bucket',
storageBucket.scopeID,
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
import { visit, currentURL, click, fillIn, select } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -31,6 +31,8 @@ module('Acceptance | storage-buckets | create', function (hooks) {
const ROLE_ARN_SELECTOR = '[name="role_arn"]';
const ACCESS_KEY_SELECTOR = '[name="access_key_id"]';
const SECRET_KEY_SELECTOR = '[name="secret_access_key"]';
const SCOPE_SELECTOR = '[name=scope]';
const instances = {
scopes: {
global: null,
@@ -90,7 +92,7 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
await click(`[value="${instances.scopes.org.scope.id}"]`);
await select(SCOPE_SELECTOR, instances.scopes.org.id);
assert.dom(BUCKET_NAME_FIELD_SELECTOR).isNotDisabled();
assert.dom(BUCKET_PREFIX_FIELD_SELECTOR).isNotDisabled();
@@ -102,8 +104,9 @@ module('Acceptance | storage-buckets | create', function (hooks) {
name: NAME_FIELD_TEXT,
});
assert.dom(ALERT_TEXT_SELECTOR).hasText('Saved successfully.');
assert.strictEqual(storageBucket.name, NAME_FIELD_TEXT);
assert.strictEqual(storageBucket.scopeId, instances.scopes.org.scope.id);
assert.strictEqual(storageBucket.scopeId, instances.scopes.org.id);
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});