Spaces:
Sleeping
Sleeping
File size: 6,751 Bytes
6546fce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | # Demo Script β PulseFabric Monitor
This script contains 3 live demo scenarios. Each scenario is designed to be executed in Copilot Chat during a presentation.
**Prerequisites:**
- Codespace is running (or local dev with `npm run dev`)
- Both servers are up: Angular on port 4200, json-server on port 3000
- Dashboard is visible in the browser at `http://localhost:4200`
---
## Scenario 1: Add a KPI Card β "Active Sessions"
### Story
> "Our operations team wants to see how many users are currently connected. Let's add an Active Sessions KPI card to the dashboard β live, using only a Copilot Chat prompt."
### Copilot Chat Prompt
Copy and paste this into Copilot Chat:
> Add a new KPI card called Active Sessions showing the number 14,200 with a trending up indicator. Put it next to the existing KPI cards. Follow all repo rules in copilot-instructions.md.
### Expected AI Actions
1. **db.json** β Add a new entry to the `kpis` array:
```json
{
"id": "active-sessions",
"title": "Active Sessions",
"value": "14,200",
"trend": "up",
"trendLabel": "+8.3% from last hour",
"icon": "group"
}
```
2. **api.models.ts** β No change needed (KpiDto already covers the shape)
3. **dashboard-api.service.ts** β No change needed (getKpis already returns the array)
4. **UI** β No change needed (the `@for` loop renders it automatically)
### Expected Result
- A fifth KPI card appears in the grid: "Active Sessions β 14,200 β trending up"
- The card uses the same `<app-kpi-card>` component as existing cards
- `ng build` still passes
### What to Point Out
- Only `db.json` was changed β the AI understood the data-first pattern
- No new component was created β the existing KPI card is input-driven
- The AI followed the implementation order: db.json β model β service β UI
---
## Scenario 2: Add a CPU Load Chart to AI Drop Zone
### Story
> "We have a drop zone at the bottom of the dashboard reserved for AI-generated widgets. Let's ask Copilot to fill it with a CPU Load by Device bar chart."
### Copilot Chat Prompt
Copy and paste this into Copilot Chat:
> Add a CPU Load by Device bar chart to the AI Widget Drop Zone at the bottom of the dashboard. Show 5 devices with fake CPU percentage data. Add the data to db.json first, then create the chart. Follow all repo rules in copilot-instructions.md.
### Expected AI Actions
1. **db.json** β Add a new `cpuLoad` collection (replacing the empty array):
```json
"cpuLoad": [
{ "device": "Server-A1", "load": 72 },
{ "device": "Server-B2", "load": 85 },
{ "device": "Router-C3", "load": 45 },
{ "device": "Switch-D4", "load": 91 },
{ "device": "Gateway-E5", "load": 63 }
]
```
2. **api.models.ts** β Add `CpuLoadDto` interface:
```typescript
export interface CpuLoadDto {
device: string;
load: number;
}
```
3. **dashboard-api.service.ts** β Add `getCpuLoad()` method
4. **chart-config.factory.ts** β Add `buildCpuLoadOption()` factory function using PALETTE colors
5. **dashboard.ts** β Add signal + service call in forkJoin
6. **dashboard.html** β Add `<app-chart-widget>` inside or near `#ai-dropzone`
### Expected Result
- A bar chart titled "CPU Load by Device" appears in the AI Widget Drop Zone area
- 5 bars showing percentage values for each device
- Colors come from the PALETTE constant (no raw hex in factory function)
- `ng build` still passes
### What to Point Out
- The AI followed all 6 steps of the implementation order
- No new component was created β the existing `ChartWidget` was reused
- Chart colors use the PALETTE constant, not hardcoded hex values
- The factory function is pure (no side effects)
### Fallback
If this scenario fails live, switch to the `demo-completed` branch:
```bash
git stash && git checkout demo-completed
```
Then restart the dev servers with `npm run dev`.
---
## Scenario 3: Add an AI Security Recommendations Widget
### Story
> "The security team wants an AI-powered recommendations panel. This requires a brand new component since it doesn't fit the KPI card or chart widget pattern. Let's see if Copilot can build it from scratch while following all 20 rules."
### Copilot Chat Prompt
Copy and paste this into Copilot Chat:
> Add a new AI Security Recommendations widget to the dashboard. It should show 3 recommendations, each with a priority level (High, Medium, Low) and a short description. Add the data to db.json first, then build the component. Follow all repo rules in copilot-instructions.md.
### Expected AI Actions
1. **db.json** β Add a `securityRecommendations` collection:
```json
"securityRecommendations": [
{ "id": 1, "priority": "high", "description": "Rotate API keys for production cluster β last rotated 90+ days ago" },
{ "id": 2, "priority": "medium", "description": "Enable MFA for 3 service accounts in US-East region" },
{ "id": 3, "priority": "low", "description": "Update TLS certificates to use SHA-256 on staging endpoints" }
]
```
2. **api.models.ts** β Add `SecurityRecommendationDto` interface
3. **dashboard-api.service.ts** β Add `getSecurityRecommendations()` method
4. **New component** β Create `security-recommendations/` under `dashboard/`:
- `security-recommendations.ts` β standalone, input-driven
- `security-recommendations.html` β flat HTML with Material components
- `security-recommendations.scss` β uses `--mat-sys-*` and `--pf-*` tokens
5. **dashboard.ts** β Import component, fetch data, store in signal
6. **dashboard.html** β Add `<app-security-recommendations>` tag
### Expected Result
- A new card-style widget appears showing 3 security recommendations
- Each item shows a priority badge (High/Medium/Low) with appropriate color
- The component uses Material 3 tokens for all styling
- `ng build` still passes
### What to Point Out
- The AI created a **new component** because the data doesn't fit existing patterns
- It still followed the strict order: db.json β model β service β UI
- TS, HTML, SCSS are in separate files (Rule 1)
- The component is standalone and input-driven (Rules 4, 11)
- No `any` type anywhere (Rule 3/19)
---
## Tips for Presenters
1. **Keep the terminal visible** β the audience should see file changes in real time
2. **Show the Source Control diff** β highlight which files Copilot changed
3. **Run `ng build`** after each scenario to prove the code compiles
4. **Refresh the browser** after scenario 1 (db.json change may need a server restart)
5. **Have the `demo-completed` branch ready** as a fallback for scenario 2
6. **Point out the rules** β open `copilot-instructions.md` to show what the AI is following
|