feat: 🎸 apply confirm dialog to remove actions

This commit is contained in:
Randall Morey committed 2020-09-30 18:50:12 -04:00
1 parent fa34a292ca
commit c3c3f25ea7
4 files changed
+9 -1

No files matched your search

@@ -3,6 +3,7 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { hash, all } from 'rsvp';
import loading from 'ember-loading/decorator';
import { confirm } from '../../../../../utilities/confirm';
export default class ScopesScopeGroupsGroupMembersRoute extends Route {
// =services
@@ -38,10 +39,11 @@ export default class ScopesScopeGroupsGroupMembersRoute extends Route {
*/
@action
@loading
@confirm('questions.remove-confirm')
async removeMember(group, member) {
try {
await group.removeMember(member.id);
await this.refresh();
this.refresh();
this.notify.success(this.intl.t('notifications.remove-success'));
} catch (error) {
// TODO: replace with translated strings
@@ -3,6 +3,7 @@ import { hash, all } from 'rsvp';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import loading from 'ember-loading/decorator';
import { confirm } from '../../../../../../../../../utilities/confirm';
export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route {
// =services
@@ -37,6 +38,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo
*/
@action
@loading
@confirm('questions.remove-confirm')
async removeHost(hostSet, host) {
try {
const scopeID = this.modelFor('scopes.scope.projects.project').id;
@@ -3,6 +3,7 @@ import { all, hash } from 'rsvp';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import loading from 'ember-loading/decorator';
import { confirm } from '../../../../../../../utilities/confirm';
export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extends Route {
// =services
@@ -55,6 +56,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend
*/
@action
@loading
@confirm('questions.remove-confirm')
async removeHostSet(target, hostSet) {
try {
await target.removeHostSet(hostSet.id);
@@ -3,6 +3,7 @@ import { all, hash } from 'rsvp';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import loading from 'ember-loading/decorator';
import { confirm } from '../../../../../utilities/confirm';
export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
// =services
@@ -65,6 +66,7 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
*/
@action
@loading
@confirm('questions.remove-confirm')
async removePrincipal(principal) {
try {
const role = this.modelFor('scopes.scope.roles.role');