Commit Graph

216 Commits

Author SHA1 Message Date
Łukasz Mierzwa
c6288d27a2 Show silence ID in the UI
This adds silence ID to the list of rendered silence elements, clicking on it will allow to copy it to the clipboard. Fixes #203
2018-01-03 13:15:19 -08:00
Łukasz Mierzwa
6273a5a585 Rewrite flag & env handling to use viper
This adds support for reading configuration from file, env support is still there and legacy env variables will still work, but flags are now following config schema, so they don't match old flags.
Having a config file allows to express more complex configuration options, which is needed for some feature requests.
2017-11-27 20:34:36 -08:00
Łukasz Mierzwa
a8c158963d Trim very long history menu items
If there's a very long menu item entry we should trim it
2017-09-07 12:22:41 -07:00
Łukasz Mierzwa
5d0366a743 Redraw alert grid after annotations visibility toggle
Alert group needs more space after expanding, so we need to redraw everything.
2017-09-07 12:15:32 -07:00
Łukasz Mierzwa
843eb80060 Add button to toggle annotation visibility
If user make annotation hidden by default, then render a button that allows to show it per label
2017-09-07 12:15:32 -07:00
Łukasz Mierzwa
21a8091a70 Handle complex annotations correctly in the frontend template 2017-09-07 12:15:32 -07:00
Łukasz Mierzwa
44830cc3c9 Use info icon instead of help, also escape annotation keys
Help icon doesn't make sense for annotation key, info icon is a bit more related to the usage of annotations
2017-08-18 12:09:35 -07:00
Łukasz Mierzwa
c7442c3adf Linkify URLs in the annotation
use linkifyjs to make all URLs in the annotation clickable, but since it requires us to stop escaping html when rendering annotation object let's first manually escape it to prevent rogue alerts with malicious annotations from executing <scripts> and other ugly things in user browsers
2017-08-18 12:09:35 -07:00
Łukasz Mierzwa
3124049c5a Fix wrong status in error
Doesn't matter for test result, but should be error since we return 500
2017-08-17 19:42:08 -07:00
Łukasz Mierzwa
f96cafca7b Test creating silences 2017-08-17 19:42:08 -07:00
Łukasz Mierzwa
ac8b3391d7 Re-use ajax mocks instead of creating one per response 2017-08-15 20:22:57 -07:00
Łukasz Mierzwa
866797cc42 Add more silence.js tests 2017-08-15 20:20:35 -07:00
Łukasz Mierzwa
431540c05e Add a test case for error handling when unsilence request fails 2017-08-15 19:53:26 -07:00
Łukasz Mierzwa
77ec8d9a8b Use correct icon
Tests are failing because we're not cleaning icons properly
2017-08-15 19:45:00 -07:00
Łukasz Mierzwa
ecf14e7633 Add a test for unsilence button 2017-08-15 19:43:49 -07:00
Łukasz Mierzwa
c6e91c658e Update test snapshots
Rendered HTML changed, so tests need updating
2017-08-15 09:46:58 -07:00
Łukasz Mierzwa
15b3072a33 Render search history and default/saved filter separator only if needed
If there are no recorded search filters than we don't need any separator
2017-08-15 09:46:58 -07:00
Łukasz Mierzwa
536379434d Enable tooltips for history dropdown
It's a dropdown so data-toggle is already used for the menu
2017-08-15 09:46:58 -07:00
Łukasz Mierzwa
d92e08f3f6 Don't reload filters until entire applyFilterList() block was completed
setFilters() will trigger fetch of the new alerts with updated filter, it's being called after each filter is added to the filter bar, so each added filter ends up with AJAX call to /alerts.json, this means that when someone clicks on a history entry with complex rule it will trigger multiple subsequent requests. What's worse first request will have bigger response body (since it filters less) so it's likely that it will finish after the next request, leaving invalid alerts on the grid. This disable setFilters() if we apply filters in batch mode.
2017-08-14 20:10:44 -07:00
Łukasz Mierzwa
c7b18f314d Add applyFilterList() function and move logic there 2017-08-13 19:25:55 -07:00
Łukasz Mierzwa
9ba23d1658 Tweak history menu UI
Show search icon for search history elements and provide a separate entries for the default and saved filter.
Default & saved filter are always rendered on the bottom, if they are non-empty.
2017-08-13 16:55:51 -07:00
Łukasz Mierzwa
256453ccaf Add snapshot tests for history dropdown 2017-08-12 21:21:25 -07:00
Łukasz Mierzwa
9645287d88 Use a Set() instead of array
We only want unique values, Set is better for this
2017-08-12 19:57:30 -07:00
Łukasz Mierzwa
f0dc85ad0b Pass storage implementation as an argument
Instead of assuming that window.localStorage is always used pass it via arguments
2017-08-11 16:40:29 -07:00
Łukasz Mierzwa
6809733346 Add history tests 2017-08-11 16:40:29 -07:00
Łukasz Mierzwa
4bb14312ff Mock local storage when running tests 2017-08-11 16:40:29 -07:00
Łukasz Mierzwa
ea62db3c2f Save filters usage history to local storage and provide a dropdown menu to access it
This allows to quickly select recently used filters from a dropdown. It also shows default (configured by unsee admin) filter and the saved one (saved by the user to a cookie)
2017-08-11 16:40:27 -07:00
Łukasz Mierzwa
d8efb97f97 Provide .less style for bootstrap-tagsinput
We use flatly theme for bootstrap while bootstrap-tagsinput bundles a css file that follow vanilla style, create a less version and use it instead of the css one bundles with bootstrap-tagsinput.
typeahead.js allows to customize class names used for UI elements, but bootstrap-tagsinput doesn't support passing that and is no longer maintained, so we need to follow default typeahead.js classes.
2017-08-10 16:53:30 -07:00
Łukasz Mierzwa
55c722773a Resume auto-refresh on backspace
Right now if user starts typing & then starts pressing backspace we pause but never resume, because stopping pressing backspace is ignored when resuming.
2017-08-08 12:03:33 -07:00
Łukasz Mierzwa
937f12e5e0 Update jquery.typing to 0.3.2 2017-08-08 11:57:38 -07:00
Łukasz Mierzwa
bea01196b3 Add more watchdog tests 2017-08-02 20:58:05 -07:00
Łukasz Mierzwa
ae5f0e39ae remove dead code from templates.test.js 2017-08-02 20:57:24 -07:00
Łukasz Mierzwa
90646a3727 Fix is-in-viewport mock to return true 2017-08-02 20:11:32 -07:00
Łukasz Mierzwa
eb21642103 Add reload tests 2017-07-30 21:35:01 -07:00
Łukasz Mierzwa
b6d5a5614e Run end-to-end tests for unsee.js
This will allow to test entire alerts flow - get alerts.json response (via mocks) and render alerts
2017-07-30 21:08:11 -07:00
Łukasz Mierzwa
2020099987 Mock templates so we actually load and parse all of them 2017-07-30 20:18:32 -07:00
Łukasz Mierzwa
bd249e4c02 Proper behaviour tests for ui.js
Checks whenever code does what it suppose to, not only if it runs
2017-07-30 17:25:10 -07:00
Łukasz Mierzwa
558ace10fc More coverage in the ui.js module tests 2017-07-30 15:53:28 -07:00
Łukasz Mierzwa
f6078d9f1f Add proper counter.js tests 2017-07-29 23:14:42 -07:00
Łukasz Mierzwa
3eb1e0cafd Test color.merge() 2017-07-29 16:57:36 -07:00
Łukasz Mierzwa
89223e8fbd Move all imports to head to avoid unstyled html on load 2017-07-29 16:26:28 -07:00
Łukasz Mierzwa
f202232be8 Version all bundles
This will tell webpack to add a hash to all bundles filenames, we generate script tags for loading those and inject them as templates. No more forced cache bypassing
2017-07-29 16:19:48 -07:00
Łukasz Mierzwa
91b55faf90 Drop old assets Makefile
No longer needed since webpack handles it now
2017-07-29 14:56:07 -07:00
Łukasz Mierzwa
566de0c347 Fix nprogress usage and styling 2017-07-29 14:43:51 -07:00
Łukasz Mierzwa
557c55dc64 Add a bundle for /help page 2017-07-29 14:22:55 -07:00
Łukasz Mierzwa
a694add079 Fix css selectors not firing with webpack 2017-07-29 13:54:14 -07:00
Łukasz Mierzwa
ca1081f461 Correctly bundle favicon.ico file 2017-07-29 13:52:55 -07:00
Łukasz Mierzwa
8f5c246297 Move to fully webpack managed assets 2017-07-29 13:52:07 -07:00
Łukasz Mierzwa
6105ae87d2 Get rid of last managed assets, everything is in webpack now 2017-07-29 13:51:29 -07:00
Łukasz Mierzwa
b08d203a04 Make is-in-viewport work with webpack 2017-07-29 13:50:55 -07:00