62 Commits

Author SHA1 Message Date
Łukasz Mierzwa
8a77d620fd Rename @status to @state
Fixes #104

@status filter was added to the master branch to support new status key from Alertmanager >=0.6.1
status ended up being nested in Alertmanager (it was added to solve AM issue 609 and that was a long PR with lots of changes), current unsee implementation ended being slightly off with how Alertmanager is naming this, it should actually be @state rather than @status.
2017-05-23 21:52:08 +01:00
Łukasz Mierzwa
46880fafd9 Split silence form code to a dedicated file
It's a lot of code, split it to a dedicated file so it's all in one place
2017-05-10 22:04:37 +01:00
Łukasz Mierzwa
fcb6c5200d Update frontend assets 2017-05-10 15:26:26 +01:00
Łukasz Mierzwa
15b5afb1a8 Update masonry 2017-05-10 15:14:04 +01:00
Łukasz Mierzwa
847df373bf Pre-render JSON silence payload when form is ready
When silence form is ready we should generate initial JSON preview, so when user clicks to show it there's something to show. Right now it's only generated if user changes something.
2017-05-10 10:51:11 +01:00
Łukasz Mierzwa
817731857a Remove all alert groups in Grid.Clear()
Clear was only hiding elements so div objects were still present, ensure they are removed from the DOM
2017-05-05 17:32:16 +01:00
Łukasz Mierzwa
0d55311a9d Replace @silenced & @inhibited filters with @status
Now that Alertmanager provides status=(unprocessed|suppressed|active) in the API it doesn't make sense to keep having separate filters for each value, merge @silenced & @inhibited into a single filter, update docs and UI
2017-05-05 13:56:48 +01:00
Łukasz Mierzwa
34c68ffb65 Rewrite js classes using prototypes
This removes the requirement on ES6 support in the browser, which will allow to use unsee on older browsers
2017-05-02 13:50:56 +01:00
Łukasz Mierzwa
12832e2c29 Fix quotation mark inconsistencies
jshint tests passing again
2017-04-27 22:52:05 -07:00
Łukasz Mierzwa
4e97f4f0aa Fix unused and undefined variables warnings 2017-04-27 22:51:53 -07:00
Łukasz Mierzwa
dd6c3b1057 Correctly anchor regex silences
Silence regex rules are not anchored, be explicit
2017-04-26 20:00:45 -07:00
Łukasz Mierzwa
7f3c414189 Don't leak event listeners in the silence form
Event listeners are setup on the modal div, but that div is not removed when the modal is hidden, only its children. This means that event listeners are stacked every time you show and hide a form. To reproduce this issue:
1. open silence form, click up button above hours, it will increment from 1 to 2
2. hide the form
3. re-open silence form, click up button above hours, it will increment from 1 to 3
4. repeat and every time increment will get a new listener that will cause higher value bump

This PR moves all listeners to the silence form element, which is removed when modal is closed, so all even listeners are destroyed properly and this bug no longer gets triggered.
Same fix is applied to the quick filter modal, it's present there but the effect there isn't as visible
2017-04-26 17:37:13 -07:00
Łukasz Mierzwa
0e7fe10b46 This should be the real fix for the even recursion
There's a bogus duplicated mouse event for a.silence-duration-btn, which I added to fix css issues, get rid of it and replace with proper css selectors. And with that drop the event.stopPropagation call as it shouldn't be needed anymore
2017-04-26 16:56:54 -07:00
Łukasz Mierzwa
aed3cf1f29 Add some space between submit button and the silence JSON preview 2017-04-26 14:17:33 -07:00
Łukasz Mierzwa
bd5b9688ac Handle load exceptions better
If js fails on startup (syntax error, can't load some files) then instead of showing blank page that doesn't work render a message with exception
2017-04-25 23:05:22 -07:00
Łukasz Mierzwa
45ba69cf76 Ensure raven-js is loaded first and works if enabled
This moves raven init into a dedicated file where it's configured on load, we no longer load it on /help, but there's only css there so there wasn't anything that could fail anyway. We will also now fail in the most visible way if the value passed to raven is invalid (as in invalid syntax)
2017-04-25 23:05:22 -07:00
Łukasz Mierzwa
5a53aa1ff7 Add jshint comments in modules that require ES6
This is to supress warnings about ES6 syntax usage, all modern browsers support 'class' so it's ok
2017-04-25 20:21:47 -07:00
Łukasz Mierzwa
9152aeff04 Prevent a chain of click events
Click events in some weird cases cause this function to be called twice, ensure that we stop processing this event after first pass
2017-04-25 19:14:18 -07:00
Łukasz Mierzwa
0c37254a71 Fix jshint warnings 2017-04-25 18:51:10 -07:00
Łukasz Mierzwa
ca0b70f3a8 Better logic for updating minutes in the duration
This makes it more consistien when user resets the duration to the minimum of 1 minute
2017-04-25 16:19:21 -07:00
Łukasz Mierzwa
3460b3003a Add a delay to the top labels popover 2017-04-25 14:59:45 -07:00
Łukasz Mierzwa
c425952b62 Don't fail if startsAt wasn't yet initialized 2017-04-25 14:59:45 -07:00
Łukasz Mierzwa
e76531a165 Make decr button reset duration to minimun if needed
With this the user is able to reset duration to minimum by clickin on the day button when only 1 hour duration is set
2017-04-25 14:59:45 -07:00
Łukasz Mierzwa
e56ec68752 Correctly update min date of the silence end time
Move it to the right place, having it in silenceFormCalculateDuration means that we can trigger recursive updates
2017-04-25 14:59:45 -07:00
Łukasz Mierzwa
c07402d353 Fix warning from jshint
jshint needs to be added to 'make lint' target eventually, let's start with fixing some of the warnings it's generating
2017-04-25 14:59:44 -07:00
Łukasz Mierzwa
e26bb6e492 Cleanup silence form controls
Drop separators and replace submit button text with an icon
2017-04-25 14:59:44 -07:00
Łukasz Mierzwa
4ba54f5573 Default to duration only UI controls
Instead of showing start & end inputs show duration input element, explicit start & end are still present under tabs, where datatime picker is inlined (so it doesn't require any click to show controls). Tabs will also show desription of relative start and end, so it should be more readable what is the real duration of a silence
2017-04-24 23:02:32 -07:00
Łukasz Mierzwa
540530488b Fix select button padding
There's an extra 25px right padding that makes no sense and creates an ugly frame when user clicks on a select, fix it
2017-04-24 16:16:37 -07:00
Łukasz Mierzwa
14cb221b6a Make the badge clickable
Clicking the badge will toggle select / deselect all values, for easy flipping labels when an alert contains large number of labels
2017-04-24 14:55:15 -07:00
Łukasz Mierzwa
03e793dd74 Add badges to selects
This gives the user a hint when a label contains more than one value in the select
2017-04-24 14:55:05 -07:00
Łukasz Mierzwa
4d3200d3fd Don't set text 'none', it can be a valid label value 2017-04-23 19:32:07 -07:00
Łukasz Mierzwa
639e9bbee5 Use icons for action box 2017-04-23 09:02:29 -07:00
Łukasz Mierzwa
d323fdd322 Turn text into labels 2017-04-23 09:02:29 -07:00
Łukasz Mierzwa
907949b9a3 Custom formatting for countSelectedText 2017-04-23 09:02:28 -07:00
Łukasz Mierzwa
f83660c43d Don't show action box when there's only one value 2017-04-23 09:02:28 -07:00
Łukasz Mierzwa
e740d5ea0c Generate more descriptive text when no value is matched 2017-04-23 09:02:28 -07:00
Łukasz Mierzwa
020b1a2728 Show loading placeholder
Form loads after ajax call, so it can take some time on big responses and slow connection
2017-04-23 09:02:27 -07:00
Łukasz Mierzwa
087458b767 Allow selecting multiple label values when creating silence.
This commit turns label checkboxes into multiselect dropdowns that are populated from all labels of all instances of current alert (matched by alertname label). There is also a cocollapsible preview box that allows user to inspect raw silence JSON object we will send to the Alertmanager API. Fixes #69
2017-04-23 09:02:27 -07:00
Łukasz Mierzwa
b407204aff Add an icon to error messages 2017-04-20 21:30:52 -07:00
Łukasz Mierzwa
d5916c81cf Add support for creating silences directly from unsee UI
It adds a button next to the @silenced filter that shows a modal window with a silence form. API request is send via AJAX call from user browser.
2017-04-20 17:01:52 -07:00
Łukasz Mierzwa
61aba84eba Fix marking invalid filters in the UI
Label classes are incorrectly set on the filter text span, rather than the label under which that span is placed.
2017-04-20 13:37:47 -07:00
Łukasz Mierzwa
a95d9a9f43 Switch typeahead.js to a maintained fork
Module was abandoned by Twitter and have some bugs that are fixed in the fork, switch over as it's a drop in replacement
2017-04-18 13:25:37 -07:00
Łukasz Mierzwa
e64010cbd1 Bloodhound will run init unless asked not to, remove explicit call 2017-04-18 13:25:37 -07:00
Łukasz Mierzwa
e30d8b79e9 If internal autocomplete index doesn't have 12 elemts (UI limit) query remote 2017-04-18 13:25:36 -07:00
Łukasz Mierzwa
ad3ed87aed Add a comment describing generateHints() use 2017-04-18 13:25:36 -07:00
Łukasz Mierzwa
9dc07d6cb9 Use relative path for autocomplete so it works with -web.prefix 2017-04-18 13:25:36 -07:00
Łukasz Mierzwa
79516e59c9 Fix settings reset button
Correctly remove save filter and reload the filter to the defaults by removing ?q= query arg
2017-04-18 09:31:29 -07:00
Łukasz Mierzwa
0a16da7604 Show inhibition status in the UI
Show it the same way as @silenced is being presented
2017-04-17 16:14:26 -07:00
Łukasz Mierzwa
f1e90e054d Rewrite clientside-haml-js templates using underscore
Drop haml templates in favor of underscore. Haml templates are harder to maintain and require extra dependencies, we already have underscore.js included and it provides a fast templating engine. Rewrite all client side templates using it.
Performance with underscore is pretty much the same as with haml (with 10k alerts).
2017-04-10 11:38:34 -07:00
Łukasz Mierzwa
001006bfe0 Move tooltip setup to the ui package 2017-04-08 11:29:11 -07:00