WIP components (as built)
This commit is contained in:
80 files changed
+2754
-132
No files matched your search
+4
-4
@@ -40,11 +40,11 @@ type AlertListOptions struct {
|
||||
// AlertListResult reports this frame's request.
|
||||
type AlertListResult struct {
|
||||
Element *ui.Element
|
||||
// Ack and Silence are the IDs to acknowledge or silence for an hour, else "".
|
||||
// Ack and Silence report requested alert IDs; empty means idle.
|
||||
Ack, Silence string
|
||||
}
|
||||
|
||||
// AlertList lists alerts by level, source and time with acknowledge and silence.
|
||||
// AlertList shows alerts with acknowledge and silence actions.
|
||||
func AlertList(c *ui.Context, alerts []AlertItem, opts AlertListOptions) AlertListResult {
|
||||
if opts.MaxHeight < 0 {
|
||||
panic("mujica: AlertList MaxHeight is negative")
|
||||
@@ -86,7 +86,7 @@ func AlertList(c *ui.Context, alerts []AlertItem, opts AlertListOptions) AlertLi
|
||||
return r
|
||||
}
|
||||
|
||||
// alertRow shows one alert and reports its acknowledge and silence presses.
|
||||
// alertRow shows an alert with acknowledge and silence buttons.
|
||||
func alertRow(c *ui.Context, a AlertItem, locked bool) (ack, silence bool) {
|
||||
k := Tokens(c)
|
||||
d := Density(c)
|
||||
@@ -94,7 +94,7 @@ func alertRow(c *ui.Context, a AlertItem, locked bool) (ack, silence bool) {
|
||||
sev := [...]Severity{SeverityInfo, SeverityWarning, SeverityError}[a.Level]
|
||||
word := msg(c, [...]string{"alert_list.info", "alert_list.warning", "alert_list.critical"}[a.Level])
|
||||
silenced := a.Silence.After(c.Now())
|
||||
row := ui.Row(c).Key(a.ID).Gap(u * 3).AlignItems(ui.Center).MinHeight(d.ControlHeight() + u*2).Padding(u*2, u*3).
|
||||
row := ui.Row(c).Key(a.ID).Gap(u*3).AlignItems(ui.Center).MinHeight(d.ControlHeight()+u*2).Padding(u*2, u*3).
|
||||
Label(word + ", " + a.Title)
|
||||
if tone, _ := severityLook(k, sev); a.Level == AlertCritical && !a.Acked {
|
||||
row.DrawOver(func(p *ui.Painter, r ui.Rect) { p.Fill(ui.Rect{X: r.X, Y: r.Y, W: 3, H: r.H}, tone, 0) })
|
||||
|
||||
Reference in new issue
Block a user