Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click alert matchers #690

Merged
merged 7 commits into from
Apr 8, 2017
Merged

Click alert matchers #690

merged 7 commits into from
Apr 8, 2017

Conversation

stuartnelson3
Copy link
Contributor

On alert list view, clicking a matcher sets the filter to that value. Holding ctrl or cmd will append to the current filter, or, if the label already exists, it will remove it. The UX motivation behind this is how users interact with a standard filesystem GUI -- clicking single files highlights that file, cmd+click'ing will select multiples.

Play around with it to make sure it's working correctly, and that this UX is what we want.

addresses #674

@stuartnelson3 stuartnelson3 requested a review from mxinden April 3, 2017 15:26
@stuartnelson3
Copy link
Contributor Author

@w0rm

@mxinden
Copy link
Member

mxinden commented Apr 4, 2017

I like the idea of multi-label-selection but I don't know any web application that uses ctrl to do multi-select. This seems rather not intuitive for a web application. Do we need the replace option? Can't we just make the append option default without needing to press the ctrl button?

in
( { model | mode = mode }, Cmd.none )

AddLabel msg ( key, value ) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only relevant for the SilenceList and the AlertList right? Would it be possible to move it down into the respective update functions? Feels weird that this lives in the global update function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure where to put it. It's definitely something only concerned with the SilenceList and AlertList views, but it is updating the top-level filter.

All the code for labels should be extracted into its own filter method, so it wouldn't be a problem to have the two different update functions implement this.

Thinking about this now, it would simplify the message being sent, and then the update function in question would know what follow-up message to use (fetch alerts/silences). I'll give it a try and see how it looks.

@brian-brazil
Copy link
Contributor

I've seen many web-apps use crtl for multi-select, it has been the standard for desktop apps for decades.

@stuartnelson3
Copy link
Contributor Author

the ctrl+click felt natural to me, but that is just my personal feeling.

If the group decides to have a default Append behavior and clicking the same label twice removes it, that's fine too. I'm not sure what the current expected web behavior is for something like this, but having talked briefly with @beorn7 this seemed to make sense to us both.

@brancz
Copy link
Member

brancz commented Apr 4, 2017

I don't have the possibility to spin this up myself right now, but from the mock ups we did on the whiteboard I would expect one click to add a label to a query in some kind of a search bar. Then a label in the query would have an "x" button to remove it from the query. Something like this.

@brancz
Copy link
Member

brancz commented Apr 4, 2017

I don't think

I've seen many web-apps use crtl for multi-select, it has been the standard for desktop apps for decades.

Is an argument for it from a usability perspective. Just because it's been done for a long time, it doesn't mean it's good in terms of usability.

)
|> (\labels ->
if List.member label labels then
List.filter (\l -> l /= label) labels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List.filter ((/=) label) labels


labels =
List.filterMap
(\( k, v ) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filterMap is only needed when you want to filter and map. In this case filter is enough.

labels = List.filter (Tuple.first >> (/=) "alertname") alert.labels

if String.isEmpty cleaned then
[]
else
Regex.split Regex.All (Regex.regex "\\s*,\\s*") cleaned
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if you call Regex.split on the empty string? Wouldn't this result with an empty list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I check in the other if branch if it is an empty string and return an empty list

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartnelson3 why do you need this check? Won't Regex.split work on the empty string?

@w0rm w0rm force-pushed the click-alert-matchers branch from 8c53eb9 to 08371cc Compare April 7, 2017 10:02
@@ -37,15 +37,14 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

const elmMake = "elm-make"
elmMakeArgs := []string{"src/Main.elm", "--output", "script.js"}
elmMakeArgs := []string{"make", "src/Main.elm", "--yes", "--output", "script.js"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future there will only be a single elm binary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cool. In general we try to bundle relevant code changes together in a PR, so try to do that in the future. That having been said, this main.go file is totally unimportant, so no worries on changing it here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should've opened a separate PR for this change. If you want, I can still do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a problem, this file will get deleted soon (I hope)

For now we are still going to require the user to
explicitly click "filter" before we send an API
request to update the list.
else
buttonLink "fa-exclamation-triangle" "#/silences/new?keep=1" "dark-red" (CreateSilenceFromAlert alert)

labels =
List.filter (Tuple.first >> (/=) "alertname") alert.labels
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can read and understand what it's doing, but how is blowing my mind.

@stuartnelson3 stuartnelson3 merged commit 8e4c29f into ui-rewrite Apr 8, 2017
@stuartnelson3 stuartnelson3 deleted the click-alert-matchers branch April 8, 2017 11:00
hh pushed a commit to ii/alertmanager that referenced this pull request Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants