Workflow module enhancement
Fixes #15496
- [x] Adding
versionIdand audit information to workflow types. - [x] Adding
versionIdand audit information to workflow . - [x] Migrating older workflow types
- [ ] Adjust workflow management page
- [ ] Adjust workflow import logic
Fixes : #14276
- [ ] Add title templates to the workflow, like
TitlePartdoes - [ ] Add workflow instance title editor for workflow types
- [ ] Adding display names to workflow types
Fixes: #12070
- [x] Add
ExecutedOnUtcfield to workflow instances, which can be used for sorting
Fixes : #11608
- [x] Adding audit information to workflow types,
CreatedUtc,ModifiedUtc,ModifiedBy,CreatedBy
Please follow https://docs.orchardcore.net/en/latest/guides/contributing/contributing-code/#:~:text=If%20your%20PR%20addresses%20an%20issue%2C%20be%20sure%20to%20link%20them.%20This%20helps%20everyone%20find%20their%20way%20around%20contributions%2C%20and%20merging%20your%20PR%20will%20automatically%20close%20the%20issue%20too.
Please follow https://docs.orchardcore.net/en/latest/guides/contributing/contributing-code/#:~:text=If%20your%20PR%20addresses%20an%20issue%2C%20be%20sure%20to%20link%20them.%20This%20helps%20everyone%20find%20their%20way%20around%20contributions%2C%20and%20merging%20your%20PR%20will%20automatically%20close%20the%20issue%20too.
I've already linked it in the first line of the PR description.😳
Not in a way explained in the docs :). You need to use something like Fixes #15496 to make this PR close that issue, and show up under the issue as its PR.
Not in a way explained in the docs :). You need to use something like
Fixes #15496to make this PR close that issue, and show up under the issue as its PR.
oh, I see , thanks!
With these changes underway in workflows would it be a good time to upgrade the diagramming ui (js plumb) to a modern ui library ?. Eg panning and zooming would be useful.
Could you please create a separate issue about that, with specific suggestions?
With these changes underway in workflows would it be a good time to upgrade the diagramming ui (js plumb) to a modern ui library ?. Eg panning and zooming would be useful.
Yes currently it does get stuck here at UI editing, as currently every update to a workflow node triggers the saving of the entire process definition, i.e. every time a node is edited it generates a version, which makes no sense!
Prepare to refer to elsa-core for design ideas
Could you please create a separate issue about that, with specific suggestions?
No problem. I created an issue here https://github.com/OrchardCMS/OrchardCore/issues/16107
I would suggest to create more focused PRs so we can approve them individually in case one would block the others.
I would suggest to create more focused PRs so we can approve them individually in case one would block the others.
The reason why we focus on one PR is that if we want to disassemble it, we will need a lot of table structure migration.
@hyzx86 do you plan to have this ready for review soon ? otherwise i would like to add a new pr for the workflow type display name and description.
@hyzx86 do you plan to have this ready for review soon ? otherwise i would like to add a new pr for the workflow type display name and description.
Sorry, I'm busy with other projects and don't have time to sort out this PR at the moment , I probably won't be continuing this PR anytime soon!
Temporary closure
I'd potentially be interested in continuing the Audit Trail support, i.e. https://github.com/OrchardCMS/OrchardCore/issues/11608. I see @hyzx86 you ticked that in the PR description, but the corresponding code is not in the PR. Could you push it, please?
This pull request has merge conflicts. Please resolve those before requesting a review.
I'd potentially be interested in continuing the Audit Trail support, i.e. #11608. I see @hyzx86 you ticked that in the PR description, but the corresponding code is not in the PR. Could you push it, please?
Some of the code is from my 1.8 implementation. My current implementation is not very good, if every time you save a node definition update it generates an audit message for the whole process, for this reason I have modified the WorkflowTypeStore so that it only generates a version when importing a process, and local modifications do not generate a version number, so that in the future the planned implementation of the SPA Workflow Designer will not have the problem of auditing the complete process every time you modify a node. This way, the SPA Workflow Designer, which is planned to be implemented in the future, will not have the problem of auditing the complete process every time a node is modified.
WorkflowTypeIndexProvider
using OrchardCore.Entities;
using OrchardCore.Workflows.Models;
using System;
using System.Linq;
using YesSql.Indexes;
namespace OrchardCore.Workflows.Indexes
{
public class WorkflowTypeIndex : MapIndex
{
public long DocumentId { get; set; }
public string WorkflowTypeId { get; set; }
public string Name { get; set; }
public bool IsEnabled { get; set; }
public bool HasStart { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string WorkflowTypeVersionId { get; set; }
public bool Latest { get; set; }
public DateTime CreatedUtc { get; set; }
public string CreatedBy { get; set; }
public DateTime ModifiedUtc { get; set; }
public string ModifiedBy { get; set; }
}
public class WorkflowTypeStartActivitiesIndex : MapIndex
{
public string WorkflowTypeId { get; set; }
public string WorkflowTypeVersionId { get; set; }
public string Name { get; set; }
public bool IsEnabled { get; set; }
public string StartActivityId { get; set; }
public string StartActivityName { get; set; }
}
public class WorkflowTypeIndexProvider : IndexProvider<WorkflowType>
{
public override void Describe(DescribeContext<WorkflowType> context)
{
context.For<WorkflowTypeIndex>()
.Map(workflowType =>
{
var workflowTypeAudit = workflowType.As<WorkflowTypeVersionAudit>();
var index = new WorkflowTypeIndex
{
WorkflowTypeId = workflowType.WorkflowTypeId,
Name = workflowType.Name,
IsEnabled = workflowType.IsEnabled,
HasStart = workflowType.Activities.Any(x => x.IsStart),
DisplayName = workflowTypeAudit.DisplayName,
Description = workflowTypeAudit.Description,
WorkflowTypeVersionId = workflowTypeAudit.WorkflowTypeVersionId,
Latest = workflowTypeAudit.Latest,
CreatedUtc = workflowTypeAudit.CreatedUtc,
ModifiedUtc = workflowTypeAudit.ModifiedUtc,
ModifiedBy = workflowTypeAudit.ModifiedBy,
CreatedBy = workflowTypeAudit.CreatedBy
};
return index;
}
);
context.For<WorkflowTypeStartActivitiesIndex>()
.Map(workflowType =>
{
var workflowTypeAudit = workflowType.As<WorkflowTypeVersionAudit>();
var startIndexies = workflowType.Activities.Where(x => x.IsStart).Select(x =>
new WorkflowTypeStartActivitiesIndex
{
WorkflowTypeVersionId = workflowTypeAudit.WorkflowTypeVersionId,
WorkflowTypeId = workflowType.WorkflowTypeId,
Name = workflowType.Name,
IsEnabled = workflowType.IsEnabled,
StartActivityId = x.ActivityId,
StartActivityName = x.Name
});
return startIndexies;
}
);
}
}
}
WorkflowTypeVersionAudit
using System;
namespace OrchardCore.Workflows.Indexes
{
public class WorkflowTypeVersionAudit
{
public string WorkflowTypeVersionId { get; set; }
public bool Latest { get; set; }
public DateTime CreatedUtc { get; set; }
public string CreatedBy { get; set; }
public DateTime ModifiedUtc { get; set; }
public string ModifiedBy { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
}
}
Thank you!
@Piedone Have you been making any progress on this? If not maybe I'm able to help out!
I haven't started it, so that would be great, thank you! To clarify, I only wanted Audit Trail support, i.e. https://github.com/OrchardCMS/OrchardCore/issues/11608. Is this something you'd continue?
I think audit trail support only makes sense when you can see what actually changed, i.e. also implement some kind of versioning. What do you think?
Since Audit Trail can record versions, that should be more or less given.
It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.
Closing this pull request because it has been stale for very long. If you think this is still relevant, feel free to reopen it.