add delay to in memory service and update check interval
This commit is contained in:
parent
82f5706350
commit
37f2f2cdf6
|
@ -47,7 +47,7 @@ import { DonutChartComponent } from './donut-chart/donut-chart.component';
|
||||||
cookieName: 'CSRF-Token-' + deviceID(),
|
cookieName: 'CSRF-Token-' + deviceID(),
|
||||||
}),
|
}),
|
||||||
environment.production ?
|
environment.production ?
|
||||||
[] : HttpClientInMemoryWebApiModule.forRoot(InMemoryConfigDataService),
|
[] : HttpClientInMemoryWebApiModule.forRoot(InMemoryConfigDataService, { delay: 200 }),
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
FlexLayoutModule
|
FlexLayoutModule
|
||||||
],
|
],
|
||||||
|
|
|
@ -19,7 +19,6 @@ export class DonutChartComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
console.log("elementID?", this.elementID)
|
|
||||||
this.canvas = document.getElementById(this.elementID);
|
this.canvas = document.getElementById(this.elementID);
|
||||||
this.ctx = this.canvas.getContext('2d');
|
this.ctx = this.canvas.getContext('2d');
|
||||||
const myChart = new Chart(this.ctx, {
|
const myChart = new Chart(this.ctx, {
|
||||||
|
|
|
@ -109,7 +109,6 @@ export class InMemoryConfigDataService {
|
||||||
"ignoredDevices": [],
|
"ignoredDevices": [],
|
||||||
"ignoredFolders": []
|
"ignoredFolders": []
|
||||||
}
|
}
|
||||||
console.log("in mem?!?!?", config)
|
|
||||||
return { config };
|
return { config };
|
||||||
}
|
}
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
|
@ -17,7 +17,6 @@ export class StatusListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggle(s: Status) {
|
onToggle(s: Status) {
|
||||||
console.log("holy moly", s);
|
|
||||||
this.currentStatus = s;
|
this.currentStatus = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ export class SystemConfigService {
|
||||||
private systemConfigUrl = environment.production ? apiURL + 'rest/system/config' : 'api/config';
|
private systemConfigUrl = environment.production ? apiURL + 'rest/system/config' : 'api/config';
|
||||||
private httpOptions;
|
private httpOptions;
|
||||||
|
|
||||||
private checkInterval: number = 500;
|
private checkInterval: number = 100;
|
||||||
|
|
||||||
constructor(private http: HttpClient, private cookieService: CookieService) {
|
constructor(private http: HttpClient, private cookieService: CookieService) {
|
||||||
this.httpOptions = { headers: new HttpHeaders(this.cookieService.getCSRFHeader()) };
|
this.httpOptions = { headers: new HttpHeaders(this.cookieService.getCSRFHeader()) };
|
||||||
|
@ -53,9 +53,10 @@ export class SystemConfigService {
|
||||||
} else {
|
} else {
|
||||||
// create timer to keep checking for folders
|
// create timer to keep checking for folders
|
||||||
let t = setInterval(() => {
|
let t = setInterval(() => {
|
||||||
if (check(this.folders))
|
if (this.folders) {
|
||||||
clearInterval(t);
|
clearInterval(t);
|
||||||
observer.next(this.folders);
|
observer.next(this.folders);
|
||||||
|
}
|
||||||
}, this.checkInterval);
|
}, this.checkInterval);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -68,7 +69,7 @@ export class SystemConfigService {
|
||||||
observer.next(this.devices);
|
observer.next(this.devices);
|
||||||
} else {
|
} else {
|
||||||
let t = setInterval(() => {
|
let t = setInterval(() => {
|
||||||
if (check(this.devices)) {
|
if (this.devices) {
|
||||||
clearInterval(t);
|
clearInterval(t);
|
||||||
observer.next(this.devices);
|
observer.next(this.devices);
|
||||||
}
|
}
|
||||||
|
@ -78,10 +79,3 @@ export class SystemConfigService {
|
||||||
return deviceObserverable;
|
return deviceObserverable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const check = (target: any): Boolean => {
|
|
||||||
if (target) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
Loading…
Reference in New Issue