Skip to content

Commit 4201077

Browse files
authored
Merge branch 'main' into fix_consumer_provider_logic
2 parents a2b3938 + e69b703 commit 4201077

File tree

27 files changed

+1973
-48
lines changed

27 files changed

+1973
-48
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const React = require('react');
2+
3+
module.exports = {
4+
Editor: () => React.createElement('div', { 'data-testid': 'monaco-editor' }),
5+
DiffEditor: () => React.createElement('div', { 'data-testid': 'monaco-diff-editor' }),
6+
loader: {
7+
config: jest.fn(),
8+
init: jest.fn(() => Promise.resolve({
9+
editor: {
10+
create: jest.fn(),
11+
defineTheme: jest.fn(),
12+
setTheme: jest.fn(),
13+
getModel: jest.fn(),
14+
setModelMarkers: jest.fn(),
15+
},
16+
languages: {
17+
register: jest.fn(),
18+
setMonarchTokensProvider: jest.fn(),
19+
setLanguageConfiguration: jest.fn(),
20+
registerCompletionItemProvider: jest.fn(),
21+
},
22+
MarkerSeverity: {
23+
Error: 8,
24+
Warning: 4,
25+
Info: 2,
26+
Hint: 1,
27+
},
28+
})),
29+
},
30+
};

keep-ui/__mocks__/monaco-editor.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
editor: {
3+
create: jest.fn(),
4+
defineTheme: jest.fn(),
5+
setTheme: jest.fn(),
6+
getModel: jest.fn(),
7+
setModelMarkers: jest.fn(),
8+
},
9+
languages: {
10+
register: jest.fn(),
11+
setMonarchTokensProvider: jest.fn(),
12+
setLanguageConfiguration: jest.fn(),
13+
registerCompletionItemProvider: jest.fn(),
14+
},
15+
MarkerSeverity: {
16+
Error: 8,
17+
Warning: 4,
18+
Info: 2,
19+
Hint: 1,
20+
},
21+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# AlertSidebar Integration in Incident Alerts
2+
3+
## Overview
4+
This implementation replaces the `ViewAlertModal` component with the `AlertSidebar` component in the incident alerts page to provide a consistent user experience across the application.
5+
6+
## Changes Made
7+
8+
### 1. Component Integration (`incident-alerts.tsx`)
9+
- **Removed**: `ViewAlertModal` import and usage
10+
- **Added**: `AlertSidebar` component from `@/features/alerts/alert-detail-sidebar`
11+
- **Updated State Management**:
12+
- Replaced `viewAlertModal` state with `selectedAlert` and `isSidebarOpen`
13+
- Added `isIncidentSelectorOpen` state for AlertSidebar compatibility
14+
15+
### 2. User Interactions
16+
The AlertSidebar can be opened in two ways:
17+
1. **Row Click**: Clicking on any alert row in the table
18+
2. **View Button**: Clicking the "View Details" button in the action tray
19+
20+
### 3. Key Features
21+
- **Consistent UI**: Uses the same sidebar component as the main alerts table
22+
- **Alert Details**: Shows alert name, severity, description, source, and other metadata
23+
- **Alert Timeline**: Displays audit history and state changes
24+
- **Related Services**: Shows topology map of related services
25+
- **Actions**: Supports workflow execution, status changes, and incident association
26+
27+
### 4. Code Comments
28+
Added explanatory comments in the implementation:
29+
- Component replacement rationale
30+
- State management explanations
31+
- Handler function descriptions
32+
- Optional prop documentation
33+
34+
## Testing
35+
36+
### Test Coverage (`incident-alerts-sidebar.test.tsx`)
37+
Created comprehensive tests covering:
38+
1. **Rendering**: Verifies alerts are displayed correctly
39+
2. **Opening Sidebar**: Tests both row click and button click methods
40+
3. **Closing Sidebar**: Ensures proper cleanup
41+
4. **Alert Switching**: Tests switching between different alerts
42+
5. **Empty State**: Handles no alerts scenario
43+
6. **Loading State**: Covers data fetching states
44+
45+
### Running Tests
46+
```bash
47+
cd keep-ui
48+
npm test -- --testPathPattern="incident-alerts-sidebar.test.tsx"
49+
```
50+
51+
## Benefits
52+
1. **Consistency**: Same sidebar experience across all alert views
53+
2. **Feature Parity**: All alert actions available in incident context
54+
3. **Maintainability**: Single component to maintain instead of multiple modals
55+
4. **User Experience**: Familiar interaction patterns for users
56+
57+
## Future Considerations
58+
- The sidebar supports additional features like workflow execution and status changes
59+
- These features can be enabled by passing the appropriate handlers as props
60+
- The component is designed to be extensible for future requirements

0 commit comments

Comments
 (0)