From 3e9a06a5b58c729129a0a0ccbcfdf5c20b49f536 Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Tue, 23 Apr 2024 10:49:33 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20adding=20host=20set?= =?UTF-8?q?=20error=20in=20targets=20(#2267)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../target/add-brokered-credential-sources.js | 6 ++++++ .../scope/targets/target/add-host-sources.js | 15 ++++++++++----- ...add-injected-application-credential-sources.js | 6 ++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-brokered-credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-brokered-credential-sources.js index 6666a9c41..c93a1fef9 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-brokered-credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-brokered-credential-sources.js @@ -37,6 +37,12 @@ export default class ScopesScopeTargetsTargetAddBrokeredCredentialSourcesRoute e scope_id, query: { filters: { scope_id: [{ equals: scope_id }] } }, }); + + // TODO: For some reason, not returning promises fixes + // an ember bug similar to this reported issue: + // https://github.com/emberjs/data/issues/8299. + // This is a temporary fix until we can find a better solution or + // we upgrade ember data to try to fix the issue. await Promise.all( credentialStores.map(({ id: credential_store_id, isStatic }) => { if (isStatic) { diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js index 886443950..87407deab 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js @@ -6,7 +6,6 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import { all } from 'rsvp'; import { loading } from 'ember-loading'; import { notifySuccess, notifyError } from 'core/decorators/notify'; @@ -37,10 +36,16 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route { scope_id, query: { filters: { scope_id: [{ equals: scope_id }] } }, }); - await all( - hostCatalogs.map(({ id: host_catalog_id }) => - this.store.query('host-set', { host_catalog_id }), - ), + + // TODO: For some reason, not returning promises fixes + // an ember bug similar to this reported issue: + // https://github.com/emberjs/data/issues/8299. + // This is a temporary fix until we can find a better solution or + // we upgrade ember data to try to fix the issue. + await Promise.all( + hostCatalogs.map(({ id: host_catalog_id }) => { + this.store.query('host-set', { host_catalog_id }); + }), ); const hostSets = this.store.peekAll('host-set'); return { diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-injected-application-credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-injected-application-credential-sources.js index 8290b731e..9bcdd04c8 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-injected-application-credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-injected-application-credential-sources.js @@ -37,6 +37,12 @@ export default class ScopesScopeTargetsTargetAddInjectedApplicationCredentialSou scope_id, query: { filters: { scope_id: [{ equals: scope_id }] } }, }); + + // TODO: For some reason, not returning promises fixes + // an ember bug similar to this reported issue: + // https://github.com/emberjs/data/issues/8299. + // This is a temporary fix until we can find a better solution or + // we upgrade ember data to try to fix the issue. await Promise.all( credentialStores.map(({ id: credential_store_id, isStatic }) => { if (isStatic) {