|
| 1 | +# Sysdig Inspect React Frontend |
| 2 | + |
| 3 | +This document explains how to use the new React.js frontend for Sysdig Inspect. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The original Sysdig Inspect frontend was built with Ember.js. This project includes a new frontend implementation using React.js and Redux, which maintains the same visual appearance and functionality as the original. |
| 8 | + |
| 9 | +The backend and controller remain unchanged, allowing you to switch between the Ember.js and React.js frontends as needed. |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +### Prerequisites |
| 14 | + |
| 15 | +- Node.js 16 or higher |
| 16 | +- npm 7 or higher |
| 17 | + |
| 18 | +### Setup |
| 19 | + |
| 20 | +1. First, set up the React frontend: |
| 21 | + |
| 22 | +```bash |
| 23 | +npm run setup:react |
| 24 | +``` |
| 25 | + |
| 26 | +This will install all the necessary dependencies for the React frontend. |
| 27 | + |
| 28 | +### Running the Application |
| 29 | + |
| 30 | +You can run the React frontend in two ways: |
| 31 | + |
| 32 | +#### Option 1: Run the complete application (backend + React frontend) |
| 33 | + |
| 34 | +```bash |
| 35 | +# On Linux/macOS |
| 36 | +npm run start:react-app |
| 37 | + |
| 38 | +# On Windows |
| 39 | +npm run start:win:react-app |
| 40 | +``` |
| 41 | + |
| 42 | +This will start both the backend server and the React frontend. The React frontend will be available at http://localhost:3001 and will communicate with the backend at http://localhost:3000. |
| 43 | + |
| 44 | +#### Option 2: Run the backend and frontend separately |
| 45 | + |
| 46 | +```bash |
| 47 | +# Start the backend |
| 48 | +npm run start:backend # or npm run start:win:backend on Windows |
| 49 | + |
| 50 | +# In a separate terminal, start the React frontend |
| 51 | +npm run start:react |
| 52 | +``` |
| 53 | + |
| 54 | +### Building for Production |
| 55 | + |
| 56 | +To build the React frontend for production: |
| 57 | + |
| 58 | +```bash |
| 59 | +npm run build:react |
| 60 | +``` |
| 61 | + |
| 62 | +This creates a production build in the `react-frontend/build` directory. |
| 63 | + |
| 64 | +### Docker |
| 65 | + |
| 66 | +You can also build and run the React frontend in a Docker container: |
| 67 | + |
| 68 | +```bash |
| 69 | +npm run make:react-docker-image |
| 70 | +docker run -p 80:80 --name sysdig-inspect-react sysdig-inspect-react |
| 71 | +``` |
| 72 | + |
| 73 | +## Switching Between Frontends |
| 74 | + |
| 75 | +You can easily switch between the original Ember.js frontend and the new React.js frontend: |
| 76 | + |
| 77 | +- To use the Ember.js frontend: `npm run start:webapp` |
| 78 | +- To use the React.js frontend: `npm run start:react` |
| 79 | + |
| 80 | +Both frontends communicate with the same backend server. |
| 81 | + |
| 82 | +## Project Structure |
| 83 | + |
| 84 | +The React frontend is located in the `react-frontend` directory and has the following structure: |
| 85 | + |
| 86 | +- `src/components`: Reusable UI components |
| 87 | +- `src/pages`: Page components that correspond to routes |
| 88 | +- `src/store`: Redux store configuration and slices |
| 89 | +- `src/services`: API and utility services |
| 90 | +- `src/styles`: LESS stylesheets |
| 91 | +- `public`: Static assets |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +This project is licensed under the GNU General Public License - see the LICENSE file for details. |
0 commit comments