|
|
@@ -33,17 +33,17 @@ export class AdjusterService {
|
|
|
allowClusters = true;
|
|
|
/** Used in the UI as a selector */
|
|
|
allowIndex = false;
|
|
|
+ clusteringInProcess = false;
|
|
|
factors: Array<Factor> = [];
|
|
|
layersReady = new Set();
|
|
|
//clusters = [];
|
|
|
+ /** Once instantiated, the load is definitely in process */
|
|
|
+ loadInProcess = true;
|
|
|
//method: string;
|
|
|
methods: Array<MethodDescription>;
|
|
|
numberOfClusters: number;
|
|
|
- private _clusteringInProcess: boolean;
|
|
|
+ raiInProcess = false;
|
|
|
private _clustersLoaded: boolean;
|
|
|
- /** Once instantiated, the load is definitely in process */
|
|
|
- private _loadInProcess = true;
|
|
|
- private _raiInProcess: boolean;
|
|
|
|
|
|
constructor(
|
|
|
public adjusterEventService: AdjusterEventService,
|
|
|
@@ -152,7 +152,7 @@ export class AdjusterService {
|
|
|
}
|
|
|
|
|
|
async calculateIndex(): Promise<void> {
|
|
|
- this._raiInProcess = true;
|
|
|
+ this.raiInProcess = true;
|
|
|
let attractivenessData: any;
|
|
|
try {
|
|
|
attractivenessData = await this.httpClient
|
|
|
@@ -175,7 +175,7 @@ export class AdjusterService {
|
|
|
);
|
|
|
console.warn(`Error obtaining data from ${this.serviceBaseUrl}.`);
|
|
|
console.log(error);
|
|
|
- this._raiInProcess = false;
|
|
|
+ this.raiInProcess = false;
|
|
|
this.adjusterEventService.loaded.next({
|
|
|
success: true,
|
|
|
type: 'index',
|
|
|
@@ -208,7 +208,7 @@ export class AdjusterService {
|
|
|
codeRecordRelations
|
|
|
);
|
|
|
console.timeEnd('forEach-Index');
|
|
|
- this._raiInProcess = false;
|
|
|
+ this.raiInProcess = false;
|
|
|
this.adjusterEventService.loaded.next({
|
|
|
success: true,
|
|
|
type: 'index',
|
|
|
@@ -216,7 +216,7 @@ export class AdjusterService {
|
|
|
}
|
|
|
|
|
|
async calculateClusters(): Promise<void> {
|
|
|
- this._clusteringInProcess = true;
|
|
|
+ this.clusteringInProcess = true;
|
|
|
/* Pre-process the API params */
|
|
|
const params = [];
|
|
|
for (const factor of this.factors) {
|
|
|
@@ -247,7 +247,7 @@ export class AdjusterService {
|
|
|
);
|
|
|
console.warn(`Error obtaining data from ${this.serviceBaseUrl}.`);
|
|
|
console.log(error);
|
|
|
- this._clusteringInProcess = false;
|
|
|
+ this.clusteringInProcess = false;
|
|
|
this.adjusterEventService.loaded.next({
|
|
|
success: false,
|
|
|
type: 'clusters',
|
|
|
@@ -296,7 +296,7 @@ export class AdjusterService {
|
|
|
//nuts.nuts3ClustersSource.legend_categories =
|
|
|
// this.adjusterLegendService.createClusterLegend(this.numberOfClusters);
|
|
|
this._clustersLoaded = true;
|
|
|
- this._clusteringInProcess = false;
|
|
|
+ this.clusteringInProcess = false;
|
|
|
this.adjusterEventService.loaded.next({
|
|
|
success: true,
|
|
|
type: 'clusters',
|
|
|
@@ -327,9 +327,9 @@ export class AdjusterService {
|
|
|
);
|
|
|
console.warn(`Web service at ${this.serviceBaseUrl} unavailable!`);
|
|
|
console.log(error);
|
|
|
- this._loadInProcess = false;
|
|
|
+ this.loadInProcess = false;
|
|
|
}
|
|
|
- this._loadInProcess = false;
|
|
|
+ this.loadInProcess = false;
|
|
|
}
|
|
|
|
|
|
resetFactorWeights(factorId: string): number {
|
|
|
@@ -344,20 +344,6 @@ export class AdjusterService {
|
|
|
* @returns {boolean} true if clustering or index processing is in process or loading data, false otherwise
|
|
|
*/
|
|
|
isInProcess(): boolean {
|
|
|
- return (
|
|
|
- this._loadInProcess || this._clusteringInProcess || this._raiInProcess
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- isLoading(): boolean {
|
|
|
- return this._loadInProcess;
|
|
|
- }
|
|
|
-
|
|
|
- isClustering(): boolean {
|
|
|
- return this._clusteringInProcess;
|
|
|
- }
|
|
|
-
|
|
|
- isCalculatingRAI(): boolean {
|
|
|
- return this._raiInProcess;
|
|
|
+ return this.loadInProcess || this.clusteringInProcess || this.raiInProcess;
|
|
|
}
|
|
|
}
|