11 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 06-global-site-selection | 03 | execute | 2 |
|
|
true |
|
|
Purpose: Makes the global site selection visible and interactive in the UI. Users see the button at all times regardless of active tab. Output: Updated MainWindow.xaml with toolbar controls, MainWindow.xaml.cs with dialog wiring, localization files with new EN/FR keys, MainWindowViewModel using localized label.
<execution_context> @C:/Users/SebastienQUEROL/.claude/get-shit-done/workflows/execute-plan.md @C:/Users/SebastienQUEROL/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/06-global-site-selection/06-CONTEXT.md @.planning/phases/06-global-site-selection/06-02-SUMMARY.md ```csharp public ObservableCollection GlobalSelectedSites { get; } public string GlobalSitesSelectedLabel { get; } // "3 site(s) selected" or "No sites selected" public RelayCommand OpenGlobalSitePickerCommand { get; } public Func? OpenGlobalSitePickerDialog { get; set; } // Factory set by code-behind ```From SharepointToolbox/MainWindow.xaml (ToolBar section):
<ToolBar DockPanel.Dock="Top">
<ComboBox Width="220" ... />
<Button Content="..." Command="{Binding ConnectCommand}" />
<Button Content="..." Command="{Binding ManageProfilesCommand}" />
<Separator />
<Button Content="..." Command="{Binding ClearSessionCommand}" />
<!-- NEW: Separator + Select Sites button + count label go HERE -->
</ToolBar>
From SharepointToolbox/Views/Tabs/PermissionsView.xaml.cs:
vm.OpenSitePickerDialog = () =>
{
var factory = serviceProvider.GetRequiredService<Func<TenantProfile, SitePickerDialog>>();
return factory(vm.CurrentProfile ?? new TenantProfile());
};
Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.connect]}"
Localization.TranslationSource.Instance["key"]
In `Strings.resx` (English), add these data entries (maintain alphabetical ordering with existing keys if the file is sorted, otherwise append at the end before the closing `</root>` tag):
```xml
<data name="toolbar.selectSites" xml:space="preserve">
<value>Select Sites</value>
</data>
<data name="toolbar.selectSites.tooltip" xml:space="preserve">
<value>Select target sites for all tabs</value>
</data>
<data name="toolbar.selectSites.tooltipDisabled" xml:space="preserve">
<value>Connect to a tenant first</value>
</data>
<data name="toolbar.globalSites.count" xml:space="preserve">
<value>{0} site(s) selected</value>
</data>
<data name="toolbar.globalSites.none" xml:space="preserve">
<value>No sites selected</value>
</data>
```
In `Strings.fr.resx` (French), add the matching entries:
```xml
<data name="toolbar.selectSites" xml:space="preserve">
<value>Choisir les sites</value>
</data>
<data name="toolbar.selectSites.tooltip" xml:space="preserve">
<value>Choisir les sites cibles pour tous les onglets</value>
</data>
<data name="toolbar.selectSites.tooltipDisabled" xml:space="preserve">
<value>Connectez-vous d'abord</value>
</data>
<data name="toolbar.globalSites.count" xml:space="preserve">
<value>{0} site(s) selectionne(s)</value>
</data>
<data name="toolbar.globalSites.none" xml:space="preserve">
<value>Aucun site selectionne</value>
</data>
```
Verify the resx files are well-formed XML after editing.
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5
Both Strings.resx and Strings.fr.resx contain the 5 new keys each. Build succeeds (resx compiles).
Task 2: Update MainWindowViewModel label to use localized strings
SharepointToolbox/ViewModels/MainWindowViewModel.cs
Update the GlobalSitesSelectedLabel property (added in plan 06-02) to use the new localization keys instead of hardcoded strings.
Replace the GlobalSitesSelectedLabel property with:
```csharp
public string GlobalSitesSelectedLabel =>
GlobalSelectedSites.Count > 0
? string.Format(Localization.TranslationSource.Instance["toolbar.globalSites.count"], GlobalSelectedSites.Count)
: Localization.TranslationSource.Instance["toolbar.globalSites.none"];
```
This follows the same pattern used by PermissionsViewModel.SitesSelectedLabel.
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5
GlobalSitesSelectedLabel uses TranslationSource localized keys instead of hardcoded strings.
Task 3: Add toolbar UI controls and wire SitePickerDialog factory
SharepointToolbox/MainWindow.xaml, SharepointToolbox/MainWindow.xaml.cs
**MainWindow.xaml** — Add a Separator, "Select Sites" button, and count label to the ToolBar, after the existing Clear Session button:
```xml
<Separator />
<Button Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.selectSites]}"
Command="{Binding OpenGlobalSitePickerCommand}"
ToolTip="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.selectSites.tooltip]}" />
<TextBlock Text="{Binding GlobalSitesSelectedLabel}"
VerticalAlignment="Center" Margin="6,0,0,0"
Foreground="Gray" />
```
Place these three elements immediately after the existing `<Button Content="..." Command="{Binding ClearSessionCommand}" />` line, before the closing `</ToolBar>` tag.
Note: The button is automatically disabled when SelectedProfile is null because OpenGlobalSitePickerCommand's CanExecute checks `SelectedProfile != null`. A disabled tooltip would require a style trigger — defer that (per context, it's Claude's discretion for exact XAML layout).
**MainWindow.xaml.cs** — Wire the SitePickerDialog factory for the global site picker. In the constructor, after the existing line that wires `OpenProfileManagementDialog`, add:
```csharp
// Wire global site picker dialog factory (same pattern as PermissionsView)
viewModel.OpenGlobalSitePickerDialog = () =>
{
var factory = serviceProvider.GetRequiredService<Func<TenantProfile, SitePickerDialog>>();
return factory(viewModel.SelectedProfile ?? new TenantProfile());
};
```
This requires adding a using directive for SitePickerDialog if not already present:
```csharp
using SharepointToolbox.Views.Dialogs; // already imported for ProfileManagementDialog
```
Also add using for TenantProfile if not already present:
```csharp
using SharepointToolbox.Core.Models; // already imported
```
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5
MainWindow.xaml shows "Select Sites" button + count label in toolbar. MainWindow.xaml.cs wires the SitePickerDialog factory to MainWindowViewModel.OpenGlobalSitePickerDialog. Build succeeds.
- `dotnet build SharepointToolbox/SharepointToolbox.csproj` succeeds with 0 errors
- MainWindow.xaml ToolBar contains the Select Sites button bound to OpenGlobalSitePickerCommand
- MainWindow.xaml ToolBar contains a TextBlock bound to GlobalSitesSelectedLabel
- MainWindow.xaml.cs sets viewModel.OpenGlobalSitePickerDialog factory
- Strings.resx contains 5 new toolbar.* keys
- Strings.fr.resx contains 5 matching FR translations
- MainWindowViewModel.GlobalSitesSelectedLabel uses localized strings
<success_criteria> The toolbar displays a "Select Sites" button and a site count label. Clicking the button opens SitePickerDialog (when connected to a tenant). The label updates to show the count of selected sites. All strings are localized in EN and FR. </success_criteria>
After completion, create `.planning/phases/06-global-site-selection/06-03-SUMMARY.md`