Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add advanced search component to editor (ZNTA-975) (#443)
* refactor(TransUnitFilter): linting fixes * refactor(editor filter): move status filter data to state.phrases.filter The status filtering is all about filtering the list of phrases, so it belongs in the phrase section with advanced search filter data which will soon be added. This change will help reduce the amount of distant data that reducers need to access. * refactor(editor filter): move phrase status filter actions to phrases-filter-actions This includes making the TransUnitFilter component a completely connected component deriving all its props from mapStateToProps and mapDispatchToProps. All the components in the headers should move in this direction, so that the header components can stick to the single responsibility of defining the layout of the other components. * refactor(phrase filter): use flux standard actions for status filter All the actions will be updated to be flux standard actions (FSAs), and I have edited these actions, so this is an appropriate time to update them. This also removes the warning for using a non-symbol as an action type, since all action types will be changed to strings so that they are serializable (required for advanced development tools such as time-travel debugging). * refactor: rename TransUnitFilter to PhraseStatusFilter * feat(ZNTA-975): add advanced search state, actions and reducer * test: fix linting warnings in EditorSearchInput.test.js * feat(ZNTA-975): connect EditorSearchInput to app and state * feat(ZNTA-975): add filter fields to status list endpoint * feat(ZNTA-975): apply style class to input component Includes a FIXME comment because the css classes need to be moved for maintainability. * refactor(editor): move middleware config to separate module * feat(ZNTA-975): add selectors for current page of phrases These are not used yet, but selectors should replace most places that we are manually pulling out or calculating pieces of state from the store. They will allow changing in one place if we move some state, and will be more efficient for calculated state since they memoize the input selectors. * feat(ZNTA-975): allow filter parameters in phrase fetch request * WIP: fetch filter phrases from server (NOT USED YET) * WIP: add logging wrapper around redux-watch * feat(ZNTA-975): fetch and store server-filtered phrase list Does not yet display the fetched list. * feat(ZNTA-975): add selector for hasAdvancedFilter * feat(ZNTA-975): display filtered phrases when filter is present * feat(ZNTA-975): WIP fixing all phrase list refs for filter, fixed paging Paging was using old location, changed to use selectors to it will adapt when selectors change next time. * feat(ZNTA-975): use watcher for glossary and suggestion searches Includes moving middleware setup to middlewares/index.js since that makes more sense and keeps the top level cleaner. * fix(setState): use callback form of setState for search input The other form has a theoretical state-clobbering bug. * feat(ZNTA-975): only select first row when unfiltered list is loaded * test(ZNTA-975): update tests to work with plain/filtered status lists * feat(ZNTA-975) fix advanced search icon alignment * feat(ZNTA-975): use standard action names for phrase list and detail * feat(ZNTA-975): use consistent names for search fields between server and editor * feat(ZNTA-975): clean up some comments * feat(ZNTA-975): prevent network request for empty filter search * feat(ZNTA-975): use request body for phrase filter fields * feat(ZNTA-975): add middleware to include meta.timestamp in all API calls The middleware also adds some repeated defaults such as credentials and JSON headers, which avoids the need to wrap calls in a helper function. I chose a distinct type rather than reusing CALL_API so that there is a way to skip the new behaviour if that is ever needed. * feat(ZNTA-975): use timestamp to ignore stale advanced search results * feat(ZNTA-975): correctly select visible phrase when phrases load * feat(ZNTA-975): limit to a single phrase detail request at a time Also only fetches phrases that do not yet have detail present. * feat(ZNTA-975): remove some unused css * feat(ZNTA-975): move styles for EditorSearchInput to its css file They were in the root css file. There is still duplication and rules conflicting/competing with other rules so more cleanup is needed. * feat(ZNTA-975): remove unused functions These are replaced by new functions in the watchers, since that is the only place they are used. * feat(ZNTA-975) added media queries for EditorSearchInput * feat(ZNTA-975) improved width of advanced search panel in editor * feat(ZNTA-975) css formatting * refactor: add FIXME comment for fragile css rule I forgot to edit my reminder comment before and it was removed. This replaces it with a more useful comment. * test(ZNTA-975): update some tests to factor in request timestamps * feat(ZNTA-975): remove blur-based closing of advanced search panel This is less surprising to users, but the main reason for this change is that the show/hide advanced button is confusing when the advanced panel is visible-on-focus only. The focus tracking to have that button toggle back to "show advanced" on blur is very complicated because it is difficult to tell whether the activity that caused a blur came from within the panel when it was not a focus on another input element. * test(ZNTA-975): update test to match new expected advanced search panel behaviour * feat(ZNTA-975): fix storybook prop names * feat(ZNTA-975): align advanced search inputs Also attempted to make it less visually busy by removing the borders and using a more subtle colouring and shadow. Could still need some work. * test(ZNTA-975): update test to match new markup in advanced search fields * fix(ZNTA-975): add missing Strings dependency This was removed by accident when resolving a merge conflict. * fix(ZNTA-975): remove some unused imports This is to satisfy the Java compiler warnings check which is currently marking the build unstable. * fix(ZNTA-975): wait for phrase loading in editor test * feat(ZNTA-975): fix advanced search input and panel width across browsers Stretch input to fill container in firefox, and limit panel width to width of container in chrome. * feat(ZNTA-975): move labels for advanced search to give inputs more width At narrow panel sizes, the inputs for advanced search fields were too narrow. This moves the labels above the inputs so they can span the full width of the panel. * feat(ZNTA-975): update test for changed EditorSearchInput markup * test: increase test coverage * refactor: delete unused module
- Loading branch information