mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 1fbbf9d76b
			
		
	
	1fbbf9d76b
	
	
	
		
			
			* rename store to pagination, remove store extension * initial update of service test * remove superfluous helper * replace store with pagination service in main app * update kmip engine syntax * add pagination to kmip engine * update to pagination in config-ui engine * update sync engine to use pagination service * use pagination service in kv engine * use pagination service in ldap engine * use pagination in pki engine * update renaming clearDataset functions * link to jira VAULT-31721 * remove comment
		
			
				
	
	
		
			35 lines
		
	
	
		
			1012 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1012 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Copyright (c) HashiCorp, Inc.
 | |
|  * SPDX-License-Identifier: BUSL-1.1
 | |
|  */
 | |
| 
 | |
| import Mixin from '@ember/object/mixin';
 | |
| import removeRecord from 'vault/utils/remove-record';
 | |
| import { service } from '@ember/service';
 | |
| 
 | |
| // removes Ember Data records from the cache when the model
 | |
| // changes or you move away from the current route
 | |
| export default Mixin.create({
 | |
|   store: service(),
 | |
|   modelPath: 'model',
 | |
|   unloadModel() {
 | |
|     const { modelPath } = this;
 | |
|     /* eslint-disable-next-line ember/no-controller-access-in-routes */
 | |
|     const model = this.controller.get(modelPath);
 | |
|     // error is thrown when you attempt to unload a record that is inFlight (isSaving)
 | |
|     if (!model || !model.unloadRecord || model.isSaving) {
 | |
|       return;
 | |
|     }
 | |
|     removeRecord(this.store, model);
 | |
|     // it's important to unset the model on the controller since controllers are singletons
 | |
|     this.controller.set(modelPath, null);
 | |
|   },
 | |
| 
 | |
|   actions: {
 | |
|     willTransition() {
 | |
|       this.unloadModel();
 | |
|       return true;
 | |
|     },
 | |
|   },
 | |
| });
 |