mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 5c18a4e7a4
			
		
	
	5c18a4e7a4
	
	
	
		
			
			* Update add-to-array and remove-from-array helpers * remove search-select-has-many, moved logic directly into mfa-login-enforcement-form (see #16470) * Replace add/remove object in MFA files - All MFA tests pass * Replace in PKI components (pki tests all passing) * Replace in core addon where applicable * glimmerize console service -- console tests pass * more replacements * update string-list, add comment to vertical-bar-chart * Refactor CSP Event service - only used one place (auth-form) so simplified that usage - glimmerize and refactor so that the tests work * small updates * more cleanup * Fix tests * Remove objectAt from console-helpers * Address PR comments * move commandIndex clearing back * Remove extra model set
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Copyright (c) HashiCorp, Inc.
 | |
|  * SPDX-License-Identifier: BUSL-1.1
 | |
|  */
 | |
| 
 | |
| import Component from '@glimmer/component';
 | |
| import { service } from '@ember/service';
 | |
| import { action } from '@ember/object';
 | |
| import { getOwner } from '@ember/application';
 | |
| import errorMessage from 'vault/utils/error-message';
 | |
| import { tracked } from '@glimmer/tracking';
 | |
| 
 | |
| /**
 | |
|  * @module Roles
 | |
|  * RolesPage component is a child component to show list of roles
 | |
|  *
 | |
|  * @param {array} roles - array of roles
 | |
|  * @param {boolean} promptConfig - whether or not to display config cta
 | |
|  * @param {array} pageFilter - array of filtered roles
 | |
|  * @param {array} breadcrumbs - breadcrumbs as an array of objects that contain label and route
 | |
|  */
 | |
| export default class RolesPageComponent extends Component {
 | |
|   @service flashMessages;
 | |
|   @tracked roleToDelete = null;
 | |
| 
 | |
|   get mountPoint() {
 | |
|     return getOwner(this).mountPoint;
 | |
|   }
 | |
| 
 | |
|   @action
 | |
|   async onDelete(model) {
 | |
|     try {
 | |
|       const message = `Successfully deleted role ${model.name}`;
 | |
|       await model.destroyRecord();
 | |
|       this.flashMessages.success(message);
 | |
|     } catch (error) {
 | |
|       const message = errorMessage(error, 'Error deleting role. Please try again or contact support');
 | |
|       this.flashMessages.danger(message);
 | |
|     } finally {
 | |
|       this.roleToDelete = null;
 | |
|     }
 | |
|   }
 | |
| }
 |