initiate custom filter properly

chnage check to initialize isSearch variable (browse menu)
This commit is contained in:
argirok 2024-01-11 17:11:30 +02:00
parent 5e47e4c237
commit 0ef14ca586
3 changed files with 10 additions and 6 deletions

View File

@ -121,7 +121,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
private configurationService: ConfigurationService) {
super();
super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search');
this.isSearch = event.url.includes('/search');
});
}
@ -131,10 +131,10 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
this.description = 'Repository Monitors';
this.setMetadata();
this.params.subscribe(params => {
this._customFilterService.setCustomFilter(null);
this.alias = params['stakeholder'];
if (this.alias) {
if(this.stakeholder?.alias !== this.alias) {
this._customFilterService.setCustomFilter(null);
this.loading = true;
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder;
@ -160,6 +160,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
}
} else {
this.stakeholder = null;
this._customFilterService.setCustomFilter(null);
}
});
}

View File

@ -85,7 +85,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
private configurationService: ConfigurationService) {
super();
super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search');
this.isSearch = event.url.includes('/search');
});
}
@ -96,11 +96,11 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
this.description = 'RFOs';
this.setMetadata();
this.params.subscribe(params => {
this._customFilterService.setCustomFilter(null);
this.alias = params['stakeholder'];
if (this.alias) {
if(this.stakeholder?.alias !== this.alias) {
this.loading = true;
this._customFilterService.setCustomFilter(null);
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder;
if (this.stakeholder && this.stakeholder.type === 'funder') {
@ -120,6 +120,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
}
} else {
this.stakeholder = null;
this._customFilterService.setCustomFilter(null);
}
});
}

View File

@ -85,7 +85,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
private configurationService: ConfigurationService) {
super();
super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search');
this.isSearch = event.url.includes('/search');
});
}
@ -96,11 +96,11 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
this.description = 'RPOs';
this.setMetadata();
this.params.subscribe(params => {
this._customFilterService.setCustomFilter(null);
this.alias = params['stakeholder'];
if (this.alias) {
if(this.stakeholder?.alias !== this.alias) {
this.loading = true;
this._customFilterService.setCustomFilter(null);
this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder;
if (this.stakeholder && this.stakeholder.type === 'organization') {
@ -120,6 +120,8 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
}
} else {
this.stakeholder = null;
this._customFilterService.setCustomFilter(null);
}
});
}