* Add new codemirror-promql-based expression editor
This adds advanced autocompletion, syntax highlighting, and linting
for PromQL.
Fixes https://github.com/prometheus/prometheus/issues/6160
Fixes https://github.com/prometheus/prometheus/issues/5421
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Group new editor options and float them left
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Improve history autocompletion handling
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Only show info tooltips for unabbreviated completion items
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Rename "new editor" to "experimental editor"
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Add path prefix support
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Revert accidental check-in of go.sum changes
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Remove spurious console.log
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fix completion item type icon styling
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Checkbox should use onChange, not onClick
This fixes react console errors:
You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Correctly pass key in metrics exporer
Instead of passing metric variable we pass 'metric' string, which causes console errors due to duplicated keys.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Update tests
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
If I have a rule with a very long name it will force the table to be wider then the viewport.
This forces the browser to wrap long rule names and uses smaller font, to avoid having overflow.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
Target errors are rendered as badges. If error text is very long it will expand the table since badges are not allowed to wrap.
Replace badge with a span which is allowed to wrap around.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Fix inconsistent display of word 'ago' in last evaluation column on rules page
Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>
* Extract adding word 'ago' to relativeDuration util function
Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>
* Add expression explorer
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Add final new line to all files
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Rename expression to metric
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Pass dedicated metrics array to metrics explorer
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix styling of button
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Use append instead of prepend
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Update max width of modal
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix code style
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix inconsistent variable naming
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix modal title
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix tests
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Prevent request from being cached
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Remove timestamp from request
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Update button selector in test
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Refactor passing down metric names and query history
Signed-off-by: Lucas Hild <git@lucas-hild.de>
* Fix code style
Signed-off-by: Lucas Hild <git@lucas-hild.de>
Similar to https://github.com/prometheus/prometheus/pull/7902, this could lead
to style bugs for label names that correspond to styled CSS class names.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* [UI] Add a test for duplicated keys in EndpointLink component
I've noticed that I'm getting warnings about multiple children with the same key on /targets page.
This adds a test that fails when that happens.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* [UI] Fix duplicated keys on /targets page
Since any URI we render on /targets page can have multi-value params we should use both name and value as components keys.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* tsdb: Expose total number of label pairs in head
Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>
* fix: add comment for NumLabelPairs
Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>
* fix: remove comment
Signed-off-by: Nguyen Le Vu Long <vulongvn98@gmail.com>
- First, it is currently not only removing "metric" autocomplete, but
also "query history autocomplete", so the checkbox is confusing.
- Then, in the future, we will want also "functions" autocomplete.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
The React app's assets are now served under /assets, while all old
custom web assets (including the ones for console templates) are now
served from /classic/static.
I tested different combinations of --web.external-url and
--web.route-prefix with proxies in front, and I couldn't find a problem
yet with the routing. Console templates also still work.
While migrating old endpoints to /classic, I noticed that /version was
being treated like a lot of the old UI pages, with readiness check
handler in front of it, etc. I kept it in /version and removed that
readiness wrapper, since it doesn't seem to be needed for that endpoint.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* UI: Add toggle to enable/disable metric autocomplete
This change adds a toggle to enable or disable the metric autocomplete
functionality. By default it is enabled. This is a port of a change I
did in [Thanos][1].
[1]: https://github.com/thanos-io/thanos/pull/3381
Signed-off-by: Jarod Watkins <jarod@42lines.net>
* Adding full variable name
Signed-off-by: Jarod Watkins <jarod@42lines.net>
* dynamically determine path prefix
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* minor changes per PR review
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* use Context for apiPath and pathPrefix
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* remove unhandled "/version" path
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* only process index once instead of on every req
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* remove unneeded tag fragment
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* switch api path to const
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* revert
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* update tests
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* linter updates
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* simplify
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
* updates per peer review
Signed-off-by: James Ranson <james_ranson@cable.comcast.com>
The current meaning of the alert firing/pending/inactive
toggle seems ambiguouos as #7460 demonstrates.
This commit adds a checkbox icon to clarify the
active state of the button.
Signed-off-by: Christian Hoffmann <mail@hoffmann-christian.info>
* add the "assets" make target and change directory note in readme
Signed-off-by: Luke Chen <showuon@gmail.com>
* address reviewer's comment
Signed-off-by: Luke Chen <showuon@gmail.com>
The collapse all option as suggested in the corresponding issue
has been implemented in this PR.
Signed-off-by: Deepjyoti Mondal <djmdeveloper060796@gmail.com>
Adding the label name as a CSS class can break styling and other
behavior when the label name has a special meaning in CSS. E.g. the
"container" label was displayed at 100% width because it was interpreted
to be a bootstrap container layout element.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
We're using Prometheus behind a reverse proxy which authenticates everything based on cookies.
Without this attribute the cookie is not send with the request for the manifest.json
Signed-off-by: Stefan Bueringer <sbueringer@gmail.com>
* Support new duration format in graph range input
This is to make the duration parsing and formatting in the graph range
input field consistent with the new duration formatting introduced for
the configuration and PromQL
(https://github.com/prometheus/prometheus/pull/7713).
Ranges were previously handled in seconds - these are now handled in
milliseconds everywhere, as this makes things nicer / easier.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fixups
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Bump jquery and @types/jquery
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Properly close color box span in graph hover detail
jQuery 3.5.0 introcuded a breaking change that was necessary to fix HTML
security issues
(https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/), and as a
result the detail-swatch span wasn't closed properly anymore, because
spans are not valid self-closing tags in
XHTML.
Fixes https://github.com/prometheus/prometheus/issues/7803
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fix up tests
Signed-off-by: Julius Volz <julius.volz@gmail.com>
Further precision is truncated by the Prometheus API, so the
steps don't end up quite aligning subsequently.
Fixes#7711
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>