[CST-8914] Add flag to show/hide csv export button

This commit is contained in:
Giuseppe Digilio
2023-02-14 11:24:08 +01:00
parent 6cb6737256
commit 0f25f9f18f
7 changed files with 29 additions and 14 deletions

View File

@@ -1 +1 @@
<ds-themed-search [trackStatistics]="true"></ds-themed-search> <ds-themed-search [showCsvExport]="true" [trackStatistics]="true"></ds-themed-search>

View File

@@ -1,6 +1,6 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<h2 *ngIf="!disableHeader">{{ (configuration ? configuration + '.search.results.head' : 'search.results.head') | translate }}</h2> <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>
<div *ngIf="searchResults && searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0" @fadeIn> <div *ngIf="searchResults && searchResults?.hasSucceeded && !searchResults?.isLoading && searchResults?.payload?.page.length > 0" @fadeIn>
<ds-viewable-collection <ds-viewable-collection

View File

@@ -47,6 +47,11 @@ export class SearchResultsComponent {
*/ */
@Input() searchConfig: PaginatedSearchOptions; @Input() searchConfig: PaginatedSearchOptions;
/**
* A boolean representing if show csv export button
*/
@Input() showCsvExport = false;
/** /**
* The current sorting configuration of the search * The current sorting configuration of the search
*/ */

View File

@@ -21,7 +21,7 @@ import { ListableObject } from '../../object-collection/shared/listable-object.m
templateUrl: '../../theme-support/themed.component.html', templateUrl: '../../theme-support/themed.component.html',
}) })
export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsComponent> { 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() linkType: CollectionElementLinkType;
@@ -29,6 +29,8 @@ export class ThemedSearchResultsComponent extends ThemedComponent<SearchResultsC
@Input() searchConfig: PaginatedSearchOptions; @Input() searchConfig: PaginatedSearchOptions;
@Input() showCsvExport = false;
@Input() sortConfig: SortOptions; @Input() sortConfig: SortOptions;
@Input() viewMode: ViewMode; @Input() viewMode: ViewMode;

View File

@@ -30,16 +30,17 @@
</button> </button>
</div> </div>
<ds-themed-search-results [searchResults]="resultsRD$ | async" <ds-themed-search-results [searchResults]="resultsRD$ | async"
[searchConfig]="searchOptions$ | async" [searchConfig]="searchOptions$ | async"
[configuration]="(currentConfiguration$ | async)" [configuration]="(currentConfiguration$ | async)"
[disableHeader]="!searchEnabled" [disableHeader]="!searchEnabled"
[linkType]="linkType" [linkType]="linkType"
[context]="(currentContext$ | async)" [context]="(currentContext$ | async)"
[selectable]="selectable" [selectable]="selectable"
[selectionConfig]="selectionConfig" [selectionConfig]="selectionConfig"
(contentChange)="onContentChange($event)" [showCsvExport]="showCsvExport"
(deselectObject)="deselectObject.emit($event)" (contentChange)="onContentChange($event)"
(selectObject)="selectObject.emit($event)"></ds-themed-search-results> (deselectObject)="deselectObject.emit($event)"
(selectObject)="selectObject.emit($event)"></ds-themed-search-results>
</div> </div>
</div> </div>
</ng-template> </ng-template>

View File

@@ -117,6 +117,11 @@ export class SearchComponent implements OnInit {
*/ */
@Input() selectionConfig: SelectionConfig; @Input() selectionConfig: SelectionConfig;
/**
* A boolean representing if show csv export button
*/
@Input() showCsvExport = false;
/** /**
* A boolean representing if show search sidebar button * A boolean representing if show search sidebar button
*/ */

View File

@@ -19,7 +19,7 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
templateUrl: '../theme-support/themed.component.html', templateUrl: '../theme-support/themed.component.html',
}) })
export class ThemedSearchComponent extends ThemedComponent<SearchComponent> { 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[] = []; @Input() configurationList: SearchConfigurationOption[] = [];
@@ -47,6 +47,8 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
@Input() selectionConfig: SelectionConfig; @Input() selectionConfig: SelectionConfig;
@Input() showCsvExport = false;
@Input() showSidebar = true; @Input() showSidebar = true;
@Input() showViewModes = true; @Input() showViewModes = true;