feat(06-04): update single-site tab VMs for global site consumption
- StorageViewModel: add OnGlobalSitesChanged, OnSiteUrlChanged, _hasLocalSiteOverride - SearchViewModel: add OnGlobalSitesChanged, OnSiteUrlChanged, _hasLocalSiteOverride - DuplicatesViewModel: add OnGlobalSitesChanged, OnSiteUrlChanged, _hasLocalSiteOverride - FolderStructureViewModel: add OnGlobalSitesChanged, OnSiteUrlChanged, _hasLocalSiteOverride - All four VMs pre-fill SiteUrl from first global site; local typing sets override flag - Tenant switch resets _hasLocalSiteOverride in all four VMs
This commit is contained in:
@@ -22,6 +22,7 @@ public partial class FolderStructureViewModel : FeatureViewModelBase
|
||||
private readonly BulkResultCsvExportService _exportService;
|
||||
private readonly ILogger<FeatureViewModelBase> _logger;
|
||||
private TenantProfile? _currentProfile;
|
||||
private bool _hasLocalSiteOverride;
|
||||
private List<FolderStructureRow>? _validRows;
|
||||
private BulkOperationSummary<string>? _lastResult;
|
||||
|
||||
@@ -65,6 +66,26 @@ public partial class FolderStructureViewModel : FeatureViewModelBase
|
||||
ExportFailedCommand = new AsyncRelayCommand(ExportFailedAsync, () => HasFailures);
|
||||
}
|
||||
|
||||
protected override void OnGlobalSitesChanged(IReadOnlyList<SiteInfo> sites)
|
||||
{
|
||||
if (_hasLocalSiteOverride) return;
|
||||
SiteUrl = sites.Count > 0 ? sites[0].Url : string.Empty;
|
||||
}
|
||||
|
||||
partial void OnSiteUrlChanged(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
_hasLocalSiteOverride = false;
|
||||
if (GlobalSites.Count > 0)
|
||||
SiteUrl = GlobalSites[0].Url;
|
||||
}
|
||||
else if (GlobalSites.Count == 0 || value != GlobalSites[0].Url)
|
||||
{
|
||||
_hasLocalSiteOverride = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ImportCsv()
|
||||
{
|
||||
var dlg = new OpenFileDialog
|
||||
@@ -154,6 +175,7 @@ public partial class FolderStructureViewModel : FeatureViewModelBase
|
||||
protected override void OnTenantSwitched(TenantProfile profile)
|
||||
{
|
||||
_currentProfile = profile;
|
||||
_hasLocalSiteOverride = false;
|
||||
SiteUrl = string.Empty;
|
||||
LibraryTitle = string.Empty;
|
||||
PreviewRows = new();
|
||||
|
||||
Reference in New Issue
Block a user