diff --git a/addons/api/addon/models/host-set.js b/addons/api/addon/models/host-set.js
index e30e86236..9b6611bb1 100644
--- a/addons/api/addon/models/host-set.js
+++ b/addons/api/addon/models/host-set.js
@@ -1,5 +1,6 @@
import GeneratedHostSetModel from '../generated/models/host-set';
import { fragmentArray } from 'ember-data-model-fragments/attributes';
+//import { computed } from '@ember/object';
export default class HostSetModel extends GeneratedHostSetModel {
@@ -11,6 +12,18 @@ export default class HostSetModel extends GeneratedHostSetModel {
*/
@fragmentArray('fragment-string', {readOnly: true}) host_ids;
+ // TODO this is here in case we want it in the future,
+ // especially for the target / add host sets workflow
+ /**
+ * Returns the host catalog instance associated with this host set if
+ * it is already loaded into the store.
+ * @type {?HostCatalogModel}
+ */
+ // @computed('host_catalog_id')
+ // get hostCatalog() {
+ // return this.store.peekRecord('host-catalog', this.host_catalog_id);
+ // }
+
// =methods
/**
diff --git a/ui/core/app/components/form/target/add-host-sets/index.hbs b/ui/core/app/components/form/target/add-host-sets/index.hbs
index b3c0a1719..5ace0a855 100644
--- a/ui/core/app/components/form/target/add-host-sets/index.hbs
+++ b/ui/core/app/components/form/target/add-host-sets/index.hbs
@@ -21,24 +21,22 @@
- {{#each this.hostSetGroups as |hostSetGroup|}}
- {{#each hostSetGroup.hostSets as |hostSet|}}
-
-
-
-
- {{hostSet.name}}
-
- {{hostSet.type}}
-
-
- {{hostSetGroup.hostCatalog.id}}
-
-
- {{/each}}
+ {{#each this.filteredHostSets as |hostSet|}}
+
+
+
+
+ {{hostSet.name}}
+
+ {{hostSet.type}}
+
+
+ {{hostSet.host_catalog_id}}
+
+
{{/each}}
diff --git a/ui/core/app/components/form/target/add-host-sets/index.js b/ui/core/app/components/form/target/add-host-sets/index.js
index afd811806..aadca547e 100644
--- a/ui/core/app/components/form/target/add-host-sets/index.js
+++ b/ui/core/app/components/form/target/add-host-sets/index.js
@@ -13,27 +13,17 @@ export default class FormTargetAddHostSetsComponent extends Component {
selectedHostSetIDs = A();
/**
- * Groups host sets not already added to the target by host catalog.
- * @type {[{hostCatalog: HostCatalogModel, hostSets: [{HostSetModel}]}]}
+ * Host sets not already added to the target.
+ * @type {[HostSetModel]}
*/
- @computed('args.{hostCatalogs.[],hostSets.[],model.host_sets.[]}')
- get hostSetGroups() {
+ @computed('args.{hostSets.[],model.host_sets.[]}')
+ get filteredHostSets() {
// Get IDs for host sets already added to the current target
const alreadyAddedHostSetIDs = this.args.model.host_sets
.map(({ host_set_id }) => host_set_id);
const notAddedHostSets = this.args.hostSets
.filter(({ id }) => !alreadyAddedHostSetIDs.includes(id));
- // Group host sets by host catalog
- const hostSetGroupsObject = notAddedHostSets.reduce((obj, hostSet) => {
- if (!obj[hostSet.host_catalog_id]) {
- const hostCatalog = this.args.hostCatalogs.findBy('id', hostSet.host_catalog_id);
- obj[hostSet.host_catalog_id] = { hostCatalog, hostSets: [] };
- }
- obj[hostSet.host_catalog_id].hostSets.push(hostSet);
- return obj;
- }, {});
- const hostSetGroups = Object.values(hostSetGroupsObject);
- return hostSetGroups;
+ return notAddedHostSets;
}
// =actions