Merge pull request #183 from hashicorp/ICU-580-delete-an-account

Delete an account
This commit is contained in:
Randall Morey authored and GitHub committed 2020-09-16 10:07:52 -04:00
commit 3c9c75377c
4 files changed
+28 -1

No files matched your search

@@ -50,4 +50,21 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
this.notify.error(error.message, { closeAfter: null });
}
}
/**
* Delete an account in current scope and redirect to index
* @param {AccountModel} account
*/
@action
async delete(account) {
try {
await account.destroyRecord();
await this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
this.refresh();
this.notify.success(this.intl.t('notify.delete-success'));
} catch (error) {
//TODO: replace with translated strings
this.notify.error(error.message, { closeAfter: null });
}
}
}
@@ -26,7 +26,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountRoute extend
outlet: 'header'
});
this.render('-empty', {
this.render('scopes/scope/auth-methods/auth-method/accounts/account/-actions', {
into: 'scopes/scope/auth-methods/auth-method',
outlet: 'actions'
});
@@ -0,0 +1,9 @@
<Rose::Dropdown @text="{{t 'actions.manage'}}" @dropdownRight={{true}} as |dropdown|>
<dropdown.button
@style="danger"
@disabled={{@model.canSave}}
{{on "click" (route-action "delete" @model)}}
>
{{t 'actions.delete-account'}}
</dropdown.button>
</Rose::Dropdown>
+1
View File
@@ -21,6 +21,7 @@ actions:
delete-host-set: Delete host set
delete-host: Delete host
delete-target: Delete target
delete-account: Delete account
add-host-set: Create Host Set
add-host: Create Host
add-host-sets: Add Host Sets