New functions added

This commit is contained in:
RZ_MINIX\rober 2025-08-14 21:54:37 -07:00
parent 76e97ad299
commit 282e3cbb5a
8 changed files with 23598 additions and 671 deletions

View File

@ -4,15 +4,16 @@ FROM python:3.9-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install Python dependencies with headless OpenCV
COPY requirements.txt requirements_temp.txt
# Replace opencv-python with opencv-python-headless
RUN sed 's/opencv-python/opencv-python-headless/g' requirements_temp.txt > requirements_fixed.txt
RUN pip install --no-cache-dir -r requirements_fixed.txt
# Copy and build the C extension
COPY simplified_filter_short_groups.c /app/

View File

@ -15,4 +15,3 @@ pandas
matplotlib
redis
requests

File diff suppressed because it is too large Load Diff

19948
well-api4.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -196,6 +196,8 @@ var last_l_time = 0;
var last_r_time = 0;
var clicked_sensor_description_fixed = "";
var epoch_start = 0;
var user_name = localStorage.getItem('user_name') || '';
var user_id = localStorage.getItem('user_id') || '0';
var key = localStorage.getItem('key');
@ -251,7 +253,7 @@ var time_min = 0;
var time_max = 2645858117;
var msecsInADay = 86400000;
var start_epoch = 0;
var start_time = Date.now();
var signature = "deployment.htm" + start_time.toString();
var unique_identifier = Math.random().toString(16).substr(2, 8) + signature;
@ -1839,12 +1841,10 @@ function ProcessQueue() {
vall = message["payload"][displaying_sensor_t];
}
epoch_ms = (timee+hours_delta * 3600) * 1000;
if (displaying_sensor == "temperature"){
vall = vall-16;
vall = vall;
}
if (displaying_sensor.startsWith("s")) {
@ -2139,6 +2139,8 @@ function PrepareChart(devices_count) {
t.onchange = function (p) {
if (true) {
xValue = UniversalChart.axes.bottom.fromPos(p.x);
ms_from_start = xValue - start_epoch;
data_index = parseInt(ms_from_start/10000.0);
var myDate = new Date(xValue);
var timeSinceMidnight = myDate.getTime() - new Date(myDate.getFullYear(), myDate.getMonth(), myDate.getDate()).getTime();
@ -2154,7 +2156,7 @@ function PrepareChart(devices_count) {
time_string = myDate.toLocaleString();
mani_part = time_string.substr(0, time_string.length - 3);
ampm_part = time_string.substr(time_string.length - 3,time_string.length);
UniversalChart.title.text = clicked_sensor_description_fixed +" " +mani_part+"."+decimal+ampm_part +", " +yValue.toFixed(2);
UniversalChart.title.text = data_index +" --- "+ clicked_sensor_description_fixed +" " +mani_part+"."+decimal+ampm_part +", " +yValue.toFixed(2);
UniversalChart.draw();
UpdateRoseChart(minute_in_day)
}
@ -2377,6 +2379,10 @@ function createCustomLegend() {
const seriesIndex = parseInt(checkbox.getAttribute('data-series-index'));
checkbox.checked = checked;
UniversalChart.series.items[seriesIndex].visible = checked;
if(checked){
console.log("Selected");
console.log(seriesIndex);
}
});
UniversalChart.draw();
}
@ -2561,6 +2567,7 @@ function DisplayPresence(data, zmap_type) {
deca = point[0];
vall = 100*point[1];
epoch_ms = start_epoch + deca*10000; //deca in ms
//epoch_ms = epoch_ms + hours_delta * 3600000

View File

@ -129,6 +129,7 @@ async function SubmitDevice() {
editing_device_id = document.getElementById("editing_device_id").innerText;
device_mac = document.getElementById("device_mac").value;
well_id = document.getElementById("well_id").value;
group_id = document.getElementById("group_id").value;
description = document.getElementById("description").value;
location_ = document.getElementById("location").value; //location is reserved word
close_to = document.getElementById("close_to").value;
@ -152,6 +153,7 @@ async function SubmitDevice() {
formData.append('editing_device_id', editing_device_id);
formData.append('device_mac', device_mac);
formData.append('well_id', well_id);
formData.append('group_id', group_id);
formData.append('description', description);
formData.append('location', location_);
formData.append('close_to', close_to);
@ -216,6 +218,11 @@ function TZoneChange() {
<input type="text" id="well_id" style="width: 50%; padding: 8px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px;">
</div>
<div class="form-group" style="margin-bottom: 15px; display: flex; align-items: center;">
<label for="group_id" style="display: block; margin-bottom: 5px; color: #333;">Group Id: *</label>
<input type="text" id="group_id" style="width: 50%; padding: 8px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px;">
</div>
<div class="form-group" style="margin-bottom: 15px; display: flex; align-items: center;">
<label for="description" style="display: block; margin-bottom: 5px; color: #333;">Description:</label>
<input type="text" id="description" style="width: 80%; padding: 8px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px;">

View File

@ -0,0 +1,282 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Wellnuo</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #f0f2f5; /* Color matching the logo's edge */
font-family: Arial, sans-serif;
}
.email-container {
max-width: 600px;
margin: 20px auto;
background-color: #ffffff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.header {
text-align: center;
padding: 20px;
background-color: #f0f2f5;
}
.header img {
max-width: 150px;
}
.content {
padding: 20px 30px;
}
.content h1 {
color: #333333;
}
.content p {
color: #555555;
line-height: 1.6;
}
.credentials, .devices-section {
margin: 20px 0;
padding: 15px;
background-color: #f9f9f9;
border-left: 4px solid #007bff;
}
.credentials p {
margin: 5px 0;
}
.device-row {
display: flex;
align-items: center;
margin-bottom: 10px;
flex-wrap: wrap;
}
.device-label {
flex: 1;
min-width: 100px;
font-weight: bold;
}
.device-inputs {
flex: 3;
display: flex;
gap: 10px;
}
.device-inputs select, .device-inputs input {
padding: 8px;
border: 1px solid #cccccc;
border-radius: 4px;
width: calc(50% - 5px);
}
.submit-button-container {
text-align: center;
margin-top: 20px;
}
.submit-button {
background-color: #007bff;
color: #ffffff;
padding: 12px 25px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
.submit-button:hover {
background-color: #0056b3;
}
.links {
margin-top: 20px;
text-align: center;
}
.links a {
display: inline-block;
margin: 5px 10px;
color: #007bff;
text-decoration: none;
}
.links a:hover {
text-decoration: underline;
}
.footer {
text-align: center;
padding: 20px;
font-size: 12px;
color: #999999;
}
.message-area {
text-align: center;
padding: 10px;
margin-bottom: 15px;
}
.message-area .success {
color: green;
}
.message-area .error {
color: red;
}
.message-area .loading {
color: #007bff;
}
</style>
</head>
<body>
<div class="email-container">
<div class="header">
<img src="https://wellnua.com/wellnuo/WellnuoLogo_1.png" alt="Wellnuo Logo">
</div>
<div class="content">
<h1>Welcome, {first_name}!</h1>
<p>Thank you for joining Wellnuo. We are excited to have you on board. Your account has been successfully created after you have approved our disclaimer.</p>
<div class="credentials">
<p><strong>First Name:</strong> {first_name}</p>
<p><strong>Last Name:</strong> {last_name}</p>
<p><strong>Username:</strong> {user_name}</p>
<p><strong>Password:</strong> {password}</p>
</div>
<div class="devices-section">
<h3>Your Devices</h3>
<p>Please provide a location and a brief description for each of your devices below.</p>
<div id="message-area" class="message-area"></div>
<form id="device-form">
{devices_html}
<div class="submit-button-container">
<button type="button" class="submit-button" onclick="submitForm()">Submit Information</button>
</div>
</form>
</div>
<div class="links">
<h3>Access Wellnuo</h3>
<a href="https://wellnua.com/wellnuo/WellNuoAppV4.apk">Android App</a> |
<a href="https://react.eluxnetworks.net/login">Mobile Web (PWA)</a> |
<a href="https://portal.eluxnetworks.net/login">Desktop Web App</a> |
<a href="https://eluxnetworks.net/function/well-api">Advanced Desktop Web App</a>
</div>
</div>
<div class="footer">
<p>&copy; 2025 Wellnuo. All rights reserved.</p>
</div>
</div>
<script>
function showLoading(message) {
const messageArea = document.getElementById('message-area');
messageArea.innerHTML = `<p class="loading">${message}</p>`;
}
function showSuccess(message) {
const messageArea = document.getElementById('message-area');
messageArea.innerHTML = `<p class="success">${message}</p>`;
}
function showError(message) {
const messageArea = document.getElementById('message-area');
messageArea.innerHTML = `<p class="error">${message}</p>`;
}
function clearMessages() {
const messageArea = document.getElementById('message-area');
messageArea.innerHTML = '';
}
const baseURL = window.location.origin;
//const api_url = `${baseURL}/function/well-api`;
const api_url = `https://eluxnetworks.net/function/well-api`;
async function SendToServer(formData) {
console.log(formData.toString());
try {
const response = await fetch(api_url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
mode: 'no-cors',
body: formData.toString()
});
if (response.ok) {
const text = await response.text();
console.log(text);
try {
const data = JSON.parse(text);
return data;
} catch {
const data = {
ok: 0
};
return data;
}
} else {
console.log(await response.json());
const data = {
ok: 0
};
return data;
}
} catch (error) {
console.error('Error:', error);
return { ok: 0 };
}
}
async function submitForm() {
showLoading("Submitting form...");
const firstName = "{first_name}";
const lastName = "{last_name}";
const username = "{user_name}";
const password = "{password}";
const email = ""; // Assuming email is not directly available in this form context
const devicesData = [];
const deviceElements = document.querySelectorAll('.device-row');
deviceElements.forEach(deviceElement => {
const deviceId = deviceElement.dataset.deviceId;
const location = deviceElement.querySelector('select').value;
const description = deviceElement.querySelector('input').value;
devicesData.push({
id: deviceId,
location: location,
description: description
});
});
try {
const formData = new URLSearchParams();
formData.append('function', "devices_locations_update");
formData.append('user_name', username);
formData.append('password', password);
formData.append('devices', JSON.stringify(devicesData));
formData.append('Date', new Date().toISOString());
const data = await SendToServer(formData);
clearMessages();
if (data.ok == 1) {
showSuccess("User account created successfully! All devices are available and assigned.");
// Optionally disable the form elements after successful submission
document.querySelectorAll('#device-form select, #device-form input, #device-form button').forEach(el => el.disabled = true);
return true;
} else {
if (data.error) {
showError(data.error);
} else {
showError("Failed to submit form. Please try again.");
}
return false;
}
} catch (error) {
clearMessages();
showError("Network error occurred. Please check your connection and try again.");
console.error("Submit error:", error);
return false;
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Wellnuo</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #f0f2f5; /* Color matching the logo's edge */
font-family: Arial, sans-serif;
}
.email-container {
max-width: 600px;
margin: 20px auto;
background-color: #ffffff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.header {
text-align: center;
padding: 20px;
background-color: #f0f2f5;
}
.header img {
max-width: 150px;
}
.content {
padding: 20px 30px;
}
.content h1 {
color: #333333;
}
.content p {
color: #555555;
line-height: 1.6;
}
.credentials, .devices-section {
margin: 20px 0;
padding: 15px;
background-color: #f9f9f9;
border-left: 4px solid #007bff;
}
.credentials p {
margin: 5px 0;
}
.device-row {
display: flex;
align-items: center;
margin-bottom: 10px;
flex-wrap: wrap;
}
.device-label {
flex: 1;
min-width: 100px;
font-weight: bold;
}
.device-inputs {
flex: 3;
display: flex;
gap: 10px;
}
.device-inputs select, .device-inputs input {
padding: 8px;
border: 1px solid #cccccc;
border-radius: 4px;
width: calc(50% - 5px);
}
.submit-button-container {
text-align: center;
margin-top: 20px;
}
.submit-button {
background-color: #007bff;
color: #ffffff;
padding: 12px 25px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
.submit-button:hover {
background-color: #0056b3;
}
.links {
margin-top: 20px;
text-align: center;
}
.links a {
display: inline-block;
margin: 5px 10px;
color: #007bff;
text-decoration: none;
}
.links a:hover {
text-decoration: underline;
}
.footer {
text-align: center;
padding: 20px;
font-size: 12px;
color: #999999;
}
.message-area {
text-align: center;
padding: 10px;
margin-bottom: 15px;
}
.message-area .success {
color: green;
}
.message-area .error {
color: red;
}
.message-area .loading {
color: #007bff;
}
</style>
</head>
<body>
<div class="email-container">
<div class="header">
<img src="https://wellnua.com/wellnuo/WellnuoLogo_1.png" alt="Wellnuo Logo">
</div>
<div class="content">
<h1>Welcome, {first_name}!</h1>
<p>Thank you for joining Wellnuo. We are excited to have you on board. Your account has been successfully created after you have approved our disclaimer.</p>
<div class="credentials">
<p><strong>First Name:</strong> {first_name}</p>
<p><strong>Last Name:</strong> {last_name}</p>
<p><strong>Username:</strong> {user_name}</p>
<p><strong>Password:</strong> {password}</p>
</div>
<p>To start using Wellnuo Service, please select one of the links below.</p>
<div class="links">
<h3>Access Wellnuo</h3>
<a href="https://wellnua.com/Helps/WebApp1/WellNuoMobileApplication.html">HELP</a> |
<a href="https://wellnua.com/wellnuo/WellNuoAppV4.apk">Android App (open this link using your Android phone)</a> |
<a href="https://react.eluxnetworks.net/login">Mobile Web (PWA)</a> |
<a href="https://portal.eluxnetworks.net/login">Desktop Web App</a> |
<a href="https://eluxnetworks.net/function/well-api">Advanced Desktop Web App</a>
</div>
</div>
<div class="footer">
<p>&copy; 2025 Wellnuo. All rights reserved.</p>
</div>
</div>
</body>
</html>