diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js index ae4b9d2a5..f69de9f1a 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js @@ -11,7 +11,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo // =methods /** - * Loads all host-sets under the current scope and host catalog. + * Loads all host-sets under the current host catalog and it's parent scope. * @return {Promise{[HostSetModel]}} */ async model() { @@ -20,7 +20,6 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo return this.store.findAll('host-set', { adapterOptions: { scopeID, hostCatalogID } }); } - // =actions /** @@ -40,7 +39,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo @action async save(hostSet) { try { - await hostSet.save(); + await hostSet.save(this.adapterOptions()); this.refresh(); this.notify.success(this.intl.t('notify.save-success')); this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set', hostSet); @@ -57,7 +56,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo @action async delete(hostSet) { try { - await hostSet.destroyRecord(); + await hostSet.destroyRecord(this.adapterOptions()); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog.host-sets'); @@ -66,4 +65,14 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo this.notify.error(error.message, { closeAfter: null }); } } + + /** + * Configure adapter options using current host catalog scope and it's parent project scope. + * @return {object} + */ + adapterOptions() { + const scopeID = this.modelFor('scopes.scope.projects.project').id; + const hostCatalogID = this.modelFor('scopes.scope.projects.project.host-catalogs.host-catalog').id; + return { adapterOptions : { scopeID, hostCatalogID } }; + } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js index 4025a17bd..7211982fb 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js @@ -4,7 +4,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo // =methods /** - * Load a host set in current scope and host-catalog. + * Load a host-set using current host-catalog and it's parent project scope. * @param {object} params * @param {string} params.host_set_id * @return {HostSetModel} @@ -37,7 +37,5 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo outlet: 'navigation', model: model }); - - super.renderTemplate(...arguments); } } diff --git a/ui/core/mirage/serializers/host-set.js b/ui/core/mirage/serializers/host-set.js new file mode 100644 index 000000000..fa67b50ba --- /dev/null +++ b/ui/core/mirage/serializers/host-set.js @@ -0,0 +1,5 @@ +import ApplicationSerializer from './application'; + +export default ApplicationSerializer.extend({ + modelName: 'host-set' +}); diff --git a/ui/core/tests/acceptance/host-sets-test.js b/ui/core/tests/acceptance/host-sets-test.js index 4f398902f..d01bb6796 100644 --- a/ui/core/tests/acceptance/host-sets-test.js +++ b/ui/core/tests/acceptance/host-sets-test.js @@ -75,4 +75,28 @@ module('Acceptance | host sets', function (hooks) { await a11yAudit(); assert.equal(currentURL(), urls.hostSets); }); + + test('can navigate to a host set form', async function (assert) { + assert.expect(0); + }); + + test('can update a host set and save changes', async function (assert) { + assert.expect(0); + }); + + test('can update a host set and cancel changes', async function (assert) { + assert.expect(0); + }); + + test('errors are displayed when save on auth method fails', async function (assert) { + assert.expect(0); + }); + + test('errors are displayed when delete on a host set fails', async function (assert) { + assert.expect(0); + }); + + test('saving an existing auth method with invalid fields displays error messages', async function (assert) { + assert.expect(0); + }); });