Skip to content
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

Replace Console's ace editor #42029

Closed
cjcenizal opened this issue Jul 25, 2019 · 4 comments
Closed

Replace Console's ace editor #42029

cjcenizal opened this issue Jul 25, 2019 · 4 comments
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@cjcenizal
Copy link
Contributor

cjcenizal commented Jul 25, 2019

Requirements

Support "enhanced JSON"

Enhanced JSON is a superset of standard JSON and Console has specific requirements for it. This type of enhanced JSON is also used by Search Profile and aspects of it have been requested in Watcher.

Inline HTTP requests

The JSON in the Console editor is always a request body preceded by a request method and path.

image

Multiple bodies for msearch requests

The msearch AP supports multiple headers and bodies separated by newlines. Example:

POST foo/_doc
{
  "foo": "foo"
}

POST bar/_doc
{
  "bar": "bar"
}

GET foo/_msearch
{}
{"query" : {"match_all" : {}}}
{"index" : "bar"}
{"query" : {"match_all" : {}}}

Multiple JSON blocks

Console supports multiple requests along with their JSON bodies.

image

Triple quoted strings escape quotes

Users have the option of escaping quotation marks by wrapping strings in triple quotes so they don't need to escape each individual quotation mark. Users can toggle this feature on and off.

image

Inline comments

Users can begin a line with a pound # to make that line a comment. Comments inside of JSON aren't supported but they've been requested (#11973).

image

Inline deprecation warnings

When a request is made using a deprecated feature, we print a warning into the response pane above the JSON.

image

Autocomplete

Console autocomplete will suggest different endpoints based on the method you've used and any input you've typed. Some users have complained that this matching logic is too liberal (#13361).

image

JSON autocompletion with placeholder fields

Autocomplete also works for the JSON body, and will complete with nested JSON objects with placeholder field names.

aggs_autocomplete

Dynamic autocomplete

Console can suggest indices, fields, and other things that the user has created. So we need the ability to update the autocomplete rules during run-time. In the example below, "test" is an index the user created.

image

Request-specific context menu

You can use this context menu to copy the request as cURL, open a documentation link for the relevant API, and auto-indent the request body.

image

Auto-indent

Auto-indent will format the request body so that it has indentation at each nesting level, and empty objects will be collapsed so that the opening and closing brackets are on the same line.

image

When auto-indented, the above becomes nicely formatted like this:

image

Auto-indenting again will condense the JSON so that it only occupies a single line and has no whitespace:

image

Subsequent auto-indents alternate between the condensed form and the nicely indented form.

Note that auto-indenting a triple-quoted string like this:

POST test/1
{
  "test": """a
  b"""
}

Will replace newlines with a newline character:

POST test/1
{"test":"a\n  b"}

Auto-indenting again will return to the original triple-quoted string form.

Collapsible blocks

JSON blocks can be collapsed and expanded.

image

image

Keyboard shortcuts

Console supports the following keyboard shortcuts:

image

Customizable font-size

Users can specify the font-size of the editor.

Nice-to-haves

Search highlighting in the content and scroll bar

#20142

@cjcenizal cjcenizal added Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Jul 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@cjcenizal
Copy link
Contributor Author

CC @jloleysens @poffdeluxe

@cjcenizal
Copy link
Contributor Author

Related to #57435

@cjcenizal
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

No branches or pull requests

2 participants