From d15327cd1301c04ee9f22868506ead34baed2574 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Thu, 14 Mar 2024 11:29:22 +0100 Subject: [PATCH] Manual fix: update i/o for ThemedConfigurationSearchPageComponent Fixes compile-time errors due to out-of-sync inputs and outputs between ThemedConfigurationSearchPageComponent and SearchComponent (note that this is was an existing problem in the source code that flew under the radar until we flipped the selector convention!) --- ...med-configuration-search-page.component.ts | 158 ++++++++++++++++-- src/app/shared/search/search.component.ts | 4 +- 2 files changed, 148 insertions(+), 14 deletions(-) diff --git a/src/app/search-page/themed-configuration-search-page.component.ts b/src/app/search-page/themed-configuration-search-page.component.ts index 1235ab5d58d..c6eb957be7b 100644 --- a/src/app/search-page/themed-configuration-search-page.component.ts +++ b/src/app/search-page/themed-configuration-search-page.component.ts @@ -1,10 +1,18 @@ import { Component, + EventEmitter, Input, + Output, } from '@angular/core'; -import { Observable } from 'rxjs'; import { Context } from '../core/shared/context.model'; +import { DSpaceObject } from '../core/shared/dspace-object.model'; +import { ViewMode } from '../core/shared/view-mode.model'; +import { CollectionElementLinkType } from '../shared/object-collection/collection-element-link.type'; +import { ListableObject } from '../shared/object-collection/shared/listable-object.model'; +import { SearchObjects } from '../shared/search/models/search-objects.model'; +import { SelectionConfig } from '../shared/search/search-results/search-results.component'; +import { SearchConfigurationOption } from '../shared/search/search-switch-configuration/search-configuration-option.model'; import { ThemedComponent } from '../shared/theme-support/themed.component'; import { ConfigurationSearchPageComponent } from './configuration-search-page.component'; @@ -17,9 +25,20 @@ import { ConfigurationSearchPageComponent } from './configuration-search-page.co templateUrl: '../shared/theme-support/themed.component.html', }) export class ThemedConfigurationSearchPageComponent extends ThemedComponent { + /** + * The list of available configuration options + */ + @Input() configurationList: SearchConfigurationOption[]; + + /** + * The current context + * If empty, 'search' is used + */ + @Input() context: Context; + /** * The configuration to use for the search options - * If empty, the configuration will be determined by the route parameter called 'configuration' + * If empty, 'default' is used */ @Input() configuration: string; @@ -29,11 +48,27 @@ export class ThemedConfigurationSearchPageComponent extends ThemedComponent; + @Input() searchFormPlaceholder: string; /** - * The current context + * A boolean representing if result entries are selectable + */ + @Input() selectable: boolean; + + /** + * The config option used for selection functionality + */ + @Input() selectionConfig: SelectionConfig; + + /** + * A boolean representing if show csv export button + */ + @Input() showCsvExport: boolean; + + /** + * A boolean representing if show search sidebar button + */ + @Input() showSidebar: boolean; + + /** + * Whether to show the thumbnail preview + */ + @Input() showThumbnails: boolean; + + /** + * Whether to show the view mode switch + */ + @Input() showViewModes: boolean; + + /** + * List of available view mode + */ + @Input() useUniquePageId: boolean; + + /** + * List of available view mode + */ + @Input() viewModeList: ViewMode[]; + + /** + * Defines whether or not to show the scope selector + */ + @Input() showScopeSelector: boolean; + + /** + * Whether or not to track search statistics by sending updates to the rest api + */ + @Input() trackStatistics: boolean; + + /** + * The default value for the search query when none is already defined in the {@link SearchConfigurationService} + */ + @Input() query: string; + + /** + * The fallback scope when no scope is defined in the url, if this is also undefined no scope will be set + */ + @Input() scope: string; + + /** + * Hides the scope in the url, this can be useful when you hardcode the scope in another way + */ + @Input() hideScopeInUrl: boolean; + + /** + * Emits an event with the current search result entries + */ + @Output() resultFound: EventEmitter> = new EventEmitter>(); + + /** + * Emits event when the user deselect result entry + */ + @Output() deselectObject: EventEmitter = new EventEmitter(); + + /** + * Emits event when the user select result entry */ - @Input() - context: Context; + @Output() selectObject: EventEmitter = new EventEmitter(); - protected inAndOutputNames: (keyof ConfigurationSearchPageComponent & keyof this)[] = - ['context', 'configuration', 'fixedFilterQuery', 'inPlaceSearch', 'searchEnabled', 'sideBarWidth']; + protected inAndOutputNames: (keyof ConfigurationSearchPageComponent & keyof this)[] = [ + 'configurationList', + 'context', + 'configuration', + 'fixedFilterQuery', + 'useCachedVersionIfAvailable', + 'inPlaceSearch', + 'linkType', + 'paginationId', + 'searchEnabled', + 'sideBarWidth', + 'searchFormPlaceholder', + 'selectable', + 'selectionConfig', + 'showCsvExport', + 'showSidebar', + 'showThumbnails', + 'showViewModes', + 'useUniquePageId', + 'viewModeList', + 'showScopeSelector', + 'trackStatistics', + 'query', + 'scope', + 'hideScopeInUrl', + 'resultFound', + 'deselectObject', + 'selectObject', + ]; protected getComponentName(): string { return 'ConfigurationSearchPageComponent'; diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index bbe53a279bb..5a9df037040 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -97,7 +97,7 @@ export class SearchComponent implements OnDestroy, OnInit { * The configuration to use for the search options * If empty, 'default' is used */ - @Input() configuration; + @Input() configuration: string; /** * The actual query for the fixed filter. @@ -164,7 +164,7 @@ export class SearchComponent implements OnDestroy, OnInit { /** * Whether to show the thumbnail preview */ - @Input() showThumbnails; + @Input() showThumbnails: boolean; /** * Whether to show the view mode switch