Commit Graph

8 Commits

Author SHA1 Message Date
Ahmed Darrazi
d9afe6d3a9 fix(policy-explorer): handle both PolicySettingRow and PolicySettingSearchResult types
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 2s
The PolicyDetailSheet component now properly handles both type unions:
- PolicySettingRow (has graphPolicyId) - used in V2
- PolicySettingSearchResult (has id) - used in V1

Uses type guard to check for 'graphPolicyId' property and falls back to 'id' field.
This fixes the TypeScript compilation error in production builds.
2025-12-10 00:45:52 +01:00
Ahmed Darrazi
aa598452e9 feat(policy-explorer-v2): Phase 6 - Enhanced Detail View
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 2s
Implemented Tasks T038-T046:
- T038: Created useCopyToClipboard hook with toast notifications
- T039: Skipped (unit tests - optional)
- T040: Added copy button for Policy ID field
- T041: Added copy button for Setting Name field
- T042: Added tabs for Details and Raw JSON views
- T043: Implemented Raw JSON tab with syntax highlighting
- T044: Created getIntunePortalLink utility (8 policy types)
- T045: Added Open in Intune button with URL construction
- T046: Fallback to copy Policy ID if URL unavailable

Files Created:
- lib/hooks/useCopyToClipboard.ts (65 lines)
- lib/utils/policy-table-helpers.ts (127 lines)

Files Updated:
- components/policy-explorer/PolicyDetailSheet.tsx (enhanced with tabs, copy buttons, Intune links)

Features:
- Copy-to-clipboard for all fields with visual feedback
- Two-tab interface: Details (enhanced fields) and Raw JSON (full object)
- Deep linking to Intune portal by policy type
- Clipboard API with document.execCommand fallback
- Toast notifications for user feedback
2025-12-10 00:40:09 +01:00
Ahmed Darrazi
4288bc7884 feat(policy-explorer-v2): implement Phase 5 - Bulk CSV Export
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 2s
 New Features (Tasks T029-T037)
- Client-side CSV export for selected rows
- Server-side CSV export for all filtered results (max 5000)
- RFC 4180 compliant CSV formatting with proper escaping
- UTF-8 BOM for Excel compatibility
- ExportButton dropdown with two export modes
- Warning UI when results exceed 5000 rows
- Loading state with spinner during server export

📦 New Files
- lib/utils/csv-export.ts - CSV generation utilities
- components/policy-explorer/ExportButton.tsx - Export dropdown

🔧 Updates
- PolicyTableToolbar now includes ExportButton
- PolicyExplorerV2Client passes export props
- Filename generation with timestamp and row count

 Zero TypeScript compilation errors
 All Phase 5 tasks complete (T029-T037)
 Ready for Phase 6 (Enhanced Detail View)

Refs: specs/004-policy-explorer-v2/tasks.md Phase 5
2025-12-10 00:30:33 +01:00
Ahmed Darrazi
c59400cd48 feat(policy-explorer-v2): implement Phase 4 - Enhanced Filtering
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 2s
 New Features (Tasks T023-T028)
- PolicyTypeFilter component with multi-select checkboxes
- 8 common Intune policy types (deviceConfiguration, compliancePolicy, etc.)
- Active filter badges with individual remove buttons
- 'Clear All Filters' button when filters active
- Filter count badge in dropdown trigger

🔧 Updates
- PolicyTableToolbar now accepts filter props
- PolicyExplorerV2Client connects filters to URL state
- Filters sync with URL for shareable links
- Filter state triggers data refetch automatically

📦 Dependencies
- Added shadcn DropdownMenu component

 Zero TypeScript compilation errors
 All Phase 4 tasks complete (T023-T028)
 Ready for Phase 5 (CSV Export)

Refs: specs/004-policy-explorer-v2/tasks.md Phase 4
2025-12-10 00:28:35 +01:00
Ahmed Darrazi
41e80b6c0c feat(policy-explorer-v2): implement MVP Phase 1-3
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 2s
 New Features
- Advanced data table with TanStack Table v8 + Server Actions
- Server-side pagination (10/25/50/100 rows per page)
- Multi-column sorting with visual indicators
- Column management (show/hide, resize) persisted to localStorage
- URL state synchronization for shareable filtered views
- Sticky header with compact/comfortable density modes

📦 Components Added
- PolicyTableV2.tsx - Main table with TanStack integration
- PolicyTableColumns.tsx - 7 column definitions with sorting
- PolicyTablePagination.tsx - Pagination controls
- PolicyTableToolbar.tsx - Density toggle + column visibility menu
- ColumnVisibilityMenu.tsx - Show/hide columns dropdown

🔧 Hooks Added
- usePolicyTable.ts - TanStack Table initialization
- useURLState.ts - URL query param sync with nuqs
- useTablePreferences.ts - localStorage persistence

🎨 Server Actions Updated
- getPolicySettingsV2 - Pagination + sorting + filtering + Zod validation
- exportPolicySettingsCSV - Server-side CSV generation (max 5000 rows)

📚 Documentation Added
- Intune Migration Guide (1400+ lines) - Reverse engineering strategy
- Intune Reference Version tracking
- Tasks completed: 22/62 (Phase 1-3)

 Zero TypeScript compilation errors
 All MVP success criteria met (pagination, sorting, column management)
 Ready for Phase 4-7 (filtering, export, detail view, polish)

Refs: specs/004-policy-explorer-v2/tasks.md
2025-12-10 00:18:05 +01:00
Ahmed Darrazi
434f33ac8f feat: Improve policy type badge system with definitive mapping
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 1s
- Create PolicyTypeBadge component for consistent badge rendering
- Add POLICY_TYPE_MAP with explicit labels for all 7 policy types:
  - configurationProfile → 'Settings Catalog'
  - deviceConfiguration → 'Device Configuration'
  - compliancePolicy → 'Compliance Policy'
  - endpointSecurity → 'Endpoint Security'
  - windowsUpdateForBusiness → 'Windows Update'
  - enrollmentConfiguration → 'Enrollment'
  - appConfiguration → 'App Configuration'
- Update PolicyTable and PolicyDetailSheet to use new component
- Maintain fallback heuristic matching for unknown types
2025-12-08 11:31:45 +01:00
Ahmed Darrazi
56088ca6c0 fix: Resolve search infinite loop issue
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 1s
Fixed useEffect dependency problem in SearchInput that caused
infinite re-renders when searching with 2+ characters.

Changes:
- Removed onSearch from useEffect dependencies
- Added ESLint disable comment for exhaustive-deps
- Search now only triggers on debouncedQuery changes

Issue: Search spinner would hang indefinitely when typing 2 chars
Root cause: onSearch callback recreated on every render, causing loop
Solution: Only depend on debouncedQuery in useEffect
2025-12-07 22:59:07 +01:00
Ahmed Darrazi
f592e5f55b feat: Policy Explorer UX Upgrade (003)
Implemented MVP with all core features:
- Browse 50 newest policies on load with null filtering
- Click row to view details in slide-over sheet
- JSON detection and pretty formatting
- Search with real-time filtering
- Badge colors for policy types (Security=red, Compliance=blue, Config=gray, App=outline)
- Navigation consolidated to 'Policy Explorer'

New components:
- PolicyTable.tsx - table with badges and hover effects
- PolicySearchContainer.tsx - search state management
- PolicyDetailSheet.tsx - JSON detail view with formatting
- PolicyExplorerClient.tsx - client wrapper
- lib/utils/policyBadges.ts - badge color mapping

Updated:
- lib/actions/policySettings.ts - added getRecentPolicySettings() with null filtering
- app/(app)/search/page.tsx - converted to Server Component
- config/nav.ts - renamed Search to Policy Explorer, removed All Settings
- components/search/EmptyState.tsx - updated messaging

Tasks complete: 36/47 (MVP ready)
- Phase 1-7: All critical features implemented
- Phase 8: Core polish complete (T041), optional tasks remain

TypeScript:  No errors
Status: Production-ready MVP
2025-12-07 02:28:15 +01:00