[Enterprise Search] Search indices empty states#131337
[Enterprise Search] Search indices empty states#131337efegurkan merged 7 commits intoelastic:mainfrom
Conversation
|
@elasticmachine merge upstream |
| const { searchIndices, searchEngines } = useValues(SearchIndicesLogic); | ||
|
|
||
| useEffect(() => { | ||
| loadSearchIndices(); |
There was a problem hiding this comment.
nitpick(non-blocking): I generally prefer using a single InitPageAction that triggers these data-load actions, rather than having two separate effects that trigger specific data fetches. It's more easily maintainable going forward, and makes re-use of and preventing unnecessary API calls easier.
| <> | ||
| <EnterpriseSearchContentPageTemplate | ||
| pageChrome={baseBreadcrumbs} | ||
| pageViewTelemetry="Search indices" |
There was a problem hiding this comment.
question: do we have schema's or a strategy defined for this telemetry somewhere? I've seen bits and pieces, but no comprehensive document.
There was a problem hiding this comment.
I am not aware of it if there are any 🤷
There was a problem hiding this comment.
Seems like a thing we should work on getting then :)
| }); | ||
|
|
||
| it('has expected default values', () => { | ||
| mount(); |
There was a problem hiding this comment.
nitpick: you can move this mount to beforeEach and remove it from the specific tests.
| path: ['enterprise_search', 'content', 'search_indices', 'search_indices_logic'], | ||
| actions: { | ||
| loadSearchIndices: true, | ||
| onSearchIndicesLoad: (searchIndices) => searchIndices, |
There was a problem hiding this comment.
suggestion: I'm not a fan of this onXXX syntax in Redux/Kea actions. Redux actions are messages in a messaging bus, they are not really functions that happen and produce a result. Rather, the reducer and listener process these messages to create a new state and/or make things happen.
The message you're sending is not that 'onLoad' is happening, it's really that the API call succeeded--so I would usually call these actions something like searchIndicesLoadSuccess. I'd also consider adding a searchIndicesLoadError action to be able to handle the error separately from the API call--makes form handling much easier, for instance.
There was a problem hiding this comment.
I will change them to searchWhateverSuccess since we didn't define the failure cases yet, will skip that, but definitely a nice convention to follow, I like the idea 👍
There was a problem hiding this comment.
I'm a big fan of this pattern, we should document how we build logic files for Enterprise Search
| }, | ||
| listeners: ({ actions }) => ({ | ||
| initPage: async () => { | ||
| try { |
There was a problem hiding this comment.
nitpick: you should be able to remove this try/catch block, as dispatching these actions should ~never error
💛 Build succeeded, but was flakyMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* Bind Search Indices empty state with Mock data * Add Logic tests * Change title on empty state to match with designs * Hide title correctly on empty state * Review changes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/enterprise-search-team/issues/1938
Summary
Binds Empty states to Search Indices route. Backend calls will be added later, for now some static data added to the logic files. Actions are exposed to the window under
contentActionsfor testing, to be removed when Backend calls added.Checklist
Delete any items that are not applicable to this PR.