228 lines
4.6 KiB
Markdown
228 lines
4.6 KiB
Markdown
# Shopfloor Dashboard
|
|
|
|
GE Aerospace West Jefferson shopfloor events and notifications dashboard.
|
|
|
|
## Overview
|
|
|
|
Real-time display dashboard for showing current and upcoming events on the shopfloor. Designed for TV displays with large, readable text and GE Aerospace branding.
|
|
|
|
## Features
|
|
|
|
- **Live Data Updates**: Auto-refreshes every 10 seconds via AJAX (no page reload)
|
|
- **48-Hour Window**: Shows current events and upcoming events within next 48 hours
|
|
- **Real-Time Clock**: Always-on clock display
|
|
- **Connection Monitoring**: Visual indicator shows live connection status
|
|
- **GE Aerospace Branding**: Official colors, fonts, and logo
|
|
|
|
## Technology Stack
|
|
|
|
- **Backend**: Node.js with Express
|
|
- **Database**: MySQL 5.6
|
|
- **Frontend**: Vanilla JavaScript (no frameworks)
|
|
- **Styling**: Custom CSS with GE Aerospace brand colors
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 16+ and npm
|
|
- MySQL 5.6+ database
|
|
- Access to ShopDB database
|
|
|
|
### Setup
|
|
|
|
```bash
|
|
# Install dependencies
|
|
npm install
|
|
|
|
# Set environment variables (optional)
|
|
export DB_HOST=localhost
|
|
export DB_PORT=3306
|
|
export DB_USER=570005354
|
|
export DB_PASS=570005354
|
|
export DB_NAME=shopdb
|
|
export PORT=3001
|
|
|
|
# Start the server
|
|
npm start
|
|
|
|
# Or for development with auto-restart
|
|
npm run dev
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Environment variables:
|
|
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `PORT` | 3000 | Server port |
|
|
| `DB_HOST` | localhost | Database host |
|
|
| `DB_PORT` | 3306 | Database port |
|
|
| `DB_USER` | 570005354 | Database username |
|
|
| `DB_PASS` | 570005354 | Database password |
|
|
| `DB_NAME` | shopdb | Database name |
|
|
|
|
## Usage
|
|
|
|
### Access the Dashboard
|
|
|
|
Open your browser to:
|
|
```
|
|
http://localhost:3001
|
|
```
|
|
|
|
### API Endpoints
|
|
|
|
**Get Notifications:**
|
|
```
|
|
GET /api/notifications
|
|
```
|
|
|
|
Returns current and upcoming events in JSON format.
|
|
|
|
**Health Check:**
|
|
```
|
|
GET /health
|
|
```
|
|
|
|
Returns server status.
|
|
|
|
## Display on TV
|
|
|
|
1. Open the dashboard URL in a web browser (Chrome recommended)
|
|
2. Press F11 for fullscreen mode
|
|
3. Dashboard will auto-refresh every 10 seconds
|
|
4. Connection status indicator shows "LIVE" when connected
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
shopfloor-dashboard/
|
|
├── server.js # Express server
|
|
├── package.json # Dependencies
|
|
├── public/
|
|
│ ├── index.html # Dashboard UI
|
|
│ └── ge-aerospace-logo.svg
|
|
├── .gitignore
|
|
└── README.md
|
|
```
|
|
|
|
## Database Schema
|
|
|
|
Queries the `notifications` table in ShopDB:
|
|
|
|
```sql
|
|
SELECT notificationid, notification, starttime, endtime,
|
|
ticketnumber, link, isactive
|
|
FROM notifications
|
|
WHERE isactive = 1
|
|
AND (conditions for current/upcoming)
|
|
ORDER BY starttime ASC
|
|
```
|
|
|
|
## Design
|
|
|
|
### Colors (GE Aerospace Brand)
|
|
|
|
- **Deep Navy**: `#00003d` (background)
|
|
- **Sky Blue**: `#4181ff` (accents, clock)
|
|
- **Avionics Green**: `#0ad64f` (live indicator)
|
|
- **Tungsten**: `#eaeaea` (secondary text)
|
|
|
|
### Typography
|
|
|
|
- **Font**: Inter (sans-serif)
|
|
- **Sizes**: Large for TV readability (38px-48px headers)
|
|
|
|
## Git Repository
|
|
|
|
This project is version controlled with Git and hosted on Gitea.
|
|
|
|
**Repository URL:**
|
|
- SSH: `ssh://git@localhost:2222/cproudlock/shopfloor-dashboard.git`
|
|
- HTTP: `http://localhost:3000/cproudlock/shopfloor-dashboard`
|
|
|
|
**SSH Key Setup:**
|
|
|
|
The repository uses SSH authentication. The SSH key is already configured:
|
|
|
|
```bash
|
|
# SSH public key location
|
|
~/.ssh/id_ed25519.pub
|
|
|
|
# Key is registered in Gitea as "AI Key"
|
|
# User: cproudlock
|
|
```
|
|
|
|
**Common Git Commands:**
|
|
|
|
```bash
|
|
# Clone the repository
|
|
git clone ssh://git@localhost:2222/cproudlock/shopfloor-dashboard.git
|
|
|
|
# Pull latest changes
|
|
git pull
|
|
|
|
# Commit and push changes
|
|
git add .
|
|
git commit -m "Your commit message"
|
|
git push
|
|
```
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Install dev dependencies
|
|
npm install
|
|
|
|
# Run with auto-restart
|
|
npm run dev
|
|
|
|
# The server will restart automatically when you edit files
|
|
```
|
|
|
|
## Deployment
|
|
|
|
For production deployment:
|
|
|
|
1. Use a process manager (PM2, systemd)
|
|
2. Set environment variables
|
|
3. Configure reverse proxy (nginx/Apache) if needed
|
|
4. Enable SSL/TLS for secure connections
|
|
|
|
### Example with PM2:
|
|
|
|
```bash
|
|
npm install -g pm2
|
|
pm2 start server.js --name shopfloor-dashboard
|
|
pm2 save
|
|
pm2 startup
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
**Port already in use:**
|
|
```bash
|
|
# Use a different port
|
|
PORT=3001 npm start
|
|
```
|
|
|
|
**Can't connect to database:**
|
|
- Verify MySQL is running
|
|
- Check credentials in environment variables
|
|
- Ensure database exists and user has permissions
|
|
|
|
**Dashboard not updating:**
|
|
- Check browser console for errors
|
|
- Verify `/api/notifications` endpoint returns data
|
|
- Check network connectivity
|
|
|
|
## License
|
|
|
|
Internal GE Aerospace project - West Jefferson facility
|
|
|
|
## Support
|
|
|
|
Contact: IT Support - West Jefferson
|