Skip to content

Commit

Permalink
Merge branch 'master' into CICD_HotFix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maheshkale447 authored Feb 3, 2025
2 parents b8a405d + d8be0e1 commit a3097da
Show file tree
Hide file tree
Showing 48 changed files with 1,440 additions and 503 deletions.
5 changes: 4 additions & 1 deletion Ginger/Ginger/Actions/ActionEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ private void SetActReturnValuesGrid()
case "Store To":
node.IsSelected = columnPreferences.Contains("StoreTo", StringComparison.OrdinalIgnoreCase);
break;
case "All":
break;
default:
Reporter.ToLog(eLogLevel.ERROR, "Invalid format in column preferences");
break;
Expand All @@ -1065,7 +1067,6 @@ private void SetActReturnValuesGrid()
}
}

// Creating the CheckBox for "Description"
CheckBox descriptionCheckBox = new CheckBox
{
Content = "Description",
Expand Down Expand Up @@ -1182,6 +1183,8 @@ private void ColumnMultiSelectComboBox_ItemCheckBoxClick(object? sender, EventAr
columnCount = node.IsSelected ? columnCount + 1 : columnCount;
columnPreferences += node.IsSelected ? "StoreTo" : "";
break;
case "All":
break;
default:
Reporter.ToLog(eLogLevel.ERROR, "Invalid format in column preferences");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ private void InitializeUIByActionType()
PanelSoap.Visibility = Visibility.Collapsed;
UseWSSecurityHeader.Visibility = Visibility.Collapsed;
//Cookie Mode
CookieMode.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.CookieMode, ApplicationAPIUtils.eCookieMode.Session.ToString()), typeof(ApplicationAPIUtils.eCookieMode), false, null);
CookieMode.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.CookieMode, nameof(ApplicationAPIUtils.eCookieMode.Session)), typeof(ApplicationAPIUtils.eCookieMode), false, null);

//Request Type
RequestTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.RequestType, ApplicationAPIUtils.eRequestType.GET.ToString()), typeof(ApplicationAPIUtils.eRequestType), false, null);
RequestTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.RequestType, nameof(ApplicationAPIUtils.eRequestType.GET)), typeof(ApplicationAPIUtils.eRequestType), false, null);

//HttpVersion content type
HttpVersioncombobox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ReqHttpVersion, ApplicationAPIUtils.eHttpVersion.HTTPV11.ToString()), typeof(ApplicationAPIUtils.eHttpVersion), false, null);
HttpVersioncombobox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ReqHttpVersion, nameof(ApplicationAPIUtils.eHttpVersion.HTTPV11)), typeof(ApplicationAPIUtils.eHttpVersion), false, null);

//Request content type
ContentTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ContentType, ApplicationAPIUtils.eContentType.JSon.ToString()), typeof(ApplicationAPIUtils.eContentType), false, ContentTypeChange);
ContentTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ContentType, nameof(ApplicationAPIUtils.eRequestContentType.JSon)), typeof(ApplicationAPIUtils.eRequestContentType), false, ContentTypeChange);

//Response Content Type
ResponseTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ResponseContentType, ApplicationAPIUtils.eContentType.JSon.ToString()), typeof(ApplicationAPIUtils.eContentType), false, ResponseTypeComboBox_SelectionChanged);
ResponseTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ResponseContentType, nameof(ApplicationAPIUtils.eResponseContentType.Any)), typeof(ApplicationAPIUtils.eResponseContentType), false, ResponseTypeComboBox_SelectionChanged);

//Request Template file:
TemplateFileNameFileBrowser.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.TemplateFileNameFileBrowser), true, true, UCValueExpression.eBrowserType.File, "txt; *.xml; *.json;", new RoutedEventHandler(BrowseTemplateFileButton_Click));
Expand Down Expand Up @@ -122,13 +122,13 @@ public void BindUiControls()
URLPasswordUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.URLPass), true, false, UCValueExpression.eBrowserType.Folder);

//Network Credential selection radio button:
NetworkCredentialsRadioButton.Init(typeof(ApplicationAPIUtils.eNetworkCredentials), NetworkCeredentials, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.NetworkCredentialsRadioButton, ApplicationAPIUtils.eNetworkCredentials.Default.ToString()), NetworkCreds_SelectionChanged);
NetworkCredentialsRadioButton.Init(typeof(ApplicationAPIUtils.eNetworkCredentials), NetworkCeredentials, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.NetworkCredentialsRadioButton, nameof(ApplicationAPIUtils.eNetworkCredentials.Default)), NetworkCreds_SelectionChanged);

//Request Body Selection radio button:
RequestBodyTypeRadioButton.Init(typeof(ApplicationAPIUtils.eRequestBodyType), BodySelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.RequestBodyTypeRadioButton, ApplicationAPIUtils.eRequestBodyType.FreeText.ToString()), RequestBodyType_Selection);
RequestBodyTypeRadioButton.Init(typeof(ApplicationAPIUtils.eRequestBodyType), BodySelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.RequestBodyTypeRadioButton, nameof(ApplicationAPIUtils.eRequestBodyType.FreeText)), RequestBodyType_Selection);

//CertficiateRadioButtons :
CertificateTypeRadioButton.Init(typeof(ApplicationAPIUtils.eCretificateType), CertificateSelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString()), CertificateSelection_Changed);
CertificateTypeRadioButton.Init(typeof(ApplicationAPIUtils.eCretificateType), CertificateSelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.CertificateTypeRadioButton, nameof(ApplicationAPIUtils.eCretificateType.AllSSL)), CertificateSelection_Changed);

//Response validation checkbox:
GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(DoNotFailActionOnBadRespose, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.DoNotFailActionOnBadRespose, "False"));
Expand All @@ -152,10 +152,10 @@ public void BindUiControls()
GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(DoNotCertificateImportFile, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.ImportCetificateFile, "False"));

//Security:
SecurityTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.SecurityType, ApplicationAPIUtils.eSercurityType.None.ToString()), typeof(ApplicationAPIUtils.eSercurityType), false, null);
SecurityTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.SecurityType, nameof(ApplicationAPIUtils.eSercurityType.None)), typeof(ApplicationAPIUtils.eSercurityType), false, null);

//Authorization:
AuthTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthorizationType, ApplicationAPIUtils.eAuthType.NoAuthentication.ToString()), typeof(ApplicationAPIUtils.eAuthType), false, AuthorizationBox);
AuthTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthorizationType, nameof(ApplicationAPIUtils.eAuthType.NoAuthentication)), typeof(ApplicationAPIUtils.eAuthType), false, AuthorizationBox);

//Authorization
AuthUserUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthUsername), true, false, UCValueExpression.eBrowserType.Folder);
Expand Down Expand Up @@ -188,15 +188,15 @@ private void CheckNetworkCredentials()
private void CheckRequestBodySelection()
{

if ((mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded.ToString()))
if ((mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.XwwwFormUrlEncoded.ToString()))
{
FreeTextStackPanel.Visibility = System.Windows.Visibility.Collapsed;
TemplateStackPanel.Visibility = System.Windows.Visibility.Collapsed;
RequestBodyTypePanel.Visibility = System.Windows.Visibility.Collapsed;
FormDataGridPanel.Visibility = System.Windows.Visibility.Visible;
DynamicElementGridPanel.Visibility = System.Windows.Visibility.Collapsed;
}
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.FormData.ToString())
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.FormData.ToString())
{
FreeTextStackPanel.Visibility = System.Windows.Visibility.Collapsed;
TemplateStackPanel.Visibility = System.Windows.Visibility.Collapsed;
Expand Down Expand Up @@ -279,7 +279,7 @@ private void RequestBodyType_Selection(object sender, RoutedEventArgs e)
BodyInputGridPannel.Visibility = System.Windows.Visibility.Collapsed;
FreeTextStackPanel.Visibility = Visibility.Collapsed;
}
else if ((mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded.ToString()) || (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.FormData.ToString()))
else if ((mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.XwwwFormUrlEncoded.ToString()) || (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.FormData.ToString()))
{
if (!String.IsNullOrEmpty((mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.TemplateFileNameFileBrowser))))
{
Expand Down Expand Up @@ -506,12 +506,12 @@ public void RefreshRequestKeyValuesGrid()
mAct.RequestKeyValues.ClearAll();
}

if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded.ToString())
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.XwwwFormUrlEncoded.ToString())
{
//switch combobox & browse button off
FormDataGrid.ChangeGridView("UrlEncoded");
}
else if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.FormData.ToString())
else if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.FormData.ToString())
{
//switch combobox & browse button on
FormDataGrid.ChangeGridView("FormData");
Expand Down Expand Up @@ -571,12 +571,12 @@ public void SetKeyValuesGrid(ObservableList<WebAPIKeyBodyValues> RequestKeyValue

FormDataGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddRow));

if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded.ToString())
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.XwwwFormUrlEncoded.ToString())
{
//switch combobox & browse button off
FormDataGrid.ChangeGridView("UrlEncoded");
}
else if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.FormData.ToString())
else if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eRequestContentType.FormData.ToString())
{
//switch combobox & browse button on
FormDataGrid.ChangeGridView("FormData");
Expand Down Expand Up @@ -620,7 +620,7 @@ private void AddRow(object sender, RoutedEventArgs e)
}
private void ResponseTypeComboBox_SelectionChanged(object sender, RoutedEventArgs e)
{
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ResponseContentType) == ApplicationAPIUtils.eContentType.JSon.ToString())
if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ResponseContentType) == ApplicationAPIUtils.eResponseContentType.JSon.ToString() || mAct.GetInputParamValue(ActWebAPIRest.Fields.ResponseContentType) == ApplicationAPIUtils.eResponseContentType.JSonWithoutCharset.ToString())
{
JSON.Visibility = Visibility.Visible;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Ginger.ApplicationModelsLib.APIModels
public partial class APIModelBodyNodeSyncPage : Page
{
GenericWindow _pageGenericWin = null;
ApplicationAPIUtils.eContentType requestBodyType;
ApplicationAPIUtils.eRequestContentType requestBodyType;
XmlDocument XMLDoc = null;
JsonExtended JsonDoc = null;
List<AppModelParameter> mParamsPendingDelete = [];
Expand All @@ -52,18 +52,18 @@ public APIModelBodyNodeSyncPage(ApplicationAPIModel applicationAPIModel, List<Ap

if (APIConfigurationsDocumentParserBase.IsValidXML(mApplicationAPIModel.RequestBody))
{
requestBodyType = ApplicationAPIUtils.eContentType.XML;
requestBodyType = ApplicationAPIUtils.eRequestContentType.XML;
XMLDoc = new XmlDocument();
XMLDoc.LoadXml(mApplicationAPIModel.RequestBody);
}
else if (APIConfigurationsDocumentParserBase.IsValidJson(mApplicationAPIModel.RequestBody))
{
requestBodyType = ApplicationAPIUtils.eContentType.JSon;
requestBodyType = ApplicationAPIUtils.eRequestContentType.JSon;
JsonDoc = new JsonExtended(applicationAPIModel.RequestBody);
}
else
{
requestBodyType = ApplicationAPIUtils.eContentType.TextPlain;
requestBodyType = ApplicationAPIUtils.eRequestContentType.TextPlain;
}
}

Expand All @@ -76,7 +76,7 @@ private void PrepareNodesPendingForDelete()
mNodesToDeleteList = mNodesToDeleteList.GroupBy(x => x.ParentOuterXml).Select(group => group.First()).ToList();

//For Json only - remove spaces and new lines from string
if (requestBodyType == ApplicationAPIUtils.eContentType.JSon)//For Json - remove spaces
if (requestBodyType == ApplicationAPIUtils.eRequestContentType.JSon)//For Json - remove spaces
{
foreach (NodeToDelete nodeToDelete in mNodesToDeleteList)
{
Expand All @@ -96,11 +96,11 @@ private void PrepareNodesPendingForDelete()
}

//4.Find the actual node string inside the request body and save its text range
if (requestBodyType == ApplicationAPIUtils.eContentType.XML)
if (requestBodyType == ApplicationAPIUtils.eRequestContentType.XML)
{
FindXMLElementAndSaveItsTextRange(NodeToInspect);
}
else if (requestBodyType == ApplicationAPIUtils.eContentType.JSon)
else if (requestBodyType == ApplicationAPIUtils.eRequestContentType.JSon)
{
FindJSONElementAndSaveItsTextRange(NodeToInspect);
}
Expand All @@ -120,7 +120,7 @@ private void PrepareNodesListForDeletion()
switch (requestBodyType)
{
//Try first searching node using Path, if not succeed try search param using placeholder
case ApplicationAPIUtils.eContentType.XML:
case ApplicationAPIUtils.eRequestContentType.XML:
XmlNode xmlNodeByXpath = XMLDocExtended.GetNodeByXpath(XMLDoc, paramToDelete.Path);
if (xmlNodeByXpath != null && xmlNodeByXpath.InnerText == paramToDelete.PlaceHolder)
{
Expand All @@ -136,7 +136,7 @@ private void PrepareNodesListForDeletion()
}
}
break;
case ApplicationAPIUtils.eContentType.JSon:
case ApplicationAPIUtils.eRequestContentType.JSon:
JToken jNode = JsonDoc.SelectToken(paramToDelete.Path);
if (jNode != null && jNode.Value<String>() == paramToDelete.PlaceHolder)
{
Expand Down Expand Up @@ -333,7 +333,7 @@ private void AddAssociatedParamsForDeletion()

public void ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Dialog)
{
if (requestBodyType is ApplicationAPIUtils.eContentType.XML or ApplicationAPIUtils.eContentType.JSon)
if (requestBodyType is ApplicationAPIUtils.eRequestContentType.XML or ApplicationAPIUtils.eRequestContentType.JSon)
{
PrepareNodesPendingForDelete();

Expand Down
Loading

0 comments on commit a3097da

Please sign in to comment.