Skip to content

Commit 0cb89f8

Browse files
authored
feat: Enhanced logs dashboard with multi-pane view, notifications, and browser launch (#68)
* fix: update go.mod and go.sum dependencies * Enhance service detection and logging for multi-service architecture - Updated service runtime detection tests to mark common ports (3000, 5000, 8000, 8080) as used to prevent conflicts and interactive prompts. - Introduced a new DashboardConfig struct in AzureYaml to support dashboard configuration in azure.yaml. - Added a simulated cache service with logging for Redis-style operations, including memory usage tracking and connection errors. - Implemented a simulated database service with SQL query logging, including slow query detection and connection management. - Created a worker service to simulate background job processing with logging for job status and queue depth. - Updated fullstack-test project to include new services (cache, database, worker) with detailed logging patterns and configurations. - Adjusted ports for hooks-platform-test and hooks-test to avoid conflicts with existing services. - Added README documentation for the fullstack-test project, detailing service configurations, expected outputs, and testing scenarios. * feat: enhance logging and service management with improved safety and race condition handling * feat: centralize log utilities and enhance logging functionality across components * feat: implement OS notification manager for service state changes and enhance logging with clickable dashboard links * Improve log pane functionality and notifications * feat: add log filtering capabilities to suppress noisy log messages - Introduced LogFilter and related functionality to filter log messages based on regex patterns. - Enhanced logs command with new flags for excluding patterns and disabling built-in filters. - Updated log buffer to utilize the log filter for managing log entries. - Integrated log filtering configuration into azure.yaml for project and service levels. - Added comprehensive tests for log filtering functionality and its integration with existing logging mechanisms. * feat: Implement dashboard browser launch feature with configuration and cross-platform support - Added automatic dashboard browser launch on `azd app run` - Introduced `--browser=<target>` and `--no-browser` flags - Integrated VS Code Simple Browser detection - Configurable via `azure.yaml` and `azd config` - Enhanced error handling and async launch capabilities - Comprehensive documentation and tests included --- feat: Add light/dark mode switcher with accessibility compliance - Implemented theme toggle with moon/sun icon - Added local storage persistence for theme selection - Ensured WCAG 2.1 AA compliance and keyboard navigation support - Completed design and implementation tasks with QA validation --- feat: Enhance log pane with visual improvements and dynamic behavior - Introduced status-based header coloring for logs - Implemented dynamic space redistribution on pane collapse/expand - Ensured compatibility with light and dark modes - Achieved WCAG AA contrast compliance --- feat: Complete process state notifications system for Azure CLI - Developed backend monitoring and notification preferences - Implemented OS notifications for Windows, macOS, and Linux - Created CLI commands for managing notifications - Achieved comprehensive test coverage and E2E testing --- chore: Review and improve test coverage for dashboard components - Increased overall test coverage from 91.84% to 98.52% - Added unit tests and Playwright E2E tests for dashboard features - Documented testing procedures and results --- fix: Integrate notifications command into azd app command structure - Registered notifications command with main app command - Updated command file structure for consistency - Ensured proper functionality through testing --- test: Add E2E tests for notifications pipeline and handlers - Implemented tests for notification flow, OS notification handling, and database persistence - Verified event broadcasting through WebSocket handler - Ensured severity mapping and conversion logic are functioning correctly * feat: Add useLogStream hook for streaming logs with WebSocket support and initial log fetching * fix: Improve type assertion for localStorage retrieval in LogsMultiPaneView and clean up variable formatting in logs.go and logfilter_test.go * Implement browser target resolution and validation tests - Added TestResolveBrowserTarget to validate browser target resolution logic based on flags and project configuration. - Introduced TestValidateBrowserFlag to ensure proper validation of browser flags. - Created TestBrowserFlagPriority to verify the priority of browser flags over project configurations. - Refactored service operation handling in server.go to use a new serviceOperationHandler for start, stop, and restart operations. - Added atomic file writing utilities in fileutil.go for JSON data to ensure data integrity during writes. - Introduced constants for file permissions and dashboard configuration in constants.go. - Simplified pattern loading and saving logic in logs_config.go by utilizing new helper functions. * feat: Enhance browser launch with context support and add validation for log patterns and overrides * feat: Add URL validation in Launch function and enhance tests for URL schemes * feat(logs): add optional port display in LogsPane component fix(tests): update ServiceStatusCard tests to reflect status label changes from Info to Running refactor(ServiceStatusCard): change Info status to Running and update related logic fix(go.mod): replace gorilla/websocket with coder/websocket for improved functionality fix(tests): update WebSocket tests to use coder/websocket and improve context handling fix(config): change directory permissions for config and notification preferences to be more restrictive feat(dashboard): implement request body size limit to prevent DoS attacks in logs configuration fix(dashboard): escape user-controllable values in fallback handler to prevent XSS vulnerabilities refactor(websocket): improve WebSocket handling with nhooyr/websocket and add origin validation feat(notifications): add sanitization for AppleScript strings to prevent command injection attacks * refactor(websocket): update health monitor and client references for coder/websocket * feat: Implement code review fixes including security hardening, context propagation, and memory management improvements * test(notify): add type assertion for darwinNotifier in Send_ScriptFormat test * refactor: Improve button accessibility and update service status indicators in ServiceStatusCard
1 parent bebd097 commit 0cb89f8

File tree

203 files changed

+29382
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+29382
-642
lines changed

.gitignore

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ bin/
1313
# Test binaries
1414
*.test
1515

16+
# Playwright test outputs
17+
test-results/
18+
playwright-report/
19+
1620
# Coverage
1721
*.out
1822
*.coverage
@@ -107,18 +111,10 @@ tests/projects/node/test-pnpm-project/azure.yaml
107111
tests/projects/python/test-uv-project/azure.yaml
108112
tests/projects/aspire-test/azure.yaml
109113

110-
cli2/jongio.azd.app/build.ps1
111-
cli2/jongio.azd.app/build.sh
112-
cli2/jongio.azd.app/changelog.md
113-
cli2/jongio.azd.app/extension.yaml
114-
cli2/jongio.azd.app/go.mod
115-
cli2/jongio.azd.app/go.sum
116-
cli2/jongio.azd.app/main.go
117-
cli2/jongio.azd.app/README.md
118-
cli2/jongio.azd.app/internal/cmd/context.go
119-
cli2/jongio.azd.app/internal/cmd/listen.go
120-
cli2/jongio.azd.app/internal/cmd/prompt.go
121-
cli2/jongio.azd.app/internal/cmd/root.go
122-
cli2/jongio.azd.app/internal/cmd/version.go
114+
123115
azd-app.sln
124116
cli/output-coverage
117+
118+
119+
120+
.github/agents/**

cli/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,45 @@ azd app reqs --generate --dry-run
157157

158158
When you run `azd app reqs --generate` in a Node.js project:
159159

160+
### `azd app notifications`
161+
162+
Manage process notifications for service state changes and events.
163+
164+
```bash
165+
# List notification history
166+
azd app notifications list
167+
168+
# Show only unread notifications
169+
azd app notifications list --unread
170+
171+
# Filter by service name
172+
azd app notifications list --service web
173+
174+
# Mark notification as read
175+
azd app notifications mark-read 123
176+
177+
# Mark all as read
178+
azd app notifications mark-read --all
179+
180+
# View notification statistics
181+
azd app notifications stats
182+
183+
# Clear old notifications
184+
azd app notifications clear --older-than 7d
185+
186+
# Clear all notifications
187+
azd app notifications clear
188+
```
189+
190+
**Features:**
191+
- ✅ Track service state changes (starting, running, stopped, failed)
192+
- ✅ Desktop notifications for critical events (OS-native)
193+
- ✅ Persistent notification history with SQLite database
194+
- ✅ Mark notifications as read/unread
195+
- ✅ Filter by service, severity, or read status
196+
- ✅ Automatic cleanup of old notifications
197+
- ✅ Statistics and reporting
198+
160199
```bash
161200
🔍 Scanning project for dependencies...
162201

cli/build.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,20 @@ foreach ($PLATFORM in $PLATFORMS) {
125125

126126
Write-Host " Building for $OS/$ARCH..." -ForegroundColor Gray
127127

128-
# Delete the output file if it already exists
128+
# Handle locked files on Windows by renaming instead of deleting
129129
if (Test-Path -Path $OUTPUT_NAME) {
130-
Remove-Item -Path $OUTPUT_NAME -Force
130+
$backupName = "$OUTPUT_NAME.old"
131+
try {
132+
# Try to remove old backup first
133+
if (Test-Path -Path $backupName) {
134+
Remove-Item -Path $backupName -Force -ErrorAction SilentlyContinue
135+
}
136+
# Rename current file (works even if running)
137+
Move-Item -Path $OUTPUT_NAME -Destination $backupName -Force -ErrorAction Stop
138+
} catch {
139+
# If rename fails, file might not be locked - try direct delete
140+
Remove-Item -Path $OUTPUT_NAME -Force -ErrorAction SilentlyContinue
141+
}
131142
}
132143

133144
# Set environment variables for Go build

cli/dashboard/e2e/dashboard.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test.describe('Dashboard - Resources View', () => {
9595
});
9696

9797
test('should display service status', async ({ page }) => {
98-
await expect(page.getByText('Running')).toBeVisible();
98+
await expect(page.getByText('Running').first()).toBeVisible();
9999
});
100100

101101
test('should show search filter input', async ({ page }) => {
@@ -186,15 +186,15 @@ test.describe('Dashboard - Console View', () => {
186186
});
187187

188188
test('should navigate to console view', async ({ page }) => {
189-
await page.getByRole('button', { name: /console/i }).click();
189+
await page.getByRole('button', { name: 'Console', exact: true }).click();
190190
await expect(page.getByRole('heading', { name: 'Console' })).toBeVisible();
191191
});
192192

193193
test('should display log controls', async ({ page }) => {
194-
await page.getByRole('button', { name: /console/i }).click();
194+
await page.getByRole('button', { name: 'Console', exact: true }).click();
195195

196-
// Check for service filter
197-
await expect(page.getByText('Service')).toBeVisible();
196+
// Check for service filter heading
197+
await expect(page.getByRole('heading', { name: 'Services' })).toBeVisible();
198198
});
199199
});
200200

@@ -220,8 +220,8 @@ test.describe('Dashboard - Error States', () => {
220220

221221
await page.goto('/');
222222

223-
// Should show loading spinner
224-
const spinner = page.locator('.animate-spin');
223+
// Should show loading spinner (use first() since there may be multiple spinners)
224+
const spinner = page.locator('.animate-spin').first();
225225
await expect(spinner).toBeVisible();
226226
});
227227

0 commit comments

Comments
 (0)