Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SIM.Tool.Windows/SIM.Tool.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
<Compile Include="UserControls\Export\ExportWizardArgs.cs" />
<Compile Include="UserControls\Export\FinishActions.cs" />
<Compile Include="UserControls\Helpers\InstallTasksHelper.cs" />
<Compile Include="UserControls\Helpers\NameCharsHelper.cs" />
<Compile Include="UserControls\Install\Containers\SelectModules.xaml.cs">
<DependentUpon>SelectModules.xaml</DependentUpon>
</Compile>
Expand Down
30 changes: 30 additions & 0 deletions src/SIM.Tool.Windows/UserControls/Helpers/NameCharsHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using SIM.Tool.Base;
using System.IO;
using System.Linq;
using System.Windows;

namespace SIM.Tool.Windows.UserControls.Helpers
{
public static class NameCharsHelper
{
private static char[] _InvalidChars;

static NameCharsHelper()
{
_InvalidChars = Path.GetInvalidFileNameChars();
}

public static bool IsValidNameChar(string nameChar, string fieldName)
{
if (nameChar.Any(c => _InvalidChars.Contains(c)))
{
WindowHelper.ShowMessage($"The enetered '{nameChar}' character is invalid for the {fieldName}.",
messageBoxImage: MessageBoxImage.Warning,
messageBoxButton: MessageBoxButton.OK
);
return false;
}
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ComboBox Grid.Row="2" Name="ProductRevision" DisplayMemberPath="RevisionAndLabel" SelectionChanged="ProductRevisionChanged" Grid.Column="5" Margin="0.2,0.4,0,0.4" />

<TextBlock Grid.Row="0" Grid.Column="4" Text="Project Name: " VerticalAlignment="Center" HorizontalAlignment="Left" Width="77" Grid.RowSpan="2" Height="16" Margin="1.6,6,0,6" Grid.ColumnSpan="2" />
<TextBox Grid.Row="0" Grid.Column="5" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" Grid.RowSpan="2" />
<TextBox Grid.Row="0" Grid.Column="5" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" Grid.RowSpan="2" PreviewTextInput="InstanceName_PreviewTextInput" />
<TextBlock Grid.Row="3" TextWrapping="Wrap" Text="Location:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,4.6,0,4.2" Height="16" Width="48"/>
<Button Name="LocationBtn" Click="LocationBtn_Click" Content="..." HorizontalAlignment="Left" Margin="53,2.6,0,0" Grid.Row="3" VerticalAlignment="Top" Width="24" Height="20"/>
<TextBox Name="LocationText" Text="{Binding ElementName=InstanceName, Path=Text, Mode=OneWay, Converter={x:Static converters:InstanceNameToLocation.Instance}}" Grid.Row="3" Grid.Column="1" TextWrapping="Wrap" Grid.ColumnSpan="5" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SIM.Tool.Base.Pipelines;
using SIM.Tool.Base.Profiles;
using SIM.Tool.Base.Wizards;
using SIM.Tool.Windows.UserControls.Helpers;
using Sitecore.Diagnostics.Base;
using Sitecore.Diagnostics.Logging;
using System;
Expand Down Expand Up @@ -504,5 +505,13 @@ private void LocationBtn_Click(object sender, RoutedEventArgs e)
{
WindowHelper.PickFolder("Choose location folder", this.LocationText, null);
}

private void InstanceName_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
if (!NameCharsHelper.IsValidNameChar(e.Text, "project name"))
{
e.Handled = true;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ public void InitializeStep(WizardArgs wizardArgs)
availableModules.Add(Module.Horizon);
GetHorizonTags();
GetHorizonAssetsTags(args.Topology);
availableModules.Add(Module.PublishingService);
GetSpsTags();
GetSpsAssetsTags(args.Topology);
// Disable the support of Publishing Service till the issue #694 is not fixed
//availableModules.Add(Module.PublishingService);
//GetSpsTags();
//GetSpsAssetsTags(args.Topology);
}

ModulesListBox.ItemsSource = availableModules;
Expand Down Expand Up @@ -390,7 +391,8 @@ private void SpsAssetsTagsComboBox_SelectionChanged(object sender, System.Window

private void GetSpsTags()
{
SpsTagsComboBox.DataContext = tagRepository.GetSortedShortTags(DockerSettings.SpsImagePath, DockerSettings.SitecoreModuleNamespace).ToArray();
// Add support only of PS 6.0.0 and later since the previous version 5.0.0 contains significant bugs and 'SITECORE_Sitecore' duplicated environment varialbes for the 'sps-mssql-init' and 'sps' services
SpsTagsComboBox.DataContext = tagRepository.GetSortedShortTags(DockerSettings.SpsImagePath, DockerSettings.SitecoreModuleNamespace).Where(tag => !tag.StartsWith("5.0")).ToArray();
SpsTagsComboBox.SelectedIndex = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public partial class Instance9Details : IWizardStep, IFlowControl
private Window owner;
private InstallWizardArgs _InstallParameters = null;
private IEnumerable<Product> _StandaloneProducts;
private char[] _InvalidChars;

// According to the following document the maximum length for a path in Windows systems is defined as 260 characters:
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Expand All @@ -58,7 +57,6 @@ public partial class Instance9Details : IWizardStep, IFlowControl
public Instance9Details()
{
InitializeComponent();
_InvalidChars = Path.GetInvalidFileNameChars();
}

#endregion
Expand Down Expand Up @@ -767,12 +765,8 @@ private void AddSolr_Click(object sender, RoutedEventArgs e)

private void InstanceName_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
if (e.Text.Any(c => _InvalidChars.Contains(c)))
if (!NameCharsHelper.IsValidNameChar(e.Text, "site name"))
{
WindowHelper.ShowMessage($"The enetered '{e.Text}' character is invalid for the site name.",
messageBoxImage: MessageBoxImage.Warning,
messageBoxButton: MessageBoxButton.OK
);
e.Handled = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<ComboBox Grid.Row="2" Grid.Column="1" Name="ProductRevision" DisplayMemberPath="RevisionAndLabel" SelectionChanged="ProductRevisionChanged" />

<TextBlock Grid.Row="0" Grid.Column="2" Text="Site Name: " />
<TextBox Grid.Row="0" Grid.Column="3" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" TextChanged="InstanceNameTextChanged" />
<TextBox Grid.Row="0" Grid.Column="3" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" TextChanged="InstanceNameTextChanged" PreviewTextInput="InstanceName_PreviewTextInput" />

<TextBlock Grid.Row="1" Grid.Column="2" Text="Host name(s): " />
<TextBox Name="HostNames" AcceptsReturn="true" Grid.Row="1" Grid.Column="3" Grid.RowSpan="2" Height="50" VerticalScrollBarVisibility="Auto"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace SIM.Tool.Windows.UserControls.Install
using JetBrains.Annotations;
using Sitecore.Diagnostics.Logging;
using SIM.Extensions;
using SIM.Tool.Windows.UserControls.Helpers;

#region

Expand Down Expand Up @@ -339,6 +340,14 @@ private void InstanceNameTextChanged([CanBeNull] object sender, [CanBeNull] Text
}
}

private void InstanceName_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
if (!NameCharsHelper.IsValidNameChar(e.Text, "site name"))
{
e.Handled = true;
}
}

[NotNull]
private IEnumerable<string> GenerateHostNames([NotNull]string name)
{
Expand Down