From f366f0a8585e42cacc3c8474bbacd463c7e2d79e Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Tue, 30 Jan 2024 09:13:20 -0600 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20id=20to=20ids=20?= =?UTF-8?q?for=20target=20onboarding=20creation=20(#2120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12412 --- addons/api/mirage/factories/role.js | 4 ++-- ui/admin/app/routes/onboarding.js | 2 +- ui/admin/tests/acceptance/roles/grants-test.js | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/api/mirage/factories/role.js b/addons/api/mirage/factories/role.js index 8ef80ad45..a2c91d8fb 100644 --- a/addons/api/mirage/factories/role.js +++ b/addons/api/mirage/factories/role.js @@ -21,8 +21,8 @@ export default factory.extend({ ], // eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects grant_strings: () => [ - 'id=*;action=*', - 'id=*;type=host-catalog;actions=create,read', + 'ids=*;action=*', + 'ids=*;type=host-catalog;actions=create,read', ], id: () => generateId('r_'), diff --git a/ui/admin/app/routes/onboarding.js b/ui/admin/app/routes/onboarding.js index 3b45519e9..3a9e6232d 100644 --- a/ui/admin/app/routes/onboarding.js +++ b/ui/admin/app/routes/onboarding.js @@ -135,7 +135,7 @@ export default class OnboardingRoute extends Route { await role.save(); await role.saveGrantStrings([ `type=target;actions=list`, - `id=${target.id};actions=authorize-session`, + `ids=${target.id};actions=authorize-session`, ]); } catch (error) { // Redirect to targets that belong to scope diff --git a/ui/admin/tests/acceptance/roles/grants-test.js b/ui/admin/tests/acceptance/roles/grants-test.js index b3b68ccb8..da1b7de15 100644 --- a/ui/admin/tests/acceptance/roles/grants-test.js +++ b/ui/admin/tests/acceptance/roles/grants-test.js @@ -97,7 +97,7 @@ module('Acceptance | roles | grants', function (hooks) { const attrs = JSON.parse(requestBody); assert.strictEqual( attrs.grant_strings[0], - 'id=123,action=delete', + 'ids=123,action=delete', 'A grant is updated', ); const id = idMethod.split(':')[0]; @@ -105,17 +105,17 @@ module('Acceptance | roles | grants', function (hooks) { }, ); await visit(urls.grants); - await fillIn(`${grantsForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${grantsForm} [name="grant"]`, 'ids=123,action=delete'); await click('.rose-form-actions [type="submit"]:not(:disabled)'); }); test('cancel a grant update', async function (assert) { await visit(urls.grants); - await fillIn(`${grantsForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${grantsForm} [name="grant"]`, 'ids=123,action=delete'); await click('.rose-form-actions button:not([type="submit"])'); assert.notEqual( find(`${grantsForm} [name="grant"]`).value, - 'id=123,action=delete', + 'ids=123,action=delete', ); }); @@ -137,7 +137,7 @@ module('Acceptance | roles | grants', function (hooks) { findAll(`${grantsForm} [name="grant"]`).length, grantsCount, ); - await fillIn(`${grantsForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${grantsForm} [name="grant"]`, 'ids=123,action=delete'); await click('.rose-form-actions [type="submit"]:not(:disabled)'); assert.ok(find('[role="alert"]')); }); @@ -158,14 +158,14 @@ module('Acceptance | roles | grants', function (hooks) { }, ); await visit(urls.grants); - await fillIn(`${newGrantForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${newGrantForm} [name="grant"]`, 'ids=123,action=delete'); await click(`${newGrantForm} [type="submit"]:not(:disabled)`); await click('.rose-form-actions [type="submit"]:not(:disabled)'); }); test('cancel a grant creation', async function (assert) { await visit(urls.grants); - await fillIn(`${newGrantForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${newGrantForm} [name="grant"]`, 'ids=123,action=delete'); await click(`${newGrantForm} [type="submit"]:not(:disabled)`); await click('.rose-form-actions button:not([type="submit"])'); assert.notOk(find(`${newGrantForm} [name="grant"]`).value); @@ -189,7 +189,7 @@ module('Acceptance | roles | grants', function (hooks) { findAll(`${grantsForm} [name="grant"]`).length, grantsCount, ); - await fillIn(`${newGrantForm} [name="grant"]`, 'id=123,action=delete'); + await fillIn(`${newGrantForm} [name="grant"]`, 'ids=123,action=delete'); await click(`${newGrantForm} [type="submit"]:not(:disabled)`); await click('.rose-form-actions [type="submit"]:not(:disabled)'); assert.ok(find('[role="alert"]'));