fix: fixed colour in the swap abort reason

main
kiruba-vec 2025-09-29 11:32:09 +05:30
parent 3a2cda3263
commit 342d322e35
15 changed files with 18 additions and 17 deletions

View File

@ -6,7 +6,8 @@ SECRET_KEY="80473e17c5707e19252ef3736fba32805be21a9b3e914190"
# --- PostgreSQL Database Connection --- # --- PostgreSQL Database Connection ---
# Replace with your actual database credentials. # Replace with your actual database credentials.
# Format: postgresql://<user>:<password>@<host>:<port>/<dbname> # Format: postgresql://<user>:<password>@<host>:<port>/<dbname>
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 Connection ---
MQTT_BROKER="mqtt-dev.upgrid.in" MQTT_BROKER="mqtt-dev.upgrid.in"

View File

@ -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://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" # 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 # This tells Flask: "For any route starting with /api/, allow requests
@ -573,7 +573,7 @@ def get_analytics_data():
hourly_swaps[log_hour] += 1 hourly_swaps[log_hour] += 1
if session_id: if session_id:
swap_starts_map[session_id] = log.timestamp swap_starts_map[session_id] = log.timestamp
elif event_type == 'EVENT_SWAP_ENDED': elif event_type == 'EVENT_BATTERY_EXIT':
completed_swaps += 1 completed_swaps += 1
daily_completed[log_date] = daily_completed.get(log_date, 0) + 1 daily_completed[log_date] = daily_completed.get(log_date, 0) + 1
if session_id and session_id in swap_starts_map: 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 = threading.Thread(target=start_mqtt_clients, daemon=True)
mqtt_thread.start() mqtt_thread.start()
print(f"Starting Flask-SocketIO server on http://192.168.1.10:5000") print(f"Starting Flask-SocketIO server on http://10.10.2.47:5000")
socketio.run(app, host='192.168.1.10', port=5000) socketio.run(app, host='10.10.2.47', port=5000)

View File

@ -1,7 +1,7 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// --- CONFIGURATION --- // --- CONFIGURATION ---
const SOCKET_URL = "http://192.168.1.10:5000"; const SOCKET_URL = "http://10.10.2.47:5000";
const API_BASE = "http://192.168.1.10:5000/api"; const API_BASE = "http://10.10.2.47:5000/api";
// --- DOM ELEMENT REFERENCES --- // --- DOM ELEMENT REFERENCES ---
const stationNameEl = document.getElementById('station-name'); const stationNameEl = document.getElementById('station-name');
@ -126,7 +126,7 @@ document.addEventListener('DOMContentLoaded', () => {
type: 'bar', type: 'bar',
data: { data: {
labels: data.labels, 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: { options: {
responsive: true, responsive: true,

View File

@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', () => {
const password = document.getElementById('password').value; const password = document.getElementById('password').value;
try { 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', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password }), body: JSON.stringify({ username, password }),

View File

@ -1,8 +1,8 @@
// frontend/js/common-header.js // frontend/js/common-header.js
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// --- CONFIGURATION --- // --- CONFIGURATION ---
const SOCKET_URL = "http://192.168.1.10:5000"; const SOCKET_URL = "http://10.10.2.47:5000";
const API_BASE = "http://192.168.1.10:5000/api"; const API_BASE = "http://10.10.2.47:5000/api";
// --- STATE & SELECTED STATION --- // --- STATE & SELECTED STATION ---
let selectedStation = null; let selectedStation = null;

View File

@ -1,7 +1,7 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// --- CONFIGURATION --- // --- CONFIGURATION ---
const SOCKET_URL = "http://192.168.1.10:5000"; const SOCKET_URL = "http://10.10.2.47:5000";
const API_BASE = "http://192.168.1.10:5000/api"; // Added for API calls const API_BASE = "http://10.10.2.47:5000/api"; // Added for API calls
// --- DOM ELEMENT REFERENCES --- // --- DOM ELEMENT REFERENCES ---
const grid = document.getElementById('chambersGrid'); const grid = document.getElementById('chambersGrid');

View File

@ -1,7 +1,7 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
// --- CONFIGURATION --- // --- CONFIGURATION ---
const SOCKET_URL = "http://192.168.1.10:5000"; const SOCKET_URL = "http://10.10.2.47:5000";
const API_BASE = "http://192.168.1.10:5000/api"; const API_BASE = "http://10.10.2.47:5000/api";
// --- DOM ELEMENT REFERENCES --- // --- DOM ELEMENT REFERENCES ---
const stationNameEl = document.getElementById('station-name'); const stationNameEl = document.getElementById('station-name');

View File

@ -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 const stationCountEl = document.getElementById('station-count'); // Make sure you have an element with this ID in your HTML
// --- CONFIG & STATE --- // --- 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 allStations = []; // Master list of stations from the API
let pollingInterval = null; let pollingInterval = null;

View File

@ -225,7 +225,7 @@
</div> </div>
<script> <script>
const API_BASE = 'http://192.168.1.10:5000/api'; const API_BASE = 'http://10.10.2.47:5000/api';
const grid = document.getElementById('stations-grid'); const grid = document.getElementById('stations-grid');
const addStationCardTmpl = document.getElementById('add-station-card-template'); const addStationCardTmpl = document.getElementById('add-station-card-template');