* web/ui: handle null case
The call might sometimes return /api/v1/label/__name__/values the
following:
```
{"status":"success","data":null}
```
Then the `index.js` file assumes that `data` is not `null`. However,
that assumption fails and then we get this error in the console:
```
graph.js?v=foo:317 Uncaught TypeError: Cannot read property 'length' of null
at Object.success (graph.js?v=foo:317)
...
```
Then it becomes impossible to, for example, send a simple query like
`time()` and graph the results.
Fix it by using an empty array as the result if it is `null`.
Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
* ui: update static assets data
Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
* Show warnings in UI if query have returned some warnings
+ improve warning (error) text if query to remote was finished with error
* Add prefixes for remote_read errors
Signed-off-by: Stan Putrya <root.vagner@gmail.com>
* Fix context for the showWarning function
If the difference between the current time on a client and time on a server is quite big, Prometheus tries to show a related warning in UI on the Graph tab. But in the code, an incorrect context is used to invoke this method. As a result, an error is showed in the web developer console and the whole page stop working at all. This commit fixes the context.
CC @juliusv
Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>
* Fix context for the showWarning function
Fixed assets
CC @juliusv
Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>
- input key handler causes 2 layout cycles on each keypress which can
clog up browser rendering when typing quickly
- this change adds a debounce to the key press handler of 500ms
Fixes#5308
Signed-off-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
1. Added an ability to resize text area on mouseclick
2. Remember selected target status button on page reload
Signed-off-by: Maria Nemtinova <nemtinovamasha@gmail.com>
* Fix JS error: cannot read source of undefined
When the page was refreshed with queries on the page,
the updateTypeaheadMetricsSet function was called before
the typeahead had been initialized.
* Fix: updates URL when query submits
When queries were submitted by pressing enter, the URL did not update
to reflect the change. Not sure why, but this was only the case when
the queries were non-simple, meaning when either labels werre specified
or other promql functions were used.
* Rebase master and make assets
* Do not autoselect the first item in the dropdown
* Historical queries only show in dropdown when toggled on
* Move shared behavior to queryHistory.isEnabled function
* Do not auto submit selected history queries