Name the preselected data sources that cannot be used right now

This commit is contained in:
Thorsten Sommer committed 2026-09-14 12:14:49 +02:00
1 parent a886d8dbf9
commit e71e389392
3 files changed
+26 -3

No files matched your search

@@ -67,6 +67,13 @@
<MudTextSwitch Label="@T("AI-based data validation")" Value="@this.aiBasedValidation" LabelOn="@T("Yes, let the AI validate & filter the retrieved data.")" LabelOff="@T("No, use all data retrieved from the data sources.")" ValueChanged="@this.ValidationModeChanged"/>
}
@if (!this.aiBasedSourceSelection && this.GetUnavailablePreselectedDataSourceNames().Length > 0)
{
<MudText Typo="Typo.body2" Color="Color.Warning" Class="mb-3">
@T("These data sources are preselected, but cannot be used right now, either due to data privacy or confidence-level requirements, or because they are unavailable:") @this.GetUnavailablePreselectedDataSourceNames()
</MudText>
}
@switch (this.aiBasedSourceSelection)
{
case true when this.availableDataSources.Count == 0:
@@ -181,6 +181,22 @@ public partial class DataSourceSelection : MSGComponentBase
var preselectedDataSourceIds = this.DataSourceOptions.PreselectedDataSourceIds.ToHashSet(StringComparer.Ordinal);
return this.GetConfiguredDataSourcesSnapshot().Where(ds => preselectedDataSourceIds.Contains(ds.Id)).ToList();
}
/// <summary>
/// Names the preselected data sources which the filters removed.
/// </summary>
/// <remarks>
/// This list shows what survived the filters, while the preselection keeps what the user asked
/// for. Without this, a preselected source which cannot be used right now is simply missing
/// from the list, and nothing says so. Preselected ids without a configured source are left
/// out: that source is gone, not unavailable.
/// </remarks>
/// <returns>The names of the unusable preselected data sources, or an empty string when there are none.</returns>
private string GetUnavailablePreselectedDataSourceNames()
{
var availableDataSourceIds = this.availableDataSources.Select(ds => ds.Id).ToHashSet(StringComparer.Ordinal);
return string.Join(", ", this.GetDataSourcesFromConfiguredIds().Where(ds => !availableDataSourceIds.Contains(ds.Id)).Select(ds => ds.Name));
}
private async Task LoadAndApplyFilters()
{