From 0bc147c5b1a2c2cd354d804f858ba1ad7711d14c Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Fri, 4 Mar 2022 09:14:38 -0500 Subject: [PATCH 01/18] Master -> dev (#44) Co-authored-by: Logan Ramos From 469a841707f14f270c87d850b6f156f234bc9c43 Mon Sep 17 00:00:00 2001 From: Christian <57967583+CKegel@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:40:15 -0500 Subject: [PATCH 02/18] Add CAD Display from Herald (#65) * Restructured Index.html and added endpoint for herald to push dispatch info to * Styled Dispatch alerts, set dispatch alert duration to three minutes, and fixed odds and ends --- public/css/style-dark.min.css | 2 +- public/css/style-dark.scss | 4 ++ public/css/style-dispatch.min.css | 1 + public/css/style-dispatch.scss | 4 ++ public/css/style.min.css | 2 +- public/css/style.scss | 4 ++ public/index.html | 108 ++++++++++++++++++------------ public/js/whiteboard.js | 33 ++++++++- server.js | 5 ++ 9 files changed, 118 insertions(+), 45 deletions(-) create mode 100644 public/css/style-dispatch.min.css create mode 100644 public/css/style-dispatch.scss diff --git a/public/css/style-dark.min.css b/public/css/style-dark.min.css index 65d3af8..946f01d 100644 --- a/public/css/style-dark.min.css +++ b/public/css/style-dark.min.css @@ -1 +1 @@ -body{font-family:"Sarabun",sans-serif;background-color:#111;color:#aaa}hr{border-top:1px solid rgba(255,255,255,.1)}#header{background-color:#080808;font-size:36px;color:#888;padding:10px 0}#header #patch{height:60px}#header .datetime{text-align:right}#header #time{margin-left:30px;color:#aaa}.section{margin-top:15px}.section-heading{text-transform:uppercase;font-size:30px;color:#bbb;margin-bottom:10px;line-height:1}#schedule div:not(.section-heading){padding:0 15px}#schedule .crew-member{margin:15px auto;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(255,255,255,.1)}#schedule .crew-member:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#schedule .crew-member .title{display:block;font-size:30px;color:#666;text-transform:uppercase;line-height:1}#schedule .crew-member .name{font-size:60px;line-height:1;font-weight:600}#schedule .crew-member .rn{margin-left:30px;font-size:36px;color:#999}#schedule .crew-member .vacant{text-transform:uppercase;color:#777;font-size:48px}#schedule .crew-member .vacant::before{content:"<"}#schedule .crew-member .vacant::after{content:">"}#call-volume{border-left:1px solid rgba(255,255,255,.1);line-height:1}#call-volume #total-count{text-align:center;font-size:180px}#call-volume #total-mishaps{text-align:center;font-size:140px}#chores{font-size:36px}#notes p{font-size:36px;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(255,255,255,.1)}#notes p:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}/*# sourceMappingURL=style-dark.min.css.map */ +body{font-family:"Sarabun",sans-serif;background-color:#111;color:#aaa}hr{border-top:1px solid rgba(255,255,255,.1)}#header{background-color:#080808;font-size:36px;color:#888;padding:10px 0}#header #patch{height:60px}#header .datetime{text-align:right}#header #time{margin-left:30px;color:#aaa}.section{margin-top:15px}.section-heading{text-transform:uppercase;font-size:30px;color:#bbb;margin-bottom:10px;line-height:1}#schedule div:not(.section-heading){padding:0 15px}#schedule .crew-member{margin:15px auto;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(255,255,255,.1)}#schedule .crew-member:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#schedule .crew-member .title{display:block;font-size:30px;color:#666;text-transform:uppercase;line-height:1}#schedule .crew-member .name{font-size:60px;line-height:1;font-weight:600}#schedule .crew-member .rn{margin-left:30px;font-size:36px;color:#999}#schedule .crew-member .vacant{text-transform:uppercase;color:#777;font-size:48px}#schedule .crew-member .vacant::before{content:"<"}#schedule .crew-member .vacant::after{content:">"}#call-volume{border-left:1px solid rgba(255,255,255,.1);line-height:1}#call-volume #total-count{text-align:center;font-size:180px}#call-volume #total-mishaps{text-align:center;font-size:140px}#chores{font-size:36px}#notes p{font-size:36px;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(255,255,255,.1)}#notes p:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#dispatch{font-size:100px}/*# sourceMappingURL=style-dark.min.css.map */ diff --git a/public/css/style-dark.scss b/public/css/style-dark.scss index c20cecf..664af11 100644 --- a/public/css/style-dark.scss +++ b/public/css/style-dark.scss @@ -127,3 +127,7 @@ hr { padding-bottom: 0; } } + +#dispatch{ + font-size: 100px; +} diff --git a/public/css/style-dispatch.min.css b/public/css/style-dispatch.min.css new file mode 100644 index 0000000..98ec3f0 --- /dev/null +++ b/public/css/style-dispatch.min.css @@ -0,0 +1 @@ +body{height:100vh;background-color:#f66}/*# sourceMappingURL=style-dispatch.min.css.map */ diff --git a/public/css/style-dispatch.scss b/public/css/style-dispatch.scss new file mode 100644 index 0000000..416b96b --- /dev/null +++ b/public/css/style-dispatch.scss @@ -0,0 +1,4 @@ +body { + height: 100vh; + background-color: #ff6666; +} \ No newline at end of file diff --git a/public/css/style.min.css b/public/css/style.min.css index fd809dc..0c0e8ff 100644 --- a/public/css/style.min.css +++ b/public/css/style.min.css @@ -1 +1 @@ -body{font-family:"Sarabun",sans-serif}#header{background-color:#333;font-size:36px;color:#fff;padding:10px 0}#header #patch{height:60px}#header .datetime{text-align:right}#time{margin-left:30px;color:#ddd}.section{margin-top:15px}.section-heading{text-transform:uppercase;font-size:30px;color:#444;margin-bottom:10px;line-height:1}#schedule div:not(.section-heading){padding:0 15px}#schedule .crew-member{margin:15px auto;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(0,0,0,.1)}#schedule .crew-member:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#schedule .crew-member .title{display:block;font-size:30px;color:#444;text-transform:uppercase;line-height:1}#schedule .crew-member .name{font-size:60px;line-height:1;font-weight:600}#schedule .crew-member .rn{margin-left:30px;font-size:36px;color:#666}#schedule .crew-member .vacant{text-transform:uppercase;color:#888;font-size:48px}#schedule .crew-member .vacant::before{content:"<"}#schedule .crew-member .vacant::after{content:">"}#call-volume{border-left:1px solid rgba(0,0,0,.1);line-height:1}#call-volume #total-count{text-align:center;font-size:180px}#call-volume #total-mishaps{text-align:center;font-size:140px}#chores{font-size:36px}#notes p{font-size:36px;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(0,0,0,.1)}#notes p:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}/*# sourceMappingURL=style.min.css.map */ +body{font-family:"Sarabun",sans-serif}#header{background-color:#333;font-size:36px;color:#fff;padding:10px 0}#header #patch{height:60px}#header .datetime{text-align:right}#time{margin-left:30px;color:#ddd}.section{margin-top:15px}.section-heading{text-transform:uppercase;font-size:30px;color:#444;margin-bottom:10px;line-height:1}#schedule div:not(.section-heading){padding:0 15px}#schedule .crew-member{margin:15px auto;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(0,0,0,.1)}#schedule .crew-member:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#schedule .crew-member .title{display:block;font-size:30px;color:#444;text-transform:uppercase;line-height:1}#schedule .crew-member .name{font-size:60px;line-height:1;font-weight:600}#schedule .crew-member .rn{margin-left:30px;font-size:36px;color:#666}#schedule .crew-member .vacant{text-transform:uppercase;color:#888;font-size:48px}#schedule .crew-member .vacant::before{content:"<"}#schedule .crew-member .vacant::after{content:">"}#call-volume{border-left:1px solid rgba(0,0,0,.1);line-height:1}#call-volume #total-count{text-align:center;font-size:180px}#call-volume #total-mishaps{text-align:center;font-size:140px}#chores{font-size:36px}#notes p{font-size:36px;padding:0;padding-bottom:15px;padding-top:5px;border-bottom:1px solid rgba(0,0,0,.1)}#notes p:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}#dispatch{font-size:100px}/*# sourceMappingURL=style.min.css.map */ diff --git a/public/css/style.scss b/public/css/style.scss index 1ca5a18..e9660d2 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -120,3 +120,7 @@ body { padding-bottom: 0; } } + +#dispatch{ + font-size: 100px; +} diff --git a/public/index.html b/public/index.html index 5e03e3b..2e51d6c 100644 --- a/public/index.html +++ b/public/index.html @@ -27,63 +27,87 @@ -
-
-
Today's crew
-
-
- Crew chief - + +
+
+
+
Today's crew
+
+
+ Crew chief + +
+
+
+
+ Driver + +
-
-
-
- Driver - +
+
+ Attendant + +
-
-
-
- Attendant - +
+
+ Attendant + +
-
-
-
- Attendant - +
+
+ Duty supervisor + +
-
-
- Duty supervisor - -
+
+
Calls to date
+
+
+
Dispatch mishaps
+
-
-
Calls to date
-
-
-
Dispatch mishaps
-
-
-
-
-
-
-
-
-
Chores
+
+
+
+
+
+
Chores
Notes
- + +
+ + + + +
diff --git a/public/js/whiteboard.js b/public/js/whiteboard.js index 31a0fc0..5e04362 100644 --- a/public/js/whiteboard.js +++ b/public/js/whiteboard.js @@ -3,7 +3,10 @@ const longitude = -73.675770; const latitude = 42.729270; // 30 minutes in milliseconds (60000 ms in 1 min) -const thirtyMinutes = 60000 * 30; +//Time Constants(in Milliseconds) +const oneMinute = 60000; +const thirtyMinutes = oneMinute * 30; +const threeMinutes = oneMinute * 3; function cleanRadioNum(id, rn) { return id > 0 ? rn : ''; @@ -108,6 +111,30 @@ function updateChores(choreList) { } } +function clearDispatch(){ + document.getElementById('dispatch').hidden = true; + document.getElementById('display').hidden = false; + + document.getElementById('stylesheet-dispatch').media = 'none'; + + document.getElementById('determinant').textContent = ''; + document.getElementById('complaint').textContent = ''; + document.getElementById('location').textContent = ''; +} + +function dispatch(determinant, complaint, location){ + document.getElementById('determinant').textContent = determinant; + document.getElementById('complaint').textContent = complaint; + document.getElementById('location').textContent = location; + + document.getElementById('stylesheet-dispatch').media = ''; + + document.getElementById('display').hidden = true; + document.getElementById('dispatch').hidden = false; + + setTimeout(clearDispatch, threeMinutes); +} + updateDate(); const socket = io.connect(); @@ -131,6 +158,10 @@ socket.on('chores', (choreResponse) => { updateChores(choreResponse.chores); }); +socket.on('dispatch', (dispatchResponse) => { + dispatch(dispatchResponse.determinant, dispatchResponse.complaint, dispatchResponse.location); +}); + // Refreshes the page allowing us to update the UI without ever touching the tv socket.on('refresh', () => window.location.reload()); diff --git a/server.js b/server.js index ac9a9ac..122d379 100644 --- a/server.js +++ b/server.js @@ -96,6 +96,11 @@ app.post('/chores', (req, res) => { res.send({success: true}); }); +app.post('/dispatch', (req, res) => { + io.emit('dispatch', req.body); + res.send({success: true}); +}); + io.on('connection', async () => { io.emit('notes', await notes.getNotes(pool)); io.emit('crews', await crews.getCrew(pool)); From ab4f1734e5a3925cec05bd71c49e568305c30121 Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 14:18:55 -0500 Subject: [PATCH 03/18] add dev env --- .env.example | 1 + public/js/whiteboard.js | 4 ++-- src/crews.js | 47 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index f974264..982ea59 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,4 @@ WEBSITE_ACCESS_TOKEN=access restriction token PORT=8080 TZ=America/New_York CHOREBOT_VERIFICATION_TOKEN=chorebot token here +ENV=dev \ No newline at end of file diff --git a/public/js/whiteboard.js b/public/js/whiteboard.js index 5e04362..099b0e9 100644 --- a/public/js/whiteboard.js +++ b/public/js/whiteboard.js @@ -79,12 +79,12 @@ function updateDate() { } const isCurrentlyDay = (times.sunrise.getTime() + thirtyMinutes) <= now - && now < (times.sunset.getTime() + thirtyMinutes) + && now < (times.sunset.getTime() + thirtyMinutes); const isDarkMode = ( (document.getElementById('stylesheet-light').media == 'none') && (document.getElementById('stylesheet-dark').media == '') - ) + ); if (isCurrentlyDay && isDarkMode) { document.getElementById('stylesheet-light').media = ''; diff --git a/src/crews.js b/src/crews.js index 2727770..c8e53ba 100644 --- a/src/crews.js +++ b/src/crews.js @@ -1,6 +1,8 @@ const { execQuery } = require('./db'); const moment = require('moment'); +const DEV = process.env.ENV == 'dev' ? true : false; + function getQuery(role) { return `SELECT c.${role} AS id, @@ -28,7 +30,7 @@ function cleanName(member) { return { id: 0, name: '', - rn: 0 + rn: 0, }; } @@ -49,14 +51,51 @@ function cleanQueryResult(results) { } exports.getCrew = async (pool) => { + if (DEV) { + const crew = { + success: true, + 'cc': { + id: 1, + name: 'C. Chief', + rn: '901' + }, + 'driver': { + id:2, + name: 'D. Driver', + rn: '902' + }, + 'rider-1': { + id:3, + name: 'A. Attendant', + rn: '903' + }, + 'rider-2': { + id:4, + name: 'O. Observer', + rn: '904' + }, + 'dutysup': { + id:5, + name: 'D. Supervisor', + rn: '910' + }, + }; + return crew; + } try { const date = buildDate(); const crew = { success: true }; - const positions = [ 'cc', 'driver', 'attendant', 'observer', 'dutysup' ]; + const positions = ['cc', 'driver', 'attendant', 'observer', 'dutysup']; - for ( const p of positions ) { - let result = await execQuery(pool, getQuery(p), date, cleanQueryResult, process.env.CREWS_DB_NAME); + for (const p of positions) { + let result = await execQuery( + pool, + getQuery(p), + date, + cleanQueryResult, + process.env.CREWS_DB_NAME + ); crew[p] = cleanName(result); } From ef0bfa351c488493cd92983ced3dcdfa56670fac Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 14:25:46 -0500 Subject: [PATCH 04/18] add dev workflow --- .github/workflows/dev.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/dev.yaml diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml new file mode 100644 index 0000000..0a49c2d --- /dev/null +++ b/.github/workflows/dev.yaml @@ -0,0 +1,18 @@ +name: deploy headsup dev + +on: + push: + branches: + - dev +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.TIEMS_DEV1_URL }} + username: ${{ secrets.TIEMS_DEV1_SSH_USERNAME }} + password: ${{ secrets.TIEMS_DEV1_SSH_PASSWORD }} + script: ${{ secrets.TIEMS_DEV1_SSH_SCRIPT }} headsup From 5a2432bc5f6fbbd51811c6ff5142f94afd64a22f Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 14:32:34 -0500 Subject: [PATCH 05/18] match database fields --- src/crews.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crews.js b/src/crews.js index c8e53ba..eecf3ad 100644 --- a/src/crews.js +++ b/src/crews.js @@ -64,12 +64,12 @@ exports.getCrew = async (pool) => { name: 'D. Driver', rn: '902' }, - 'rider-1': { + 'attendant': { id:3, name: 'A. Attendant', rn: '903' }, - 'rider-2': { + 'observer': { id:4, name: 'O. Observer', rn: '904' From 8cca585581021de50a48241e528dbb6350c56eb5 Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 15:03:50 -0500 Subject: [PATCH 06/18] add css file to index.html --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 2e51d6c..3b9893a 100644 --- a/public/index.html +++ b/public/index.html @@ -8,7 +8,7 @@ - + From 0bc575a977d094609d152f077ca42896a5bcdc43 Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 15:04:59 -0500 Subject: [PATCH 07/18] this is what happens when you copy and paste a line --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 3b9893a..c4045c4 100644 --- a/public/index.html +++ b/public/index.html @@ -8,7 +8,7 @@ - + From 7d588bdda2154bfc73d1f3ca9580cf47629eb133 Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Sat, 18 Feb 2023 15:24:07 -0500 Subject: [PATCH 08/18] eslint --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 122d379..d52b604 100644 --- a/server.js +++ b/server.js @@ -17,7 +17,7 @@ const pool = mariadb.createPool({ user: process.env.DB_USER, password: process.env.DB_PASSWORD, connectionLimit: 10, - charset: 'utf8mb4' + charset: 'utf8mb4', }); // Initialize express app @@ -93,12 +93,12 @@ app.get('/mishap', async (_, res) => { app.post('/chores', (req, res) => { io.emit('chores', req.body); - res.send({success: true}); + res.send({ success: true }); }); app.post('/dispatch', (req, res) => { io.emit('dispatch', req.body); - res.send({success: true}); + res.send({ success: true }); }); io.on('connection', async () => { From 477fae9330e44b9ec5e4453999a4360cacc271c3 Mon Sep 17 00:00:00 2001 From: Dan Bruce Date: Thu, 23 Feb 2023 15:41:40 -0500 Subject: [PATCH 09/18] work on dispatch styling --- public/css/style-dispatch.min.css | 2 +- public/css/style-dispatch.min.css.map | 1 + public/css/style-dispatch.scss | 49 ++++- public/index.html | 19 +- public/js/whiteboard.js | 250 ++++++++++++++------------ 5 files changed, 199 insertions(+), 122 deletions(-) create mode 100644 public/css/style-dispatch.min.css.map diff --git a/public/css/style-dispatch.min.css b/public/css/style-dispatch.min.css index 98ec3f0..5fc5a0b 100644 --- a/public/css/style-dispatch.min.css +++ b/public/css/style-dispatch.min.css @@ -1 +1 @@ -body{height:100vh;background-color:#f66}/*# sourceMappingURL=style-dispatch.min.css.map */ +@keyframes dispatchBackground{from{background-color:#4a0000}to{background-color:#5a0000}}body{height:100vh;animation:dispatchBackground 1s infinite alternate;color:#fff;font-weight:700}#dispatch-filler{height:200px}#determinant{border-radius:100px}.alpha{background:#9bda9b;color:#000}.bravo{background:#ece68d;color:#000}.charlie{background:#f09442;color:#020004}.delta{background:#b10000;color:#fff}.echo{background:#000;color:#ff1f1f}/*# sourceMappingURL=style-dispatch.min.css.map */ \ No newline at end of file diff --git a/public/css/style-dispatch.min.css.map b/public/css/style-dispatch.min.css.map new file mode 100644 index 0000000..3ccd1be --- /dev/null +++ b/public/css/style-dispatch.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["style-dispatch.scss"],"names":[],"mappings":"AAAA,8BACE,KACE,wBAAA,CAEF,GACE,wBAAA,CAAA,CAIJ,KACE,YAAA,CAEA,kDAAA,CACA,UAAA,CACA,eAAA,CAGF,iBACE,YAAA,CAGF,aACE,mBAAA,CAGF,OACE,kBAAA,CACA,UAAA,CAGF,OACE,kBAAA,CACA,UAAA,CAGF,SACE,kBAAA,CACA,aAAA,CAGF,OACE,kBAAA,CACA,UAAA,CAIF,MACE,eAAA,CACA,aAAA","file":"style-dispatch.min.css"} \ No newline at end of file diff --git a/public/css/style-dispatch.scss b/public/css/style-dispatch.scss index 416b96b..4791cf3 100644 --- a/public/css/style-dispatch.scss +++ b/public/css/style-dispatch.scss @@ -1,4 +1,49 @@ +@keyframes dispatchBackground { + from { + background-color: #4a0000; + } + to { + background-color: #5a0000; + } +} + body { height: 100vh; - background-color: #ff6666; -} \ No newline at end of file + // background-color: #952525; + animation: dispatchBackground 1s infinite alternate; + color: white; + font-weight: 700; +} + +#dispatch-filler { + height: 200px; +} + +#determinant { + border-radius: 100px; +} + +.alpha { + background: #9bda9b; + color: black; +} + +.bravo { + background: #ece68d; + color: black; +} + +.charlie { + background: #f09442; + color: #020004; +} + +.delta { + background: #b10000; + color: #fff; + +} + +.echo { + background: #000; + color: #ff1f1f;} \ No newline at end of file diff --git a/public/index.html b/public/index.html index c4045c4..0379955 100644 --- a/public/index.html +++ b/public/index.html @@ -91,19 +91,20 @@