Skip to content

Commit e17133f

Browse files
committed
resolve for dataselection profiles
1 parent fefc4ce commit e17133f

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

src/app/modules/data-selection/components/search/search.component.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { TreeNode } from 'src/app/shared/models/TreeNode/TreeNodeInterface';
2222
import { DataSelectionProfile } from 'src/app/model/DataSelection/Profile/DataSelectionProfile';
2323
import { DataSelectionProviderService } from '../../services/DataSelectionProvider.service';
2424
import { NavigationHelperService } from 'src/app/service/NavigationHelper.service';
25+
import { ActivatedRoute } from '@angular/router';
2526

2627
@Component({
2728
selector: 'num-search-data-selection',
@@ -55,7 +56,8 @@ export class SearchDataSelectionComponent implements OnInit, AfterViewInit, OnDe
5556
private dataSelectionProviderService: DataSelectionProviderService,
5657
private activeDataSelectionService: ActiveDataSelectionService,
5758
private selectedDataSelectionProfileService: SelectedDataSelectionProfileService,
58-
private navigationHelperService: NavigationHelperService
59+
private navigationHelperService: NavigationHelperService,
60+
private activeRoute: ActivatedRoute
5961
) {}
6062

6163
ngOnInit(): void {
@@ -66,13 +68,9 @@ export class SearchDataSelectionComponent implements OnInit, AfterViewInit, OnDe
6668
this.selectedDataSelectionProfileService.getSelectedProfiles();
6769

6870
this.handleSelectedItemsSubscription();
69-
this.dataSelectionProfileTreeSubscription = this.dataSelectionProfileTreeService
70-
.fetchProfileTree()
71-
.subscribe((tree) => {
72-
const treeNodes = tree.getTreeNode();
73-
const rootNode = DataSelectionTreeAdapter.fromTree(tree.getTreeNode());
74-
this.trees = rootNode;
75-
});
71+
const tree = this.activeRoute.snapshot.data.preLoadDataSelectionData;
72+
const rootNode = DataSelectionTreeAdapter.fromTree(tree.getTreeNode());
73+
this.trees = rootNode;
7674
}
7775

7876
/**

src/app/modules/data-selection/data-selection-routing.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
33
import { RouterModule, Routes } from '@angular/router';
44
import { SearchDataSelectionComponent } from './components/search/search.component';
55
import { PathSegments } from 'src/app/app-paths';
6+
import { DataSelectionProfileResolverService } from 'src/app/service/Resolver/DataSelectionProfileResolver.servcie';
67

78
const routes: Routes = [
89
{
@@ -14,6 +15,9 @@ const routes: Routes = [
1415
{
1516
path: PathSegments.search,
1617
component: SearchDataSelectionComponent,
18+
resolve: {
19+
preLoadDataSelectionData: DataSelectionProfileResolverService,
20+
},
1721
data: { animation: 'Data_Selection_Search', title: 'TAB_TITLE.DATA_SELECTION.SEARCH' },
1822
},
1923
{

src/app/service/Resolver/CriteriaSearchDataResolver.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Observable } from 'rxjs';
99
export class CriteriaSearchDataResolverService {
1010
constructor(private searchService: SearchService) {}
1111

12-
resolve(): Observable<SearchTermResultList> {
12+
public resolve(): Observable<SearchTermResultList> {
1313
return this.searchService.searchCriteria('');
1414
}
1515
}

src/app/service/Resolver/CriteriaSearchFilterResolver.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { SearchTermFilter } from 'src/app/model/ElasticSearch/ElasticSearchFilte
99
export class CriteriaSearchFilterResolverService {
1010
constructor(private searchFilterService: SearchFilterService) {}
1111

12-
resolve(): Observable<Array<SearchTermFilter>> {
12+
public resolve(): Observable<Array<SearchTermFilter>> {
1313
return this.searchFilterService.fetchFilters();
1414
}
1515
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { DataSelectionProfileTree } from 'src/app/model/DataSelection/ProfileTree/DataSelectionProfileTree';
2+
import { DataSelectionProfileTreeService } from '../DataSelection/CreateDataselectionProfileTree';
3+
import { Injectable } from '@angular/core';
4+
import { Observable } from 'rxjs';
5+
6+
@Injectable({
7+
providedIn: 'root',
8+
})
9+
export class DataSelectionProfileResolverService {
10+
constructor(private dataSelectionProfileTreeService: DataSelectionProfileTreeService) {}
11+
12+
public resolve(): Observable<DataSelectionProfileTree> {
13+
return this.dataSelectionProfileTreeService.fetchProfileTree();
14+
}
15+
}

src/app/shared/models/SearchFilter/CriteriaSearchFilterAdapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { TerminologySystemDictionary } from 'src/app/model/Utilities/Terminology
66

77
export class CriteriaSearchFilterAdapter {
88
public static convertToFilterValues(filter: SearchTermFilter): SearchFilter {
9-
console.log('Converting SearchTermFilter to SearchFilter:', filter);
109
const searchFilterValues: SearchFilterValues[] = filter
1110
.getValues()
1211
.map((filterValue: SearchTermFilterValues) =>

0 commit comments

Comments
 (0)