diff --git a/datapoint.go b/datapoint.go index 2d2286e..a75491a 100644 --- a/datapoint.go +++ b/datapoint.go @@ -54,14 +54,14 @@ func (dp DatapointValue) Value() any { // {{{ } if dp.ValueDateTime.Valid { - return dp.ValueDateTime.Time.In(smonConfig.timezoneLocation) + return dp.ValueDateTime.Time } return nil } // }}} func (dp DatapointValue) FormattedTime() string { // {{{ if dp.ValueDateTime.Valid { - return dp.ValueDateTime.Time.In(smonConfig.timezoneLocation).Format("2006-01-02 15:04:05") + return dp.ValueDateTime.Time.Format("2006-01-02 15:04:05") } return "invalid time" } // }}} diff --git a/main.go b/main.go index dfca0a2..b429a8d 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ import ( "time" ) -const VERSION = "v31" +const VERSION = "v30" var ( logger *slog.Logger @@ -951,22 +951,7 @@ func actionTriggerDatapointAdd(w http.ResponseWriter, r *http.Request, _ *sessio return } - // Also retrieve the datapoint to get the latest value - // for immediate presentation when added. - dp, err := DatapointRetrieve(0, dpName) - if err != nil { - httpError(w, werr.Wrap(err).WithData(dpName).Log()) - return - } - dp.LastDatapointValue.TemplateValue = dp.LastDatapointValue.Value() - j, _ := json.Marshal( - struct { - OK bool - Datapoint Datapoint - }{ - true, - dp, - }) + j, _ := json.Marshal(struct{ OK bool }{OK: true}) w.Header().Add("Content-Type", "application/json") w.Write(j) } // }}} diff --git a/static/js/trigger_edit.mjs b/static/js/trigger_edit.mjs index 826afd4..f706136 100644 --- a/static/js/trigger_edit.mjs +++ b/static/js/trigger_edit.mjs @@ -158,7 +158,7 @@ export class Trigger { alert(json.Error) return } - this.datapoints[dp.Name] = json.Datapoint + this.datapoints[dp.Name] = dp }) }//}}} }