diff options
author | Ittay Stern <ittay.stern@att.com> | 2018-08-29 17:01:32 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-02-18 18:35:30 +0200 |
commit | 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch) | |
tree | 936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts | |
parent | 67d99f816cc583643c35193197594cf78d8ce60a (diff) |
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts index 0ce5d2074..94a0e1c52 100644 --- a/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts +++ b/vid-webpack-master/src/app/shared/components/spinner/spinner.component.ts @@ -1,18 +1,50 @@ -import { Component, Input } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; +import {Component} from '@angular/core'; +import {Subject} from 'rxjs/Subject'; +import * as _ from 'lodash'; @Component({ selector : 'spinner-component', - templateUrl : './spinner.component.html', - styleUrls : ['./spinner.component.scss'] + templateUrl: './spinner.component.html', + styleUrls : ['./spinner.component.scss'], + providers : [] + }) -export class SpinnerComponent { - show : boolean = false; - static showSpinner: Subject<boolean> = new Subject<boolean>(); +export class SpinnerComponent{ + show : boolean; + size = "large"; + global = true; + + requestMap = {}; + + static showSpinner: Subject<SpinnerInfo> = new Subject<SpinnerInfo>(); constructor(){ - SpinnerComponent.showSpinner.subscribe((status) => { - this.show = status; + SpinnerComponent.showSpinner.subscribe((spinnerInfo) => { + let status = spinnerInfo['status']; + let requestType = spinnerInfo['requestType']; + let requestUrl = spinnerInfo['requestUrl']; + + if(status && requestType === 'json'){ + this.requestMap[requestUrl] = true; + }else { + delete this.requestMap[requestUrl] + } + console.log(this.requestMap); + this.show = !_.isEmpty(this.requestMap) && this.requestMap !== undefined; + }) } } + + +export class SpinnerInfo { + status : boolean; + requestUrl : string; + requestType : string; + + constructor(status : boolean, requestUrl : string, requestType : string){ + this.status = status; + this.requestUrl = requestUrl; + this.requestType = requestType; + } +} |