Fix a bug while getting numbers of previous active subcategory. Fix sidebar in topics

This commit is contained in:
Konstantinos Triantafyllou 2023-01-27 15:58:21 +02:00
parent bf97a1ff2a
commit 74934c1a8b
4 changed files with 22 additions and 21 deletions

View File

@ -483,24 +483,27 @@ export class MonitorComponent implements OnInit, OnDestroy {
}); });
urls.forEach((indexes, pair) => { urls.forEach((indexes, pair) => {
pair = JSON.parse(pair); pair = JSON.parse(pair);
let activeSubcategory = this.activeSubCategory._id;
this.subscriptions.push(this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => { this.subscriptions.push(this.statisticsService.getNumbers(this.statisticsService.getSourceType(pair[0]), pair[1]).subscribe(response => {
indexes.forEach(([i, j]) => { if(activeSubcategory === this.activeSubCategory._id) {
let result = JSON.parse(JSON.stringify(response)); indexes.forEach(([i, j]) => {
this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => { let result = JSON.parse(JSON.stringify(response));
if (result) { this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
result = result[jsonPath]; if (result) {
} result = result[jsonPath];
}); }
if (typeof result === 'string' || typeof result === 'number') { });
result = Number(result); if (typeof result === 'string' || typeof result === 'number') {
if (result === Number.NaN) { result = Number(result);
if (result === Number.NaN) {
result = 0;
}
} else {
result = 0; result = 0;
} }
} else { this.numberResults.set(i + '-' + j, result);
result = 0; });
} }
this.numberResults.set(i + '-' + j, result);
});
})); }));
}); });
this.activeSubCategory.charts.forEach((section, i) => { this.activeSubCategory.charts.forEach((section, i) => {

@ -1 +1 @@
Subproject commit 3acd9a6c29cd54699f27ea58fd9664e07526d589 Subproject commit 5454509b55e817b9320a128920d03cb75b5ac44d

View File

@ -14,8 +14,7 @@
<ul class="uk-list uk-nav uk-nav-default uk-nav-parent-icon" transition-group [id]="'topics'" uk-nav="duration: 400"> <ul class="uk-list uk-nav uk-nav-default uk-nav-parent-icon" transition-group [id]="'topics'" uk-nav="duration: 400">
<li *ngFor="let topic of stakeholder.topics; let i=index" class="uk-parent" [class.uk-active]="topicIndex === i" transition-group-item> <li *ngFor="let topic of stakeholder.topics; let i=index" class="uk-parent" [class.uk-active]="topicIndex === i" transition-group-item>
<a [routerLink]="'/admin/'+stakeholder.alias + '/indicators/' + topic.alias" <a [routerLink]="'/admin/'+stakeholder.alias + '/indicators/' + topic.alias"
[title]="topic.name" class="uk-visible-toggle"> [title]="topic.name" class="uk-visible-toggle uk-flex uk-flex-middle">
<span class="uk-flex uk-flex-middle">
<div *ngIf="topic.icon" class="uk-width-auto"> <div *ngIf="topic.icon" class="uk-width-auto">
<icon class="menu-icon" [svg]="topic.icon" ratio="0.9" [flex]="true"></icon> <icon class="menu-icon" [svg]="topic.icon" ratio="0.9" [flex]="true"></icon>
</div> </div>
@ -90,7 +89,6 @@
</ul> </ul>
</div> </div>
</span> </span>
</span>
</a> </a>
<ul *ngIf="isBrowser || topicIndex === i" class="uk-nav-sub" [id]="'categories-' + i.toString()" transition-group> <ul *ngIf="isBrowser || topicIndex === i" class="uk-nav-sub" [id]="'categories-' + i.toString()" transition-group>
<li *ngFor="let category of topic.categories; let j=index" transition-group-item class="uk-visible-toggle" [class.uk-active]="categoryIndex == j"> <li *ngFor="let category of topic.categories; let j=index" transition-group-item class="uk-visible-toggle" [class.uk-active]="categoryIndex == j">
@ -173,7 +171,7 @@
</li> </li>
<li *ngIf="isCurator" class="hide-on-close"> <li *ngIf="isCurator" class="hide-on-close">
<a (click)="editTopicOpen(-1); $event.preventDefault()"> <a (click)="editTopicOpen(-1); $event.preventDefault()">
<div class="uk-flex uk-flex-middle uk-flex-center"> <div class="uk-flex uk-flex-middle">
<div class="uk-width-auto"> <div class="uk-width-auto">
<icon class="menu-icon" name="add" [flex]="true"></icon> <icon class="menu-icon" name="add" [flex]="true"></icon>
</div> </div>

@ -1 +1 @@
Subproject commit 99ecab0b4e9ceed21424c8fa26ef270b4695b11e Subproject commit 78c51f00f766b53cd516eac381e676f0be9ad20f