-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enterprise Search][tech debt] Add Kea logic paths for easier debugging/defaults #77698
Conversation
@@ -16,6 +16,7 @@ export interface IAppActions { | |||
} | |||
|
|||
export const AppLogic = kea<MakeLogicType<IAppValues, IAppActions>>({ | |||
path: ['enterpriseSearch', 'appSearch', 'app'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JasonStoltz changed from snake_case to camelCase, hope that's cool 🤔
Also... do we have any strong thoughts about using our common/constants.ts
strings here? In theory this could be:
path: [ENTERPRISE_SEARCH_PLUGIN.ID, APP_SEARCH_PLUGIN.ID, 'app']
instead... but I don't know if that's necessarily better/easier to read lol? (I'm pretty lazy about constant strings when it comes to dev-only strings tbh though, it's one of my many failings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I like camel case because it matches the directory/file structure. If I saw enterprise_search -> app_search -> app_logic
I know exactly what I need to type into the file jumper in vscode to get there. Otherwise if we use camelcase these should be names of the components and Logics [EnterpriseSearch
, AppSearchConfigured
, AppLogic
]. If this is meant to ease debugging it should give me something I can easily search our codebase for to get to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter to me which we go with, I just want to get this merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I like camel case
assuming you mean snake case, just to confirm?
re: names lining up with directory / file names:
I think if we want to guarantee that, we should just install babel-plugin-kea to automatically handle that for us. Otherwise, there's absolutely no guarantee that someone will name all logic files correctly in the future (for example, this line in question is app
, not even appLogic
).
I can definitely switch this PR over to just being yarn install if we're cool with it. Yay/nay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming you mean snake case, just to confirm?
yeah sorry, I'm a idiot lmao
10000% for using this babel plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome possum. Imma do it here shortly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a bit more digging: sadly it's not that straightforward 😞 Since Kibana maintains it's own babel package/settings, we'll have to open an issue and get approval from the ops team after they evaluate the plugin.
Additionally, after looking at the plugin source code, it camelCases file names so it actually wouldn't achieve what Byron wants in any case (doh).
@byronhulcher it sounds like you have the strongest feelings here re: path names, so I'll go ahead and rename to snake_case as well as matching file names exactly. I'm also going to update our documentation/README to note our use of Kea and path names, and why we're specifically using snake_case for those lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I personally lean against the constants in path, since this is dev-only
@@ -32,6 +32,7 @@ const convertToArray = (messages: IFlashMessage | IFlashMessage[]) => | |||
!Array.isArray(messages) ? [messages] : messages; | |||
|
|||
export const FlashMessagesLogic = kea<MakeLogicType<IFlashMessagesValues, IFlashMessagesActions>>({ | |||
path: ['enterprise_search', 'flash_messages_logic'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byronhulcher just wanted to highlight that this still doesn't "exactly" follow the file path (i.e. enterprise_search/public/applications/shared/flash_messages/flash_messages/logic
), but hopefully the important part is the last key for file finding purposes 🤷
Re-requesting reviews from everyone (particularly on the docs!) 📖 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
💚 Build SucceededBuild metricsasync chunks size
History
To update your PR or re-run it, just comment with: |
* master: (92 commits) [ILM] Data tiers for 7.10 (elastic#76126) [ML] Transforms: Fixes styling of preview grid pagination in summary step (elastic#77789) [Drilldowns] Beta badge support. Mark URL Drilldown as Beta (elastic#75654) Re-enable session lifespan, idle timeout api integration tests and use unique names for the security test reports. (elastic#77746) [Alerting] renames code in alerting RBAC exemption to make it easier to maintain (elastic#77598) [Alerting & Actions] Overwrite SOs when updating instead of partially updating (elastic#73688) fixed react warning in Suspense in alert flyout (elastic#77777) [APM] Track usage of Gold+ features (elastic#77630) Visualize: Bad request when working with histogram aggregation (elastic#77684) remove legacy ES plugin (elastic#77703) [Lens] change name of custom query to filters (elastic#77725) skip flaky suite (elastic#76239) remove visual aspects of baseline job (elastic#77815) skip flaky suite (elastic#77835) Fixes typo in data recognizer text (elastic#77691) management/update trusted_apps jest snapshot [build] Use Elastic hosted UBI minimal base image (elastic#77776) [APM] Add transaction error rate alert (elastic#76933) [Security Solution] [Detections] Remove file validation on import route (elastic#77770) [Enterprise Search][tech debt] Add Kea logic paths for easier debugging/defaults (elastic#77698) ...
Summary
Promise I'm not trying to steal your thunder @JasonStoltz - just want to keep commits as modular as possible, + this way it makes it easier for us to have a convo about this separately from the credentials logic :)
Per Jason's explanation on what Kea paths accomplish, these changes should:
https://github.com/elastic/kibana/blob/b0fcf4a24ab33c8b39fc68a2162994c064b20eab/x-pack/plugins/enterprise_search/public/applications/app_search/components/credentials/credentials_logic.test.ts#L21-L33
Checklist