|
|
@@ -4,7 +4,6 @@ import {Injectable} from '@angular/core';
|
|
|
import {HsLayerManagerService} from 'hslayers-ng/components/layermanager';
|
|
|
import {HsUtilsService} from 'hslayers-ng/components/utils/utils.service';
|
|
|
|
|
|
-// import attractivity from '../Attractivity.json';
|
|
|
import {obce, osmLayer} from '../app.config';
|
|
|
|
|
|
@Injectable({providedIn: 'root'})
|
|
|
@@ -13,6 +12,8 @@ export class AdjusterService {
|
|
|
//nutsCodeRecordRelations = {};
|
|
|
//attractivity;
|
|
|
factors: any = [];
|
|
|
+ private _clusteringInProcess: boolean;
|
|
|
+ private _raiInProcess: boolean;
|
|
|
|
|
|
constructor(
|
|
|
public hsLayerManagerService: HsLayerManagerService,
|
|
|
@@ -23,6 +24,8 @@ export class AdjusterService {
|
|
|
window.location.hostname === 'localhost'
|
|
|
? 'https://jmacura.ml/ws/' // 'http://localhost:3000/'
|
|
|
: 'https://publish.lesprojekt.cz/nodejs/';
|
|
|
+ this._raiInProcess = false;
|
|
|
+ this._clusteringInProcess = false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -31,6 +34,7 @@ export class AdjusterService {
|
|
|
*/
|
|
|
apply(): void {
|
|
|
const f = () => {
|
|
|
+ this._raiInProcess = true;
|
|
|
this.$http
|
|
|
.post(this.serviceBaseUrl + 'scores/cz', {
|
|
|
factors: this.factors.map((f) => {
|
|
|
@@ -116,16 +120,19 @@ export class AdjusterService {
|
|
|
});*/
|
|
|
});
|
|
|
console.timeEnd('forEachObce');
|
|
|
+ this._raiInProcess = false;
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.warn(`Error obtaining data from ${this.serviceBaseUrl}.`);
|
|
|
console.log(error);
|
|
|
+ this._raiInProcess = false;
|
|
|
});
|
|
|
};
|
|
|
this.hsUtilsService.debounce(f, 300, false, this)();
|
|
|
}
|
|
|
|
|
|
init(): void {
|
|
|
+ this._raiInProcess = true;
|
|
|
this.$http
|
|
|
.get(this.serviceBaseUrl + 'datasets/cz')
|
|
|
.toPromise()
|
|
|
@@ -143,6 +150,7 @@ export class AdjusterService {
|
|
|
.map((ds) => {
|
|
|
return {
|
|
|
name: ds.Name,
|
|
|
+ desc: ds.Description,
|
|
|
included: true,
|
|
|
};
|
|
|
});
|
|
|
@@ -153,6 +161,14 @@ export class AdjusterService {
|
|
|
.catch((error) => {
|
|
|
console.warn(`Web service at ${this.serviceBaseUrl} unavailable!`);
|
|
|
console.log(error);
|
|
|
+ this._raiInProcess = false;
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @returns {boolean} true if clustering or index processing is in process, false otherwise
|
|
|
+ */
|
|
|
+ isInProcess(): boolean {
|
|
|
+ return this._clusteringInProcess || this._raiInProcess;
|
|
|
+ }
|
|
|
}
|