From: Daniel Kutyła Date: Thu, 2 Dec 2021 21:12:59 +0000 (+0100) Subject: 17579: Added search input clear after project change X-Git-Tag: 2.4.0~23^2~9 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/91fdf9e2d937de38309f1464b30cb699df4f6389 17579: Added search input clear after project change Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js index 1c175952..4d77d3a5 100644 --- a/cypress/integration/project.spec.js +++ b/cypress/integration/project.spec.js @@ -194,4 +194,27 @@ describe('Project tests', function() { cy.contains(testRootProject.uuid).should('exist'); }); }); + + it('clears search input when changing project', () => { + cy.createGroup(activeUser.token, { + name: `Test root project ${Math.floor(Math.random() * 999999)}`, + group_class: 'project', + }).as('testProject1'); + cy.createGroup(activeUser.token, { + name: `Test root project ${Math.floor(Math.random() * 999999)}`, + group_class: 'project', + }).as('testProject2'); + + cy.getAll('@testProject1', '@testProject2').then(function([testProject1, testProject2]) { + cy.loginAs(activeUser); + + cy.get('[data-cy=side-panel-tree]').contains(testProject1.name).click(); + + cy.get('[data-cy=search-input] input').type('test123'); + + cy.get('[data-cy=side-panel-tree]').contains('Projects').click(); + + cy.get('[data-cy=search-input] input').should('not.have.value', 'test123'); + }); + }); }); \ No newline at end of file diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index a7001a61..97ec3bf9 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -463,7 +463,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
1 ? classes.searchWrapper : classes.searchWrapperHidden}> - +
{ @@ -510,7 +510,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
- +
{ isWritable && diff --git a/src/components/collection-panel-files/collection-panel-files2.tsx b/src/components/collection-panel-files/collection-panel-files2.tsx index 41182482..481844d9 100644 --- a/src/components/collection-panel-files/collection-panel-files2.tsx +++ b/src/components/collection-panel-files/collection-panel-files2.tsx @@ -83,6 +83,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 d272e870..5f396bb4 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -82,12 +82,19 @@ interface DataExplorerActionProps { type DataExplorerProps = DataExplorerDataProps & DataExplorerActionProps & WithStyles; export const DataExplorer = withStyles(styles)( - class DataExplorerGeneric extends React.Component> { + class DataExplorerGeneric extends React.Component, { currentItemUuid: string }> { + constructor(props) { + super(props); + this.state = { + currentItemUuid: props.currentItemUuid + }; + } componentDidMount() { if (this.props.onSetColumns) { this.props.onSetColumns(this.props.columns); } } + render() { const { columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey, @@ -96,6 +103,7 @@ export const DataExplorer = withStyles(styles)( dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput, paperKey, fetchMode, currentItemUuid, title } = this.props; + return {title &&
{title}
} {(!hideColumnSelector || !hideSearchInput) && @@ -104,6 +112,7 @@ export const DataExplorer = withStyles(styles)( {!hideSearchInput && }
{actions} diff --git a/src/components/search-input/search-input.tsx b/src/components/search-input/search-input.tsx index 5d5a9a22..955cf5e5 100644 --- a/src/components/search-input/search-input.tsx +++ b/src/components/search-input/search-input.tsx @@ -35,6 +35,7 @@ const styles: StyleRulesCallback = theme => { interface SearchInputDataProps { value: string; label?: string; + selfClearProp: string; } interface SearchInputActionProps { @@ -47,6 +48,7 @@ type SearchInputProps = SearchInputDataProps & SearchInputActionProps & WithStyl interface SearchInputState { value: string; label: string; + selfClearProp: string; } export const DEFAULT_SEARCH_DEBOUNCE = 1000; @@ -55,7 +57,8 @@ export const SearchInput = withStyles(styles)( class extends React.Component { state: SearchInputState = { value: "", - label: "" + label: "", + selfClearProp: "" }; timeout: number; @@ -66,6 +69,7 @@ export const SearchInput = withStyles(styles)( {this.state.label} - +