Files
Sharepoint-Toolbox/.planning/phases/03-storage/03-08-SUMMARY.md
Dev 43dd6ce17f docs(03-08): complete SearchViewModel + DuplicatesViewModel + Views plan — Phase 3 complete
- 3 tasks completed, 9 files created/modified
- Visual checkpoint pending: all three Phase 3 tabs wired and ready for UI verification
2026-04-02 16:10:54 +02:00

4.6 KiB

phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
phase plan subsystem tags dependency_graph tech_stack key_files decisions metrics
03 08 ui-viewmodels
wpf
viewmodel
search
duplicates
di
xaml
requires provides affects
03-05
03-06
03-07
SearchViewModel
DuplicatesViewModel
SearchView
DuplicatesView
Phase3-DI
App.xaml.cs
MainWindow.xaml
MainWindow.xaml.cs
added patterns
FeatureViewModelBase
AsyncRelayCommand
TenantProfile-site-override
DI-tab-wiring
created modified
SharepointToolbox/ViewModels/Tabs/SearchViewModel.cs
SharepointToolbox/Views/Tabs/SearchView.xaml
SharepointToolbox/Views/Tabs/SearchView.xaml.cs
SharepointToolbox/ViewModels/Tabs/DuplicatesViewModel.cs
SharepointToolbox/Views/Tabs/DuplicatesView.xaml
SharepointToolbox/Views/Tabs/DuplicatesView.xaml.cs
SharepointToolbox/App.xaml.cs
SharepointToolbox/MainWindow.xaml
SharepointToolbox/MainWindow.xaml.cs
SearchViewModel and DuplicatesViewModel use TenantProfile site URL override pattern — ctx.Url is read-only in CSOM (established pattern from StorageViewModel)
DuplicateRow flat DTO wraps DuplicateItem with GroupName and GroupSize for DataGrid display
duration completed_date tasks files
4min 2026-04-02 3 9

Phase 3 Plan 08: SearchViewModel + DuplicatesViewModel + Views + DI Wiring Summary

One-liner: SearchViewModel and DuplicatesViewModel with full XAML views wired into MainWindow via DI, completing Phase 3 Storage feature tabs.

Tasks Completed

# Name Commit Files
1a SearchViewModel + SearchView 7e6d39a SearchViewModel.cs, SearchView.xaml, SearchView.xaml.cs
1b DuplicatesViewModel + DuplicatesView 0984a36 DuplicatesViewModel.cs, DuplicatesView.xaml, DuplicatesView.xaml.cs
2 DI registration + MainWindow wiring 1f2a49d App.xaml.cs, MainWindow.xaml, MainWindow.xaml.cs

What Was Built

SearchViewModel (SearchViewModel.cs): Full filter state (extensions, regex, 4 date range checkboxes, createdBy, modifiedBy, library, maxResults), RunOperationAsync that calls ISearchService.SearchFilesAsync, ExportCsvCommand + ExportHtmlCommand with CanExport guard, OnTenantSwitched clears results.

SearchView.xaml: Left filter panel (260px ScrollViewer) with GroupBox for filters, Run Search + Cancel buttons, Export CSV/HTML group, status TextBlock. Right: full-width DataGrid with 8 columns (name, ext, created, author, modified, modifiedBy, size, path) using BytesConverter and RightAlignStyle.

DuplicatesViewModel (DuplicatesViewModel.cs): Mode (Files/Folders), 5 criteria checkboxes, IncludeSubsites, Library, RunOperationAsync that calls IDuplicatesService.ScanDuplicatesAsync, flattens DuplicateGroup.Items to flat DuplicateRow list for DataGrid, ExportHtmlCommand.

DuplicatesView.xaml: Left options panel (240px) with type RadioButtons, criteria checkboxes, library TextBox, IncludeSubsites checkbox, Run Scan + Cancel + Export HTML buttons. Right: DataGrid with group, copies, name, library, size, created, modified, path columns.

DI + Wiring: App.xaml.cs registers all Phase 3 Search and Duplicates services and views. MainWindow.xaml replaces FeatureTabBase stubs with named TabItems. MainWindow.xaml.cs wires content from DI.

Deviations from Plan

Auto-fixed Issues

1. [Rule 1 - Bug] Fixed ctx.Url read-only error in SearchViewModel

  • Found during: Task 1a verification build
  • Issue: Plan code used ctx.Url = SiteUrl.TrimEnd('/')ClientRuntimeContext.Url is read-only in CSOM (CS0200)
  • Fix: Replaced with new TenantProfile { TenantUrl = SiteUrl.TrimEnd('/'), ClientId = ..., Name = ... } and passed to GetOrCreateContextAsync — identical to StorageViewModel pattern documented in STATE.md
  • Files modified: SearchViewModel.cs
  • Commit: 7e6d39a (fix applied in same commit)

2. [Rule 1 - Bug] Pre-emptively fixed ctx.Url in DuplicatesViewModel

  • Found during: Task 1b (same issue pattern as Task 1a)
  • Issue: Plan code also used ctx.Url = for DuplicatesViewModel
  • Fix: Same TenantProfile override pattern applied before writing the file
  • Files modified: DuplicatesViewModel.cs
  • Commit: 0984a36

Pre-existing Test Failure (Out of Scope)

FeatureViewModelBaseTests.CancelCommand_DuringOperation_SetsStatusMessageToCancelled fails because test asserts .Contains("cancel") (case-insensitive) but the app returns French string "Opération annulée". This failure predates this plan (confirmed via git stash test). Out of scope — logged to deferred items.

Self-Check: PASSED