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

Workflow module enhancement #16043

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

hyzx86
Copy link
Contributor

@hyzx86 hyzx86 commented May 13, 2024

Fixes #15496

  • Adding versionId and audit information to workflow types.
  • Adding versionId and audit information to workflow .
  • Migrating older workflow types
  • Adjust workflow management page
  • Adjust workflow import logic

Fixes : #14276

  • Add title templates to the workflow, like TitlePart does
  • Add workflow instance title editor for workflow types
  • Adding display names to workflow types

Fixes: #12070

  • Add ExecutedOnUtc field to workflow instances, which can be used for sorting

Fixes : #11608

  • Adding audit information to workflow types, CreatedUtc,ModifiedUtc,ModifiedBy,CreatedBy

@hyzx86 hyzx86 changed the title Implementing the workflow version Versioning workflow support May 13, 2024
@Piedone
Copy link
Member

Piedone commented May 14, 2024

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.

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 14, 2024

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.

oh, I see , thanks!

@hyzx86 hyzx86 changed the title Versioning workflow support Workflow module enhancement May 14, 2024
@giannik
Copy link
Contributor

giannik commented May 15, 2024

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.

@Piedone
Copy link
Member

Piedone commented May 15, 2024

Could you please create a separate issue about that, with specific suggestions?

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 20, 2024

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

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 20, 2024

Could you please create a separate issue about that, with specific suggestions?

No problem. I created an issue here #16107

@sebastienros
Copy link
Member

I would suggest to create more focused PRs so we can approve them individually in case one would block the others.

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 30, 2024

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.

@giannik
Copy link
Contributor

giannik commented May 31, 2024

@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
Copy link
Contributor Author

hyzx86 commented May 31, 2024

@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

@hyzx86 hyzx86 closed this May 31, 2024
@Piedone
Copy link
Member

Piedone commented Sep 23, 2024

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?

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hyzx86
Copy link
Contributor Author

hyzx86 commented Sep 25, 2024

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; }
    }
}

@Piedone
Copy link
Member

Piedone commented Sep 25, 2024

Thank you!

@wterpstra
Copy link

@Piedone Have you been making any progress on this? If not maybe I'm able to help out!

@Piedone
Copy link
Member

Piedone commented Oct 31, 2024

I haven't started it, so that would be great, thank you! To clarify, I only wanted Audit Trail support, i.e. #11608. Is this something you'd continue?

@wterpstra
Copy link

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?

@Piedone
Copy link
Member

Piedone commented Nov 2, 2024

Since Audit Trail can record versions, that should be more or less given.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants