diff --git a/area.go b/area.go index 18e2b38..8d95156 100644 --- a/area.go +++ b/area.go @@ -2,10 +2,9 @@ package main import ( // External - werr "git.gibonuddevalla.se/go/wrappederror" + re "git.gibonuddevalla.se/go/wrappederror" // Standard - "database/sql" "encoding/json" "sort" ) @@ -42,7 +41,7 @@ func AreaRetrieve() (areas []Area, err error) { // {{{ var jsonData []byte err = row.Scan(&jsonData) if err != nil { - err = werr.Wrap(err) + err = re.Wrap(err) return } @@ -52,74 +51,20 @@ func AreaRetrieve() (areas []Area, err error) { // {{{ err = json.Unmarshal(jsonData, &areas) if err != nil { - err = werr.Wrap(err) + err = re.Wrap(err) return } return } // }}} -func AreaCreate(name string) (err error) { // {{{ +func AreaCreate(name string) (err error) {// {{{ _, err = service.Db.Conn.Exec(`INSERT INTO area(name) VALUES($1)`, name) return -} // }}} -func AreaRename(id int, name string) (err error) { // {{{ +}// }}} +func AreaRename(id int, name string) (err error) {// {{{ _, err = service.Db.Conn.Exec(`UPDATE area SET name=$2 WHERE id=$1`, id, name) return -} // }}} -func AreaDelete(id int) (err error) { // {{{ - var trx *sql.Tx - trx, err = service.Db.Conn.Begin() - if err != nil { - err = werr.Wrap(err).WithData(id) - } - - _, err = trx.Exec(` - DELETE - FROM trigger t - USING section s - WHERE - t.section_id = s.id AND - s.area_id = $1 - `, - id, - ) - if err != nil { - err2 := trx.Rollback() - if err2 != nil { - return werr.Wrap(err2).WithData(err) - } - return werr.Wrap(err).WithData(id) - } - - _, err = trx.Exec(`DELETE FROM public.section WHERE area_id = $1`, id) - if err != nil { - err2 := trx.Rollback() - if err2 != nil { - return werr.Wrap(err2).WithData(err) - } - return werr.Wrap(err).WithData(id) - } - - _, err = trx.Exec(`DELETE FROM public.area WHERE id = $1`, id) - if err != nil { - err2 := trx.Rollback() - if err2 != nil { - return werr.Wrap(err2).WithData(err) - } - return werr.Wrap(err).WithData(id) - } - - err = trx.Commit() - if err != nil { - err2 := trx.Rollback() - if err2 != nil { - return werr.Wrap(err2).WithData(err) - } - return werr.Wrap(err).WithData(id) - } - - return nil -} // }}} +}// }}} func (a Area) SortedSections() []Section { // {{{ sort.SliceStable(a.Sections, func(i, j int) bool { diff --git a/datapoint.go b/datapoint.go index 084e4bf..02acec4 100644 --- a/datapoint.go +++ b/datapoint.go @@ -25,7 +25,6 @@ type Datapoint struct { Group string Name string Datatype DatapointType - Comment string LastValue time.Time `db:"last_value"` DatapointValueJSON []byte `db:"datapoint_value_json"` LastDatapointValue DatapointValue @@ -74,12 +73,11 @@ func (dp Datapoint) Update() (err error) { // {{{ if dp.ID == 0 { _, err = service.Db.Conn.Exec( - `INSERT INTO datapoint("group", name, datatype, nodata_problem_seconds, comment) VALUES($1, $2, $3, $4, $5)`, + `INSERT INTO datapoint("group", name, datatype, nodata_problem_seconds) VALUES($1, $2, $3, $4)`, dp.Group, name, dp.Datatype, dp.NodataProblemSeconds, - dp.Comment, ) } else { /* Keep nodata_is_problem as is unless the nodata_problem_seconds is changed. @@ -92,11 +90,10 @@ func (dp Datapoint) Update() (err error) { // {{{ "group"=$2, name=$3, datatype=$4, - comment=$5, - nodata_problem_seconds=$6, + nodata_problem_seconds=$5, nodata_is_problem = ( CASE - WHEN $6 != nodata_problem_seconds THEN false + WHEN $5 != nodata_problem_seconds THEN false ELSE nodata_is_problem END @@ -108,7 +105,6 @@ func (dp Datapoint) Update() (err error) { // {{{ dp.Group, name, dp.Datatype, - dp.Comment, dp.NodataProblemSeconds, ) } @@ -165,7 +161,6 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{ dp.datatype, dp.last_value, dp.group, - dp.comment, dp.nodata_problem_seconds, dpv.id AS v_id, @@ -195,7 +190,6 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{ Group string Name string Datatype DatapointType - Comment string LastValue time.Time `db:"last_value"` NodataProblemSeconds int `db:"nodata_problem_seconds"` @@ -220,7 +214,6 @@ func DatapointsRetrieve() (dps []Datapoint, err error) { // {{{ dp.Name = res.Name dp.Group = res.Group dp.Datatype = res.Datatype - dp.Comment = res.Comment dp.LastValue = res.LastValue dp.Found = true dp.NodataProblemSeconds = res.NodataProblemSeconds diff --git a/main.go b/main.go index 569d99f..9496441 100644 --- a/main.go +++ b/main.go @@ -120,35 +120,33 @@ func main() { // {{{ service.Register("/", false, false, staticHandler) - service.Register("/area/new/{name}", false, false, actionAreaNew) - service.Register("/area/rename/{id}/{name}", false, false, actionAreaRename) - service.Register("/area/delete/{id}", false, false, actionAreaDelete) + service.Register("/area/new/{name}", false, false, areaNew) + service.Register("/area/rename/{id}/{name}", false, false, areaRename) - service.Register("/section/new/{areaID}/{name}", false, false, actionSectionNew) - service.Register("/section/rename/{id}/{name}", false, false, actionSectionRename) - service.Register("/section/delete/{id}", false, false, actionSectionDelete) + service.Register("/section/new/{areaID}/{name}", false, false, sectionNew) + service.Register("/section/rename/{id}/{name}", false, false, sectionRename) service.Register("/problems", false, false, pageProblems) - service.Register("/problem/acknowledge/{id}", false, false, actionProblemAcknowledge) - service.Register("/problem/unacknowledge/{id}", false, false, actionProblemUnacknowledge) + service.Register("/problem/acknowledge/{id}", false, false, pageProblemAcknowledge) + service.Register("/problem/unacknowledge/{id}", false, false, pageProblemUnacknowledge) service.Register("/datapoints", false, false, pageDatapoints) service.Register("/datapoint/edit/{id}", false, false, pageDatapointEdit) - service.Register("/datapoint/update/{id}", false, false, actionDatapointUpdate) - service.Register("/datapoint/delete/{id}", false, false, actionDatapointDelete) + service.Register("/datapoint/update/{id}", false, false, pageDatapointUpdate) + service.Register("/datapoint/delete/{id}", false, false, pageDatapointDelete) service.Register("/datapoint/values/{id}", false, false, pageDatapointValues) service.Register("/triggers", false, false, pageTriggers) - service.Register("/trigger/create/{sectionID}/{name}", false, false, actionTriggerCreate) + service.Register("/trigger/create/{sectionID}/{name}", false, false, triggerCreate) service.Register("/trigger/edit/{id}", false, false, pageTriggerEdit) service.Register("/trigger/edit/{id}/{sectionID}", false, false, pageTriggerEdit) - service.Register("/trigger/addDatapoint/{id}/{datapointName}", false, false, actionTriggerDatapointAdd) - service.Register("/trigger/update/{id}", false, false, actionTriggerUpdate) - service.Register("/trigger/run/{id}", false, false, actionTriggerRun) + service.Register("/trigger/addDatapoint/{id}/{datapointName}", false, false, pageTriggerDatapointAdd) + service.Register("/trigger/update/{id}", false, false, pageTriggerUpdate) + service.Register("/trigger/run/{id}", false, false, pageTriggerRun) service.Register("/trigger/delete/{id}", false, false, actionTriggerDelete) service.Register("/configuration", false, false, pageConfiguration) - service.Register("/entry/{datapoint}", false, false, actionEntryDatapoint) + service.Register("/entry/{datapoint}", false, false, entryDatapoint) go nodataLoop() @@ -199,7 +197,7 @@ func staticHandler(w http.ResponseWriter, r *http.Request, sess *session.T) { // service.StaticHandler(w, r, sess) } // }}} -func actionEntryDatapoint(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{ +func entryDatapoint(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{ dpoint := r.PathValue("datapoint") value, _ := io.ReadAll(r.Body) @@ -370,7 +368,7 @@ func pageIndex(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{ page.Render(w) } // }}} -func actionAreaNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func areaNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ name := r.PathValue("name") err := AreaCreate(name) if err != nil { @@ -382,7 +380,7 @@ func actionAreaNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{ w.WriteHeader(302) return } // }}} -func actionAreaRename(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func areaRename(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -401,26 +399,8 @@ func actionAreaRename(w http.ResponseWriter, r *http.Request, _ *session.T) { // w.WriteHeader(302) return } // }}} -func actionAreaDelete(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ - idStr := r.PathValue("id") - id, err := strconv.Atoi(idStr) - if err != nil { - httpError(w, werr.Wrap(err).WithData(idStr).Log()) - return - } - err = AreaDelete(id) - if err != nil { - httpError(w, werr.Wrap(err).WithData(id).Log()) - return - } - - w.Header().Add("Location", "/configuration") - w.WriteHeader(302) - return -} // }}} - -func actionSectionNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func sectionNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("areaID") areaID, err := strconv.Atoi(idStr) if err != nil { @@ -439,7 +419,7 @@ func actionSectionNew(w http.ResponseWriter, r *http.Request, _ *session.T) { // w.WriteHeader(302) return } // }}} -func actionSectionRename(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func sectionRename(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -458,24 +438,6 @@ func actionSectionRename(w http.ResponseWriter, r *http.Request, _ *session.T) { w.WriteHeader(302) return } // }}} -func actionSectionDelete(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ - idStr := r.PathValue("id") - id, err := strconv.Atoi(idStr) - if err != nil { - httpError(w, werr.Wrap(err).WithData(idStr).Log()) - return - } - - err = SectionDelete(id) - if err != nil { - httpError(w, werr.Wrap(err).WithData(id).Log()) - return - } - - w.Header().Add("Location", "/configuration") - w.WriteHeader(302) - return -} // }}} func pageProblems(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{ page := Page{ @@ -512,7 +474,7 @@ func pageProblems(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{ page.Render(w) return } // }}} -func actionProblemAcknowledge(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageProblemAcknowledge(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -531,7 +493,7 @@ func actionProblemAcknowledge(w http.ResponseWriter, r *http.Request, _ *session return } // }}} -func actionProblemUnacknowledge(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageProblemUnacknowledge(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -610,7 +572,7 @@ func pageDatapointEdit(w http.ResponseWriter, r *http.Request, _ *session.T) { / page.Render(w) return } // }}} -func actionDatapointUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageDatapointUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -626,7 +588,6 @@ func actionDatapointUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) dp.Group = r.FormValue("group") dp.Name = r.FormValue("name") dp.Datatype = DatapointType(r.FormValue("datatype")) - dp.Comment = r.FormValue("comment") dp.NodataProblemSeconds = nodataSeconds err = dp.Update() if err != nil { @@ -637,7 +598,7 @@ func actionDatapointUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) w.Header().Add("Location", "/datapoints") w.WriteHeader(302) } // }}} -func actionDatapointDelete(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageDatapointDelete(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -713,7 +674,7 @@ func pageTriggers(w http.ResponseWriter, _ *http.Request, _ *session.T) { // {{{ page.Render(w) } // }}} -func actionTriggerCreate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func triggerCreate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ name := r.PathValue("name") sectionIDStr := r.PathValue("sectionID") sectionID, err := strconv.Atoi(sectionIDStr) @@ -800,7 +761,7 @@ func pageTriggerEdit(w http.ResponseWriter, r *http.Request, _ *session.T) { // page.Render(w) } // }}} -func actionTriggerDatapointAdd(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageTriggerDatapointAdd(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ triggerID := r.PathValue("id") dpName := r.PathValue("datapointName") @@ -832,7 +793,7 @@ func actionTriggerDatapointAdd(w http.ResponseWriter, r *http.Request, _ *sessio w.Header().Add("Content-Type", "application/json") w.Write(j) } // }}} -func actionTriggerUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageTriggerUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { @@ -867,7 +828,7 @@ func actionTriggerUpdate(w http.ResponseWriter, r *http.Request, _ *session.T) { w.Header().Add("Location", "/triggers") w.WriteHeader(302) } // }}} -func actionTriggerRun(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ +func pageTriggerRun(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{ idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) if err != nil { diff --git a/notification/factory.go b/notification/factory.go index 90c5cfe..db0a4b7 100644 --- a/notification/factory.go +++ b/notification/factory.go @@ -16,16 +16,7 @@ func ServiceFactory(t string, config []byte, prio int, ackURL string, logger *sl err = werr.Wrap(err).WithData(config) return nil, err } - ntfy.SetLogger(logger) return ntfy, nil - case "SCRIPT": - script, err := NewScript(config, prio, ackURL) - if err != nil { - err = werr.Wrap(err).WithData(config) - return nil, err - } - script.SetLogger(logger) - return script, nil } return nil, werr.New("Unknown notification service, '%s'", t).WithCode("002-0000") diff --git a/notification/script.go b/notification/script.go deleted file mode 100644 index 1e8fcca..0000000 --- a/notification/script.go +++ /dev/null @@ -1,70 +0,0 @@ -package notification - -import ( - // External - werr "git.gibonuddevalla.se/go/wrappederror" - - // Standard - "encoding/json" - "log/slog" - "os/exec" - "strconv" - "strings" -) - -type Script struct { - Filename string - Prio int - AcknowledgeURL string - logger *slog.Logger -} - -func NewScript(config []byte, prio int, ackURL string) (instance *Script, err error) { - instance = new(Script) - err = json.Unmarshal(config, &instance) - if err != nil { - err = werr.Wrap(err).WithCode("002-0001").WithData(config) - return - } - instance.Prio = prio - instance.AcknowledgeURL = ackURL - return instance, nil -} - -func (script *Script) SetLogger(l *slog.Logger) { - script.logger = l -} - -func (script *Script) GetType() string { - return "SCRIPT" -} - -func (script *Script) GetPrio() int { - return script.Prio -} - -func (script Script) Send(problemID int, msg []byte) (err error) { - var errbuf strings.Builder - cmd := exec.Command(script.Filename, strconv.Itoa(problemID), script.AcknowledgeURL, string(msg)) - cmd.Stderr = &errbuf - - err = cmd.Run() - if err != nil { - script.logger.Error("notification", "type", "script", "error", err) - err = werr.Wrap(err).WithData( - struct { - Filename string - ProblemID int - Msg string - StdErr string - }{ - script.Filename, - problemID, - string(msg), - errbuf.String(), - }, - ).Log() - } - - return -} diff --git a/section.go b/section.go index 82177d9..b86f5c0 100644 --- a/section.go +++ b/section.go @@ -1,9 +1,6 @@ package main import ( - // External - werr "git.gibonuddevalla.se/go/wrappederror" - // Standard "sort" ) @@ -25,23 +22,11 @@ func (s *Section) SortedTriggers() []Trigger { return s.Triggers } -func SectionCreate(areaID int, name string) (err error) { // {{{ +func SectionCreate(areaID int, name string) (err error) {// {{{ _, err = service.Db.Conn.Exec(`INSERT INTO section(area_id, name) VALUES($1, $2)`, areaID, name) return -} // }}} -func SectionRename(id int, name string) (err error) { // {{{ +}// }}} +func SectionRename(id int, name string) (err error) {// {{{ _, err = service.Db.Conn.Exec(`UPDATE section SET name=$2 WHERE id=$1`, id, name) return -} // }}} -func SectionDelete(id int) (err error) { // {{{ - _, err = service.Db.Conn.Exec(`DELETE FROM public.trigger WHERE section_id = $1`, id) - if err != nil { - return werr.Wrap(err).WithData(id) - } - - _, err = service.Db.Conn.Exec(`DELETE FROM public.section WHERE id = $1`, id) - if err != nil { - return werr.Wrap(err).WithData(id) - } - return -} // }}} +}// }}} diff --git a/sql/00016.sql b/sql/00016.sql deleted file mode 100644 index 9f9aad5..0000000 --- a/sql/00016.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TYPE notification_type RENAME TO _notification_type; -CREATE TYPE notification_type AS ENUM ('NTFY', 'SCRIPT'); - -ALTER TABLE notification RENAME COLUMN service TO _service; -ALTER TABLE notification ADD service notification_type NOT NULL DEFAULT 'NTFY'; -UPDATE notification SET service = _service::text::notification_type; - -ALTER TABLE notification DROP COLUMN _service; -DROP TYPE _notification_type; diff --git a/sql/00017.sql b/sql/00017.sql deleted file mode 100644 index 8603963..0000000 --- a/sql/00017.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE public.datapoint ADD COLUMN comment VARCHAR DEFAULT '' NOT NULL; diff --git a/static/css/configuration.css b/static/css/configuration.css deleted file mode 100644 index e013c47..0000000 --- a/static/css/configuration.css +++ /dev/null @@ -1,130 +0,0 @@ -html { - box-sizing: border-box; -} -*, -*:before, -*:after { - box-sizing: inherit; -} -*:focus { - outline: none; -} -[onClick] { - cursor: pointer; -} -html, -body { - margin: 0; - padding: 0; -} -body { - background: #282828; - font-family: sans-serif; - font-weight: 300; - color: #d5c4a1; - font-size: 11pt; -} -h1, -h2 { - margin-bottom: 4px; -} -h1:first-child, -h2:first-child { - margin-top: 0px; -} -h1 { - font-size: 1.5em; - color: #fb4934; - font-weight: 800; -} -h2 { - font-size: 1.25em; - color: #b8bb26; - font-weight: 800; -} -a { - color: #3f9da1; - text-decoration: none; -} -a:hover { - text-decoration: underline; -} -b { - font-weight: 800; -} -input[type="text"], -textarea, -select { - font-family: monospace; - background: #202020; - color: #d5c4a1; - padding: 4px 8px; - border: none; - font-size: 1em; - line-height: 1.5em; -} -button { - background: #202020; - color: #d5c4a1; - padding: 8px 32px; - border: 1px solid #535353; - font-size: 1em; - height: 3em; -} -button:focus { - background: #333; -} -.line { - grid-column: 1 / -1; - border-bottom: 1px solid #4e4e4e; -} -span.date { - color: #d5c4a1; - font-weight: 800; -} -span.time { - font-size: 0.9em; - color: #d5c4a1; -} -span.seconds { - display: none; -} -label { - user-select: none; -} -.description { - border: 1px solid #737373; - color: #3f9da1; - background: #202020; - padding: 4px 8px; - margin-top: 8px; - white-space: nowrap; - width: min-content; - border-radius: 8px; -} -#areas .area > .name { - display: grid; - grid-template-columns: 1fr min-content; - grid-gap: 0px 16px; - align-items: center; - padding-left: 16px; - padding-right: 8px; -} -#areas .area > .name img { - margin-top: 3px; - margin-bottom: 4px; - height: 16px; -} -#areas .area .section.configuration { - display: grid; - grid-template-columns: 1fr min-content; - grid-gap: 0 16px; - margin-top: 8px; - margin-bottom: 8px; -} -#areas .area .section.configuration:last-child { - margin-bottom: 16px; -} -#areas .area .section.configuration img { - height: 16px; -} diff --git a/static/css/datapoints.css b/static/css/datapoints.css index 3baa3b0..0057c02 100644 --- a/static/css/datapoints.css +++ b/static/css/datapoints.css @@ -125,16 +125,12 @@ label { } #datapoints div { white-space: nowrap; - align-self: center; } #datapoints .icons { display: flex; gap: 12px; align-items: center; } -#datapoints img.info { - height: 20px; -} #values { display: grid; grid-template-columns: repeat(2, min-content); diff --git a/static/css/main.css b/static/css/main.css index c5de4d4..a213f0d 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -182,6 +182,10 @@ label { margin-top: 12px; margin-bottom: 20px; } +#areas .area .section.configuration { + margin-top: 8px; + margin-bottom: 8px; +} #areas .area .section:last-child { margin-bottom: 12px; } diff --git a/static/images/delete_white.svg b/static/images/delete_white.svg deleted file mode 100644 index 7ae4dab..0000000 --- a/static/images/delete_white.svg +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - trash-can-outline - - - diff --git a/static/images/info-filled.svg b/static/images/info-filled.svg deleted file mode 100644 index 71e7cb2..0000000 --- a/static/images/info-filled.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - information-slab-circle - information - - - diff --git a/static/images/info-outline.svg b/static/images/info-outline.svg deleted file mode 100644 index e53a3ce..0000000 --- a/static/images/info-outline.svg +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - information-slab-circle - information-slab-circle-outline - information-outline - - - diff --git a/static/less/configuration.less b/static/less/configuration.less deleted file mode 100644 index 8c59755..0000000 --- a/static/less/configuration.less +++ /dev/null @@ -1,38 +0,0 @@ -@import 'theme.less'; - -#areas { - .area { - & > .name { - display: grid; - grid-template-columns: 1fr min-content; - grid-gap: 0px 16px; - align-items: center; - padding-left: 16px; - padding-right: 8px; - - img { - margin-top: 3px; - margin-bottom: 4px; - height: 16px; - } - } - - - .section.configuration { - display: grid; - grid-template-columns: 1fr min-content; - grid-gap: 0 16px; - - margin-top: 8px; - margin-bottom: 8px; - - &:last-child { - margin-bottom: 16px; - } - - img { - height: 16px; - } - } - } -} diff --git a/static/less/datapoints.less b/static/less/datapoints.less index 8ecc09a..b8ce8c5 100644 --- a/static/less/datapoints.less +++ b/static/less/datapoints.less @@ -13,7 +13,6 @@ margin-top: 1.5em; padding-bottom: 4px; } - h2 { border-bottom: unset; } @@ -27,7 +26,6 @@ div { white-space: nowrap; - align-self: center; } .icons { @@ -35,10 +33,6 @@ gap: 12px; align-items: center; } - - img.info { - height: 20px; - } } #values { diff --git a/static/less/main.less b/static/less/main.less index d04e244..de80c87 100644 --- a/static/less/main.less +++ b/static/less/main.less @@ -94,6 +94,11 @@ margin-top: 12px; margin-bottom: 20px; + &.configuration { + margin-top: 8px; + margin-bottom: 8px; + } + &:last-child { margin-bottom: 12px; } diff --git a/views/pages/configuration.gotmpl b/views/pages/configuration.gotmpl index aecf759..0fdfd54 100644 --- a/views/pages/configuration.gotmpl +++ b/views/pages/configuration.gotmpl @@ -1,6 +1,4 @@ {{ define "page" }} - {{ $version := .VERSION }} - {{ block "page_label" . }}{{end}} @@ -72,21 +58,14 @@
{{ range .Data.Areas }}
-
-
{{ .Name }}
- -
+
{{ .Name }}
Create
{{ range .SortedSections }} - {{ if eq .ID 0 }} - {{ continue }} - {{ end }}
{{ .Name }}
-
{{ end }}
diff --git a/views/pages/datapoint_edit.gotmpl b/views/pages/datapoint_edit.gotmpl index 12b2fc2..9d65b50 100644 --- a/views/pages/datapoint_edit.gotmpl +++ b/views/pages/datapoint_edit.gotmpl @@ -32,12 +32,6 @@
Set to 0 to disable.
-
Comment
-
- -
- -
{{ if eq .Data.Datapoint.ID 0 }} diff --git a/views/pages/datapoints.gotmpl b/views/pages/datapoints.gotmpl index aa3327b..1300e55 100644 --- a/views/pages/datapoints.gotmpl +++ b/views/pages/datapoints.gotmpl @@ -31,11 +31,6 @@
{{ .LastDatapointValue.Value }}
{{ end }}
- {{ if eq .Comment "" }} -
- {{ else }} -
- {{ end }}
diff --git a/views/pages/triggers.gotmpl b/views/pages/triggers.gotmpl index 093a340..a0a5bef 100644 --- a/views/pages/triggers.gotmpl +++ b/views/pages/triggers.gotmpl @@ -38,9 +38,6 @@
{{ .Name }}
{{ range .SortedSections }} - {{ if eq .ID 0 }} - {{ continue }} - {{ end }}
{{ .Name }}