Skip to content

Commit

Permalink
ActionTimeoutChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
GokulBothe committed Jun 12, 2024
1 parent 4aa24b7 commit 20f1a95
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Ginger/Ginger/Actions/ActionEditPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<Label Content="Wait:" Style="{StaticResource $LabelStyle}" />
<Actions:UCValueExpression x:Name="xWaitVeUC" ToolTip="Action will wait this seconds long before start to run" HorizontalAlignment="Stretch" Width="80" />
<Label Content="Timeout:" Style="{StaticResource $LabelStyle}" Margin="10,0,0,0"/>
<TextBox x:Name="xTimeoutTextBox" TextChanged="txtTimeout_TextChanged" ToolTip="Timeout field is in seconds. Default is 30 minutes (1800 seconds). Use 0 for no timeout, allowing actions to run indefinitely. If an action exceeds the specified timeout duration, it will be stopped and marked as failed." Style="{StaticResource @TextBoxStyle}" Width="50" TextAlignment="Center" HorizontalAlignment="Left" />
<TextBox x:Name="xTimeoutTextBox" TextChanged="txtTimeout_TextChanged" PreviewTextInput="xTimeoutTextBox_PreviewTextInput" ToolTip="Timeout field is in seconds. Default is 30 minutes (1800 seconds). Use 0 for no timeout, allowing actions to run indefinitely. If an action exceeds the specified timeout duration, it will be stopped and marked as failed." Style="{StaticResource @TextBoxStyle}" Width="50" TextAlignment="Center" HorizontalAlignment="Left" />
</StackPanel>

<Expander x:Name="xRetryExpander" DockPanel.Dock="Top" Margin="0,10,0,0" ExpandDirection="Down" IsExpanded="False" Style="{StaticResource $ExpanderStyle}">
Expand Down
31 changes: 30 additions & 1 deletion Ginger/Ginger/Actions/ActionEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ private void txtTimeout_TextChanged(object sender, TextChangedEventArgs e)
{
if (xTimeoutTextBox.Text == String.Empty || xTimeoutTextBox.Text == null)
{
xTimeoutTextBox.Text = "0";
xTimeoutTextBox.Text = null;
xTimeoutTextBox.CaretIndex = 1;
}
}
Expand Down Expand Up @@ -2259,5 +2259,34 @@ protected override void IsVisibleChangedHandler(object sender, DependencyPropert
base.IsVisibleChangedHandler(sender, e);
}
}

private void xTimeoutTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{

bool isEmptyString = string.IsNullOrEmpty(e.Text);
if (isEmptyString)
{
//allow
e.Handled = false;
return;
}

string currentText = xTimeoutTextBox.Text != null ? xTimeoutTextBox.Text : string.Empty;
bool isValidInteger = int.TryParse(currentText + e.Text, out _);
if (isValidInteger)
{
//allow
e.Handled = false;
return;
}
else
{
//don't allow
e.Handled = true;
}

}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ private int NewSmartSyncGetMaxTimeout(ActNewSmartSync act)
}
else
{
return 300;
return (int)ImplicitWait;
}

}
Expand Down

0 comments on commit 20f1a95

Please sign in to comment.