Icu 13880 create manage scopes route and view with keyword values (#2342)
* feat: 🎸 manage scopes route and page ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13880 * Update addons/core/translations/resources/en-us.yaml Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * Update ui/admin/app/abilities/role.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * Update ui/admin/app/components/form/role/manage-scopes/index.hbs Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
This commit is contained in:
1 parent
85bce84356
commit
89e072401c
18 files changed
+536
-16
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { loading } from 'ember-loading';
|
||||
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
|
||||
export default class ScopesScopeRolesRoleManageScopesController extends Controller {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
|
||||
// =actions
|
||||
|
||||
/**
|
||||
* Save grant scope IDs to current role via the API.
|
||||
* @param {RoleModel} role
|
||||
* @param {[string]} grantScopeIDs
|
||||
*/
|
||||
@action
|
||||
@loading
|
||||
@notifyError(({ message }) => message, { catch: true })
|
||||
@notifySuccess('notifications.add-success')
|
||||
async setGrantScopes(role, grantScopeIDs) {
|
||||
await role.setGrantScopes(grantScopeIDs);
|
||||
this.router.replaceWith('scopes.scope.roles.role.scopes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to role scopes as if nothing ever happened.
|
||||
*/
|
||||
@action
|
||||
async cancel() {
|
||||
await this.router.replaceWith('scopes.scope.roles.role.scopes');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user