* Upgrade bootstrap and reactstrap to the latest version
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add SASS support
node-sass is needed for cra to handle SCSS files instead of pure CSS.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme
This adds a dark theme and UI controls to switch between themes.
Dark theme will require some CSS changes that will follow in future commits.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a margin to Prometheus brand
There is no space between 'Prometheus' brand text and the toggle button when using mobile device.
This adds a margin to the button that's only rendered on mobile
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for CollapsibleAlertPanel
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for RulesContent
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for Config
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Use bootstrap classes for margins
We can override margins via bootstrap css classes instead of loading custom css module.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for QueryStatsView
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for MetricsExplorer
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for 'Clear time' button
This button had some custom css based on light bootstrap theme so it needs to be adjusted for dark theme.
This change re-uses bootstrap styles used for input components instead of copying color values
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add dark theme for Graph panel input
This makes the whole input group look consistent in dark mode as the old styles were made to blend it with the default bootstrap theme.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for CME expression input
This change splits current CME theme into 3:
1 - base theme used for both light and dark mode
2 - light mode specific theme that overrides base
3 - dark mode specific theme that overrides base
To make it all work we also need to move theme to dynamic config, so when theme value
in ThemeContext changes CME input will apply a new theme.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Add a dark theme for /graph page tabs
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Fix metrics explorer modal scroll
bootstrap-dark breaks scrolling on the metrics modal, so we need an extra rule to fix that.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Move App.css rules to themes/_shared.scss
This completes splitting styles into light and dark theme.
It also fixes some small issues with themes as now all styles from App.css are applied correctly.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Move html{} styles to a dedicated file
html block is root document so styles for it cannot be nested under theme classes.
Move it out and add a bit of documentation to explain what which file does.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Fix reboot styles overriding other FontAwesome classes
Both bootstrap themes we use import reboot classes (https://getbootstrap.com/docs/4.6/content/reboot/) which has the side effect of overriding other classes. We need reboot to be applied as defaults for the browser, so it needs to be moved out of theme class selectors. But because reboot requires scss variables we need to feed it something, for that we use the default light theme, so it gets imported there and browser will use style of the default theme to reset default (unthemed) styles.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* Move codicon font to app.scss
This needs to be applied globally, not per theme.
Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
* bump cm-promql to v0.14.1
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
* enhancement a bit the way to build the codemirror PromQL extension
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
* Changed error wording
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Added another test and moved both into the correct suite
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Added 16w and 26w time range steps
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Fixed indentation
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Check response and return alternate page if no statistics
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Added tests for alternate page
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Change error handling in unixToTime
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* 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>