Turned getter-like extension methods into extension properties (#1157)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 13:00:56 +01:00
1 parent 0375318b1b
commit f649febf88
286 files changed
+1379 -1109

No files matched your search

@@ -125,8 +125,8 @@ public partial class AssistantBlock<TSettings> : MSGComponentBase, IAssistantCat
/// <returns><c>true</c> when this block represents the owner.</returns>
private bool OwnedByThisBlock(MediaImportOwner owner)
{
if (owner.Kind.PersistsOwnSources())
return owner.Kind == this.Component.MediaOwnerKind();
if (owner.Kind.PersistsOwnSources)
return owner.Kind == this.Component.MediaOwnerKind;
if (string.IsNullOrWhiteSpace(this.AssistantSessionInstanceId))
return owner.Kind is MediaImportOwnerKind.ASSISTANT && owner.Id.StartsWith($"{this.Component}:", StringComparison.Ordinal);
@@ -256,7 +256,7 @@
<td>
<MudText Typo="Typo.body2"><b>@T("Required minimum")</b></MudText>
</td>
<td><MudText Typo="Typo.body2">@state.Settings.MinimumLevel.GetName()</MudText></td>
<td><MudText Typo="Typo.body2">@state.Settings.MinimumLevel.Name</MudText></td>
</tr>
</tbody>
</MudSimpleTable>
@@ -290,7 +290,7 @@
<MudStack Spacing="2">
@foreach (var finding in state.Audit.Findings)
{
<MudAlert Severity="@finding.Severity.GetSeverity()" Variant="Variant.Text" Dense="@true">
<MudAlert Severity="@finding.Severity.Severity" Variant="Variant.Text" Dense="@true">
<strong>@finding.Category</strong><span>: @finding.Description</span>
@if (!string.IsNullOrWhiteSpace(finding.Location))
{
@@ -185,7 +185,7 @@ public partial class AttachDocuments : MSGComponentBase
var delivery = this.MediaTranscriptionService.GetPendingDelivery(this.EffectiveMediaImportTarget);
// Owners that persist their own sources have already taken the media over when the batch
// started, so re-adding the delivered transcripts here would duplicate them.
var completed = this.EffectiveImportOwner.Kind.PersistsOwnSources()
var completed = this.EffectiveImportOwner.Kind.PersistsOwnSources
? Array.Empty<FileAttachment>()
: delivery?.Attachments ?? [];
var pending = this.OwnerChat?.Draft.MediaTranscripts ?? [];
@@ -436,7 +436,7 @@ public partial class AttachDocuments : MSGComponentBase
// Owners that persist their own sources show the file right away and keep it next to the
// stored document, instead of waiting for the transcription to be delivered back.
if (this.EffectiveImportOwner.Kind.PersistsOwnSources())
if (this.EffectiveImportOwner.Kind.PersistsOwnSources)
{
foreach (var mediaPath in mediaPaths)
this.DocumentPaths.Add(FileAttachment.FromPath(mediaPath));
@@ -795,7 +795,7 @@ public partial class ChatComponent : MSGComponentBase
get
{
if (this.IsProviderSelected)
return string.Format(T("Your Prompt (use selected instance '{0}', provider '{1}')"), this.Provider.InstanceName, this.Provider.UsedLLMProvider.ToName());
return string.Format(T("Your Prompt (use selected instance '{0}', provider '{1}')"), this.Provider.InstanceName, this.Provider.UsedLLMProvider.Name);
return this.T("Select a provider first");
}
@@ -48,7 +48,7 @@
@T("Confidence Level")
</MudText>
<MudText Typo="Typo.body1" Style="@this.GetCurrentConfidenceColor()">
<b>@this.currentConfidence.Level.GetName()</b>
<b>@this.currentConfidence.Level.Name</b>
</MudText>
</MudCardContent>
<MudCardActions>
@@ -58,7 +58,7 @@
<MudTd Style="white-space: normal; overflow-wrap: anywhere;">
<div style="min-width: 10em;">@context.Name</div>
</MudTd>
<MudTd>@context.Type.GetDisplayName()</MudTd>
<MudTd>@context.Type.DisplayName</MudTd>
<MudTd>@this.GetEmbeddingName(context)</MudTd>
<MudTd>
@if (context is IIndexedDataSource)
@@ -306,7 +306,7 @@ public partial class DataSourceManagement : MSGComponentBase
var dialogParameters = new DialogParameters<ConfirmDialog>
{
{ x => x.Message, string.Format(T("Are you sure you want to delete the data source '{0}' of type '{1}'?"), dataSource.Name, dataSource.Type.GetDisplayName()) },
{ x => x.Message, string.Format(T("Are you sure you want to delete the data source '{0}' of type '{1}'?"), dataSource.Name, dataSource.Type.DisplayName) },
};
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Data Source"), dialogParameters, DialogOptions.FULLSCREEN);
@@ -146,7 +146,7 @@
@if (source.DataSource is IInternalDataSource internalSource)
{
<MudSpacer/>
<MudTooltip Text="@internalSource.ConfidenceLevel.GetName()">
<MudTooltip Text="@internalSource.ConfidenceLevel.Name">
<MudIcon Icon="@Icons.Material.Filled.Security" Size="Size.Small" Class="confidence-icon" Style="@this.GetConfidenceIconStyle(internalSource)"/>
</MudTooltip>
}
@@ -15,7 +15,7 @@
{
<MudIcon Icon="@this.GetBlockedIcon()" Size="Size.Small" Color="@this.GetBlockedIconColor()" Style="flex-shrink: 0;"/>
}
<MudTooltip Text="@internalSource.ConfidenceLevel.GetName()">
<MudTooltip Text="@internalSource.ConfidenceLevel.Name">
<MudIcon Icon="@Icons.Material.Filled.Security" Size="Size.Small" Class="confidence-icon" Style="@this.GetConfidenceIconStyle(internalSource)"/>
</MudTooltip>
}
@@ -66,7 +66,7 @@ public sealed class HighlightedCodeBlock : ComponentBase
builder.AddContent(2, this.Code[position..token.Start]);
builder.OpenElement(3, "span");
builder.AddAttribute(4, "class", token.Kind.ToCssClass());
builder.AddAttribute(4, "class", token.Kind.CssClass);
builder.AddContent(5, this.Code.Substring(token.Start, token.Length));
builder.CloseElement();
position = token.Start + token.Length;
@@ -4,7 +4,7 @@
<CompactExpansionPanel HeaderText="@this.HeaderTextOf(area)" HeaderIcon="@IconOf(area)" Class="mb-3 rounded" Expanded="@this.expandedAreas.Contains(area)" ExpandedChanged="@(expanded => this.SetExpanded(area, expanded))">
@if (this.expandedAreas.Contains(area))
{
@foreach (var purpose in Enum.GetValues<LayoutPurpose>().Where(purpose => purpose.Area() == area))
@foreach (var purpose in Enum.GetValues<LayoutPurpose>().Where(purpose => purpose.Area == area))
{
@this.ChoiceContent(purpose)
}
@@ -35,8 +35,8 @@ public partial class LayoutChoicePanels : ComponentBase
private string HeaderTextOf(LayoutPurposeArea area)
{
var chosen = Enum.GetValues<LayoutPurpose>().Count(purpose => purpose.Area() == area && this.IsChosen(purpose));
return chosen == 0 ? area.Label() : $"{area.Label()} ({chosen})";
var chosen = Enum.GetValues<LayoutPurpose>().Count(purpose => purpose.Area == area && this.IsChosen(purpose));
return chosen == 0 ? area.Label : $"{area.Label} ({chosen})";
}
private void SetExpanded(LayoutPurposeArea area, bool expanded)
@@ -2,7 +2,7 @@
@using AIStudio.Settings.DataModel
@inherits MSGComponentBase
<MudSelect T="OutboundDataRestriction" Value="@this.Value" ValueChanged="@this.ValueChanged" Text="@this.Value.GetName()" Label="@this.Label" Class="mb-1" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Shield">
<MudSelect T="OutboundDataRestriction" Value="@this.Value" ValueChanged="@this.ValueChanged" Text="@this.Value.Name" Label="@this.Label" Class="mb-1" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Shield">
@foreach (var restriction in ConfigurationSelectDataFactory.GetOutboundDataRestrictionData(this.Minimum))
{
<MudSelectItem T="OutboundDataRestriction" Value="@restriction.Value">
@@ -11,7 +11,7 @@
}
</MudSelect>
<MudJustifiedText Typo="Typo.body2" Class="mb-1">
@this.Value.GetDescription()
@this.Value.Description
</MudJustifiedText>
@if (this.LimitationText is { } limitationText)
{
@@ -12,8 +12,8 @@ public static class ReadWebContentStepsExtensions
/// <summary>
/// Gets the text representation of a given ReadWebContentSteps enum value.
/// </summary>
/// <returns>>The text representation of the process step.</returns>
public string GetText() => step switch
/// <value>The text representation of the process step.</value>
public string Text => step switch
{
ReadWebContentSteps.START => TB("Start"),
ReadWebContentSteps.LOADING => TB("Loading"),
@@ -128,14 +128,14 @@ public partial class SettingsPanelApp : SettingsPanelBase
// Several configuration plugins may contribute at the same time, e.g. one preview feature
// for the whole organization and another one for a single department:
if (ManagedConfiguration.TryGet(x => x.App, x => x.EnabledPreviewFeatures, out var meta) && meta.HasPluginContribution)
return meta.PluginContributions.Values.SelectMany(contribution => contribution).Where(x => !x.IsReleased()).ToHashSet();
return meta.PluginContributions.Values.SelectMany(contribution => contribution).Where(x => !x.IsReleased).ToHashSet();
return [];
}
private bool IsPluginContributedPreviewFeature(PreviewFeatures feature)
{
if (feature.IsReleased())
if (feature.IsReleased)
return false;
if (!ManagedConfiguration.TryGet(x => x.App, x => x.EnabledPreviewFeatures, out var meta) || !meta.HasPluginContribution)
@@ -146,7 +146,7 @@ public partial class SettingsPanelApp : SettingsPanelBase
private HashSet<PreviewFeatures> GetSelectedPreviewFeatures()
{
var enabled = this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures.Where(x => !x.IsReleased()).ToHashSet();
var enabled = this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures.Where(x => !x.IsReleased).ToHashSet();
enabled.UnionWith(this.GetPluginContributedPreviewFeatures());
return enabled;
}
@@ -35,7 +35,7 @@
</HeaderContent>
<RowTemplate>
<MudTd Style="vertical-align: top;">
@context.ToName()
@context.Name
</MudTd>
<MudTd>
<MudMarkdown Value="@context.GetConfidence(this.SettingsManager).Description" MarkdownPipeline="Markdown.SAFE_MARKDOWN_PIPELINE"/>
@@ -54,7 +54,7 @@
continue;
<MudMenuItem OnClick="@(async () => await this.ChangeCustomConfidenceLevel(context, confidenceLevel))">
@confidenceLevel.GetName()
@confidenceLevel.Name
</MudMenuItem>
}
</MudMenu>
@@ -8,7 +8,7 @@ public partial class SettingsPanelConfidence : SettingsPanelBase
private string GetCurrentConfidenceLevelName(LLMProviders llmProvider)
{
if (this.TryGetShownConfidenceLevel(llmProvider, out var level))
return level.GetName();
return level.Name;
return T("Not yet configured");
}
@@ -32,7 +32,7 @@
<MudTh Class="provider-group-header" colspan="4">
@if (context.Key is LLMProviders llmProvider)
{
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.ToName()" />
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.Name" />
}
</MudTh>
</GroupHeaderTemplate>
@@ -74,7 +74,7 @@
else
{
<MudTooltip Text="@T("Open Dashboard")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())"/>
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.DashboardURL" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard)"/>
</MudTooltip>
<MudTooltip Text="@T("Edit")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Edit" OnClick="@(() => this.EditEmbeddingProvider(context))"/>
@@ -25,7 +25,7 @@
<MudTh Class="provider-group-header" colspan="4">
@if (context.Key is LLMProviders llmProvider)
{
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.ToName()" />
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.Name" />
}
</MudTh>
</GroupHeaderTemplate>
@@ -63,7 +63,7 @@
else
{
<MudTooltip Text="@T("Open Dashboard")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())"/>
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.DashboardURL" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard)"/>
</MudTooltip>
<MudTooltip Text="@T("Edit")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Edit" OnClick="@(() => this.EditLLMProvider(context))"/>
@@ -107,7 +107,7 @@ public partial class SettingsPanelTools : SettingsPanelBase
// minimum confidence; the long wording wraps into a tall block there:
private string GetConfidenceLevelName(ConfidenceLevel confidenceLevel) => confidenceLevel is ConfidenceLevel.NONE
? this.T("No minimum")
: confidenceLevel.GetName();
: confidenceLevel.Name;
private string SetCurrentConfidenceLevelColorStyle(ToolCatalogItem item) =>
$"background-color: {GetMinimumProviderConfidence(item).GetColor(this.SettingsManager)};";
@@ -29,7 +29,7 @@
<MudTh Class="provider-group-header" colspan="4">
@if (context.Key is LLMProviders llmProvider)
{
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.ToName()" />
<ProviderLabel ProviderType="@llmProvider" Text="@llmProvider.Name" />
}
</MudTh>
</GroupHeaderTemplate>
@@ -68,7 +68,7 @@
else
{
<MudTooltip Text="@T("Open Dashboard")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.GetDashboardURL()" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard())"/>
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.OpenInBrowser" Href="@context.UsedLLMProvider.DashboardURL" Target="_blank" Disabled="@(!context.UsedLLMProvider.HasDashboard)"/>
</MudTooltip>
<MudTooltip Text="@T("Edit")">
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Edit" OnClick="@(() => this.EditTranscriptionProvider(context))"/>
@@ -187,7 +187,7 @@ public partial class SourcePassageView : MSGComponentBase
/// </remarks>
private string GetTranscriptLabel()
{
if (!this.Passage.IsTranscript())
if (!this.Passage.IsTranscript)
return string.Empty;
var extension = Path.GetExtension(this.Passage.Path);
@@ -194,8 +194,8 @@ public partial class ToolSelection : MSGComponentBase
return string.Format(
this.T("This tool requires provider confidence {0}. The selected provider has {1}."),
GetMinimumProviderConfidence(item).GetName(),
this.ProviderConfidence.GetName());
GetMinimumProviderConfidence(item).Name,
this.ProviderConfidence.Name);
}
/// <summary>