-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Click alert matchers #690
Conversation
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 |
ui/app/src/Updates.elm
Outdated
in | ||
( { model | mode = mode }, Cmd.none ) | ||
|
||
AddLabel msg ( key, value ) -> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I've seen many web-apps use crtl for multi-select, it has been the standard for desktop apps for decades. |
the ctrl+click felt natural to me, but that is just my personal feeling. If the group decides to have a default |
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. |
I don't think
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. |
ui/app/src/Updates.elm
Outdated
) | ||
|> (\labels -> | ||
if List.member label labels then | ||
List.filter (\l -> l /= label) labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List.filter ((/=) label) labels
ui/app/src/Views/AlertList/Views.elm
Outdated
|
||
labels = | ||
List.filterMap | ||
(\( k, v ) -> |
There was a problem hiding this comment.
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
ui/app/src/Updates.elm
Outdated
if String.isEmpty cleaned then | ||
[] | ||
else | ||
Regex.split Regex.All (Regex.regex "\\s*,\\s*") cleaned |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
- Normal click replaces filter with selected label - Modifier (ctrl, cmd) + click appends to filter
8c53eb9
to
08371cc
Compare
@@ -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"} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
This PR closes prometheus#690
On alert list view, clicking a matcher sets the filter to that value. Holding
ctrl
orcmd
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