-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from EasyAbp/custom-actions
Support for custom actions
- Loading branch information
Showing
14 changed files
with
206 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
host/EasyAbp.ProcessManagement.Web.Unified/Permissions/DemoPermissionDefinitionProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using EasyAbp.ProcessManagement.Localization; | ||
using Volo.Abp.Authorization.Permissions; | ||
using Volo.Abp.Localization; | ||
|
||
namespace EasyAbp.ProcessManagement.Permissions; | ||
|
||
public class DemoPermissionDefinitionProvider : PermissionDefinitionProvider | ||
{ | ||
public override void Define(IPermissionDefinitionContext context) | ||
{ | ||
var demoGroup = context.AddGroup(DemoPermissions.GroupName, L("Permission:Demo")); | ||
|
||
var exportingPermission = | ||
demoGroup.AddPermission(DemoPermissions.Exporting.Default, L("Permission:Exporting")); | ||
|
||
exportingPermission.AddChild(DemoPermissions.Exporting.Retry, L("Permission:Retry")); | ||
} | ||
|
||
private static LocalizableString L(string name) | ||
{ | ||
return LocalizableString.Create<DemoResource>(name); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
host/EasyAbp.ProcessManagement.Web.Unified/Permissions/DemoPermissions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Volo.Abp.Reflection; | ||
|
||
namespace EasyAbp.ProcessManagement.Permissions; | ||
|
||
public class DemoPermissions | ||
{ | ||
public const string GroupName = "Demo"; | ||
|
||
public static string[] GetAll() | ||
{ | ||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DemoPermissions)); | ||
} | ||
|
||
public class Exporting | ||
{ | ||
public const string Default = GroupName + ".Exporting"; | ||
public const string Retry = Default + ".Retry"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/EasyAbp.ProcessManagement.Web/Options/ProcessManagementWebOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace EasyAbp.ProcessManagement.Web.Options; | ||
|
||
public class ProcessManagementWebOptions | ||
{ | ||
public TimeSpan NotificationLifetime { get; set; } = TimeSpan.FromDays(7); | ||
|
||
/// <summary> | ||
/// Defined actions for users to initiate. | ||
/// </summary> | ||
public List<ProcessStateActionDefinition> Actions { get; } = new(); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/EasyAbp.ProcessManagement.Web/Options/ProcessStateActionDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Volo.Abp.Localization; | ||
|
||
namespace EasyAbp.ProcessManagement.Web.Options; | ||
|
||
public class ProcessStateActionDefinition | ||
{ | ||
/// <summary> | ||
/// The hardcoded Name value from ProcessDefinition. | ||
/// </summary> | ||
public string ProcessName { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// The hardcoded state name defined by the backend. | ||
/// </summary> | ||
public string StateName { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// Display name. | ||
/// </summary> | ||
public ILocalizableString DisplayName { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// JS code that is executed when the action button is clicked. | ||
/// </summary> | ||
/// <example>detailsModal.open({id: data.record.id});</example> | ||
public string OnClickCallbackCode { get; set; } = null!; | ||
|
||
/// <summary> | ||
/// JS code for the action visible check. Skip checking if null. | ||
/// </summary> | ||
/// <example>abp.auth.isGranted('MyPermissionName')</example> | ||
public string? VisibleCheckCode { get; set; } | ||
|
||
public ProcessStateActionDefinition(string processName, string stateName, ILocalizableString displayName, | ||
string onClickCallbackCode, string? visibleCheckCode) | ||
{ | ||
ProcessName = processName; | ||
StateName = stateName; | ||
DisplayName = displayName; | ||
OnClickCallbackCode = onClickCallbackCode; | ||
VisibleCheckCode = visibleCheckCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.