Skip to content

Commit

Permalink
⚡️ add group for definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnkwlp committed Sep 16, 2023
1 parent 9ffb1c5 commit b398d2a
Show file tree
Hide file tree
Showing 62 changed files with 4,335 additions and 235 deletions.
448 changes: 334 additions & 114 deletions .editorconfig

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Demo.Migrations;

/// <inheritdoc />
public partial class Add_WorkflowGroup2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "GroupId",
table: "ElsaWorkflowInstances",
type: "uniqueidentifier",
nullable: true);

migrationBuilder.AddColumn<Guid>(
name: "GroupId",
table: "ElsaWorkflowDefinitions",
type: "uniqueidentifier",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "GroupName",
table: "ElsaWorkflowDefinitions",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);

migrationBuilder.CreateTable(
name: "ElsaWorkflowGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ElsaWorkflowGroups", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ElsaWorkflowGroups");

migrationBuilder.DropColumn(
name: "GroupId",
table: "ElsaWorkflowInstances");

migrationBuilder.DropColumn(
name: "GroupId",
table: "ElsaWorkflowDefinitions");

migrationBuilder.DropColumn(
name: "GroupName",
table: "ElsaWorkflowDefinitions");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
Expand Down Expand Up @@ -348,6 +348,13 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<Guid?>("GroupId")
.HasColumnType("uniqueidentifier");
b.Property<string>("GroupName")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
Expand Down Expand Up @@ -590,6 +597,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<DateTime?>("FinishedTime")
.HasColumnType("datetime2");
b.Property<Guid?>("GroupId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Input")
.HasColumnType("nvarchar(max)");
Expand Down Expand Up @@ -793,6 +803,70 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("ElsaWorkflowInstanceVariables", (string)null);
});

modelBuilder.Entity("Passingwind.Abp.ElsaModule.Groups.WorkflowGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("ElsaWorkflowGroups", (string)null);
});

modelBuilder.Entity("Passingwind.Abp.ElsaModule.Teams.WorkflowTeam", b =>
{
b.Property<Guid>("Id")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;

namespace Passingwind.Abp.ElsaModule.Groups;

public interface IWorkflowGroupAppService : IApplicationService
{
Task<PagedResultDto<WorkflowGroupDto>> GetListAsync(WorkflowGroupListRequestDto input);

Task<WorkflowGroupDto> GetAsync(Guid id);

Task<WorkflowGroupDto> CreateAsync(WorkflowGroupCreateOrUpdateDto input);

Task<WorkflowGroupDto> UpdateAsync(Guid id, WorkflowGroupCreateOrUpdateDto input);

Task DeleteAsync(Guid id);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;

namespace Passingwind.Abp.ElsaModule.Groups;

public class WorkflowGroupCreateOrUpdateDto : ExtensibleEntityDto
{
[Required]
[MaxLength(64)]
public virtual string Name { get; set; }

[MaxLength(128)]
public virtual string Description { get; set; }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using Volo.Abp.Application.Dtos;

namespace Passingwind.Abp.ElsaModule.Groups;

public class WorkflowGroupDto : ExtensibleAuditedEntityDto<Guid>
{
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual Guid? TenantId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;

namespace Passingwind.Abp.ElsaModule.Groups;

public class WorkflowGroupListRequestDto : PagedResultRequestDto
{
public string Filter { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ public override void Define(IPermissionDefinitionContext context)
globalVariablesPermission.AddChild(ElsaModulePermissions.GlobalVariables.Update, L("Permission:Update"));
globalVariablesPermission.AddChild(ElsaModulePermissions.GlobalVariables.Delete, L("Permission:Delete"));

var workflowTeamsPermission = myGroup.AddPermission(ElsaModulePermissions.WorkflowTeam.Default, L("Permission:WorkflowTeams"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeam.Create, L("Permission:Create"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeam.Update, L("Permission:Update"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeam.Delete, L("Permission:Delete"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeam.ManagePermissions, L("Permission:WorkflowTeams.ManagePermissions"));
var workflowTeamsPermission = myGroup.AddPermission(ElsaModulePermissions.WorkflowTeams.Default, L("Permission:WorkflowTeams"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeams.Create, L("Permission:Create"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeams.Update, L("Permission:Update"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeams.Delete, L("Permission:Delete"));
workflowTeamsPermission.AddChild(ElsaModulePermissions.WorkflowTeams.ManagePermissions, L("Permission:WorkflowTeams.ManagePermissions"));

var workflowGroupPermission = myGroup.AddPermission(ElsaModulePermissions.WorkflowGroups.Default, L("Permission:WorkflowGroups"));
workflowGroupPermission.AddChild(ElsaModulePermissions.WorkflowGroups.Create, L("Permission:Create"));
workflowGroupPermission.AddChild(ElsaModulePermissions.WorkflowGroups.Update, L("Permission:Update"));
workflowGroupPermission.AddChild(ElsaModulePermissions.WorkflowGroups.Delete, L("Permission:Delete"));
}

private static LocalizableString L(string name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System;
using System.Threading.Tasks;
using Passingwind.Abp.ElsaModule.Groups;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Content;
Expand Down Expand Up @@ -37,4 +38,5 @@ public interface IWorkflowDefinitionAppService : ICrudAppService<WorkflowDefinit
Task<IRemoteStreamContent> ExportAsync(WorkflowDefinitionExportRequestDto input);
Task<WorkflowDefinitionImportResultDto> ImportAsync(WorkflowDefinitionImportRequestDto input);

Task<ListResultDto<WorkflowGroupDto>> GetAssignableGroupsAsync();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Elsa.Models;
using Volo.Abp.Application.Dtos;

Expand All @@ -24,5 +24,9 @@ public class WorkflowDefinitionBasicDto : AuditedEntityDto<Guid>

public string Tag { get; set; }

public Guid? GroupId { get; set; }

public string GroupName { get; set; }

public WorkflowPersistenceBehavior PersistenceBehavior { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Elsa.Models;

Expand All @@ -24,6 +25,8 @@ public class WorkflowDefinitionCreateOrUpdateDto
[MaxLength(64)]
public string Tag { get; set; }

public Guid? GroupId { get; set; }

public WorkflowPersistenceBehavior PersistenceBehavior { get; set; } = WorkflowPersistenceBehavior.WorkflowBurst;

public WorkflowContextOptions ContextOptions { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Elsa.Models;
using Volo.Abp.Application.Dtos;
Expand All @@ -25,6 +25,10 @@ public class WorkflowDefinitionDto : AuditedEntityDto<Guid>

public string Tag { get; set; }

public Guid? GroupId { get; set; }

public string GroupName { get; set; }

public WorkflowPersistenceBehavior PersistenceBehavior { get; set; }

public WorkflowContextOptions ContextOptions { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
using System;
using Elsa.Models;
using Volo.Abp.Application.Dtos;

namespace Passingwind.Abp.ElsaModule.WorkflowDefinitions;

public class WorkflowDefinitionListRequestDto : PagedResultRequestDto
public class WorkflowDefinitionListRequestDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
public bool? IsSingleton { get; set; }
public string Sorting { get; set; }

public bool IsSingleton { get; set; }

public bool DeleteCompletedInstances { get; set; }

public string Channel { get; set; }

public string Tag { get; set; }

public Guid? GroupId { get; set; }

public WorkflowPersistenceBehavior? PersistenceBehavior { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Passingwind.Abp.ElsaModule.Common;
using Volo.Abp.Application.Dtos;

Expand All @@ -18,9 +18,11 @@ public class WorkflowInstanceBasicDto : AuditedEntityDto<Guid>
public string ContextType { get; set; }
public string ContextId { get; set; }

public Guid? GroupId { get; set; }

public DateTime? LastExecutedTime { get; set; }
public DateTime? FinishedTime { get; set; }
public DateTime? CancelledTime { get; set; }
public DateTime? FaultedTime { get; set; }
public TimeSpan? FinishedDuration { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Elsa.Services.Models;
using Passingwind.Abp.ElsaModule.Common;
Expand All @@ -21,12 +21,17 @@ public class WorkflowInstanceDto : AuditedEntityDto<Guid>
public string ContextType { get; set; }
public string ContextId { get; set; }

public Guid? GroupId { get; set; }

public DateTime? LastExecutedTime { get; set; }
public DateTime? FinishedTime { get; set; }
public DateTime? CancelledTime { get; set; }
public DateTime? FaultedTime { get; set; }

public TimeSpan? FinishedDuration { get; set; } // => FinishedTime - CreationTime;
/// <summary>
/// => FinishedTime - CreationTime;
/// </summary>
public TimeSpan? FinishedDuration { get; set; }

public Guid? LastExecutedActivityId { get; set; }
public WorkflowInputReference Input { get; set; }
Expand Down
Loading

0 comments on commit b398d2a

Please sign in to comment.