taskid 85843 Add a tree to browse hierarchical facets on the search page - feedback

This commit is contained in:
Samuel
2021-12-23 11:43:59 +01:00
committed by Jens Vannerum
parent 2fab841562
commit 3b7d962671
3 changed files with 11 additions and 10 deletions

View File

@@ -1,7 +1,8 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { VocabularyTreeviewComponent } from '../../../../../app/shared/vocabulary-treeview/vocabulary-treeview.component'; import { VocabularyTreeviewComponent } from '../../../../../app/shared/vocabulary-treeview/vocabulary-treeview.component';
import { filter, startWith } from 'rxjs/operators'; import { filter, map, startWith } from 'rxjs/operators';
import { PageInfo } from '../../../../../app/core/shared/page-info.model'; import { PageInfo } from '../../../../../app/core/shared/page-info.model';
import { lowerCase } from 'lodash';
/** /**
* Component that show a hierarchical vocabulary in a tree view. * Component that show a hierarchical vocabulary in a tree view.
@@ -27,10 +28,10 @@ export class OkrVocabularyTreeviewComponent extends VocabularyTreeviewComponent
}) })
); );
const descriptionLabel = 'vocabulary-treeview.tree.description.' + this.vocabularyOptions.name; this.translate.get(`search.filters.filter.${this.vocabularyOptions.name}.head`).pipe(
this.description = this.translate.get(descriptionLabel).pipe( map((type) => lowerCase(type)),
filter((msg) => msg !== descriptionLabel), ).subscribe(
startWith('') (type) => this.description = this.translate.get('okr-vocabulary-treeview.info', { type })
); );
this.loading = this.vocabularyTreeviewService.isLoading(); this.loading = this.vocabularyTreeviewService.isLoading();

View File

@@ -1,8 +1,8 @@
<ds-search-hierarchy-filter></ds-search-hierarchy-filter> <ds-search-hierarchy-filter></ds-search-hierarchy-filter>
<div *ngIf="vocabularyExists$ | async" <a *ngIf="vocabularyExists$ | async"
href="javascript:void(0);"
id="show-{{filterConfig.name}}-tree" id="show-{{filterConfig.name}}-tree"
class="text-lowercase"
(click)="showVocabularyTree()"> (click)="showVocabularyTree()">
{{'search.filters.filter.show-tree' | translate: {name: ('search.filters.filter.' + filterConfig.name + '.head' | translate)} }} {{'search.filters.filter.show-tree' | translate: {name: ('search.filters.filter.' + filterConfig.name + '.head' | translate | lowercase )} }}
</div> </a>

View File

@@ -82,7 +82,7 @@ describe('OkrSearchHierarchyFilterComponent', () => {
function init() { function init() {
fixture = TestBed.createComponent(OkrSearchHierarchyFilterComponent); fixture = TestBed.createComponent(OkrSearchHierarchyFilterComponent);
fixture.detectChanges(); fixture.detectChanges();
showVocabularyTreeLink = fixture.debugElement.query(By.css('div#show-test-search-filter-tree')); showVocabularyTreeLink = fixture.debugElement.query(By.css('a#show-test-search-filter-tree'));
} }
describe('if the vocabulary doesn\'t exist', () => { describe('if the vocabulary doesn\'t exist', () => {