80 |
{ n.Date.Format("15:04:05.000") }
81 |
82 |
{ n.Message }
83 | if len(n.Message) > 0 {
84 |
90 | }
91 |
92 |
93 | }
94 | }
95 |
96 | templ EmptyRun(id string) {
97 | ")
60 | if err != nil {
61 | return err
62 | }
63 | var_2 := `no events found`
64 | _, err = templBuffer.WriteString(var_2)
65 | if err != nil {
66 | return err
67 | }
68 | _, err = templBuffer.WriteString("
")
69 | if err != nil {
70 | return err
71 | }
72 | if !templIsBuffer {
73 | _, err = templBuffer.WriteTo(w)
74 | }
75 | return err
76 | })
77 | }
78 |
79 | func SearchSelect(runs []*notification.Notification, currentRun string) templ.Component {
80 | return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
81 | templBuffer, templIsBuffer := w.(*bytes.Buffer)
82 | if !templIsBuffer {
83 | templBuffer = templ.GetBuffer()
84 | defer templ.ReleaseBuffer(templBuffer)
85 | }
86 | ctx = templ.InitializeContext(ctx)
87 | var_3 := templ.GetChildren(ctx)
88 | if var_3 == nil {
89 | var_3 = templ.NopComponent
90 | }
91 | ctx = templ.ClearChildren(ctx)
92 | _, err = templBuffer.WriteString("")
187 | if err != nil {
188 | return err
189 | }
190 | var var_8 string = n.Date.Format("15:04:05.000")
191 | _, err = templBuffer.WriteString(templ.EscapeString(var_8))
192 | if err != nil {
193 | return err
194 | }
195 | _, err = templBuffer.WriteString("
")
196 | if err != nil {
197 | return err
198 | }
199 | var var_9 string = n.Message
200 | _, err = templBuffer.WriteString(templ.EscapeString(var_9))
201 | if err != nil {
202 | return err
203 | }
204 | _, err = templBuffer.WriteString("
")
205 | if err != nil {
206 | return err
207 | }
208 | if len(n.Message) > 0 {
209 | _, err = templBuffer.WriteString("
")
210 | if err != nil {
211 | return err
212 | }
213 | }
214 | _, err = templBuffer.WriteString("
")
215 | if err != nil {
216 | return err
217 | }
218 | } else {
219 | _, err = templBuffer.WriteString("")
228 | if err != nil {
229 | return err
230 | }
231 | var var_10 string = n.Date.Format("15:04:05.000")
232 | _, err = templBuffer.WriteString(templ.EscapeString(var_10))
233 | if err != nil {
234 | return err
235 | }
236 | _, err = templBuffer.WriteString("
")
237 | if err != nil {
238 | return err
239 | }
240 | var var_11 string = n.Message
241 | _, err = templBuffer.WriteString(templ.EscapeString(var_11))
242 | if err != nil {
243 | return err
244 | }
245 | _, err = templBuffer.WriteString("
")
246 | if err != nil {
247 | return err
248 | }
249 | if len(n.Message) > 0 {
250 | _, err = templBuffer.WriteString("
")
251 | if err != nil {
252 | return err
253 | }
254 | }
255 | _, err = templBuffer.WriteString("
")
256 | if err != nil {
257 | return err
258 | }
259 | }
260 | if !templIsBuffer {
261 | _, err = templBuffer.WriteTo(w)
262 | }
263 | return err
264 | })
265 | }
266 |
267 | func EmptyRun(id string) templ.Component {
268 | return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
269 | templBuffer, templIsBuffer := w.(*bytes.Buffer)
270 | if !templIsBuffer {
271 | templBuffer = templ.GetBuffer()
272 | defer templ.ReleaseBuffer(templBuffer)
273 | }
274 | ctx = templ.InitializeContext(ctx)
275 | var_12 := templ.GetChildren(ctx)
276 | if var_12 == nil {
277 | var_12 = templ.NopComponent
278 | }
279 | ctx = templ.ClearChildren(ctx)
280 | _, err = templBuffer.WriteString("")
322 | if err != nil {
323 | return err
324 | }
325 | for _, n := range run {
326 | err = Event(n).Render(ctx, templBuffer)
327 | if err != nil {
328 | return err
329 | }
330 | }
331 | _, err = templBuffer.WriteString("
")
332 | if err != nil {
333 | return err
334 | }
335 | }
336 | if !templIsBuffer {
337 | _, err = templBuffer.WriteTo(w)
338 | }
339 | return err
340 | })
341 | }
342 |
--------------------------------------------------------------------------------
/internal/webui/server.go:
--------------------------------------------------------------------------------
1 | package webui
2 |
3 | // gomon is a simple command line tool that watches your files and automatically restarts the application when it detects any changes in the working directory.
4 | // Copyright (C) 2023 John Dudmesh
5 |
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 |
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 |
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see