TSK-651 - [UI] Add spinner when domain is changed
This commit is contained in:
parent
20fa83f3c9
commit
55c7453034
|
@ -72,4 +72,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showNavbar" class="navbar-backdrop" (click)="toogleNavBar()"></div>
|
<div *ngIf="showNavbar" class="navbar-backdrop" (click)="toogleNavBar()"></div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable , BehaviorSubject , ReplaySubject } from 'rxjs';
|
import { Observable, ReplaySubject } from 'rxjs';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { RequestInProgressService } from '../requestInProgress/request-in-progress.service';
|
import { RequestInProgressService } from '../requestInProgress/request-in-progress.service';
|
||||||
|
@ -13,7 +13,7 @@ export class DomainService {
|
||||||
|
|
||||||
private domainRestValue: Array<string> = new Array<string>();
|
private domainRestValue: Array<string> = new Array<string>();
|
||||||
private domainValue: Array<string> = new Array<string>();
|
private domainValue: Array<string> = new Array<string>();
|
||||||
private domainSelectedValue;
|
private domainSelectedValue: string;
|
||||||
private domainSelected = new ReplaySubject<string>(1);
|
private domainSelected = new ReplaySubject<string>(1);
|
||||||
private dataObs$ = new ReplaySubject<Array<string>>(1);
|
private dataObs$ = new ReplaySubject<Array<string>>(1);
|
||||||
private hasMasterDomain = false;
|
private hasMasterDomain = false;
|
||||||
|
@ -64,18 +64,16 @@ export class DomainService {
|
||||||
return this.domainSelected.asObservable();
|
return this.domainSelected.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
selectDomain(value: string) {
|
|
||||||
// this.requestInProgressService.setRequestInProgress(true);
|
|
||||||
this.domainSelectedValue = value;
|
|
||||||
this.domainSelected.next(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
switchDomain(value: string) {
|
switchDomain(value: string) {
|
||||||
|
this.requestInProgressService.setRequestInProgress(true);
|
||||||
this.selectDomain(value);
|
this.selectDomain(value);
|
||||||
this.router.navigate([this.getNavigationUrl()]);
|
this.router.navigate([this.getNavigationUrl()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
domainChangedComplete() {
|
/*
|
||||||
|
This function should be called after getSelectedDomain inner subscriptions have been finished
|
||||||
|
*/
|
||||||
|
domainChangedComplete() {
|
||||||
this.requestInProgressService.setRequestInProgress(false);
|
this.requestInProgressService.setRequestInProgress(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,13 +94,17 @@ export class DomainService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private selectDomain(value: string) {
|
||||||
|
this.domainSelectedValue = value;
|
||||||
|
this.domainSelected.next(value);
|
||||||
|
}
|
||||||
|
|
||||||
private addEmptyDomain(domains: Array<string>): Array<string> {
|
private addEmptyDomain(domains: Array<string>): Array<string> {
|
||||||
this.domainValue = Object.assign([], domains);
|
this.domainValue = Object.assign([], domains);
|
||||||
this.domainValue.push('');
|
this.domainValue.push('');
|
||||||
return this.domainValue;
|
return this.domainValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private getNavigationUrl(): string {
|
private getNavigationUrl(): string {
|
||||||
if (this.router.url.indexOf('workbaskets') !== -1) {
|
if (this.router.url.indexOf('workbaskets') !== -1) {
|
||||||
return 'administration/workbaskets';
|
return 'administration/workbaskets';
|
||||||
|
|
Loading…
Reference in New Issue