chore: Save and delete host-set with host-catalog adapteropts
This commit is contained in:
4 files changed
+43
-7
No files matched your search
+13
-4
@@ -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 } };
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
modelName: 'host-set'
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user