Workflow düzeltmeleri
This commit is contained in:
parent
c204eef755
commit
bade0bab98
2 changed files with 24 additions and 22 deletions
|
|
@ -303,7 +303,13 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
var start = context.Criteria.FirstOrDefault(x => x.Kind == "Start")
|
||||
?? throw new UserFriendlyException("Workflow başlangıç adımı bulunamadı.");
|
||||
|
||||
return await RunUntilWaitAsync(context, start);
|
||||
var result = await RunUntilWaitAsync(context, start);
|
||||
await InsertWorkflowNoteAsync(
|
||||
context,
|
||||
$"Workflow Started: {start.Title}",
|
||||
BuildWorkflowNoteContent(context.WorkflowNoteRows));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost("decision")]
|
||||
|
|
@ -368,8 +374,14 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
}
|
||||
|
||||
var next = FindNextCriteria(context.Criteria, input.Approved ? current.NextOnApprove : current.NextOnReject);
|
||||
await LogWorkflowDecisionAsync(context, current, next, input.Approved, input.Note);
|
||||
return await RunUntilWaitAsync(context, next);
|
||||
AddWorkflowDecisionRows(context, current, next, input.Approved, input.Note ?? string.Empty);
|
||||
var result = await RunUntilWaitAsync(context, next);
|
||||
await InsertWorkflowNoteAsync(
|
||||
context,
|
||||
$"Workflow {(input.Approved ? "Approved" : "Rejected")}: {current.Title}",
|
||||
BuildWorkflowNoteContent(context.WorkflowNoteRows));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<WorkflowRunResultDto> RunForEachKeyAsync(
|
||||
|
|
@ -522,7 +534,7 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
informedRecipient = await SendInformEmailAsync(context, node);
|
||||
}
|
||||
|
||||
await LogWorkflowNodeAsync(context, node, informedRecipient);
|
||||
AddWorkflowNodeRows(context, node, informedRecipient ?? string.Empty);
|
||||
}
|
||||
|
||||
private async Task<string> SendInformEmailAsync(WorkflowRunContext context, ListFormWorkflow node)
|
||||
|
|
@ -590,7 +602,7 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
""";
|
||||
}
|
||||
|
||||
private async Task LogWorkflowDecisionAsync(
|
||||
private static void AddWorkflowDecisionRows(
|
||||
WorkflowRunContext context,
|
||||
ListFormWorkflow current,
|
||||
ListFormWorkflow next,
|
||||
|
|
@ -598,16 +610,11 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
string description)
|
||||
{
|
||||
var action = approved ? "Approved" : "Rejected";
|
||||
var subject = $"Workflow {action}: {current.Title}";
|
||||
var rows = new List<(string Label, string Value)>();
|
||||
|
||||
rows.Add(("Description", description ?? string.Empty));
|
||||
rows.Add(("Next Step", FormatNode(next)));
|
||||
|
||||
await InsertWorkflowNoteAsync(context, subject, BuildWorkflowNoteContent(rows));
|
||||
context.WorkflowNoteRows.Add(("Decision: ", $"{action}: {FormatNode(current)}"));
|
||||
context.WorkflowNoteRows.Add(("Description: ", description ?? string.Empty));
|
||||
}
|
||||
|
||||
private async Task LogWorkflowNodeAsync(
|
||||
private static void AddWorkflowNodeRows(
|
||||
WorkflowRunContext context,
|
||||
ListFormWorkflow node,
|
||||
string informedRecipient)
|
||||
|
|
@ -622,19 +629,12 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
_ => "Processed"
|
||||
};
|
||||
|
||||
var subject = $"Workflow {action}: {node.Title}";
|
||||
var rows = new List<(string Label, string Value)>();
|
||||
context.WorkflowNoteRows.Add(($"{action}: ", $"{FormatNode(node)}"));
|
||||
|
||||
if (!node.Approver.IsNullOrWhiteSpace())
|
||||
{
|
||||
rows.Add((node.Kind == "Inform" ? "Inform Target" : "Approver", node.Approver));
|
||||
context.WorkflowNoteRows.Add((node.Kind == "Inform" ? "Inform: " : "Approver: ", node.Approver));
|
||||
}
|
||||
if (!informedRecipient.IsNullOrWhiteSpace())
|
||||
{
|
||||
rows.Add(("Informed Email", informedRecipient));
|
||||
}
|
||||
|
||||
await InsertWorkflowNoteAsync(context, subject, BuildWorkflowNoteContent(rows));
|
||||
}
|
||||
|
||||
private async Task InsertWorkflowNoteAsync(
|
||||
|
|
@ -1136,5 +1136,6 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA
|
|||
IDictionary<string, object> Row)
|
||||
{
|
||||
public HashSet<string> UserUpdatedFields { get; } = [];
|
||||
public List<(string Label, string Value)> WorkflowNoteRows { get; } = [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -654,6 +654,7 @@ function WorkflowApprovalDecisionDialog({
|
|||
className="input input-textarea mb-4 min-h-[96px] w-full resize-y"
|
||||
rows={4}
|
||||
value={note}
|
||||
autoFocus
|
||||
placeholder="Onay veya red aciklamasi"
|
||||
onChange={(event) => setNote(event.target.value)}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue