* React UI: Fix issue when changing query then time, the old query is executed
Signed-off-by: Dustin Hooten <dhooten@splunk.com>
* pr feedback
Signed-off-by: Dustin Hooten <dhooten@splunk.com>
* more pr feedback
Signed-off-by: Dustin Hooten <dhooten@splunk.com>
* move graph related files into own folder
Signed-off-by: blalov <boiskila@gmail.com>
* move graph helper functions into own file
Signed-off-by: blalov <boiskila@gmail.com>
* fix typo in file name
Signed-off-by: blalov <boiskila@gmail.com>
* fix typo in file name and lint fixes
Signed-off-by: blalov <boiskila@gmail.com>
* React UI: Fix tests harder
Again not sure why this passed last time (?), but now I was getting an
error about 'NaN' not being a valid value to assign to the 'height'
property of the input element. This changes it so that only the blur()
function is actually mocked out on the active input element.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fixup
Signed-off-by: Julius Volz <julius.volz@gmail.com>
It being a Reach Router <Link> caused the Reach router to not actually
leave the React app, even though the destination path was not a path
handled by the Reach Router.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This fixes two TypeScript errors. Not sure why we didn't catch the
breakage in the PR CI tests... also, updating TypeScript just for good
measure.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This is a quick change because the release is about to be cut in a few
hours and it would be good to clarify to users what the empty pages in
the new UI are about.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Adding TSDB Head Stats like cardinality to Status Page
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Moving mutx to Head
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Renaming variabls
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Renaming variabls and html
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Removing unwanted whitespaces
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Adding Tests, Banchmarks and Max Heap for Postings Stats
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Adding more tests for postingstats and web handler
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Adding more tests for postingstats and web handler
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Remove generated asset file that is no longer used
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
* Changing comment and variable name for more readability
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* Using time.Duration in postings status function and removing refresh button from web page
Signed-off-by: Sharad Gaur <sgaur@splunk.com>
* pass the value to the input instead to downshift
Signed-off-by: blalov <boyko.lalov@tick42.com>
* adjust expression input tests
Signed-off-by: blalov <boyko.lalov@tick42.com>
* improve ExpressionInput test coverage
Signed-off-by: blalov <boyko.lalov@tick42.com>
* React UI: Support custom path prefixes
The challenge was that the path prefix can be set dynamically as a flag
on Prometheus, but the React app bundle is statically compiled in to
expect a given path prefix. By adding a placeholder value to the React
app's index.html and replacing it in Prometheus with the right path
prefix during serving, this injects Prometheus's path prefix into the
React app via a global const.
Threading the path prefix into the different React components could have
been done with React's Contexts (https://reactjs.org/docs/context.html),
but I found the consumer side of context values to be a bit cumbersome
(wrapping entire components in context consumers), so I ended up
preferring direct threading of the path prefix values to components that
needed them. Also, using contexts in tests is more verbose than just
passing in path prefix values directly.
Fixes https://github.com/prometheus/prometheus/issues/6163
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Review feedback
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* React UI: Improve styling of autocomplete sections
I removed the Card-related components and went back to normal <ul>/<li>,
since the style that Cards added just got in the way (like adding extra
borders and rounding, etc.), and from the examples at
https://getbootstrap.com/docs/4.3/components/card/, it doesn't seem like
multiple Cards are meant to be used as part of a larger list
(style-wise).
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Address review feedback
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* React UI: More conversions to Function Components
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Address chat feedback over Riot
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Implement the /flags page in react
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
* Use custom react hook for calling api
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
* local storage selectedTab on targets tab was renamed
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
* added filters when displaying alerts
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
* function was simplified
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
* fixed rebase
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
* minor rename
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
* Active -> Pending
Signed-off-by: Michał Szczygieł <1153719+mszczygiel@users.noreply.github.com>
This makes React UI URLs look nicer than the previous
/static/graph-new/app.html, but internally still serves all React UI
files from the compiled-in static assets directory.
Also, to allow future usage of the React / Reach router, we need to
serve the main React app's index.html on certain sub-paths that
correspond to current Prometheus's UI pages, instead of trying to serve
actual files that match the provided path name.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Use root relative font size rather than px to avoid hidpi issues.
* Darken to 50% saturation of base font color.
Signed-off-by: Ben Kochie <superq@gmail.com>
The metric names only get loaded once initially, so there is no reason
to mix them up with the handling of ongoing query history.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Adds the query stats to UI
Adds the query load time, resolution and total number of time series,
as the current UI has
Signed-off-by: cstdev <pietomb00@hotmail.com>
* Implement unit test for QueryStats
Signed-off-by: cstdev <pietomb00@hotmail.com>
* Tidy Query Stats component
Rename it and expose a interface for the values it displays
Make it a functional component as it has no state or lifecycle
Better null/undefined checks
Only render if needed, decided by the panel
Remove old stats if the next errors
Signed-off-by: cstdev <pietomb00@hotmail.com>
* make expression input controlled
Signed-off-by: blalov <boyko.lalov@tick42.com>
* close menu explicitly when autosuggestion dropdown is hidden
Signed-off-by: blalov <boyko.lalov@tick42.com>
* Add component to sanitize html
Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>
* Use SanitizeHTML component to allow only supported elements
Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>
* Add allowedTags props in SanitizeHTML component
Signed-off-by: Ritesh Shrivastav <ritesh.conf@gmail.com>
* Update all React app node modules
I ran "yarn upgrade --latest" and then fixed items that caused errors
with new linter settings in the React UI source.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fix more React UI lint errors that fail CI
Signed-off-by: Julius Volz <julius.volz@gmail.com>