gofmt
This commit is contained in:
10 files changed
+22
-15
No files matched your search
+1
-1
@@ -94,7 +94,7 @@ func alertRow(c *ui.Context, a AlertItem, locked bool) (ack, silence bool) {
|
|||||||
sev := [...]Severity{SeverityInfo, SeverityWarning, SeverityError}[a.Level]
|
sev := [...]Severity{SeverityInfo, SeverityWarning, SeverityError}[a.Level]
|
||||||
word := msg(c, [...]string{"alert_list.info", "alert_list.warning", "alert_list.critical"}[a.Level])
|
word := msg(c, [...]string{"alert_list.info", "alert_list.warning", "alert_list.critical"}[a.Level])
|
||||||
silenced := a.Silence.After(c.Now())
|
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)
|
Label(word + ", " + a.Title)
|
||||||
if tone, _ := severityLook(k, sev); a.Level == AlertCritical && !a.Acked {
|
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) })
|
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) })
|
||||||
|
|||||||
+4
-2
@@ -52,7 +52,7 @@ func AttachmentChip(c *ui.Context, a Attachment) AttachmentChipResult {
|
|||||||
if a.Err != nil {
|
if a.Err != nil {
|
||||||
border = k.Danger
|
border = k.Danger
|
||||||
}
|
}
|
||||||
r.Element = ui.Row(c).Gap(u * 2).AlignItems(ui.Center).Padding(u, u, u, u*2).Width(220).
|
r.Element = ui.Row(c).Gap(u*2).AlignItems(ui.Center).Padding(u, u, u, u*2).Width(220).
|
||||||
Radius(theme.ControlRadius).Background(k.Surface).Border(theme.BorderWidth, border).Role(ui.RoleGroup).Label(a.Name)
|
Radius(theme.ControlRadius).Background(k.Surface).Border(theme.BorderWidth, border).Role(ui.RoleGroup).Label(a.Name)
|
||||||
disabled := r.Element.IsDisabled()
|
disabled := r.Element.IsDisabled()
|
||||||
r.Element.Children(func() {
|
r.Element.Children(func() {
|
||||||
@@ -72,7 +72,9 @@ func AttachmentChip(c *ui.Context, a Attachment) AttachmentChipResult {
|
|||||||
ui.Text(c, fmt.Sprintf(msg(c, "attachment_chip.uploading"), pct)).SingleLine().FontSize(small).TextColor(k.TextMuted).FontFeatures("tnum")
|
ui.Text(c, fmt.Sprintf(msg(c, "attachment_chip.uploading"), pct)).SingleLine().FontSize(small).TextColor(k.TextMuted).FontFeatures("tnum")
|
||||||
frac := float32(a.Progress)
|
frac := float32(a.Progress)
|
||||||
ui.Box(c).Height(3).Radius(1.5).Background(k.Border).Role(ui.RoleProgress).Label(fmt.Sprintf(msg(c, "attachment_chip.uploading"), pct)).
|
ui.Box(c).Height(3).Radius(1.5).Background(k.Border).Role(ui.RoleProgress).Label(fmt.Sprintf(msg(c, "attachment_chip.uploading"), pct)).
|
||||||
Draw(func(p *ui.Painter, b ui.Rect) { p.Fill(ui.Rect{X: b.X, Y: b.Y, W: b.W * frac, H: b.H}, k.AccentText, 1.5) })
|
Draw(func(p *ui.Painter, b ui.Rect) {
|
||||||
|
p.Fill(ui.Rect{X: b.X, Y: b.Y, W: b.W * frac, H: b.H}, k.AccentText, 1.5)
|
||||||
|
})
|
||||||
default:
|
default:
|
||||||
ui.Text(c, fileMessageSize(c, a.Size)).SingleLine().FontSize(small).TextColor(k.TextMuted)
|
ui.Text(c, fileMessageSize(c, a.Size)).SingleLine().FontSize(small).TextColor(k.TextMuted)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -15,9 +15,9 @@ import (
|
|||||||
type Source struct {
|
type Source struct {
|
||||||
// Title and URL are required.
|
// Title and URL are required.
|
||||||
Title, URL string
|
Title, URL string
|
||||||
Site string
|
Site string
|
||||||
Snippet string
|
Snippet string
|
||||||
Published time.Time
|
Published time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// CitationState links citations, source cards and the sources panel; the caller holds it.
|
// CitationState links citations, source cards and the sources panel; the caller holds it.
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ func incidentUpdate(c *ui.Context, k theme.Tokens, up IncidentUpdate, last bool)
|
|||||||
}
|
}
|
||||||
p.FillPath(internal.Diamond(cx, cy, 9), k.Ornament)
|
p.FillPath(internal.Diamond(cx, cy, 9), k.Ornament)
|
||||||
})
|
})
|
||||||
ui.Column(c).Grow(1).Shrink(1).Gap(u / 2).Padding(0, 0, u*2, 0).Children(func() {
|
ui.Column(c).Grow(1).Shrink(1).Gap(u/2).Padding(0, 0, u*2, 0).Children(func() {
|
||||||
ui.Row(c).Gap(u * 2).Children(func() {
|
ui.Row(c).Gap(u * 2).Children(func() {
|
||||||
ui.Text(c, incidentStatusWord(c, up.Status)).FontWeight(600)
|
ui.Text(c, incidentStatusWord(c, up.Status)).FontWeight(600)
|
||||||
if !up.At.IsZero() {
|
if !up.At.IsZero() {
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ func logStreamRow(c *ui.Context, l LogLine) {
|
|||||||
k := Tokens(c)
|
k := Tokens(c)
|
||||||
d := Density(c)
|
d := Density(c)
|
||||||
col := [...]ui.Color{k.TextMuted, k.Info, k.Warning, k.Danger}[l.Level]
|
col := [...]ui.Color{k.TextMuted, k.Info, k.Warning, k.Danger}[l.Level]
|
||||||
ui.Row(c).MinHeight(d.ControlHeight() - 8).Padding(0, d.Unit()*3).Gap(d.Unit() * 3).AlignItems(ui.Center).Children(func() {
|
ui.Row(c).MinHeight(d.ControlHeight()-8).Padding(0, d.Unit()*3).Gap(d.Unit() * 3).AlignItems(ui.Center).Children(func() {
|
||||||
if !l.Time.IsZero() {
|
if !l.Time.IsZero() {
|
||||||
codeMono(c, l.Time.Format("15:04:05.000")).TextColor(k.TextMuted).Shrink(0)
|
codeMono(c, l.Time.Format("15:04:05.000")).TextColor(k.TextMuted).Shrink(0)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -41,7 +41,9 @@ func ParameterPanel(c *ui.Context, params []ModelParam) ChoiceResult {
|
|||||||
}
|
}
|
||||||
r.Element.Children(func() {
|
r.Element.Children(func() {
|
||||||
for _, p := range params {
|
for _, p := range params {
|
||||||
format := func(v float64) string { return strconv.FormatFloat(v, 'f', sliderDecimals(p.Min, p.Step, p.Default), 64) }
|
format := func(v float64) string {
|
||||||
|
return strconv.FormatFloat(v, 'f', sliderDecimals(p.Min, p.Step, p.Default), 64)
|
||||||
|
}
|
||||||
ui.Column(c).Key(p.Label).Gap(u).Children(func() {
|
ui.Column(c).Key(p.Label).Gap(u).Children(func() {
|
||||||
ui.Row(c).Gap(u * 2).AlignItems(ui.Center).Children(func() {
|
ui.Row(c).Gap(u * 2).AlignItems(ui.Center).Children(func() {
|
||||||
ui.Text(c, p.Label).FontWeight(600).Grow(1).SingleLine()
|
ui.Text(c, p.Label).FontWeight(600).Grow(1).SingleLine()
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ func SchemaTree(c *ui.Context, s *SchemaTreeState, roots []SchemaNode, opts Sche
|
|||||||
restore := dataSelectTheme(c, 0)
|
restore := dataSelectTheme(c, 0)
|
||||||
e := ui.Outline(c, &s.outline, s.roots, func(p string) []string { return s.kids[p] }, func(p string) {
|
e := ui.Outline(c, &s.outline, s.roots, func(p string) []string { return s.kids[p] }, func(p string) {
|
||||||
n := s.nodes[p]
|
n := s.nodes[p]
|
||||||
ui.Row(c).Grow(1).MinWidth(0).MinHeight(d.ControlHeight()-2*d.Unit()).Gap(d.Unit()*2).AlignItems(ui.Center).
|
ui.Row(c).Grow(1).MinWidth(0).MinHeight(d.ControlHeight() - 2*d.Unit()).Gap(d.Unit() * 2).AlignItems(ui.Center).
|
||||||
Label(fmt.Sprintf("%s %s %s", schemaWord(c, n.Kind), n.Name, n.Detail)).Children(func() {
|
Label(fmt.Sprintf("%s %s %s", schemaWord(c, n.Kind), n.Name, n.Detail)).Children(func() {
|
||||||
sel, _ := s.Selected()
|
sel, _ := s.Selected()
|
||||||
codeSelectMark(c, sel == p)
|
codeSelectMark(c, sel == p)
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ func ServiceStatus(c *ui.Context, services []ServiceItem, opts ServiceStatusOpti
|
|||||||
summary := msg(c, [...]string{"service_status.all_ok", "service_status.some_degraded", "service_status.some_down"}[worst])
|
summary := msg(c, [...]string{"service_status.all_ok", "service_status.some_degraded", "service_status.some_down"}[worst])
|
||||||
col := ui.Column(c).Shrink(0).Gap(u * 2).Label(summary)
|
col := ui.Column(c).Shrink(0).Gap(u * 2).Label(summary)
|
||||||
col.Children(func() {
|
col.Children(func() {
|
||||||
ui.Row(c).Gap(u * 3).AlignItems(ui.Center).Padding(u*3).Radius(theme.CardRadius).Border(theme.BorderWidth, k.Border).
|
ui.Row(c).Gap(u*3).AlignItems(ui.Center).Padding(u*3).Radius(theme.CardRadius).Border(theme.BorderWidth, k.Border).
|
||||||
Background(k.Surface).Role(ui.RoleStatus).Label(summary).Children(func() {
|
Background(k.Surface).Role(ui.RoleStatus).Label(summary).Children(func() {
|
||||||
devtoolsSeverity(c, serviceSeverity(worst), summary)
|
devtoolsSeverity(c, serviceSeverity(worst), summary)
|
||||||
ui.Box(c).Grow(1)
|
ui.Box(c).Grow(1)
|
||||||
@@ -66,7 +66,7 @@ func ServiceStatus(c *ui.Context, services []ServiceItem, opts ServiceStatusOpti
|
|||||||
agentRows(c, len(services), func(i int) {
|
agentRows(c, len(services), func(i int) {
|
||||||
s := services[i]
|
s := services[i]
|
||||||
word := serviceWord(c, s.Health)
|
word := serviceWord(c, s.Health)
|
||||||
ui.Row(c).Key(i).Gap(u * 3).AlignItems(ui.Center).MinHeight(Density(c).ControlHeight()).Padding(u, u*3).
|
ui.Row(c).Key(i).Gap(u*3).AlignItems(ui.Center).MinHeight(Density(c).ControlHeight()).Padding(u, u*3).
|
||||||
Label(s.Name + ", " + word).Children(func() {
|
Label(s.Name + ", " + word).Children(func() {
|
||||||
ui.Column(c).Grow(1).Shrink(1).Children(func() {
|
ui.Column(c).Grow(1).Shrink(1).Children(func() {
|
||||||
ui.Text(c, s.Name).SingleLine()
|
ui.Text(c, s.Name).SingleLine()
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ func slashMenuPanel(c *ui.Context, a ui.Rect, st *slashMenuState, rows []slashMe
|
|||||||
panel.Children(func() {
|
panel.Children(func() {
|
||||||
ui.Scroll(c).Fill().Padding(u).Children(func() {
|
ui.Scroll(c).Fill().Padding(u).Children(func() {
|
||||||
if len(rows) == 0 {
|
if len(rows) == 0 {
|
||||||
ui.Row(c).MinHeight(rowH).Padding(0, u*3).Gap(u*2).AlignItems(ui.Center).TextColor(k.TextMuted).Children(func() {
|
ui.Row(c).MinHeight(rowH).Padding(0, u*3).Gap(u * 2).AlignItems(ui.Center).TextColor(k.TextMuted).Children(func() {
|
||||||
if o.loading {
|
if o.loading {
|
||||||
Spinner(c, SpinnerOptions{Size: 14})
|
Spinner(c, SpinnerOptions{Size: 14})
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ func slashMenuPanel(c *ui.Context, a ui.Rect, st *slashMenuState, rows []slashMe
|
|||||||
ui.Text(c, group).Height(headH).Padding(u*2, u*3, 0, u*3).FontSize(FontSize(c, theme.CaptionSize)).
|
ui.Text(c, group).Height(headH).Padding(u*2, u*3, 0, u*3).FontSize(FontSize(c, theme.CaptionSize)).
|
||||||
FontWeight(600).TextColor(k.TextMuted).Role(ui.RoleText)
|
FontWeight(600).TextColor(k.TextMuted).Role(ui.RoleText)
|
||||||
}
|
}
|
||||||
row := ui.Row(c).Key(i).Height(rowH).Padding(0, u*3, 0, u*2).Gap(u*2).AlignItems(ui.Center).
|
row := ui.Row(c).Key(i).Height(rowH).Padding(0, u*3, 0, u*2).Gap(u * 2).AlignItems(ui.Center).
|
||||||
Radius(theme.ControlRadius).Role(ui.RoleListItem).Label(r.label).Cursor(ui.CursorPointer)
|
Radius(theme.ControlRadius).Role(ui.RoleListItem).Label(r.label).Cursor(ui.CursorPointer)
|
||||||
if row.Clicked() {
|
if row.Clicked() {
|
||||||
clicked = i
|
clicked = i
|
||||||
|
|||||||
+4
-1
@@ -170,7 +170,10 @@ func TestLayoutTransitionResizes(t *testing.T) {
|
|||||||
t.Fatal("negative duration did not panic")
|
t.Fatal("negative duration did not panic")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
ui.Render(func(c *ui.Context) { Use(c, Settings{}); LayoutTransition(c, LayoutTransitionOptions{Duration: -1}, nil) }, 100, 50, 1)
|
ui.Render(func(c *ui.Context) {
|
||||||
|
Use(c, Settings{})
|
||||||
|
LayoutTransition(c, LayoutTransitionOptions{Duration: -1}, nil)
|
||||||
|
}, 100, 50, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPresenceSnapshot(t *testing.T) {
|
func TestPresenceSnapshot(t *testing.T) {
|
||||||
|
|||||||
Reference in new issue
Block a user