implemented separate action for various objects in cron frontend

This commit is contained in:
Bogdan Pilyugin 2023-05-19 18:45:53 +02:00
parent 3179a64d25
commit 734c3c77ff
8 changed files with 1033 additions and 1025 deletions

1912
.project

File diff suppressed because it is too large Load Diff

View File

@ -37,8 +37,8 @@ function dbgtmr(){PostData("tmrdbg=1", "application.html", false, false, false);
</section>
</main>
<script>
loadcrondata(cron_objs, cron_acts);
drawtimers(timarr);
loadcrondata(timarr, cron_objs, cron_acts);
drawtimers();
showMenu('header-toggle','navbar');
showcronerr("~cronerr~");
</script>

View File

@ -1,31 +1,31 @@
adapters.html
api
api/dbg.json
api/dbg2.json
api/gendata.json
api/mem.json
api/set1.json
api/set2.json
api/set3.json
api/stat.json
api/status.json
api/tmr.json
api/wifiscan.json
application.html
favicon.ico
index.html
info.html
reboot.html
res
res/appstyles.css
res/ca_cert.pem
res/cron.js
res/crondata.js
res/iconsfont.css
res/iconsfont.woff2
res/logo.png
res/main.js
res/res.js
res/styles.css
services.html
adapters.html
api
api/dbg.json
api/dbg2.json
api/gendata.json
api/mem.json
api/set1.json
api/set2.json
api/set3.json
api/stat.json
api/status.json
api/tmr.json
api/wifiscan.json
application.html
favicon.ico
index.html
info.html
reboot.html
res
res/appstyles.css
res/ca_cert.pem
res/cron.js
res/crondata.js
res/iconsfont.css
res/iconsfont.woff2
res/logo.png
res/main.js
res/res.js
res/styles.css
services.html
system.html

View File

@ -1,13 +1,11 @@
objects_dscr = ["object_1", "object_2", "object_3", "object_4", "object_5", "object_6",
"object_7", "object_8", "object_9", "object_10", "object_11", "object_12", "object_13",
"object_14", "object_15", "object_16"];
actions_dscr = ["action_1", "action_2", "action_3", "action_4"];
var tarr;
var cron_objs;
var cron_acts;
function loadcrondata(arr1, arr2)
function loadcrondata(arr1, arr2, arr3)
{
cron_objs = arr1;
cron_acts = arr2;
tarr = arr1;
cron_objs = arr2;
cron_acts = arr3;
}
function PostData(data,page,conf,alrt,reld) {
@ -207,14 +205,17 @@ function setcron(n) {
target.innerHTML = ""; mainbut.innerHTML = "Open editor"; mainbut.onclick = function(){setcron(n)};}
target.innerHTML = content;
}
function actupdate(num){
alert("Changed object on timer "+num);
//var tim = tarr[num-1];
var actselect = document.getElementById("action" + num);
actselect.innerHTML = "";
}
function drawtimers(tarr) {
function actupdate(i){
var content = "";
newobj = document.getElementById("object" + i).value;
for (k = 0; k < cron_acts.length; k++) {
var selected = (tarr[i - 1].act == k) ? "selected" : "";
if(cron_objs[newobj].acts.includes(k))
content += ("<option value=\"" + (k) + "\" " + selected + ">" + cron_acts[k] + "</option>");}
document.getElementById("action" + i).innerHTML = content;
}
function drawtimers() {
var num = tarr.length;
var target = document.getElementById("timer");
var content = "";
@ -254,8 +255,8 @@ function drawtimers(tarr) {
content += ("<select class=\"\" id=\"action"+i+"\">");
for (k = 0; k < cron_acts.length; k++) {
var selected = (tarr[i - 1].act == k) ? "selected" : "";
if(cron_objs[k].acts.includes(k))
content += ("<option value=\"" + (k) + "\" " + selected + ">" + actions_dscr[k] + "</option>");}
if(cron_objs[tarr[i - 1].obj].acts.includes(k))
content += ("<option value=\"" + (k) + "\" " + selected + ">" + cron_acts[k] + "</option>");}
content += ("</select></div></div>");

@ -1 +1 @@
Subproject commit e65b1e3075f9ef87899eb73b073a35f36cc52cd0
Subproject commit 5f8f2be7b069abbcbfc68f837cbce088883df726

View File

@ -1,9 +1,9 @@
dependencies:
idf:
component_hash: null
source:
type: idf
version: 4.4.4
manifest_hash: f9b3d78d7d56685d1c543701158a0fab7a56c908117ed70644f77e4247c831ae
target: esp32
version: 1.0.0
dependencies:
idf:
component_hash: null
source:
type: idf
version: 4.4.4
manifest_hash: 31dd4ec84ade1450fc168388f4adce2efacd1516170670735140bc772e9d72bd
target: esp32
version: 1.0.0

View File

@ -27,7 +27,7 @@
#define TAG "CRON_TIMER"
const char *cron_actions[] = { "ON", "OFF", "TOGGLE", "REBOOT" };
const char *cron_actions[] = { "ON", "REBOOT", "TOGGLE", "OFF","HALT" };
const char *cron_objects[] = {
"RELAY1",
"RELAY2",
@ -39,15 +39,15 @@ const char *cron_objects[] = {
"RELAY8",
"SYSTEM" };
const char *cron_act_avail[] = {
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[0,1,2]",
"[3]" };
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[0,2,3]",
"[1,4]" };
char* GetCronObjectNameDef(int idx)
{

View File

@ -1295,6 +1295,13 @@ CONFIG_WEBGUIAPP_SNTP_AUTOUPDATE_PERIOD=3600
CONFIG_WEBGUIAPP_SNTP_TIMEZONE=2
# end of SNTP client settings
#
# CRON settings
#
CONFIG_WEBGUIAPP_CRON_ENABLE=y
CONFIG_WEBGUIAPP_CRON_NUMBER=16
# end of CRON settings
#
# SPI settings
#