diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js index c5bbfb2d9..01cfdb92e 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js @@ -1,9 +1,15 @@ import Route from '@ember/routing/route'; -import { hash } from 'rsvp'; +import { hash, all } from 'rsvp'; import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route { + // =services + + @service intl; + @service notify; + // =methods /** @@ -13,18 +19,18 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo this.store.unloadAll('host'); } - /** * Loads all hosts under the current host catalog. * @return {Promise{[HostModel]}} */ async model() { const scopeID = this.modelFor('scopes.scope.projects.project').id; - const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id; const hostSet = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set'); return hash({ hostSet, - hosts: this.store.findAll('host', { adapterOptions: { scopeID, hostCatalogID } }) + hosts: all(hostSet.host_ids.map(id => + this.store.findRecord('host', id, { adapterOptions: { scopeID } }) + )) }); } @@ -37,6 +43,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo try { const scopeID = this.modelFor('scopes.scope.projects.project').id; const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id; + //FIXME: Are adapterOptions needed? await hostSet.removeHost(host.id, { adapterOptions : { scopeID, hostCatalogID } }); this.refresh(); this.notify.success(this.intl.t('notify.delete-success'));