38 lines
896 B
TypeScript
38 lines
896 B
TypeScript
/** @file
|
|
* @author Edouard DUPIN
|
|
* @copyright 2018, Edouard DUPIN, all right reserved
|
|
* @license PROPRIETARY (see license file)
|
|
*/
|
|
import { Component, Input } from '@angular/core';
|
|
|
|
export enum AsyncActionState {
|
|
IDLE = "idle",
|
|
LOADING = "loading",
|
|
DONE = "done",
|
|
FAIL = "fail",
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-async-status-component',
|
|
templateUrl: 'async-status-component.html',
|
|
styleUrls: ['async-status-component.less'],
|
|
})
|
|
export class AsyncActionStatusComponent {
|
|
/// Value of the password
|
|
@Input() value: AsyncActionState = AsyncActionState.IDLE;
|
|
|
|
public getImage(): string {
|
|
switch(this.value) {
|
|
case AsyncActionState.IDLE:
|
|
return '';
|
|
case AsyncActionState.LOADING:
|
|
return 'assets/images/load.svg';
|
|
case AsyncActionState.DONE:
|
|
return 'assets/images/validate.svg';
|
|
case AsyncActionState.FAIL:
|
|
return 'assets/images/validate-not.svg';
|
|
|
|
}
|
|
}
|
|
}
|