Fix UI and icon display (#101)
This commit is contained in:
parent
b7c9069030
commit
4c3f8a0c73
4 changed files with 32 additions and 30 deletions
|
|
@ -85,12 +85,13 @@ func NewSocketHub() *SocketHub {
|
|||
func (h *SocketHub) encode(v core.Param) ([]byte, error) {
|
||||
var s string
|
||||
switch val := v.Val.(type) {
|
||||
case string:
|
||||
case time.Duration:
|
||||
// must be before stringer to convert to seconds instead of string
|
||||
s = fmt.Sprintf("{\"%s\": %d}", v.Key, int64(val.Seconds()))
|
||||
case fmt.Stringer, string:
|
||||
s = fmt.Sprintf("{\"%s\": \"%s\"}", v.Key, val)
|
||||
case float64:
|
||||
s = fmt.Sprintf("{\"%s\": %.3f}", v.Key, val)
|
||||
case time.Duration:
|
||||
s = fmt.Sprintf("{\"%s\": %d}", v.Key, int64(val.Seconds()))
|
||||
default:
|
||||
s = fmt.Sprintf("{\"%s\": %v}", v.Key, val)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue