forked from syntaxbullet/AuroraBot-discord
feat: implement administrative control panel with real-time bot actions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# DASH-004: Administrative Control Panel
|
||||
|
||||
**Status:** Draft
|
||||
**Status:** Done
|
||||
**Created:** 2026-01-08
|
||||
**Tags:** dashboard, control-panel, bot-actions, operations
|
||||
|
||||
@@ -32,7 +32,22 @@
|
||||
2. [ ] **Given** a running bot, **When** the "Clear Cache" button is pushed, **Then** the bot flushes its internal memory maps and the memory usage metric reflects the drop.
|
||||
|
||||
## 5. Implementation Plan
|
||||
- [ ] Step 1: Create an `action.service.ts` to handle the logic of triggering bot-specific functions.
|
||||
- [ ] Step 2: Implement the `/api/actions` route group.
|
||||
- [ ] Step 3: Design a "Quick Actions" card with premium styled buttons in `Dashboard.tsx`.
|
||||
- [ ] Step 4: Add loading states to buttons to show when an operation is "In Progress."
|
||||
- [x] Step 1: Create an `action.service.ts` to handle the logic of triggering bot-specific functions.
|
||||
- [x] Step 2: Implement the `/api/actions` route group.
|
||||
- [x] Step 3: Design a "Quick Actions" card with premium styled buttons in `Dashboard.tsx`.
|
||||
- [x] Step 4: Add loading states to buttons to show when an operation is "In Progress."
|
||||
|
||||
## Implementation Notes
|
||||
Successfully implemented the Administrative Control Panel with the following changes:
|
||||
- **Backend Service**: Created `shared/modules/admin/action.service.ts` to coordinate actions like reloading commands, clearing cache, and toggling maintenance mode.
|
||||
- **System Bus**: Updated `shared/lib/events.ts` with new action events.
|
||||
- **API Endpoints**: Added `POST /api/actions/*` routes to the web server in `web/src/server.ts`.
|
||||
- **Bot Integration**:
|
||||
- Updated `AuroraClient` in `bot/lib/BotClient.ts` to listen for system action events.
|
||||
- Implemented `maintenanceMode` flag in `AuroraClient`.
|
||||
- Updated `CommandHandler.ts` to respect maintenance mode, blocking user commands with a helpful error embed.
|
||||
- **Frontend UI**:
|
||||
- Created `ControlPanel.tsx` component with a premium glassmorphic design and real-time state feedback.
|
||||
- Integrated `ControlPanel` into the `Dashboard.tsx` page.
|
||||
- Updated `use-dashboard-stats` hook and shared types to include maintenance mode status.
|
||||
- **Verification**: Created 3 new test suites covering the service, the bot listener, and the command handler enforcement. All tests passing.
|
||||
|
||||
Reference in New Issue
Block a user