Skip to content

Commit 64d9af9

Browse files
committed
Fix in schedule shortcut panel
1 parent 46b182d commit 64d9af9

File tree

6 files changed

+39
-12
lines changed

6 files changed

+39
-12
lines changed

config/big-sample-config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ GlowDash:
6868
Title: Sensors
6969
PanelType: Sensors # Shows the current values of some sensors
7070
DeviceType: smtherm # SMTherm - daemon
71-
DeviceIp: 192.168.1.10
71+
DeviceIp: 192.168.1.10
7272
Sensors:
7373
- Name: Living room # Display name of the sensor
7474
Code: livingroom # Codename of the sensor in SMTherm
@@ -79,7 +79,7 @@ GlowDash:
7979

8080
- Id: ppid003
8181
PanelType: ScheduleShortcut # Shortcut to a scheduled task
82-
ScheduleName: "Moring wake up"
82+
ScheduleName: "Morning wake up"
8383

8484
- Id: ppidheaterset
8585
Title: Central heating
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
glowdash:
3+
image: hyperprog/glowdash
4+
restart: unless-stopped
5+
environment:
6+
TZ: "Europe/Budapest"
7+
ports:
8+
- "80:80"
9+
volumes:
10+
- ./userstuff:/glowdash/user
11+
- ./config:/glowdash/config
12+
hassesdaemon:
13+
image: hyperprog/hassesdaemon
14+
container_name: hasses_sse_srv
15+
restart: always
16+
ports:
17+
- "8080:8080"
18+
- "8085:8085"
19+
logging:
20+
options:
21+
max-size: 5m
22+

glowdash/glowdash.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ var CommSSEHost string = ""
140140
var CommSSEPort int = 8085
141141
var BackgroudDevQueryNetDialerTimeout time.Duration = time.Duration(1200) * time.Millisecond
142142
var BackgroudDevQueryNetKeepaliveTimeout time.Duration = time.Duration(1200) * time.Millisecond
143-
var AssetVer string = "107"
143+
var AssetVer string = "108"
144144

145145
var Panels []PanelInterface
146146
var Pages []PageInterface

glowdash/schedulepanel.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (p PanelScheduleShortcut) PanelHtml(withContainer bool) string {
5858
</div>
5959
</div>
6060
61-
<div class="main-container panelnoinfo" data-refid="b-{{.Id}}">
61+
<div class="main-container {{if .MissingSchedule}}panelnoinfo{{end}}" data-refid="b-{{.Id}}">
6262
<div class="main-container-top">
6363
<div class="placeholdersp"></div>
6464
@@ -116,8 +116,6 @@ func (p PanelScheduleShortcut) PanelHtml(withContainer bool) string {
116116
Disabled: connectedSchedule && !s.enabled,
117117
}
118118

119-
///Reggeli ébresztő
120-
121119
buffer := bytes.Buffer{}
122120
templ.Execute(&buffer, pass)
123121

@@ -153,6 +151,9 @@ func (p PanelScheduleShortcut) IsActionIdMatch(aId string) bool {
153151
if "b-"+p.idStr+"-updateclock" == aId {
154152
return true
155153
}
154+
if "b-"+p.idStr+"-update" == aId {
155+
return true
156+
}
156157
return false
157158
}
158159

@@ -168,17 +169,18 @@ func (p PanelScheduleShortcut) DoAction(actionName string, parameters map[string
168169
var updatedIds []string = []string{}
169170
if actionName == "toggle" {
170171
idx := getScheduleIndex(p.scheduleName)
171-
if idx > 0 {
172+
if idx >= 0 {
172173
s := getScheduleByIndex(idx)
173174
s.enabled = !s.enabled
174175
updateSchedule(idx, s)
176+
175177
stateChanged = true
176178
updatedIds = append(updatedIds, p.QueryDevice()...)
177179
}
178180
}
179181
if actionName == "updateclock" {
180182
idx := getScheduleIndex(p.scheduleName)
181-
if idx > 0 {
183+
if idx >= 0 {
182184
s := getScheduleByIndex(idx)
183185
if len(parameters["toclock"]) > 3 && parameters["toclock"][0] == 'h' {
184186
hmtxt := strings.Split(parameters["toclock"][1:], "m")
@@ -193,10 +195,12 @@ func (p PanelScheduleShortcut) DoAction(actionName string, parameters map[string
193195
}
194196
}
195197
}
196-
197198
updatedIds = append(updatedIds, p.QueryDevice()...)
198199
}
199200
}
201+
if actionName == "update" {
202+
updatedIds = append(updatedIds, p.QueryDevice()...)
203+
}
200204
return "ok", updatedIds, stateChanged
201205
}
202206

static/glowdash.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function sendRequestForPanelId(id,reqSuffix,param) {
173173
xhrRequests.set(id,xhr);
174174
let url_to_call = '/action/'+id+"-"+reqSuffix+"?otsseid="+ot_sse_id;
175175
if(param != null && param != "" && param.length > 0 )
176-
url_to_call += "?" + param;
176+
url_to_call += "&" + param;
177177
xhr.open('GET',url_to_call , true);
178178
xhr.onreadystatechange = function(e) {
179179
xhrRequests.delete(id);
@@ -430,7 +430,7 @@ function initClockPickerBlocks() {
430430
const allClockPickerBlock = document.getElementsByClassName("clockpicker-controller-block");
431431
for (let i = 0; i < allClockPickerBlock.length; i++) {
432432
if(allClockPickerBlock[i].classList.contains('clockpicker-processed'))
433-
continue;
433+
continue;
434434
let mainId = allClockPickerBlock[i].dataset.mainid;
435435
init_clockselector(mainId);
436436
allClockPickerBlock[i].classList.add('clockpicker-processed');
@@ -470,7 +470,7 @@ function initActionSubselector() {
470470
const allActionSelector = document.getElementsByClassName("schedule-action-selector");
471471
for (let i = 0; i < allActionSelector.length; i++) {
472472
if(allActionSelector[i].classList.contains('action-selector-processed'))
473-
continue;
473+
continue;
474474
let actionSubId = allActionSelector[i].dataset.actionsubid;
475475
allActionSelector[i].addEventListener('change',function(e){
476476
fillActionSubselect(e.target.value,actionSubId);
@@ -494,6 +494,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
494494
handleJustMovingPanels();
495495
handleDeferredInfos();
496496
initUnravedGauges();
497+
initClockPickerBlocks();
497498
startSSE();
498499
updateTime();
499500
});

0 commit comments

Comments
 (0)