Skip to content

Commit

Permalink
[CST-8914] Add flag to show/hide csv export button
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Feb 14, 2023
1 parent 6cb6737 commit 0f25f9f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/search-page/search-page.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ds-themed-search [trackStatistics]="true"></ds-themed-search>
<ds-themed-search [showCsvExport]="true" [trackStatistics]="true"></ds-themed-search>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="d-flex justify-content-between">
<h2 *ngIf="!disableHeader">{{ (configuration ? configuration + '.search.results.head' : 'search.results.head') | translate }}</h2>
<ds-search-export-csv [searchConfig]="searchConfig"></ds-search-export-csv>
<ds-search-export-csv *ngIf="showCsvExport" [searchConfig]="searchConfig"></ds-search-export-csv>
</div>
<div *ngIf="searchResults && searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0" @fadeIn>
<ds-viewable-collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export class SearchResultsComponent {
*/
@Input() searchConfig: PaginatedSearchOptions;

/**
* A boolean representing if show csv export button
*/
@Input() showCsvExport = false;

/**
* The current sorting configuration of the search
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ import { ListableObject } from '../../object-collection/shared/listable-object.m
templateUrl: '../../theme-support/themed.component.html',
})
export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsComponent> {
protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject'];
protected inAndOutputNames: (keyof SearchResultsComponent & keyof this)[] = ['linkType', 'searchResults', 'searchConfig', 'showCsvExport', 'sortConfig', 'viewMode', 'configuration', 'disableHeader', 'selectable', 'context', 'hidePaginationDetail', 'selectionConfig', 'contentChange', 'deselectObject', 'selectObject'];

@Input() linkType: CollectionElementLinkType;

@Input() searchResults: RemoteData<PaginatedList<SearchResult<DSpaceObject>>>;

@Input() searchConfig: PaginatedSearchOptions;

@Input() showCsvExport = false;

@Input() sortConfig: SortOptions;

@Input() viewMode: ViewMode;
Expand Down
21 changes: 11 additions & 10 deletions src/app/shared/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
</button>
</div>
<ds-themed-search-results [searchResults]="resultsRD$ | async"
[searchConfig]="searchOptions$ | async"
[configuration]="(currentConfiguration$ | async)"
[disableHeader]="!searchEnabled"
[linkType]="linkType"
[context]="(currentContext$ | async)"
[selectable]="selectable"
[selectionConfig]="selectionConfig"
(contentChange)="onContentChange($event)"
(deselectObject)="deselectObject.emit($event)"
(selectObject)="selectObject.emit($event)"></ds-themed-search-results>
[searchConfig]="searchOptions$ | async"
[configuration]="(currentConfiguration$ | async)"
[disableHeader]="!searchEnabled"
[linkType]="linkType"
[context]="(currentContext$ | async)"
[selectable]="selectable"
[selectionConfig]="selectionConfig"
[showCsvExport]="showCsvExport"
(contentChange)="onContentChange($event)"
(deselectObject)="deselectObject.emit($event)"
(selectObject)="selectObject.emit($event)"></ds-themed-search-results>
</div>
</div>
</ng-template>
Expand Down
5 changes: 5 additions & 0 deletions src/app/shared/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export class SearchComponent implements OnInit {
*/
@Input() selectionConfig: SelectionConfig;

/**
* A boolean representing if show csv export button
*/
@Input() showCsvExport = false;

/**
* A boolean representing if show search sidebar button
*/
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/search/themed-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
templateUrl: '../theme-support/themed.component.html',
})
export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showSidebar', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics'];
protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showCsvExport', 'showSidebar', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics'];

@Input() configurationList: SearchConfigurationOption[] = [];

Expand Down Expand Up @@ -47,6 +47,8 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {

@Input() selectionConfig: SelectionConfig;

@Input() showCsvExport = false;

@Input() showSidebar = true;

@Input() showViewModes = true;
Expand Down

0 comments on commit 0f25f9f

Please sign in to comment.