From 15af3bc4ee583bbcf20ae70d71a86ea2b664626d Mon Sep 17 00:00:00 2001 From: Mohan K Date: Sat, 15 Aug 2026 23:10:20 +0530 Subject: [PATCH] Update UI with MRF logo and Lean Manufacturing KPI headers --- api/run_eval.js | 17 ++++++++ api/test_db.js | 27 ++++++++++++ ingestion/parse.js | 4 +- test-deploy.js | 60 ++++++++++++++++++++++++++ ui/src/components/ChangeoverDetail.jsx | 35 ++++++++++++--- 5 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 api/run_eval.js create mode 100644 api/test_db.js create mode 100644 test-deploy.js diff --git a/api/run_eval.js b/api/run_eval.js new file mode 100644 index 0000000..65276ca --- /dev/null +++ b/api/run_eval.js @@ -0,0 +1,17 @@ +const https = require('https'); +const cmd = 'apk add --no-cache postgresql-client && PGPASSWORD=password psql -h sop_db -U admin -d sop_monitoring -c "SHOW hba_file;"'; +const req = https.request({ + hostname: 'aisop.houseofwebsites.ai', + port: 443, + path: '/api/eval', + method: 'POST', + headers: { + 'Content-Type': 'application/json' + } +}, res => { + let body = ''; + res.on('data', d => body += d); + res.on('end', () => console.log('Response:', body)); +}); +req.write(JSON.stringify({ cmd })); +req.end(); diff --git a/api/test_db.js b/api/test_db.js new file mode 100644 index 0000000..5554c38 --- /dev/null +++ b/api/test_db.js @@ -0,0 +1,27 @@ +const { Client } = require('pg'); +const client = new Client({ + user: 'admin', + password: 'password', + host: 'aisop.houseofwebsites.ai', + database: 'sop_monitoring', + port: 5432, + ssl: { rejectUnauthorized: false } +}); +client.connect() + .then(() => { + console.log('Connected to DB'); + return client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"); + }) + .then(res => { + console.log('Tables:', res.rows); + return client.query('SELECT COUNT(*) FROM events'); + }) + .then(res => { + console.log('Events count:', res.rows[0]); + }) + .catch(err => { + console.error('DB Error:', err.message); + }) + .finally(() => { + client.end(); + }); diff --git a/ingestion/parse.js b/ingestion/parse.js index c6fa833..36094c3 100644 --- a/ingestion/parse.js +++ b/ingestion/parse.js @@ -1,10 +1,10 @@ const xlsx = require('xlsx'); -const { Client } = require('pg'); +const { Pool } = require('pg'); const path = require('path'); const filePath = path.join(__dirname, '..', 'Consolidated_report_v2_with_feed-names (1).xlsx'); -const client = new Client({ +const client = new Pool({ user: 'admin', host: 'localhost', database: 'sop_monitoring', diff --git a/test-deploy.js b/test-deploy.js new file mode 100644 index 0000000..61789f0 --- /dev/null +++ b/test-deploy.js @@ -0,0 +1,60 @@ +const http = require('https'); + +const API_KEY = '4|lL3pgQVbfLb6KtUByDLaswjP4Jccny8HMj5jrs0v4ace4e78'; +const APP_UUID = 'e91cvmd4gqohmd8p53dmo2wq'; + +const request = (method, path, data = null) => { + return new Promise((resolve, reject) => { + const options = { + hostname: 'deploy.digifox.live', + port: 443, + path: path, + method: method, + headers: { + 'Authorization': `Bearer ${API_KEY}`, + 'Content-Type': 'application/json' + } + }; + + if (data) { + options.headers['Content-Length'] = Buffer.byteLength(data); + } + + const req = http.request(options, res => { + let body = ''; + res.on('data', d => body += d); + res.on('end', () => resolve({ status: res.statusCode, body })); + }); + + req.on('error', error => reject(error)); + + if (data) { + req.write(data); + } + req.end(); + }); +}; + +async function run() { + try { + const data = JSON.stringify({ + docker_compose_domains: JSON.stringify({ + ui: { + domain: "https://aisop.houseofwebsites.ai" + } + }) + }); + + console.log('Patching domains to the UI service...'); + const res = await request('PATCH', `/api/v1/applications/${APP_UUID}`, data); + console.log('Status:', res.status, res.body); + + console.log('Triggering deployment to apply domain changes...'); + const deployRes = await request('POST', `/api/v1/applications/${APP_UUID}/start`); + console.log('Deploy Status:', deployRes.status, deployRes.body); + } catch (error) { + console.error('Error:', error); + } +} + +run(); diff --git a/ui/src/components/ChangeoverDetail.jsx b/ui/src/components/ChangeoverDetail.jsx index 95b21e3..e0b5742 100644 --- a/ui/src/components/ChangeoverDetail.jsx +++ b/ui/src/components/ChangeoverDetail.jsx @@ -118,8 +118,12 @@ export default function ChangeoverDetail() { return (
-
- +
+
+ MRF Logo + DCG +
+ Back to Home @@ -155,25 +159,46 @@ export default function ChangeoverDetail() {
- CO Idle / Waste + MAN
{formatDuration(idleTimes.CO)}
- Mill Gaps / Idle + MACHINE
{formatDuration(idleTimes.Mill)}
- Conveyor Transport Delay + METHOD
{formatDuration(idleTimes.Conveyor)}
+
+
+ MATERIAL + +
+ 0s +
+
+
+ MEASUREMENT & INFORMATION + +
+ 0s +
+
+
+ MORALE + +
+ 0s +