-
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
Painless Playground PoC #54578
Painless Playground PoC #54578
Conversation
Taking the grok debugger as skeleton and transforming it into a basic Painless Playground
@kertal this is really cool so far! Is there a list of things that you'd still like to include with this PoC? (for it to be "done" 🙂). And perhaps some stretch goals too? |
Update layout of code editor slightly Fixed i18n issue (not rendering inside context)
- Move view request to flyout - Update rendering of error output - Tweak spaces in panels
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.
Summary
Overall I think this is looking great. I think this definitely gives users a lot of value for a small amount of UI changes overall (they now have a way to work with Painless!). Thanks for this contribution @kertal
Code Suggestions
I have opened this PR against your repo with code suggestions kertal#4.
I also think we should break PainlessPlayground
into some smaller components. At the moment, with the tabbed content, it gets a bit tricky to keep track of where changes will be surfaced 😅
Monaco issues
I noticed the following in the dev console when navigating to "Settings" view
General UX feedback
I think the fewer tabs we can have the better for this tool. The user should not be taken away from the main input editor preferably, so we can consider rendering the tools section inside of a flyout too? Wdyt?
New Platform (NP) > Legacy
I think we should aim to get this set up as a new platform plugin ASAP :) - as discussed off-github.
@jloleysens thx for your very valuable feedback, due to an issue with our timezone, I'm coming back to you at the start of the week! |
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
Pinging @elastic/kibana-app (Team:KibanaApp) |
…op. Use heart script as the example script.
… in 'Output' tab.
Refine Painless Playground UI/UX
@elasticmachine merge upstream |
merge conflict between base and head |
I retargeted this PR to a branch hosted on |
Hey everyone, I've created #57538 to continue this work. @spacecabbie If you'd like to check out that PR and go through the process of building a complex script, I'd love to hear your feedback. Thanks in advance! |
💔 Build FailedTest FailuresKibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security·ts.Advanced Settings security feature controls no advanced_settings privileges does not allow navigation to advanced settings; redirects to management homeStandard Out
Stack Trace
Kibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces·ts.Index Patterns feature controls spaces space with Index Patterns disabled redirects to Kibana homeStandard Out
Stack Trace
Kibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/transform/creation_saved_search·ts.transform creation_saved_search batch transform with terms groups and avg agg with saved search filter starts the transform and finishes processingStandard Out
Stack Trace
and 5 more failures, only showing the first 3. History
To update your PR or re-run it, just comment with: |
Sure no problemen kan you link me a rough set of setup instructions ? I am bit lost how to do it. I could just rebuild it i suppose ? but quick dirty injection to current install is also ok |
@spacecabbie Awesome thanks! You can follow these steps in our contributing guide to get Kibana running locally. You'll have to check out the |
Surry no probleem kan do that. will have to set up a quick vm for sterile test then. But i was wondering to do a quick and dirty copy to current production/test that way i can run it on the current live data. Otherwise i have to repipe log flow and it will take a while to build up a good content db. I have an idea how to do it i'll try both just for good measure. When test env is up i'll make it available for limited access to the dev's who want to. |
* Create Painless Playground app (#54578) * Replace heart script with smiley face script. (#57755) * Rename Painless Playground -> Painless Lab. (#57545) * Fix i18n namespace. * Improve smiley face proportions. - Add def keyword to Painless spec. - Temporarily fix broken highlighting. - Add small padding to main controls. * [Painless Lab] Minor Fixes (#58135) * Code restructure, improve types, add plugin id, introduced hook Moved the code execution hook to a custom hook outside of main, also chaining off promise to avoid lower level handling of sequencing. * Re-instated formatting code To improve DX the execution error response from the painless API was massaged to a more reader friendly state, only giving non-repeating information. Currently it is hard to determine the line and character information from the painless endpoint. If the user wishes to see this raw information it will be available in the API response flyout. * Remove leading new line in default script * Remove registration of feature flag * Fix types * Restore previous auto-submit request behaviour * Remove use of null and remove old comment Stick with "undefined" as the designation for something not existing. * [Painless Lab] NP migration (#59794) * Fix sample document editor. * [Painless Lab] Fix float -> integer coercion bug (#60201) * Clarify data and persistence flow. Fix floating point precision bug. * Send a string to API and ES client instead of an object. * Rename helpers lib to format. Add tests for formatRequestPayload. * Add query parameter to score context (#60414) * Fix typo and i18n * Make state init lazy Otherwise we are needlessly reading and JSON.parse'ing on every state update * Support the query parameter in requests to Painless * Fix borked i18n * Fix i18n * Another i18n issue * [Painless] Minor state update model refactor (#60532) * Fix typo and i18n * Make state init lazy Otherwise we are needlessly reading and JSON.parse'ing on every state update * Support the query parameter in requests to Painless * WiP on state refactor * Some cleanup after manual testing * Fix types and i18n * Fix i18n in context_tab * i18n * [Painless] Language Service (#60612) * Added language service * Use the correct monaco instance and add wordwise operations * Remove plugin context initializer for now * [Painless] Replace hard-coded links (#60603) * Replace hard-coded links Also remove all props from Main component * Pass the new links object to the request flyout too * Link directly to painless execute API's contexts * Remove responsive stacking from tabs with icons in them. * Resize Painless Lab bottom bar to accommodate nav drawer width (#60833) * Validate Painless Lab index field (#60841) * Make JSON format of parameters field more prominent. Set default parameters to provide an example to users. * Set default document to provide an example to users. * Simplify context's updateState interface. * Refactor store and context file organization. - Remove common directory, move constants and types files to root. - Move initialState into context file, where it's being used. * Add validation for index input. * Create context directory. * Fix bottom bar z-index. * Position flyout help link so it's bottom-aligned with the title and farther from the close button. Co-authored-by: Matthias Wilhelm <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Alison Goryachev <[email protected]>
* Create Painless Playground app (#54578) * Replace heart script with smiley face script. (#57755) * Rename Painless Playground -> Painless Lab. (#57545) * Fix i18n namespace. * Improve smiley face proportions. - Add def keyword to Painless spec. - Temporarily fix broken highlighting. - Add small padding to main controls. * [Painless Lab] Minor Fixes (#58135) * Code restructure, improve types, add plugin id, introduced hook Moved the code execution hook to a custom hook outside of main, also chaining off promise to avoid lower level handling of sequencing. * Re-instated formatting code To improve DX the execution error response from the painless API was massaged to a more reader friendly state, only giving non-repeating information. Currently it is hard to determine the line and character information from the painless endpoint. If the user wishes to see this raw information it will be available in the API response flyout. * Remove leading new line in default script * Remove registration of feature flag * Fix types * Restore previous auto-submit request behaviour * Remove use of null and remove old comment Stick with "undefined" as the designation for something not existing. * [Painless Lab] NP migration (#59794) * Fix sample document editor. * [Painless Lab] Fix float -> integer coercion bug (#60201) * Clarify data and persistence flow. Fix floating point precision bug. * Send a string to API and ES client instead of an object. * Rename helpers lib to format. Add tests for formatRequestPayload. * Add query parameter to score context (#60414) * Fix typo and i18n * Make state init lazy Otherwise we are needlessly reading and JSON.parse'ing on every state update * Support the query parameter in requests to Painless * Fix borked i18n * Fix i18n * Another i18n issue * [Painless] Minor state update model refactor (#60532) * Fix typo and i18n * Make state init lazy Otherwise we are needlessly reading and JSON.parse'ing on every state update * Support the query parameter in requests to Painless * WiP on state refactor * Some cleanup after manual testing * Fix types and i18n * Fix i18n in context_tab * i18n * [Painless] Language Service (#60612) * Added language service * Use the correct monaco instance and add wordwise operations * Remove plugin context initializer for now * [Painless] Replace hard-coded links (#60603) * Replace hard-coded links Also remove all props from Main component * Pass the new links object to the request flyout too * Link directly to painless execute API's contexts * Remove responsive stacking from tabs with icons in them. * Resize Painless Lab bottom bar to accommodate nav drawer width (#60833) * Validate Painless Lab index field (#60841) * Make JSON format of parameters field more prominent. Set default parameters to provide an example to users. * Set default document to provide an example to users. * Simplify context's updateState interface. * Refactor store and context file organization. - Remove common directory, move constants and types files to root. - Move initialState into context file, where it's being used. * Add validation for index input. * Create context directory. * Fix bottom bar z-index. * Position flyout help link so it's bottom-aligned with the title and farther from the close button. Co-authored-by: Matthias Wilhelm <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Alison Goryachev <[email protected]> Co-authored-by: Matthias Wilhelm <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Alison Goryachev <[email protected]>
Summary
PoC taking the grok debugger as skeleton and transforming it into a basic Painless Playground (REPL)
Powered by space, time 👽
An easy way to try out Painless, the scripting language of Elasticsearch
A new part of the Kibana's developer tools lets you quickly try out Painless code with syntax highlighting.
It's using the Painless execute API of Elasticsearch
So you can copy paste the request, for e.g. Console
And you can try out Painless in different contexts
Apart from the default context, it can also be executed like
script_score
function of afunction_score
query (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html)script
query (https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html)Note: Would be nice to do this e.g. also in ingest context
Why
💊 Lower the barrier to start with painless
💊 Increase Painless visibility in Kibana
💊 Help debugging
💊 Fix painless documentation:
Todos, in case this all makes sense:
Feature flag release
GA
And beyond
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers