From 0c46ea8a69b345729809290883271706119e7165 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 19 Oct 2020 11:14:58 -0300 Subject: [PATCH] 13494: Adds ability to customize the search label on DataExplorer. Also, fixed DataExplorer's default search label as it was showing 'Search files' on wrong contexts (ie: Projects panel). Also, hides the search feature on the Collection PDH panel, as it doesn't make sense to search for files on different collections with identical contents, and also kind of gets stuck when searching for collection names and having one result, the panel auto navigates to the collection panel. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../collection-panel-files.tsx | 1 + src/components/data-explorer/data-explorer.tsx | 4 +++- src/components/search-input/search-input.tsx | 14 ++++++++++---- .../collection-content-address-panel.tsx | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 29f20be2..6a9f0f40 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -84,6 +84,7 @@ export const CollectionPanelFilesComponent = ({ onItemMenuOpen, onSearchChange, Files } diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index 7107bd70..28ae86cd 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -47,6 +47,7 @@ interface DataExplorerDataProps { items: T[]; itemsAvailable: number; columns: DataColumns; + searchLabel?: string; searchValue: string; rowsPerPage: number; rowsPerPageOptions: number[]; @@ -90,7 +91,7 @@ export const DataExplorer = withStyles(styles)( render() { const { columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey, - rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch, + rowsPerPage, rowsPerPageOptions, onColumnToggle, searchLabel, searchValue, onSearch, items, itemsAvailable, onRowClick, onRowDoubleClick, classes, dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput, paperKey, fetchMode, currentItemUuid, title @@ -101,6 +102,7 @@ export const DataExplorer = withStyles(styles)(
{!hideSearchInput && }
diff --git a/src/components/search-input/search-input.tsx b/src/components/search-input/search-input.tsx index 3b4ab35a..02c193c2 100644 --- a/src/components/search-input/search-input.tsx +++ b/src/components/search-input/search-input.tsx @@ -34,6 +34,7 @@ const styles: StyleRulesCallback = theme => { interface SearchInputDataProps { value: string; + label?: string; } interface SearchInputActionProps { @@ -45,6 +46,7 @@ type SearchInputProps = SearchInputDataProps & SearchInputActionProps & WithStyl interface SearchInputState { value: string; + label: string; } export const DEFAULT_SEARCH_DEBOUNCE = 1000; @@ -52,7 +54,8 @@ export const DEFAULT_SEARCH_DEBOUNCE = 1000; export const SearchInput = withStyles(styles)( class extends React.Component { state: SearchInputState = { - value: "" + value: "", + label: "" }; timeout: number; @@ -60,14 +63,14 @@ export const SearchInput = withStyles(styles)( render() { return
- Search files + {this.state.label} - + @@ -80,7 +83,10 @@ export const SearchInput = withStyles(styles)( } componentDidMount() { - this.setState({ value: this.props.value }); + this.setState({ + value: this.props.value, + label: this.props.label || 'Search' + }); } componentWillReceiveProps(nextProps: SearchInputProps) { diff --git a/src/views/collection-content-address-panel/collection-content-address-panel.tsx b/src/views/collection-content-address-panel/collection-content-address-panel.tsx index 925c5848..038fea2f 100644 --- a/src/views/collection-content-address-panel/collection-content-address-panel.tsx +++ b/src/views/collection-content-address-panel/collection-content-address-panel.tsx @@ -145,6 +145,7 @@ export const CollectionsContentAddressPanel = withStyles(styles)(