mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
taskid 85843 Add a tree to browse hierarchical facets on the search page - overrides
This commit is contained in:
@@ -98,7 +98,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
|
|||||||
/**
|
/**
|
||||||
* Array to track all subscriptions and unsubscribe them onDestroy
|
* Array to track all subscriptions and unsubscribe them onDestroy
|
||||||
*/
|
*/
|
||||||
private subs: Subscription[] = [];
|
protected subs: Subscription[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize instance variables
|
* Initialize instance variables
|
||||||
@@ -110,9 +110,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
public activeModal: NgbActiveModal,
|
public activeModal: NgbActiveModal,
|
||||||
private vocabularyTreeviewService: VocabularyTreeviewService,
|
protected vocabularyTreeviewService: VocabularyTreeviewService,
|
||||||
private store: Store<CoreState>,
|
protected store: Store<CoreState>,
|
||||||
private translate: TranslateService
|
protected translate: TranslateService
|
||||||
) {
|
) {
|
||||||
this.treeFlattener = new VocabularyTreeFlattener(this.transformer, this.getLevel,
|
this.treeFlattener = new VocabularyTreeFlattener(this.transformer, this.getLevel,
|
||||||
this.isExpandable, this.getChildren);
|
this.isExpandable, this.getChildren);
|
||||||
@@ -301,7 +301,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
|
|||||||
/**
|
/**
|
||||||
* Return an id for a given {@link VocabularyEntry}
|
* Return an id for a given {@link VocabularyEntry}
|
||||||
*/
|
*/
|
||||||
private getEntryId(entry: VocabularyEntry): string {
|
protected getEntryId(entry: VocabularyEntry): string {
|
||||||
return entry.authority || entry.otherInformation.id || undefined;
|
return entry.authority || entry.otherInformation.id || undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { VocabularyTreeviewComponent } from '../../../../../app/shared/vocabulary-treeview/vocabulary-treeview.component';
|
||||||
|
import { filter, find, startWith } from 'rxjs/operators';
|
||||||
|
import { PageInfo } from '../../../../../app/core/shared/page-info.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component that show a hierarchical vocabulary in a tree view
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-okr-vocabulary-treeview',
|
||||||
|
templateUrl: '../../../../../app/shared/vocabulary-treeview/vocabulary-treeview.component.html',
|
||||||
|
styleUrls: [
|
||||||
|
'./okr-vocabulary-treeview.component.scss',
|
||||||
|
'../../../../../app/shared/vocabulary-treeview/vocabulary-treeview.component.scss',
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class OkrVocabularyTreeviewComponent extends VocabularyTreeviewComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the component, setting up the data to build the tree
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.subs.push(
|
||||||
|
this.vocabularyTreeviewService.getData().subscribe((data) => {
|
||||||
|
this.dataSource.data = data;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const descriptionLabel = 'vocabulary-treeview.tree.description.' + this.vocabularyOptions.name;
|
||||||
|
this.description = this.translate.get(descriptionLabel).pipe(
|
||||||
|
filter((msg) => msg !== descriptionLabel),
|
||||||
|
startWith('')
|
||||||
|
);
|
||||||
|
|
||||||
|
// set isAuthenticated
|
||||||
|
this.isAuthenticated = this.store.pipe(select(isAuthenticated));
|
||||||
|
|
||||||
|
this.loading = this.vocabularyTreeviewService.isLoading();
|
||||||
|
|
||||||
|
this.isAuthenticated.pipe(
|
||||||
|
find((isAuth) => isAuth)
|
||||||
|
).subscribe(() => {
|
||||||
|
const entryId: string = (this.selectedItem) ? this.getEntryId(this.selectedItem) : null;
|
||||||
|
this.vocabularyTreeviewService.initialize(this.vocabularyOptions, new PageInfo(), entryId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user