diff --git a/README.md b/README.md index 6ab92fa5..0558b899 100644 --- a/README.md +++ b/README.md @@ -250,13 +250,6 @@ There are some ideas and feature requests which are not currently being pursued Frank Haverland - - - Slider0007 -
- Slider0007 -
- SybexX @@ -264,6 +257,13 @@ There are some ideas and feature requests which are not currently being pursued michael + + + Slider0007 +
+ Slider0007 +
+ nliaudat @@ -368,6 +368,13 @@ There are some ideas and feature requests which are not currently being pursued parhedberg + + + fsck-block +
+ fsck-block +
+ slovdahl @@ -389,13 +396,6 @@ There are some ideas and feature requests which are not currently being pursued LordGuilly - - - bilalmirza74 -
- Bilal Mirza -
- muggenhor @@ -406,10 +406,17 @@ There are some ideas and feature requests which are not currently being pursued - - ppisljar + + bilalmirza74
- Peter Pisljar + Bilal Mirza +
+ + + + AngryApostrophe +
+ AngryApostrophe
@@ -426,6 +433,13 @@ There are some ideas and feature requests which are not currently being pursued Ranjana761 + + + SURYANSH-RAI +
+ SURYANSH RAI +
+ SkylightXD @@ -433,6 +447,8 @@ There are some ideas and feature requests which are not currently being pursued SkylightXD + + ottk3 @@ -447,8 +463,6 @@ There are some ideas and feature requests which are not currently being pursued Tobias Bieniek - - tkopczuk @@ -477,6 +491,8 @@ There are some ideas and feature requests which are not currently being pursued flox_x + + gneluka @@ -491,8 +507,6 @@ There are some ideas and feature requests which are not currently being pursued kalwados - - kub3let @@ -521,13 +535,8 @@ There are some ideas and feature requests which are not currently being pursued smartboart - - - AngryApostrophe -
- AngryApostrophe -
- + + wetneb @@ -535,8 +544,6 @@ There are some ideas and feature requests which are not currently being pursued Antonin Delpeuch - - adarazs @@ -572,6 +579,8 @@ There are some ideas and feature requests which are not currently being pursued Dave + + FarukhS52 @@ -579,8 +588,6 @@ There are some ideas and feature requests which are not currently being pursued Farookh Zaheer Siddiqui - - hex7c0 @@ -616,6 +623,8 @@ There are some ideas and feature requests which are not currently being pursued Joerg Rosenkranz + + Innovatorcloudy @@ -623,8 +632,6 @@ There are some ideas and feature requests which are not currently being pursued KrishCode - - myxor @@ -652,6 +659,13 @@ There are some ideas and feature requests which are not currently being pursued
Michael Geissler
+ + + + ppisljar +
+ Peter Pisljar +
diff --git a/code/components/jomjol_fileserver_ota/server_file.cpp b/code/components/jomjol_fileserver_ota/server_file.cpp index eb69913a..137aeb5f 100644 --- a/code/components/jomjol_fileserver_ota/server_file.cpp +++ b/code/components/jomjol_fileserver_ota/server_file.cpp @@ -6,11 +6,8 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ - - #include "server_file.h" - #include #include #include @@ -58,7 +55,6 @@ struct file_server_data { char scratch[SERVER_FILER_SCRATCH_BUFSIZE]; }; - #include #include #include @@ -67,11 +63,9 @@ using namespace std; string SUFFIX_ZW = "_0xge"; - static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file); static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file); - esp_err_t get_numbers_file_handler(httpd_req_t *req) { std::string ret = flowctrl.getNumbersName(); @@ -87,7 +81,6 @@ esp_err_t get_numbers_file_handler(httpd_req_t *req) return ESP_OK; } - esp_err_t get_data_file_handler(httpd_req_t *req) { struct dirent *entry; @@ -131,7 +124,6 @@ esp_err_t get_data_file_handler(httpd_req_t *req) return ESP_OK; } - esp_err_t get_tflite_file_handler(httpd_req_t *req) { struct dirent *entry; @@ -175,12 +167,11 @@ esp_err_t get_tflite_file_handler(httpd_req_t *req) return ESP_OK; } - /* Send HTTP response with a run-time generated html consisting of * a list of all files and folders under the requested path. * In case of SPIFFS this returns empty list when path is any * string other than '/', since SPIFFS doesn't support directories */ -static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char* uripath, bool readonly) +static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char *uripath, bool readonly) { char entrypath[FILE_PATH_MAX]; char entrysize[16]; @@ -192,82 +183,85 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char dirpath_corrected[FILE_PATH_MAX]; strcpy(dirpath_corrected, dirpath); - file_server_data * server_data = (file_server_data *) req->user_ctx; - if ((strlen(dirpath_corrected)-1) > strlen(server_data->base_path)) // if dirpath is not mountpoint, the last "\" needs to be removed - dirpath_corrected[strlen(dirpath_corrected)-1] = '\0'; + file_server_data *server_data = (file_server_data *)req->user_ctx; - DIR *dir = opendir(dirpath_corrected); + if ((strlen(dirpath_corrected) - 1) > strlen(server_data->base_path)) { + // if dirpath is not mountpoint, the last "\" needs to be removed + dirpath_corrected[strlen(dirpath_corrected) - 1] = '\0'; + } + + DIR *pdir = opendir(dirpath_corrected); const size_t dirpath_len = strlen(dirpath); ESP_LOGD(TAG, "Dirpath: <%s>, Pathlength: %d", dirpath, dirpath_len); - /* Retrieve the base path of file storage to construct the full path */ + // Retrieve the base path of file storage to construct the full path strlcpy(entrypath, dirpath, sizeof(entrypath)); ESP_LOGD(TAG, "entrypath: <%s>", entrypath); - if (!dir) { + if (!pdir) { LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat dir: " + std::string(dirpath) + "!"); - /* Respond with 404 Not Found */ + // Respond with 404 Not Found httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL; } httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); - /* Send HTML file header */ - httpd_resp_sendstr_chunk(req, ""); + // Send HTML file header + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, ""); -///////////////////////////////////////////////// - if (!readonly) { - FILE *fd = fopen("/sdcard/html/file_server.html", "r"); - char *chunk = ((struct file_server_data *)req->user_ctx)->scratch; - size_t chunksize; - do { - chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd); - // ESP_LOGD(TAG, "Chunksize %d", chunksize); - if (chunksize > 0){ - if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { - fclose(fd); - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File sending failed!"); - return ESP_FAIL; - } - } - } while (chunksize != 0); - fclose(fd); - // ESP_LOGI(TAG, "File sending complete"); - } -/////////////////////////////// + httpd_resp_sendstr_chunk(req, ""); + + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, "" + ""); + httpd_resp_sendstr_chunk(req, "

Fileserver

" + "" + "
" + "" + "
" + "" + "
" + "" + "
"); + + httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, ""); std::string _zw = std::string(dirpath); _zw = _zw.substr(8, _zw.length() - 8); - _zw = "/delete/" + _zw + "?task=deldircontent"; + _zw = "/delete/" + _zw + "?task=deldircontent"; + // Send file-list table definition and column labels + httpd_resp_sendstr_chunk(req, "" + "" + ""); - /* Send file-list table definition and column labels */ - httpd_resp_sendstr_chunk(req, - "
NameTypeSize
" - "" - ""); if (!readonly) { - httpd_resp_sendstr_chunk(req, ""); + httpd_resp_sendstr_chunk(req, "\">"); } + httpd_resp_sendstr_chunk(req, "\n"); - /* Iterate over all files / folders and fetch their names and sizes */ - while ((entry = readdir(dir)) != NULL) { - if (strcmp("wlan.ini", entry->d_name) != 0 ) // wlan.ini soll nicht angezeigt werden! - { + // Iterate over all files / folders and fetch their names and sizes + while ((entry = readdir(pdir)) != NULL) { + // wlan.ini soll nicht angezeigt werden! + if (strcmp("wlan.ini", entry->d_name) != 0) { entrytype = (entry->d_type == DT_DIR ? "directory" : "file"); strlcpy(entrypath + dirpath_len, entry->d_name, sizeof(entrypath) - dirpath_len); ESP_LOGD(TAG, "Entrypath: %s", entrypath); + if (stat(entrypath, &entry_stat) == -1) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat " + string(entrytype) + ": " + string(entry->d_name)); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat " + std::string(entrytype) + ": " + std::string(entry->d_name)); continue; } @@ -283,22 +277,25 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const } } - ESP_LOGI(TAG, "Found %s: %s (%s bytes)", entrytype, entry->d_name, entrysize); + ESP_LOGD(TAG, "Found %s: %s (%s bytes)", entrytype, entry->d_name, entrysize); - /* Send chunk of HTML file containing table entries with file name and size */ + // Send chunk of HTML file containing table entries with file name and size httpd_resp_sendstr_chunk(req, "\n"); } } - closedir(dir); - /* Finish the file list table */ + closedir(pdir); + + // Finish the file list table httpd_resp_sendstr_chunk(req, "
NameTypeSize" - "
" - "
d_name); + if (entry->d_type == DT_DIR) { httpd_resp_sendstr_chunk(req, "/"); } + httpd_resp_sendstr_chunk(req, "\">"); httpd_resp_sendstr_chunk(req, entry->d_name); httpd_resp_sendstr_chunk(req, ""); httpd_resp_sendstr_chunk(req, entrytype); httpd_resp_sendstr_chunk(req, ""); httpd_resp_sendstr_chunk(req, entrysize); + if (!readonly) { httpd_resp_sendstr_chunk(req, ""); httpd_resp_sendstr_chunk(req, "
d_name); httpd_resp_sendstr_chunk(req, "\">
"); } + httpd_resp_sendstr_chunk(req, "
"); - /* Send remaining chunk of HTML file to complete it */ + // Send remaining chunk of HTML file to complete it httpd_resp_sendstr_chunk(req, ""); - /* Send empty chunk to signal HTTP response completion */ + // Send empty chunk to signal HTTP response completion httpd_resp_sendstr_chunk(req, NULL); return ESP_OK; } -/* -#define IS_FILE_EXT(filename, ext) \ - (strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0) -*/ static esp_err_t logfileact_get_full_handler(httpd_req_t *req) { return send_logfile(req, true); } - static esp_err_t logfileact_get_last_part_handler(httpd_req_t *req) { return send_logfile(req, false); } @@ -339,7 +333,6 @@ static esp_err_t datafileact_get_full_handler(httpd_req_t *req) { return send_datafile(req, true); } - static esp_err_t datafileact_get_last_part_handler(httpd_req_t *req) { return send_datafile(req, false); } @@ -424,7 +417,6 @@ static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file) return ESP_OK; } - static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file) { LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "log_get_last_part_handler"); @@ -510,7 +502,6 @@ static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file) return ESP_OK; } - /* Handler to download a file kept on the server */ static esp_err_t download_get_handler(httpd_req_t *req) { @@ -528,7 +519,6 @@ static esp_err_t download_get_handler(httpd_req_t *req) // filename = get_path_from_uri(filepath, ((struct file_server_data *)req->user_ctx)->base_path, // req->uri, sizeof(filepath)); - if (!filename) { LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Filename is too long"); /* Respond with 414 Error */ @@ -759,7 +749,6 @@ static esp_err_t upload_post_handler(httpd_req_t *req) httpd_resp_set_hdr(req, "Location", directory.c_str()); httpd_resp_sendstr(req, "File uploaded successfully"); - return ESP_OK; } @@ -770,7 +759,6 @@ static esp_err_t delete_post_handler(httpd_req_t *req) char filepath[FILE_PATH_MAX]; struct stat file_stat; - ////////////////////////////////////////////////////////////// char _query[200]; char _valuechar[30]; @@ -893,13 +881,11 @@ static esp_err_t delete_post_handler(httpd_req_t *req) } } - httpd_resp_set_hdr(req, "Location", directory.c_str()); httpd_resp_sendstr(req, "File successfully deleted"); return ESP_OK; } - void delete_all_in_directory(std::string _directory) { struct dirent *entry; @@ -1137,8 +1123,6 @@ void unzip(std::string _in_zip_file, std::string _target_directory){ ESP_LOGD(TAG, "Success."); } - - void register_server_file_uri(httpd_handle_t server, const char *base_path) { static struct file_server_data *server_data = NULL; @@ -1164,8 +1148,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) strlcpy(server_data->base_path, base_path, sizeof(server_data->base_path)); - - /* URI handler for getting uploaded files */ // char zw[sizeof(serverprefix)+1]; // strcpy(zw, serverprefix); @@ -1180,7 +1162,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) }; httpd_register_uri_handler(server, &file_download); - httpd_uri_t file_datafileact = { .uri = "/datafileact", // Match all URIs of type /path/to/file .method = HTTP_GET, @@ -1189,7 +1170,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) }; httpd_register_uri_handler(server, &file_datafileact); - httpd_uri_t file_datafile_last_part_handle = { .uri = "/data", // Match all URIs of type /path/to/file .method = HTTP_GET, @@ -1206,7 +1186,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) }; httpd_register_uri_handler(server, &file_logfileact); - httpd_uri_t file_logfile_last_part_handle = { .uri = "/log", // Match all URIs of type /path/to/file .method = HTTP_GET, @@ -1215,7 +1194,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) }; httpd_register_uri_handler(server, &file_logfile_last_part_handle); - /* URI handler for uploading files to server */ httpd_uri_t file_upload = { .uri = "/upload/*", // Match all URIs of type /upload/path/to/file @@ -1233,5 +1211,4 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path) .user_ctx = server_data // Pass server data as context }; httpd_register_uri_handler(server, &file_delete); - } diff --git a/code/components/openmetrics/openmetrics.cpp b/code/components/openmetrics/openmetrics.cpp index c90100e8..fd893e7d 100644 --- a/code/components/openmetrics/openmetrics.cpp +++ b/code/components/openmetrics/openmetrics.cpp @@ -1,4 +1,6 @@ #include "openmetrics.h" +#include "functional" +#include "esp_log.h" /** * create a singe metric from the given input @@ -10,10 +12,66 @@ std::string createMetric(const std::string &metricName, const std::string &help, metricName + " " + value + "\n"; } +typedef struct sequence_metric { + const char *name; + const char *help; + const char *type; + std::function valueFunc; +} sequence_metric_t; + + +sequence_metric_t sequenceMetrics[4] = { + { "flow_value", "current value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnValue;} }, + { "flow_raw_value", "current raw value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnRawValue;} }, + { "flow_pre_value", "previous value of meter readout", "gauge", [](NumberPost *number)-> std::string {return number->ReturnPreValue;} }, + { "flow_error", "Error message text != 'no error'", "gauge", [](NumberPost *number)-> std::string {return number->ErrorMessageText.compare("no error") == 0 ? "0" : "1";} }, +}; + +std::string createSequenceMetrics(std::string prefix, const std::vector &numbers) +{ + std::string result; + for (int i = 0; iname.c_str(), value.c_str()); + + // only valid data is reported (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#missing-data) + if (value.length() > 0) + { + auto label = number->name; + // except newline, double quote, and backslash (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#abnf) + // to keep it simple, these characters are just removed from the label + replaceAll(label, "\\", ""); + replaceAll(label, "\"", ""); + replaceAll(label, "\n", ""); + + res += prefix + "_" + sequenceMetrics[i].name + "{sequence=\"" + label + "\"} " + value + "\n"; + } + } + // prepend metadata if a valid metric was created + if (res.length() > 0) + { + res = "# HELP " + prefix + "_" + sequenceMetrics[i].name + " " + sequenceMetrics[i].help + "\n" + + "# TYPE " + prefix + "_" + sequenceMetrics[i].name + " " + sequenceMetrics[i].type + "\n" + + res; + } + result += res; + } + + return result; +} + /** * Generate the MetricFamily from all available sequences * @returns the string containing the text wire format of the MetricFamily **/ +/* std::string createSequenceMetrics(std::string prefix, const std::vector &numbers) { std::string res; @@ -41,3 +99,4 @@ std::string createSequenceMetrics(std::string prefix, const std::vectorname = "main"; number_1->ReturnValue = "123.456"; + number_1->ReturnRawValue = "N23.456"; + number_1->ReturnPreValue = "986.543"; + number_1->ErrorMessageText = ""; NUMBERS.push_back(number_1); const std::string metricNamePrefix = "ai_on_the_edge_device"; - const std::string metricName = metricNamePrefix + "_flow_value"; + const std::string metricName1 = metricNamePrefix + "_flow_value"; + const std::string metricName2 = metricNamePrefix + "_flow_raw_value"; + const std::string metricName3 = metricNamePrefix + "_flow_pre_value"; + const std::string metricName4 = metricNamePrefix + "_flow_error"; + + std::string expected1 ; + expected1 = "# HELP " + metricName1 + " current value of meter readout\n# TYPE " + metricName1 + " gauge\n" + + metricName1 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n"; + + expected1 += "# HELP " + metricName2 + " current raw value of meter readout\n# TYPE " + metricName2 + " gauge\n" + + metricName2 + "{sequence=\"" + number_1->name + "\"} " + "NaN" + "\n"; + + expected1 += "# HELP " + metricName3 + " previous value of meter readout\n# TYPE " + metricName3 + " gauge\n" + + metricName3 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnPreValue + "\n"; + + expected1 += "# HELP " + metricName4 + " Error message text != 'no error'\n# TYPE " + metricName4 + " gauge\n" + + metricName4 + "{sequence=\"" + number_1->name + "\"} " + "1" + "\n"; - std::string expected1 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" + - metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n"; TEST_ASSERT_EQUAL_STRING(expected1.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str()); NumberPost *number_2 = new NumberPost; number_2->name = "secondary"; number_2->ReturnValue = "1.0"; + number_2->ReturnRawValue = "01.000"; + number_2->ReturnPreValue = "0.987"; + number_2->ErrorMessageText = "no error"; NUMBERS.push_back(number_2); - std::string expected2 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" + - metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n" + - metricName + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnValue + "\n"; + std::string expected2 ; + expected2 = "# HELP " + metricName1 + " current value of meter readout\n# TYPE " + metricName1 + " gauge\n" + + metricName1 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n" + + metricName1 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnValue + "\n"; + + expected2 += "# HELP " + metricName2 + " current raw value of meter readout\n# TYPE " + metricName2 + " gauge\n" + + metricName2 + "{sequence=\"" + number_1->name + "\"} " + "NaN" + "\n" + + metricName2 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnRawValue + "\n"; + + expected2 += "# HELP " + metricName3 + " previous value of meter readout\n# TYPE " + metricName3 + " gauge\n" + + metricName3 + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnPreValue + "\n" + + metricName3 + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnPreValue + "\n"; + + expected2 += "# HELP " + metricName4 + " Error message text != 'no error'\n# TYPE " + metricName4 + " gauge\n" + + metricName4 + "{sequence=\"" + number_1->name + "\"} " + "1" + "\n" + + metricName4 + "{sequence=\"" + number_2->name + "\"} " + "0" + "\n"; + + TEST_ASSERT_EQUAL_STRING(expected2.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str()); } diff --git a/sd-card/html/backup.html b/sd-card/html/backup.html index 04af87f3..cc3c57c1 100644 --- a/sd-card/html/backup.html +++ b/sd-card/html/backup.html @@ -1,222 +1,222 @@ - - - - Backup/Restore Configuration - - - - - - - -

Backup Configuration

-

With the following action the config folder on the SD-card gets zipped and provided as a download.

- - -

-
-

Restore Configuration

-

Use the File Server to upload individual files.

- - - - - - - - - + + + + Backup/Restore Configuration + + + + + + + +

Backup Configuration

+

With the following action the config folder on the SD-card gets zipped and provided as a download.

+ + +

+
+

Restore Configuration

+

Use the File Server to upload individual files.

+ + + + + + + + + diff --git a/sd-card/html/data_export.html b/sd-card/html/data_export.html new file mode 100644 index 00000000..786b868f --- /dev/null +++ b/sd-card/html/data_export.html @@ -0,0 +1,207 @@ + + + + Data Export (CSV) + + + + + + +

Data Export(CSV)

+

With the following action the data folder on the SD-card gets zipped and provided as a download.

+ +

+
+

+ + + + + + + + diff --git a/sd-card/html/edit_alignment.html b/sd-card/html/edit_alignment.html index 0ba6b387..6445144a 100644 --- a/sd-card/html/edit_alignment.html +++ b/sd-card/html/edit_alignment.html @@ -79,6 +79,18 @@ transform: translate(-50%,-50%); -ms-transform: translate(-50%,-50%); } + + #reboot_button { + float: none; + background-color: #f44336; + color: white; + padding: 5px; + border-radius: + 5px; font-weight: bold; + text-align: center; + text-decoration: none; + display: inline-block; + } @@ -188,13 +200,11 @@ param; function doReboot() { - if (confirm("Are you sure you want to reboot? Did you save your changes?")) { - var stringota = domainname + "/reboot"; - window.location = stringota; - window.location.href = stringota; - window.location.assign(stringota); - window.location.replace(stringota); - } + var stringota = domainname + "/reboot"; + window.location = stringota; + window.location.href = stringota; + window.location.assign(stringota); + window.location.replace(stringota); } function ChangeSelection(){ @@ -215,50 +225,45 @@ document.getElementById("overlay").style.display = "block"; document.getElementById("overlaytext").innerHTML = "Save Alignment Marker..."; - if (confirm("Are you sure you want to save the new alignment marker configuration?")) { - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } - async function task() { - while (true) { - WriteConfigININew(); - - if (neueref1 == 1 && neueref2 == 1) { - UpdateConfigReferences(domainname); - } - else if (neueref1 == 1) { - var anzneueref = 1; - UpdateConfigReference(anzneueref, domainname); - } - else if (neueref2 == 1) { - var anzneueref = 2; - UpdateConfigReference(anzneueref, domainname); - } - - SaveConfigToServer(domainname); - - document.getElementById("updatemarker").disabled = false; - // document.getElementById("savemarker").disabled = true; - // document.getElementById("enhancecontrast").disabled = true; - - EnDisableItem(false, "savemarker", true); - EnDisableItem(false, "enhancecontrast", true); - - document.getElementById("overlay").style.display = "none"; - firework.launch('Alignment marker saved. They will get applied after next reboot', 'success', 5000); - return; + async function task() { + while (true) { + WriteConfigININew(); + + if (neueref1 == 1 && neueref2 == 1) { + UpdateConfigReferences(domainname); + } + else if (neueref1 == 1) { + var anzneueref = 1; + UpdateConfigReference(anzneueref, domainname); + } + else if (neueref2 == 1) { + var anzneueref = 2; + UpdateConfigReference(anzneueref, domainname); } - } - setTimeout(function () { - // Delay so the overlay gets shown - task(); - }, 1); - } - else { - document.getElementById("overlay").style.display = "none"; + SaveConfigToServer(domainname); + + document.getElementById("updatemarker").disabled = false; + // document.getElementById("savemarker").disabled = true; + // document.getElementById("enhancecontrast").disabled = true; + + EnDisableItem(false, "savemarker", true); + EnDisableItem(false, "enhancecontrast", true); + + document.getElementById("overlay").style.display = "none"; + firework.launch('Alignment marker saved. They will get applied after the next reboot!

\nreboot now', 'success', 5000); + return; + } } + + setTimeout(function () { + // Delay so the overlay gets shown + task(); + }, 1); } function EnhanceContrast() { diff --git a/sd-card/html/edit_analog.html b/sd-card/html/edit_analog.html index 8b713dbb..bc2ab661 100644 --- a/sd-card/html/edit_analog.html +++ b/sd-card/html/edit_analog.html @@ -5,6 +5,20 @@ Analog ROI + + @@ -185,13 +199,11 @@ The following settings are only used for easier setup, they are not persi domainname = getDomainname(); function doReboot() { - if (confirm("Are you sure you want to reboot? Did you save your changes?")) { - var stringota = getDomainname() + "/reboot"; - window.location = stringota; - window.location.href = stringota; - window.location.assign(stringota); - window.location.replace(stringota); - } + var stringota = getDomainname() + "/reboot"; + window.location = stringota; + window.location.href = stringota; + window.location.assign(stringota); + window.location.replace(stringota); } function EnDisableAnalog() { @@ -331,16 +343,14 @@ The following settings are only used for easier setup, they are not persi } function SaveToConfig() { - if (confirm("Are you sure you want to save the new analog ROI configuration?")) { - //_zwcat = getConfigCategory(); - cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked; - WriteConfigININew(); - SaveConfigToServer(domainname); - UpdateROIs(); - document.getElementById("saveroi").disabled = true; + //_zwcat = getConfigCategory(); + cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked; + WriteConfigININew(); + SaveConfigToServer(domainname); + UpdateROIs(); + document.getElementById("saveroi").disabled = true; - firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000); - } + firework.launch('Configuration saved. It will get applied after the next reboot!

\nreboot now', 'success', 5000); } function ShowMultiplier() { diff --git a/sd-card/html/edit_config_raw.html b/sd-card/html/edit_config_raw.html index 803a6d46..91deb2b5 100644 --- a/sd-card/html/edit_config_raw.html +++ b/sd-card/html/edit_config_raw.html @@ -20,6 +20,18 @@ textarea { font-size: 15px; } + + #reboot_button { + float: none; + background-color: #f44336; + color: white; + padding: 5px; + border-radius: + 5px; font-weight: bold; + text-align: center; + text-decoration: none; + display: inline-block; + } @@ -38,15 +50,8 @@ - - - -
- - - -
- +
+ @@ -64,23 +69,19 @@ function saveTextAsFile() { - if (confirm("Are you sure you want to save the configuration?")) { - FileDeleteOnServer("/config/config.ini", domainname); - var textToSave = document.getElementById("inputTextToSave").value; - FileSendContent(textToSave, "/config/config.ini", domainname); + FileDeleteOnServer("/config/config.ini", domainname); + var textToSave = document.getElementById("inputTextToSave").value; + FileSendContent(textToSave, "/config/config.ini", domainname); - firework.launch('Configuration saved. It will get applied after next reboot', 'success', 5000); - } + firework.launch('Configuration saved. It will get applied after the next reboot!

\nreboot now', 'success', 5000); } function doReboot() { - if (confirm("Are you sure you want to reboot?")) { - var stringota = "/reboot"; - window.location = stringota; - window.location.href = stringota; - window.location.assign(stringota); - window.location.replace(stringota); - } + var stringota = "/reboot"; + window.location = stringota; + window.location.href = stringota; + window.location.assign(stringota); + window.location.replace(stringota); } LoadConfigNeu(); diff --git a/sd-card/html/edit_config_template.html b/sd-card/html/edit_config_template.html index 007c86fd..7176c72d 100644 --- a/sd-card/html/edit_config_template.html +++ b/sd-card/html/edit_config_template.html @@ -183,7 +183,19 @@ color: white; transform: translate(-50%,-50%); -ms-transform: translate(-50%,-50%); - } + } + + #reboot_button { + float: none; + background-color: #f44336; + color: white; + padding: 5px; + border-radius: + 5px; font-weight: bold; + text-align: center; + text-decoration: none; + display: inline-block; + } @@ -897,7 +909,7 @@ - Parameter per number sequence: + The following parameters are configurable individually for each number sequence: @@ -1188,8 +1200,8 @@ - - + + $TOOLTIP_MQTT_MeterType @@ -1208,7 +1220,7 @@ - Parameter per number sequence: + The following parameters are configurable individually for each number sequence: @@ -1937,11 +1949,11 @@ -