Skip to content

Commit

Permalink
[DSC-499] Fix issue with improper scope when switching mydspace view …
Browse files Browse the repository at this point in the history
…mode
  • Loading branch information
atarix83 committed Mar 2, 2022
1 parent 2c6a16a commit 1c8bba5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ds-search-switch-configuration *ngIf="configurationList"
[configurationList]="configurationList"
[defaultConfiguration]="configuration"
[defaultScope]="currentScope"
[inPlaceSearch]="inPlaceSearch"
(changeConfiguration)="changeConfiguration.emit($event)"></ds-search-switch-configuration>
<ds-search-filters [currentScope]="currentScope"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export class SearchSwitchConfigurationComponent implements OnDestroy, OnInit {
*/
@Input() defaultConfiguration: string;

/**
* The default scope to use if no defined
*/
@Input() defaultScope: string;

/**
* The current scope
*/
Expand Down Expand Up @@ -64,7 +69,7 @@ export class SearchSwitchConfigurationComponent implements OnDestroy, OnInit {
* Init current configuration
*/
ngOnInit() {
this.searchConfigService.getCurrentScope(this.defaultConfiguration)
this.searchConfigService.getCurrentScope(this.defaultScope)
.subscribe((currentScope) => this.currentScope = currentScope);

this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration)
Expand All @@ -81,9 +86,13 @@ export class SearchSwitchConfigurationComponent implements OnDestroy, OnInit {
const navigationExtras: NavigationExtras = {
queryParams: {
configuration: this.selectedOption.value,
scope: this.currentScope
},
};
if (this.currentScope) {
navigationExtras.queryParams = Object.assign(navigationExtras.queryParams, {
scope: this.currentScope
});
}

this.changeConfiguration.emit(this.selectedOption);
this.router.navigate(this.getSearchLinkParts(), navigationExtras);
Expand Down

0 comments on commit 1c8bba5

Please sign in to comment.