Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Model rule for UI action merge type #1680

Merged
merged 4 commits into from Jun 27, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -543,27 +543,23 @@ public override Exception CheckRule(object instance, string memberName)

private string GetErrorOrNull(EntityWorkflowAction action, FormReferenceMenuItem menuItem)
{
if (action.MergeType == ServiceOutputMethod.Ignore)
if (menuItem.Screen == null ||
action.MergeType == ServiceOutputMethod.Ignore ||
action.Mode != PanelActionMode.MultipleCheckboxes)
{
return null;
}
if (menuItem.Screen == null)
{
return null;
}


var screenConditions = action.ChildItems
.ToGeneric()
.OfType<ScreenCondition>()
.ToList();
bool shouldShowOnScreen = screenConditions.Any(
screenCondition =>
screenCondition.ScreenId == menuItem.ScreenId);
if (screenConditions.Count > 0 && shouldShowOnScreen ||
screenConditions.Count == 0)
if (screenConditions.Count > 0 && !shouldShowOnScreen)
{
return
$"Action {action.Name} ({action.Id}) does not have the MergeType set to \"Ignore\"";
return null;
}

var screenSectionIds = menuItem.Screen.ChildItems
Expand All @@ -580,13 +576,12 @@ private string GetErrorOrNull(EntityWorkflowAction action, FormReferenceMenuItem
.Any(screenCondition =>
screenSectionIds.Contains(screenCondition
.ScreenSectionId));
if (screenSectionConditions.Count > 0 && shouldShowOnScreenSection ||
screenSectionConditions.Count == 0)
if (screenSectionConditions.Count > 0 && !shouldShowOnScreenSection)
{
return
$"Action {action.Name} ({action.Id}) does not have the MergeType set to \"Ignore\"";
return null;
}
return null;
return
$"Action {action.Name} ({action.Id}) does not have the MergeType set to \"Ignore\"";
}
}
}
11 changes: 6 additions & 5 deletions backend/Origam.Server/ServerCoreUIService.cs
Expand Up @@ -466,18 +466,19 @@ public IList RowStates(RowStatesInput input)
}
}

if(action?.ConfirmationRule == null)
{
return new RuleExceptionDataCollection();
}
var sessionStore = sessionManager.GetSession(
input.SessionFormIdentifier);
if (sessionStore.IsDelayedLoading &&
action is EntityWorkflowAction workflowAction &&
action.Mode == PanelActionMode.MultipleCheckboxes &&
action is EntityWorkflowAction workflowAction &&
workflowAction.MergeType != ServiceOutputMethod.Ignore)
{
throw new Exception("Only actions with merge type Ignore can be invoked in lazily loaded screens.");
}
if(action?.ConfirmationRule == null)
{
return new RuleExceptionDataCollection();
}
List<DataRow> rows = sessionStore.GetRows(input.Entity, input.SelectedIds);
IXmlContainer xml
= DatasetTools.GetRowXml(rows, DataRowVersion.Default);
Expand Down