mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 21:39:46 +00:00
Added server name & description
This commit is contained in:
parent
65feb13951
commit
9bc6d04b22
@ -20,6 +20,9 @@
|
||||
<PreviewPrototype/>
|
||||
<div class="mb-6"></div>
|
||||
|
||||
<MudTextField T="string" @bind-Text="@this.serverName" Validation="@this.ValidateServerName" Immediate="@true" Label="EDI server name" HelperText="Please give your EDI server a name that provides information about the data source and/or its intended purpose. The name will be displayed to users in AI Studio." Counter="60" MaxLength="60" Variant="Variant.Outlined" Margin="Margin.Normal" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||
<MudTextField T="string" @bind-Text="@this.serverDescription" Validation="@this.ValidateServerDescription" Immediate="@true" Label="EDI server description" HelperText="Please provide a brief description of your EDI server. Describe or explain what your EDI server does and what data it uses for this purpose. This description will be shown to users in AI Studio." Counter="512" MaxLength="512" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||
|
||||
<MudStack Row="@true" AlignItems="AlignItems.Center" Class="mb-3">
|
||||
<MudSelect T="EDIVersion" @bind-Value="@this.selectedEDIVersion" Label="EDI specification version" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateEDIVersion">
|
||||
@foreach (var version in Enum.GetValues<EDIVersion>())
|
||||
|
@ -42,6 +42,8 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
{
|
||||
if (!this.MightPreselectValues())
|
||||
{
|
||||
this.serverName = string.Empty;
|
||||
this.serverDescription = string.Empty;
|
||||
this.selectedEDIVersion = EDIVersion.V1;
|
||||
this.selectedProgrammingLanguage = ProgrammingLanguages.NONE;
|
||||
this.otherProgrammingLanguage = string.Empty;
|
||||
@ -62,6 +64,8 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
{
|
||||
if (this.SettingsManager.ConfigurationData.EDI.PreselectOptions)
|
||||
{
|
||||
this.serverName = this.SettingsManager.ConfigurationData.EDI.PreselectedServerName;
|
||||
this.serverDescription = this.SettingsManager.ConfigurationData.EDI.PreselectedServerDescription;
|
||||
this.selectedEDIVersion = this.SettingsManager.ConfigurationData.EDI.PreselectedEDIVersion;
|
||||
this.selectedProgrammingLanguage = this.SettingsManager.ConfigurationData.EDI.PreselectedProgrammingLanguage;
|
||||
this.otherProgrammingLanguage = this.SettingsManager.ConfigurationData.EDI.PreselectedOtherProgrammingLanguage;
|
||||
@ -84,6 +88,8 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
return false;
|
||||
}
|
||||
|
||||
private string serverName = string.Empty;
|
||||
private string serverDescription = string.Empty;
|
||||
private EDIVersion selectedEDIVersion = EDIVersion.V1;
|
||||
private ProgrammingLanguages selectedProgrammingLanguage = ProgrammingLanguages.NONE;
|
||||
private string otherProgrammingLanguage = string.Empty;
|
||||
@ -98,6 +104,28 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
private string retrievalDescription = string.Empty;
|
||||
private string additionalLibraries = string.Empty;
|
||||
|
||||
private string? ValidateServerName(string name)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(name))
|
||||
return "Please provide a name for your EDI server. This name will be used to identify the server in AI Studio.";
|
||||
|
||||
if(name.Length is > 60 or < 6)
|
||||
return "The name of your EDI server must be between 6 and 60 characters long.";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string? ValidateServerDescription(string description)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(description))
|
||||
return "Please provide a description for your EDI server. What data will the server retrieve? This description will be used to inform users about the purpose of your EDI.";
|
||||
|
||||
if(description.Length is < 32 or > 512)
|
||||
return "The description of your EDI server must be between 32 and 512 characters long.";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string? ValidateEDIVersion(EDIVersion version)
|
||||
{
|
||||
if (version == EDIVersion.NONE)
|
||||
|
@ -12,6 +12,16 @@ public sealed class DataEDI
|
||||
/// </summary>
|
||||
public bool PreselectOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the server name?
|
||||
/// </summary>
|
||||
public string PreselectedServerName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the server description?
|
||||
/// </summary>
|
||||
public string PreselectedServerDescription { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Preselect the EDI version?
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user