diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js b/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js index 34418acea..79547405a 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js +++ b/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js @@ -1,7 +1,15 @@ import Route from '@ember/routing/route'; import { all, hash } from 'rsvp'; +import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; + export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extends Route { + // =services + + @service intl; + @service notify; + // =methods /** @@ -40,4 +48,18 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend model() { return this.modelFor('scopes.scope.projects.project.targets.target'); } + + // =actions + @action + async delete(target, hostSet) { + try { + await target.deleteHostSets(hostSet); + this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); + this.transitionTo('scopes.scope.projects.project.targets.target.host-sets'); + } catch (error) { + // TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } } diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs index 3effb2b0d..c50bb079d 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs @@ -23,6 +23,16 @@ {{hostSet.model.id}} + + + + {{t "actions.delete"}} + + + {{/each}}