66 Commits

Author SHA1 Message Date
Maxim Prokhorov
2c728074f9 web: image length is a compile time constant 2022-06-01 21:52:18 +03:00
Maxim Prokhorov
fa3deeffbf webui: remove jquery dependencies and clean-up websocket API
Refactor WebUI:
- remove jquery dependency from the base custom.js and use vanilla JS
- remove jquery + jquery-datatables dependency from the RFM69 module
- replace jquery-datatables handlers with pure-css table + some basic cell filtering
  (may be incomplete, but tbh it is not worth additional 50Kb to the .bin size)
- introduce a common way to notify about the app errors, show small text notification
  at the top of the page instead of relying on user to find out about errors by using the Web Developer Tools
- replace <span name=...> with <span data-settings-key=...>
- replace <div> templates with <template>, disallowing modification
  without an explicit DOM clone
- run `eslint` on html/custom.js and `html-validate` on html/index.html,
  and fix issues detected by both tools

Streamline settings group handling in custom.js & index.html
- drop module-specific button-add-... in favour of button-add-settings-group
- only enforce data-settings-max requirement when the property actually exists
- re-create label for=... and input id=... when settings group is
  modified, so checkboxes refer to the correct element
- introduce additional data-... properties to generalize settings group additions
- introduce Enumerable object to track some common list elements for
  <select>, allow to re-create <option> list when messages come in
  different order

Minor fixes that also came with this:
- fix relay code incorrectly parsing the payload, causing no relay names
  to be displayed in the SWITCHES panel
- fix scheduler code accidentally combining keys b/c of the way C parses
  string literals on separate lines, without any commas in-between
- thermostat should not reference tmpUnit directly in the webui, replace with
  module-specific thermostatUnit that is handled on the device itself
- fix index.html initial setup invalid adminPass ids
- fix index.html layout when removing specific schedules
2021-07-18 23:30:32 +03:00
Maxim Prokhorov
3dfa06ead1 webui: fix favicon mime type
inline-source uses 'image/ico' otherwise
supposed to be fixed upstream via the usage of type="image/x-icon" as
link attribute, but there's no npmjs release yet
2021-02-04 12:03:26 +03:00
Maxim Prokhorov
8df23392a9 webui: clean-up cfd6e36dbe
update to terser v5
replace gulp-remove-code with a rough equivalent in the gulpscript itself
replace gulp-inline with gulp-inline-source-html
remove base64 modules as redundant when running inline-source (does both)
remove crass as redundant when running inline-source (uses csso)
fixup jquery source map comment (but still keep the actual file)

at least now this seems stable enough to start more of the ui tweaking
2021-01-16 20:40:23 +03:00
Maxim Prokhorov
3e0291e534 webui: bump old deps 2021-01-15 23:06:19 +03:00
Maxim Prokhorov
c6e2dbbc5a webui: show the actual error when compressJs fails
note that this does not show the correct error line b/c we filter this
through the remover() first
2021-01-15 22:46:55 +03:00
Maxim Prokhorov
cfd6e36dbe webui: use terser as js minifier
support es6 syntax
use js comment style in custom.js
only minify the custom.js

using 4.x branch, since 5.x wants async / await and more changes to the gulp script
2021-01-15 22:45:44 +03:00
DmitryBlinov
5aeb24f263 garland: new module (#2408)
Port of https://github.com/Vasil-Pahomov/ArWs2812 from Arduino to ESP8266
Implementing garland of WS2812

Co-authored-by: Dmitry Blinov <dblinov@blackberry.com>
2020-12-24 17:44:59 +03:00
Eric Chauvet
21e75bef51 Kingart curtain switch UI support (#2250)
* Completed kingart curtain switch support:
Added Web UI controls and view in status
Added power up behaviour (nothing, close, open, last position)
Added curtain style (Roller, etc...) for UI status and to be used in MQTT

* Checked commit before PR. Added html gulp static files generated.

* Corrected a code refactor error which make the MQTT messages not handling position from received messages. Added comment to debug tab to show how to enable debug

* Use the maximum compression for gzip. A byte is a byte :)

* Update code/espurna/curtain_kingart.cpp

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>

* Variable name prefix update
Added public set position function and curtain count

* Added Scheduler new type : curtain

* Add curtain schedule support and correct the 12h bug when adding a slot (00:00 after refresh). Default Hour is 12h

* Code cleaning.
Schedule support.
Light support is having an issue with new schedules corrected here.

* I let do better by the specialists

* Curtain init statues

* Coding style corrections

* Removed debug stuff from now - will be back later with the right way

* rebuild webui

* revert 435f1c5e03 schHour default, rebuild ui

Co-authored-by: Eric Chauvet <eric.chauvet@test-tree.com>
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-05-18 02:19:50 +03:00
Max Prokhorov
8e7854b04e WebUI fix change detection of input elements (#1986)
- use setOriginalsFromValues function right after elements had changed and
**only** with those elements
- add checkbox handling to setOriginalsFromValues to match hasChanged
- apply hasChanged after value is set to refresh originals after saving
- change parts that already set 'original' attribute manually

This was sort-of broken, because original attr never worked as intended. 
Also fix possible OOM for large WebUI images, since sending full config each time means that we need more memory to buffer and parse it.
2019-12-18 17:45:51 +03:00
Xose Pérez
b00b159e42 Do not check line-end-style in web UI builder (#1657) 2019-03-25 13:46:25 +01:00
Dmitry Blinov
376205c9bb Merge branch 'dev' into thermostat
# Conflicts:
#	code/espurna/config/webui.h
#	code/espurna/data/index.all.html.gz
#	code/espurna/data/index.light.html.gz
#	code/espurna/data/index.rfbridge.html.gz
#	code/espurna/data/index.rfm69.html.gz
#	code/espurna/data/index.sensor.html.gz
#	code/espurna/data/index.small.html.gz
#	code/espurna/espurna.ino
#	code/espurna/static/index.all.html.gz.h
#	code/espurna/static/index.light.html.gz.h
#	code/espurna/static/index.rfbridge.html.gz.h
#	code/espurna/static/index.rfm69.html.gz.h
#	code/espurna/static/index.sensor.html.gz.h
#	code/espurna/static/index.small.html.gz.h
#	code/espurna/web.ino
#	code/gulpfile.js
#	code/html/index.html
2019-03-08 01:35:36 +02:00
Dmitry Blinov
ec39ac5c88 Fix conflicts:
1. Add thermostat to the espurna_modules in progmem.h
2. Add thermostat to webui, gulp, html, js.
3. in general.h MQTT_USE_JSON returned to 0 by default and 1 if thermostat enabled.
2019-03-08 01:02:11 +02:00
Andrey F. Kupreychik
609e047f95 Merge remote-tracking branch 'xoseperez/dev' into lightfox-dual 2019-03-05 22:44:29 +07:00
Malachi Soord
c8231860ac [copyright-update] Update for 2019 2019-02-23 22:35:49 +01:00
Andrey F. Kupreychik
bcb36c1859 Merge remote-tracking branch 'xoseperez/dev' into lightfox-dual 2019-01-04 19:10:04 +07:00
Andrey F. Kupreychik
8b4713dee1 UI for LightFox 2019-01-04 18:57:07 +07:00
Max Prokhorov
65d5a50b0b Update to gulp@4 2018-12-09 00:03:55 +03:00
Max Prokhorov
1383b4441e Update npm packages
Bump npm version installed by travis
Update package-lock for latest npm version
Bump packages versions and clean-up unused
Missing datatables.js images to avoid warnings
2018-09-22 05:04:20 +03:00
Xose Pérez
592ee1b593 Fix codacy issues 2018-08-27 11:50:23 +02:00
Xose Pérez
d4e5302a81 Fix codacy issues 2018-08-27 11:39:53 +02:00
Xose Pérez
3bad3428bb Add RFBRIDGE code to full webUI image (#1157) 2018-08-27 10:49:00 +02:00
Xose Pérez
88d0ad7d67 Fix codacy issues in build.js 2018-07-23 15:39:34 +02:00
Indu Prakash
380eee72cb Using correct separator 2018-07-11 17:29:26 -05:00
Xose Pérez
008abd619a Merge branch 'dev' into rfm69 2018-06-28 14:14:59 +02:00
gn0st1c
26e25650b2 Update gulpfile.js
tabs to spaces for consistency
2018-06-25 22:15:59 +03:00
Xose Pérez
3cd58e7f7c Initial support for RFM69GW board 2018-06-24 22:39:06 +02:00
Xose Pérez
cfbd071a71 Use full web UI image if device has more than one webui module (#981) 2018-06-23 19:35:20 +02:00
Xose Pérez
1c755cfb89 Pre-build the different available WebUI images 2018-06-22 20:19:39 +02:00
Xose Pérez
2dd60912cc Silent webui build on commit 2018-06-21 18:09:34 +02:00
Xose Pérez
52ca64eded Clean up builder files 2018-06-21 00:38:13 +02:00
Xose Pérez
b56e986e69 Support for webui_module configuration in the OTA manager 2018-06-20 12:02:57 +02:00
Xose Pérez
894e19124d Build correctly when no modules 2018-06-20 10:14:04 +02:00
Xose Pérez
1583a5810f Configure what HTML modules has each image 2018-06-18 14:44:42 +02:00
Xose Pérez
79cb59b06c Adding filtering code to HTML and JS files 2018-06-16 23:00:15 +02:00
Xose Pérez
86d9ee8009 CSS optimization (#870, #871) 2018-05-21 12:48:04 +02:00
Xose Pérez
6f62758244 Using crass for CSS minification 2018-03-30 23:31:51 +02:00
Xose Pérez
c69d47acd3 Fix codacy issues 2018-03-13 08:40:46 +01:00
Xose Pérez
191e805b78 Remove dependency from gulp-util (#493) 2018-03-02 14:01:25 +01:00
Xose Pérez
536211f030 Still refactoring custom.js 2018-02-08 23:01:14 +01:00
Xose Pérez
21fb8d8b59 Small fixes to custom and gulpfile js 2018-02-08 13:00:33 +01:00
Xose Pérez
939a1e184a Added CSS lint to gulp file 2018-01-26 23:54:38 +01:00
Xose Pérez
a843698b9f More js fixes 2018-01-15 20:30:22 +01:00
Lazar Obradovic
902180db12 try 2 2018-01-12 16:08:44 +01:00
Lazar Obradovic
023f70d203 lintfixes, try1 2018-01-12 15:00:46 +01:00
Xose Pérez
af805ab045 Update copyright notices 2018-01-07 01:21:23 +01:00
Xose Pérez
8b87f70696 Add HTML linter to gulp builder, fix issues with HTML 2017-12-08 09:59:06 +01:00
Xose Pérez
a7c2a6b197 HTTPS disabled by default 2017-08-14 12:05:02 +02:00
Xose Pérez
e850c68c85 Testing web interface over SSL 2017-08-14 09:54:08 +02:00
Xose Pérez
a67c80de69 Small changes 2017-07-23 16:39:04 +02:00