From 342d322e353464f80d41f4f49677b380f9ddb7e2 Mon Sep 17 00:00:00 2001 From: kiruba-vec Date: Mon, 29 Sep 2025 11:32:09 +0530 Subject: [PATCH] fix: fixed colour in the swap abort reason --- backend/.env | 3 ++- backend/__pycache__/models.cpython-313.pyc | Bin 3839 -> 3832 bytes .../core/__pycache__/__init__.cpython-313.pyc | Bin 184 -> 178 bytes .../__pycache__/mqtt_client.cpython-313.pyc | Bin 6048 -> 6041 bytes .../protobuf_decoder.cpython-313.pyc | Bin 6601 -> 6595 bytes backend/main.py | 8 ++++---- .../__pycache__/__init__.cpython-313.pyc | Bin 185 -> 179 bytes .../vec_payload_chgSt_pb2.cpython-313.pyc | Bin 6145 -> 6138 bytes frontend/js/analytics.js | 6 +++--- frontend/js/auth.js | 2 +- frontend/js/common-header.js | 4 ++-- frontend/js/dashboard.js | 4 ++-- frontend/js/logs.js | 4 ++-- frontend/js/station_selection.js | 2 +- frontend/station_selection.html | 2 +- 15 files changed, 18 insertions(+), 17 deletions(-) diff --git a/backend/.env b/backend/.env index bc44926..b270d86 100644 --- a/backend/.env +++ b/backend/.env @@ -6,7 +6,8 @@ SECRET_KEY="80473e17c5707e19252ef3736fba32805be21a9b3e914190" # --- PostgreSQL Database Connection --- # Replace with your actual database credentials. # Format: postgresql://:@:/ -DATABASE_URL="postgresql://swap_app_user:2004@localhost:5432/swap_station_db" +# DATABASE_URL="postgresql://swap_app_user:2004@localhost:5432/swap_station_db" +DATABASE_URL="postgresql://swap_app_user:Vec%40123@localhost:5432/swap_station_db" # --- MQTT Broker Connection --- MQTT_BROKER="mqtt-dev.upgrid.in" diff --git a/backend/__pycache__/models.cpython-313.pyc b/backend/__pycache__/models.cpython-313.pyc index fc4be5d6db2f68a1b4c0b3e2ff620ab42bbb153c..4825daaf2ccab0d9c350f33d54958665d9aa7afa 100644 GIT binary patch delta 62 zcmew_`$LxdGcPX}0}#k;I=+!Ridn_W*(xTqIJKxa#yhj9G$}DVu_!Sw#wE2lyClCL QCM-2MH$Qpv1m=8h0FNXU(EtDd delta 46 zcmew%`(Kv(GcPX}0}xz%d~_ps6th5}vsFxJacWUHX;R|kDrVWu-ORb%0C%kq A(f|Me diff --git a/backend/core/__pycache__/__init__.cpython-313.pyc b/backend/core/__pycache__/__init__.cpython-313.pyc index 1b8d7442c3553d36eb93d13f797758e96a02b7f7..45a9ccac455279abe28182d91bc42420a8c9daf1 100644 GIT binary patch delta 49 zcmdnNxQUVbGcPX}0}#k;IzExxSTxYtDkiizwWv78JF}=XDKR^-C^2uMpDbhi#BxUf DX*mzD delta 80 zcmdnQxPy`VGcPX}0}wpdUNw>1*fQMNDkiizwWv78JF}=XDKW++wK%&ZzaSHX;R|kLRQ($O|0TV08l3m Af&c&j diff --git a/backend/core/__pycache__/protobuf_decoder.cpython-313.pyc b/backend/core/__pycache__/protobuf_decoder.cpython-313.pyc index 06b6075d66dd651dac43694fa720dae08a09b5bc..1f52f62a83371a58259f6902999694e117d3ac6b 100644 GIT binary patch delta 77 zcmX?UeAt-#GcPX}0}#k;I=+!xo5eWN*(xTqIJKxa#yhj9G$}DVu_!Sw#wE2lyClCL fCM-2MH$OQ)FDAG=u^_l4u_QA;FMe}AOOz-8^Me~~ delta 59 zcmX?XeA1ZvGcPX}0}z}vT(yx~n?)er*(xTqIJKxa#yhj9G%0biH;XJ!OmKN(L2yZ8 NNoIcD=1i6-Q2;4D6Dt4! diff --git a/backend/main.py b/backend/main.py index 5bbef7a..3fac265 100644 --- a/backend/main.py +++ b/backend/main.py @@ -39,7 +39,7 @@ app = Flask(__name__) # CORS(app, resources={r"/api/*": {"origins": "http://127.0.0.1:5500"}}, supports_credentials=True, expose_headers='Content-Disposition') -CORS(app, resources={r"/api/*": {"origins": ["http://192.168.1.10:5500","http://127.0.0.1:5500"]}}, supports_credentials=True, expose_headers='Content-Disposition') +CORS(app, resources={r"/api/*": {"origins": ["http://10.10.2.47:5501","http://127.0.0.1:5501"]}}, supports_credentials=True, expose_headers='Content-Disposition') # CORS(app, resources={r"/api/*": {"origins": "http://localhost:5173"}}) , "http://127.0.0.1:5500" # This tells Flask: "For any route starting with /api/, allow requests @@ -573,7 +573,7 @@ def get_analytics_data(): hourly_swaps[log_hour] += 1 if session_id: swap_starts_map[session_id] = log.timestamp - elif event_type == 'EVENT_SWAP_ENDED': + elif event_type == 'EVENT_BATTERY_EXIT': completed_swaps += 1 daily_completed[log_date] = daily_completed.get(log_date, 0) + 1 if session_id and session_id in swap_starts_map: @@ -953,5 +953,5 @@ if __name__ == '__main__': mqtt_thread = threading.Thread(target=start_mqtt_clients, daemon=True) mqtt_thread.start() - print(f"Starting Flask-SocketIO server on http://192.168.1.10:5000") - socketio.run(app, host='192.168.1.10', port=5000) + print(f"Starting Flask-SocketIO server on http://10.10.2.47:5000") + socketio.run(app, host='10.10.2.47', port=5000) diff --git a/backend/proto/__pycache__/__init__.cpython-313.pyc b/backend/proto/__pycache__/__init__.cpython-313.pyc index 25d384da07393c68bba8e51410728347050042b0..2b269ac4005615fe422af8fb0a16f5a171c8e839 100644 GIT binary patch delta 49 zcmdnVxS5grGcPX}0}#k;IzExxSTxAlDkiizwWv78JF}=XDKR^-C^2uMpDbhi#BwJ9 DX}1rw delta 80 zcmdnYxRa6lGcPX}0}wpdUNw>1*fPS|DkiizwWv78JF}=XDKW++wK%&ZzaS { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // --- DOM ELEMENT REFERENCES --- const stationNameEl = document.getElementById('station-name'); @@ -126,7 +126,7 @@ document.addEventListener('DOMContentLoaded', () => { type: 'bar', data: { labels: data.labels, - datasets: [{ label: 'Total Swaps', data: data.swap_data, backgroundColor: 'rgba(56, 189, 248, 0.6)' }] + datasets: [{ label: 'Total Swaps initiated', data: data.swap_data, backgroundColor: 'rgba(56, 189, 248, 0.6)' }] }, options: { responsive: true, diff --git a/frontend/js/auth.js b/frontend/js/auth.js index 22c5689..aab6210 100644 --- a/frontend/js/auth.js +++ b/frontend/js/auth.js @@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', () => { const password = document.getElementById('password').value; try { - const response = await fetch('http://192.168.1.10:5000/api/login', { + const response = await fetch('http://10.10.2.47:5000/api/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username, password }), diff --git a/frontend/js/common-header.js b/frontend/js/common-header.js index d9a4660..4a1cc5b 100644 --- a/frontend/js/common-header.js +++ b/frontend/js/common-header.js @@ -1,8 +1,8 @@ // frontend/js/common-header.js document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // --- STATE & SELECTED STATION --- let selectedStation = null; diff --git a/frontend/js/dashboard.js b/frontend/js/dashboard.js index 3bafa00..a99bc05 100644 --- a/frontend/js/dashboard.js +++ b/frontend/js/dashboard.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; // Added for API calls + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // Added for API calls // --- DOM ELEMENT REFERENCES --- const grid = document.getElementById('chambersGrid'); diff --git a/frontend/js/logs.js b/frontend/js/logs.js index 5cc61ca..98b4319 100644 --- a/frontend/js/logs.js +++ b/frontend/js/logs.js @@ -1,7 +1,7 @@ document.addEventListener('DOMContentLoaded', () => { // --- CONFIGURATION --- - const SOCKET_URL = "http://192.168.1.10:5000"; - const API_BASE = "http://192.168.1.10:5000/api"; + const SOCKET_URL = "http://10.10.2.47:5000"; + const API_BASE = "http://10.10.2.47:5000/api"; // --- DOM ELEMENT REFERENCES --- const stationNameEl = document.getElementById('station-name'); diff --git a/frontend/js/station_selection.js b/frontend/js/station_selection.js index 641ee7f..9433cd7 100644 --- a/frontend/js/station_selection.js +++ b/frontend/js/station_selection.js @@ -4,7 +4,7 @@ document.addEventListener('DOMContentLoaded', () => { const stationCountEl = document.getElementById('station-count'); // Make sure you have an element with this ID in your HTML // --- CONFIG & STATE --- - const API_BASE = 'http://192.168.1.10:5000/api'; + const API_BASE = 'http://10.10.2.47:5000/api'; let allStations = []; // Master list of stations from the API let pollingInterval = null; diff --git a/frontend/station_selection.html b/frontend/station_selection.html index a4f3036..685c493 100644 --- a/frontend/station_selection.html +++ b/frontend/station_selection.html @@ -225,7 +225,7 @@