diff --git a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html index 8498411a38c..851ccaf880d 100644 --- a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html +++ b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.html @@ -11,6 +11,7 @@ [preloadLevel]="preloadLevel" [selectedItems]="selectedItems" [multiSelect]="multiSelect" + [showAdd]="showAdd" (select)="onSelect($event)"> diff --git a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.ts b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.ts index 706b725f89e..15532939cc6 100644 --- a/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.ts +++ b/src/app/shared/form/vocabulary-treeview-modal/vocabulary-treeview-modal.component.ts @@ -36,6 +36,11 @@ export class VocabularyTreeviewModalComponent implements OnInit { */ @Input() multiSelect = false; + /** + * A boolean representing if to show the add button or not + */ + @Input() showAdd = true; + /** * Contain a descriptive message for this vocabulary retrieved from i18n files */ diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts index f52e2c9835b..1cee59f435b 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts @@ -2,7 +2,6 @@ import { FlatTreeControl } from '@angular/cdk/tree'; import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; -import { TranslateService } from '@ngx-translate/core'; import { VocabularyEntryDetail } from '../../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; import { hasValue, isEmpty, isNotEmpty } from '../../empty.util'; @@ -13,7 +12,6 @@ import { PageInfo } from '../../../core/shared/page-info.model'; import { VocabularyEntry } from '../../../core/submission/vocabularies/models/vocabulary-entry.model'; import { VocabularyTreeFlattener } from './vocabulary-tree-flattener'; import { VocabularyTreeFlatDataSource } from './vocabulary-tree-flat-data-source'; -import { VocabularyService } from '../../../core/submission/vocabularies/vocabulary.service'; import { AlertType } from '../../alert/alert-type'; import { FormFieldMetadataValueObject } from '../builder/models/form-field-metadata-value.model'; @@ -50,7 +48,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges @Input() multiSelect = false; /** - * The vocabulary entries already selected, if any + * A boolean representing if to show the add button or not */ @Input() showAdd = true; @@ -117,13 +115,9 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges * Initialize instance variables * * @param {VocabularyTreeviewService} vocabularyTreeviewService - * @param {vocabularyService} vocabularyService - * @param {TranslateService} translate */ constructor( - private vocabularyTreeviewService: VocabularyTreeviewService, - private vocabularyService: VocabularyService, - private translate: TranslateService + private vocabularyTreeviewService: VocabularyTreeviewService ) { this.treeFlattener = new VocabularyTreeFlattener(this.transformer, this.getLevel, this.isExpandable, this.getChildren); diff --git a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.ts b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.ts index f9b3f2bff94..812be0bfc68 100644 --- a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.ts +++ b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.ts @@ -10,7 +10,8 @@ import { SearchService } from '../../../../../core/shared/search/search.service' import { FILTER_CONFIG, IN_PLACE_SEARCH, - SearchFilterService, REFRESH_FILTER + REFRESH_FILTER, + SearchFilterService } from '../../../../../core/shared/search/search-filter.service'; import { Router } from '@angular/router'; import { RemoteDataBuildService } from '../../../../../core/cache/builders/remote-data-build.service'; @@ -18,14 +19,15 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-p import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service'; import { SearchFilterConfig } from '../../../models/search-filter-config.model'; import { FacetValue } from '../../../models/facet-value.model'; -import { getFacetValueForType } from '../../../search.utils'; +import { addOperatorToFilterValue, getFacetValueForType } from '../../../search.utils'; import { filter, map, take } from 'rxjs/operators'; import { VocabularyService } from '../../../../../core/submission/vocabularies/vocabulary.service'; -import { Observable, BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, Observable } from 'rxjs'; import { PageInfo } from '../../../../../core/shared/page-info.model'; import { environment } from '../../../../../../environments/environment'; -import { addOperatorToFilterValue } from '../../../search.utils'; -import { VocabularyTreeviewModalComponent } from '../../../../form/vocabulary-treeview-modal/vocabulary-treeview-modal.component'; +import { + VocabularyTreeviewModalComponent +} from '../../../../form/vocabulary-treeview-modal/vocabulary-treeview-modal.component'; @Component({ selector: 'ds-search-hierarchy-filter', @@ -91,6 +93,7 @@ export class SearchHierarchyFilterComponent extends SearchFacetFilterComponent i name: this.getVocabularyEntry(), closed: true }; + modalRef.componentInstance.showAdd = false; modalRef.result.then((detail: VocabularyEntryDetail) => { this.selectedValues$ .pipe(take(1))