feat: Delete host set association in a target
This commit is contained in:
2 files changed
+32
No files matched your search
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,16 @@
|
||||
<row.cell>
|
||||
<code>{{hostSet.model.id}}</code>
|
||||
</row.cell>
|
||||
<row.cell>
|
||||
<Rose::Dropdown @icon="more-horizontal" @iconOnly={{true}} @dropdownRight={{true}} as |dropdown|>
|
||||
<dropdown.button
|
||||
@style="danger"
|
||||
{{on "click" (route-action "delete" @model hostSet.model)}}
|
||||
>
|
||||
{{t "actions.delete"}}
|
||||
</dropdown.button>
|
||||
</Rose::Dropdown>
|
||||
</row.cell>
|
||||
</body.row>
|
||||
{{/each}}
|
||||
</table.body>
|
||||
|
||||
Reference in new issue
Block a user