mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 49b46ead82
			
		
	
	49b46ead82
	
	
	
		
			
			* add capabilities service to replication engine * fix capabilities paths in route file * pass updated capabilities using getters * add changelog * fix logic so default is based on undefined capabilities (not no mode)
		
			
				
	
	
		
			32 lines
		
	
	
		
			942 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			942 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Copyright (c) HashiCorp, Inc.
 | |
|  * SPDX-License-Identifier: BUSL-1.1
 | |
|  */
 | |
| 
 | |
| import ReplicationModeBaseController from './replication-mode';
 | |
| import { tracked } from '@glimmer/tracking';
 | |
| 
 | |
| export default class ReplicationIndexController extends ReplicationModeBaseController {
 | |
|   @tracked modeSelection = 'dr';
 | |
| 
 | |
|   getPerm(type) {
 | |
|     if (this.modeSelection === 'dr') {
 | |
|       // returns canEnablePrimaryDr or canEnableSecondaryDr
 | |
|       return `canEnable${type}Dr`;
 | |
|     }
 | |
|     if (this.modeSelection === 'performance') {
 | |
|       // returns canEnablePrimaryPerformance or canEnableSecondaryPerformance
 | |
|       return `canEnable${type}Performance`;
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   // if there's a problem checking capabilities, default to true
 | |
|   // since the backend will gate as a fallback
 | |
|   get canEnablePrimary() {
 | |
|     return this.model[this.getPerm('Primary')] ?? true;
 | |
|   }
 | |
|   get canEnableSecondary() {
 | |
|     return this.model[this.getPerm('Secondary')] ?? true;
 | |
|   }
 | |
| }
 |