From 72a53fef13784110b8961c6df112d330cd68768b Mon Sep 17 00:00:00 2001 From: bogdan Date: Tue, 11 Apr 2023 19:58:26 +0200 Subject: [PATCH] cron extended editor developing --- HTML/espfs.paths | 58 ++++++------ HTML/res/appstyles.css | 26 +---- HTML/res/cron.js | 210 ++++++++++++++++++++++++++--------------- dependencies.lock | 18 ++-- 4 files changed, 175 insertions(+), 137 deletions(-) diff --git a/HTML/espfs.paths b/HTML/espfs.paths index 0976c73..b5a6c0d 100644 --- a/HTML/espfs.paths +++ b/HTML/espfs.paths @@ -1,30 +1,30 @@ -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/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/iconsfont.css +res/iconsfont.woff2 +res/logo.png +res/main.js +res/res.js +res/styles.css +services.html system.html \ No newline at end of file diff --git a/HTML/res/appstyles.css b/HTML/res/appstyles.css index 83acf88..35ca562 100644 --- a/HTML/res/appstyles.css +++ b/HTML/res/appstyles.css @@ -185,28 +185,8 @@ align-items: center; width:100%; } -​/* The Modal (background) */ -.modal { - display: none; /* Hidden by default */ - position: fixed; /* Stay in place */ - z-index: 1; /* Sit on top */ - padding-top: 100px; /* Location of the box */ - left: 0; - top: 0; - width: 100%; /* Full width */ - height: 100%; /* Full height */ - overflow: auto; /* Enable scroll if needed */ - background-color: rgb(0,0,0); /* Fallback color */ - background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ +.crselect +{ + height:120px; } -/* Modal Content */ -.modal-content { - background-color: #fefefe; - margin: auto; - padding: 20px; - border: 1px solid #888; - width: 80%; -} - - diff --git a/HTML/res/cron.js b/HTML/res/cron.js index 1e1abcc..999bca7 100644 --- a/HTML/res/cron.js +++ b/HTML/res/cron.js @@ -1,78 +1,136 @@ -objects_test = ["scene_1","scene_2","scene_3","scene_4","scene_5","scene_6","scene_7","scene_8","scene_9","scene_10","scene_11","scene_12","scene_13","scene_14","scene_15","scene_16"]; - actions_test = ["start", "stop"]; - timarr_test = [{'num':1, 'obj':2, 'act':0, 'start':1000000000,'cron':'*/2 * * * * *'}, - {'num':2, 'obj':12,'act':1, 'start':1622222222,'cron':'6 0 12 * * *'}, - {'num':3, 'obj':8,'act':0, 'start':1675757575,'cron':'* * * * * *'}]; - function savetm(n) - { - - } - function deltm(n) - { - alert("Delete timer "+n); - timarr_test.splice(n-1,1); - drawtimers(timarr_test); - } - function closecron(n) - { - var target = document.getElementById("cronext"+n); - var content = ""; - target.innerHTML = content; - } - function setcron(n) - { - var target = document.getElementById("cronext"+n); - var content = ""; - content +=("

Here extebnded cron editor

"); - content +=(""); - target.innerHTML = content; - } - function drawtimers(tarr) - { - var num = tarr.length; - var target = document.getElementById("timer"); - var content = ""; - for (i = 1; i<=num; i++) - { - content +=("
"); - content +=(""); - content +=("
"); - - content +=("
"); - //content +=(""); - content +=(""); - content +=("
") - - content +=("
"); - - content +=(""); - content +=(""); - - content +=(""); - +objects_test = ["scene_1", "scene_2", "scene_3", "scene_4", "scene_5", "scene_6", "scene_7", "scene_8", "scene_9", "scene_10", "scene_11", "scene_12", "scene_13", "scene_14", "scene_15", "scene_16"]; +actions_test = ["start", "stop"]; +timarr_test = [{ 'num': 1, 'obj': 2, 'act': 0, 'start': 1000000000, 'cron': '*/2 * * * * *' }, +{ 'num': 2, 'obj': 12, 'act': 1, 'start': 1622222222, 'cron': '6 0 12 * * *' }, +{ 'num': 3, 'obj': 8, 'act': 0, 'start': 1675757575, 'cron': '* * * * * *' }]; +function savetm(n) { - content +=(""); - content +=(""); - - content +=("
"); +} +function set_cron_string(tnum, s, m, h, d, mm, w) { + var c = (document.getElementById("cron" + tnum).value).split(" "); + if (c.length == 6) { + if (s != null) + c[0] = s; + if (m != null) + c[1] = m; + if (h != null) + c[2] = h; + if (d != null) + c[3] = d; + if (mm != null) + c[4] = mm; + if (w != null) + c[5] = w; + document.getElementById("cron" + tnum).value = c[0] + " " + c[1] + " " + c[2] + " " + c[3] + " " + c[4] + " " + c[5]; + } +} +function getSecondSelect(n) { + var s = document.getElementById("seconds").value; + set_cron_string(n, s, null, null, null, null, null); +} +function getMinutesSelect(n) { + var m = document.getElementById("minutes").value; + set_cron_string(n, null, m, null, null, null, null); +} +function getHoursSelect(n) { + var h = document.getElementById("hours").value; + set_cron_string(n, null, null, h, null, null, null); +} + +function deltm(n) { + alert("Delete timer " + n); + timarr_test.splice(n - 1, 1); + drawtimers(timarr_test); +} +function closecron(n) { + var target = document.getElementById("cronext"+n); + var content = ""; + target.innerHTML = content; +} +function setcron(n) { + var target = document.getElementById("cronext" + n); + var content = ""; + content += ("
"); + content += ("
"); + + content += ("
"); + content += ("
"); + + content += (""); + + + + content += ("
"); + target.innerHTML = content; +} +function drawtimers(tarr) { + var num = tarr.length; + var target = document.getElementById("timer"); + var content = ""; + for (i = 1; i <= num; i++) { + content += ("
"); + content += (""); + content += ("
"); + + content += ("
"); + //content +=(""); + content += (""); + content += ("
") + + content += ("
"); + + content += (""); + content += (""); + + content += (""); + + + content += (""); + content += (""); + + content += ("
"); target.innerHTML = content; - } - } - function applytm() - { - - } - function addtm() - { - var num = timarr_test.length + 1; - timarr_test.push({'num':num,'start':1500000000,'cron':'* * * * * *'}); - drawtimers(timarr_test); - } \ No newline at end of file + } +} +function applytm() { + +} +function addtm() { + var num = timarr_test.length + 1; + timarr_test.push({ 'num': num, 'start': 1500000000, 'cron': '* * * * * *' }); + drawtimers(timarr_test); +} \ No newline at end of file diff --git a/dependencies.lock b/dependencies.lock index 55ac77a..b34c22b 100644 --- a/dependencies.lock +++ b/dependencies.lock @@ -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