Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
584 changes: 584 additions & 0 deletions docs/controller-dashboard.md

Large diffs are not rendered by default.

964 changes: 964 additions & 0 deletions docs/frontend-gap-analysis.md

Large diffs are not rendered by default.

654 changes: 654 additions & 0 deletions docs/frontend-implementation.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API Configuration
VITE_API_URL=http://localhost:8000

# Optional: Auth Token (if required)
# VITE_AUTH_TOKEN=your-auth-token-here

20 changes: 20 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
}

30 changes: 30 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Environment files
.env
.env.local
.env.production

244 changes: 244 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
# Controller Dashboard - Frontend

A modern React + TypeScript + Vite web application for managing workflows, monitoring sandboxes, and tracking execution metrics.

## πŸš€ Features

- **Workflow Management**: View, toggle, and execute workflows
- **Real-Time Monitoring**: Live updates of sandbox execution status
- **Dashboard Analytics**: Summary statistics and metrics visualization
- **Responsive Design**: Works on desktop, tablet, and mobile devices
- **Type-Safe**: Full TypeScript implementation
- **Fast Development**: Vite for instant HMR and fast builds

## πŸ› οΈ Tech Stack

- **Framework**: React 18.3.1
- **Language**: TypeScript 5.4.3
- **Build Tool**: Vite 5.2.0
- **Routing**: React Router 6.22.3
- **State Management**: Zustand 4.5.2
- **Data Fetching**: TanStack Query 5.28.4
- **HTTP Client**: Axios 1.6.8
- **Styling**: Tailwind CSS 3.4.1
- **Icons**: Lucide React 0.363.0
- **Date Utilities**: date-fns 3.6.0

## πŸ“¦ Installation

```bash
# Install dependencies
npm install

# Copy environment variables
cp .env.example .env

# Update .env with your API URL
# VITE_API_URL=http://localhost:8000
```

## πŸƒ Development

```bash
# Start development server (runs on http://localhost:3000)
npm run dev

# Type check
npm run type-check

# Lint code
npm run lint

# Run tests
npm run test
```

## πŸ—οΈ Building for Production

```bash
# Build for production
npm run build

# Preview production build
npm run preview
```

The build output will be in the `dist/` directory.

## πŸ“ Project Structure

```
frontend/
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ api/ # API client and type definitions
β”‚ β”‚ β”œβ”€β”€ client.ts # HTTP client with all API methods
β”‚ β”‚ └── types.ts # TypeScript interfaces
β”‚ β”œβ”€β”€ components/ # React components
β”‚ β”‚ β”œβ”€β”€ Common/ # Reusable UI components
β”‚ β”‚ β”œβ”€β”€ Dashboard/ # Dashboard-specific components
β”‚ β”‚ β”œβ”€β”€ Workflows/ # Workflow management components
β”‚ β”‚ └── Sandboxes/ # Sandbox monitoring components
β”‚ β”œβ”€β”€ hooks/ # Custom React hooks
β”‚ β”‚ β”œβ”€β”€ useWorkflows.ts
β”‚ β”‚ └── useSandboxes.ts
β”‚ β”œβ”€β”€ pages/ # Page components
β”‚ β”‚ β”œβ”€β”€ DashboardPage.tsx
β”‚ β”‚ β”œβ”€β”€ WorkflowsPage.tsx
β”‚ β”‚ └── SandboxesPage.tsx
β”‚ β”œβ”€β”€ store/ # Zustand state management
β”‚ β”‚ β”œβ”€β”€ workflowStore.ts
β”‚ β”‚ └── sandboxStore.ts
β”‚ β”œβ”€β”€ styles/ # Global styles
β”‚ β”‚ └── index.css
β”‚ β”œβ”€β”€ utils/ # Utility functions
β”‚ β”‚ β”œβ”€β”€ formatters.ts
β”‚ β”‚ └── cn.ts
β”‚ β”œβ”€β”€ App.tsx # Main application component
β”‚ └── main.tsx # Application entry point
β”œβ”€β”€ public/ # Static assets
β”œβ”€β”€ index.html # HTML template
β”œβ”€β”€ package.json # Dependencies and scripts
β”œβ”€β”€ tsconfig.json # TypeScript configuration
β”œβ”€β”€ vite.config.ts # Vite configuration
β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
└── README.md # This file
```

## πŸ”Œ API Integration

The frontend connects to the Controller Dashboard backend API. Ensure the backend is running and accessible at the URL specified in your `.env` file.

### API Endpoints Used

- `GET /api/workflows` - List all workflows
- `POST /api/workflows/{id}/toggle` - Toggle workflow enabled/disabled
- `POST /api/workflows/{id}/execute` - Execute workflow
- `GET /api/sandboxes` - List all sandboxes
- `POST /api/sandboxes/{id}/terminate` - Terminate sandbox
- `GET /api/dashboard/summary` - Get dashboard statistics

## 🎨 Customization

### Colors

The application uses a custom color palette defined in `tailwind.config.js`:

- **Primary Purple**: `rgb(82, 19, 217)` - Main brand color
- **Accent Orange**: `rgb(255, 202, 133)` - Active states
- **Success Green**: `rgb(66, 196, 153)` - Success indicators
- **Error Red**: `rgb(255, 103, 103)` - Error states

### Components

All components are built with Tailwind CSS and are easily customizable. Common components are located in `src/components/Common/`.

## πŸ§ͺ Testing

```bash
# Run tests
npm run test

# Run tests with UI
npm run test:ui

# Run tests with coverage
npm run test -- --coverage
```

## 🚒 Deployment

### Vercel (Recommended)

```bash
# Install Vercel CLI
npm i -g vercel

# Deploy
vercel
```

### Netlify

```bash
# Install Netlify CLI
npm i -g netlify-cli

# Deploy
netlify deploy --prod --dir=dist
```

### Docker

```dockerfile
# Build stage
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Production stage
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
```

## πŸ“ Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `VITE_API_URL` | Backend API URL | `http://localhost:8000` |
| `VITE_AUTH_TOKEN` | Optional auth token | - |

## 🀝 Contributing

1. Create a feature branch
2. Make your changes
3. Ensure tests pass and types check
4. Submit a pull request

## πŸ“„ License

MIT License - see LICENSE file for details

## πŸ†˜ Support

For issues or questions:
- Open an issue on GitHub
- Check the backend documentation
- Review the IRIS frontend gap analysis document

## 🎯 Roadmap

- [ ] WebSocket support for real-time updates
- [ ] Visual workflow editor (React Flow integration)
- [ ] PRD editor with rich text support
- [ ] Project management UI
- [ ] Dark mode support
- [ ] Advanced filtering and search
- [ ] Export functionality (CSV, PDF)
- [ ] User authentication UI
- [ ] Mobile app (React Native)

## ⚑ Performance

- **First Contentful Paint**: < 1.5s
- **Time to Interactive**: < 3s
- **Lighthouse Score**: 90+
- **Bundle Size**: < 500KB (gzipped)

## πŸ”’ Security

- All API calls use HTTPS in production
- Environment variables for sensitive config
- CORS properly configured
- Input validation on all forms
- XSS protection via React

---

Built with ❀️ using React + TypeScript + Vite

15 changes: 15 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Controller Dashboard - Workflow Management</title>
<meta name="description" content="Controller Dashboard for managing workflows, sandboxes, and monitoring execution metrics" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

44 changes: 44 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "controller-dashboard-ui",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"type-check": "tsc --noEmit",
"test": "vitest",
"test:ui": "vitest --ui"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.22.3",
"@tanstack/react-query": "^5.28.4",
"zustand": "^4.5.2",
"axios": "^1.6.8",
"recharts": "^2.12.2",
"lucide-react": "^0.363.0",
"clsx": "^2.1.0",
"date-fns": "^3.6.0"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.1",
"typescript": "^5.4.3",
"vite": "^5.2.0",
"vitest": "^1.4.0"
}
}

7 changes: 7 additions & 0 deletions frontend/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

Loading