Skip to content

Commit

Permalink
[DURACOM-208] add showAdd flag in vocabulary-treeview-modal.component
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Jan 11, 2024
1 parent 1fd0d35 commit 585c49c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ <h4 class="modal-title">{{'vocabulary-treeview.header' | translate}}</h4>
[preloadLevel]="preloadLevel"
[selectedItems]="selectedItems"
[multiSelect]="multiSelect"
[showAdd]="showAdd"
(select)="onSelect($event)">
</ds-vocabulary-treeview>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ 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';
import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-page.component';
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',
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 585c49c

Please sign in to comment.