Open cjcenizal opened 5 years ago
Pinging @elastic/es-ui
few clarifications to this one: I think about the MVP of this as very close to a very simple example skeleton (the snippet value) replacing a reserved word that is the key for the snippet in the system snippets dictionary (which preferably is a JSON file). No need for fancy cursor tricks like jumping into placeholders etc. This closely resembles another feature that lets the user select the API and use case to execute on the console using a menu with list of areas and user cases. The only difference the ability to have a bloc of code that is a sub API body rather than the entire API body. One notable example would be a type of aggregation like date histogram. I don't see this as a high priority in the console set of improvements
Here's an example of how ElasticHQ surfaces similar functionality:
Could also be related to https://github.com/elastic/kibana/issues/29999 and https://github.com/elastic/kibana/issues/10095 if we end up storing snippets inside their own workpads, tabs, or other organizational system.
Per @yaronp68, the Console snippets feature will be a registry of various templated requests (and sub-sections of a request) that can be inserted into the request pane. When the user selects a snippet, it will be loaded in the editor with placeholders for various fields/values. Users could select snippets that are sub-sections of a request to flesh out an existing request in the editor.
Examples of snippets:
We could use this feature to support "power mode" creation flows. For example, in the Rollup Job Wizard we could add a "Create in Console" button. When the user clicks this button they could be taken directly to Console with the appropriate snippet loaded in the editor. Of course, once we have "Load in Console" functionality (https://github.com/elastic/kibana/pull/25810) we'll be able to implement this feature even without snippets.
Once this feature is built we can explore the feasibility/value of embedding a snippet inside of other apps.