mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	![hashicorp-copywrite[bot]](/assets/img/avatar_default.png) 0b12cdcfd1
			
		
	
	0b12cdcfd1
	
	
	
		
			
			* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
		
			
				
	
	
		
			69 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Copyright (c) HashiCorp, Inc.
 | |
|  * SPDX-License-Identifier: BUSL-1.1
 | |
|  */
 | |
| 
 | |
| import Component from '@glimmer/component';
 | |
| import { action } from '@ember/object';
 | |
| import { later } from '@ember/runloop';
 | |
| import { tracked } from '@glimmer/tracking';
 | |
| import { messageTypes } from 'core/helpers/message-types';
 | |
| 
 | |
| /**
 | |
|  * @module AlertInline
 | |
|  * `AlertInline` components are used to inform users of important messages.
 | |
|  *
 | |
|  * @example
 | |
|  * ```js
 | |
|  * <AlertInline @type="danger" @message="{{model.keyId}} is not a valid lease ID"/>
 | |
|  * ```
 | |
|  *
 | |
|  * @param {string} type=null - The alert type passed to the message-types helper.
 | |
|  * @param {string} [message=null] - The message to display within the alert.
 | |
|  * @param {boolean} [paddingTop=false] - Whether or not to add padding above component.
 | |
|  * @param {boolean} [isMarginless=false] - Whether or not to remove margin bottom below component.
 | |
|  * @param {boolean} [sizeSmall=false] - Whether or not to display a small font with padding below of alert message.
 | |
|  * @param {boolean} [mimicRefresh=false] - If true will display a loading icon when attributes change (e.g. when a form submits and the alert message changes).
 | |
|  */
 | |
| 
 | |
| export default class AlertInlineComponent extends Component {
 | |
|   @tracked isRefreshing = false;
 | |
| 
 | |
|   get mimicRefresh() {
 | |
|     return this.args.mimicRefresh || false;
 | |
|   }
 | |
| 
 | |
|   get paddingTop() {
 | |
|     return this.args.paddingTop ? ' padding-top' : '';
 | |
|   }
 | |
| 
 | |
|   get isMarginless() {
 | |
|     return this.args.isMarginless ? ' is-marginless' : '';
 | |
|   }
 | |
| 
 | |
|   get sizeSmall() {
 | |
|     return this.args.sizeSmall ? ' size-small' : '';
 | |
|   }
 | |
| 
 | |
|   get textClass() {
 | |
|     if (this.args.type === 'danger') {
 | |
|       return this.alertType.glyphClass;
 | |
|     }
 | |
|     return null;
 | |
|   }
 | |
| 
 | |
|   get alertType() {
 | |
|     return messageTypes([this.args.type]);
 | |
|   }
 | |
| 
 | |
|   @action
 | |
|   refresh() {
 | |
|     if (this.mimicRefresh) {
 | |
|       this.isRefreshing = true;
 | |
|       later(() => {
 | |
|         this.isRefreshing = false;
 | |
|       }, 200);
 | |
|     }
 | |
|   }
 | |
| }
 |