Working on adding icons to the tasks, and started working on the tasks page
This commit is contained in:
parent
55d1beadbc
commit
7048594ea9
@ -4,6 +4,7 @@ public class TaskMetadata
|
|||||||
{
|
{
|
||||||
public string TaskType { get; set; }
|
public string TaskType { get; set; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
|
public string Icon { get; set; }
|
||||||
public List<string> Capabilities { get; set; } = [];
|
public List<string> Capabilities { get; set; } = [];
|
||||||
|
|
||||||
public string OutcomeLabel { get; set; }
|
public string OutcomeLabel { get; set; }
|
||||||
|
|||||||
42
e-suite.API/eSuite.API/Controllers/TasksController.cs
Normal file
42
e-suite.API/eSuite.API/Controllers/TasksController.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using e_suite.API.Common;
|
||||||
|
using e_suite.Utilities.Pagination;
|
||||||
|
using eSuite.API.security;
|
||||||
|
using eSuite.API.Utilities;
|
||||||
|
using eSuite.Core.Security;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace eSuite.API.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User manage is responsible for managing users within e-suite.
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class TasksController : ESuiteControllerBase
|
||||||
|
{
|
||||||
|
private readonly IWorkflowTemplateManager _workflowTemplateManager;
|
||||||
|
|
||||||
|
public TasksController()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of workflow templates
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paging"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
[Route("myTasks")]
|
||||||
|
[AccessKey(SecurityAccess.ViewTasks)]
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetMyTasks(
|
||||||
|
[FromQuery] Paging paging,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,8 +21,7 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
{
|
{
|
||||||
_workflowTemplateManager = workflowTemplateManager;
|
_workflowTemplateManager = workflowTemplateManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a list of workflow templates
|
/// Get a list of workflow templates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,7 +32,10 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
[Route("templates")]
|
[Route("templates")]
|
||||||
[AccessKey(SecurityAccess.ViewWorkflowTemplates)]
|
[AccessKey(SecurityAccess.ViewWorkflowTemplates)]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> GetWorkflowTemplates([FromQuery] Paging paging, CancellationToken cancellationToken = default!)
|
public async Task<IActionResult> GetWorkflowTemplates(
|
||||||
|
[FromQuery] Paging paging,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var result = await _workflowTemplateManager.GetWorkflowTemplatesAsync(paging, cancellationToken);
|
var result = await _workflowTemplateManager.GetWorkflowTemplatesAsync(paging, cancellationToken);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
@ -69,7 +71,10 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
[Route("templateVersions")]
|
[Route("templateVersions")]
|
||||||
[AccessKey(SecurityAccess.ViewWorkflowTemplates)]
|
[AccessKey(SecurityAccess.ViewWorkflowTemplates)]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> GetWorkflowTemplateVersions([FromQuery] Paging paging,CancellationToken cancellationToken = default!)
|
public async Task<IActionResult> GetWorkflowTemplateVersions(
|
||||||
|
[FromQuery] Paging paging,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var result = await _workflowTemplateManager.GetWorkflowTemplateVersionsAsync(paging, cancellationToken);
|
var result = await _workflowTemplateManager.GetWorkflowTemplateVersionsAsync(paging, cancellationToken);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
@ -107,7 +112,10 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[AccessKey(SecurityAccess.EditWorkflowTemplate)]
|
[AccessKey(SecurityAccess.EditWorkflowTemplate)]
|
||||||
public async Task<IActionResult> EditTemplateVersion(GetWorkflowTemplateVersion template, CancellationToken cancellationToken = default!)
|
public async Task<IActionResult> EditTemplateVersion(
|
||||||
|
GetWorkflowTemplateVersion template,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
|
)
|
||||||
{
|
{
|
||||||
await _workflowTemplateManager.EditTemplateVersion(AuditUserDetails, template, cancellationToken);
|
await _workflowTemplateManager.EditTemplateVersion(AuditUserDetails, template, cancellationToken);
|
||||||
return Ok();
|
return Ok();
|
||||||
@ -124,9 +132,14 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[AccessKey(SecurityAccess.EditWorkflowTemplate)]
|
[AccessKey(SecurityAccess.EditWorkflowTemplate)]
|
||||||
public async Task<IActionResult> PatchWorkflowTemplateVersion([FromQuery] IGeneralIdRef templateId, [FromBody] PatchWorkflowTemplateVersion patchTemplate, CancellationToken cancellationToken = default!)
|
public async Task<IActionResult> PatchWorkflowTemplateVersion(
|
||||||
|
[FromQuery] IGeneralIdRef templateId,
|
||||||
|
[FromBody] PatchWorkflowTemplateVersion patchTemplate,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
|
)
|
||||||
{
|
{
|
||||||
await _workflowTemplateManager.PatchTemplateVersion(AuditUserDetails, templateId, patchTemplate, cancellationToken);
|
await _workflowTemplateManager.PatchTemplateVersion(AuditUserDetails, templateId, patchTemplate,
|
||||||
|
cancellationToken);
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +193,7 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ProblemDetails))]
|
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ProblemDetails))]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ProblemDetails))]
|
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ProblemDetails))]
|
||||||
[AccessKey(SecurityAccess.DeleteWorkflowTemplate)]
|
[AccessKey(SecurityAccess.Everyone)]
|
||||||
public async Task<IActionResult> GetAllowedTaskMetadataList(
|
public async Task<IActionResult> GetAllowedTaskMetadataList(
|
||||||
[FromQuery] string? taskType,
|
[FromQuery] string? taskType,
|
||||||
CancellationToken cancellationToken = default!
|
CancellationToken cancellationToken = default!
|
||||||
@ -189,5 +202,4 @@ public class WorkflowTemplateController : ESuiteControllerBase
|
|||||||
var result = await _workflowTemplateManager.GetAllowedTaskMetadataList(taskType, cancellationToken);
|
var result = await _workflowTemplateManager.GetAllowedTaskMetadataList(taskType, cancellationToken);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -251,5 +251,8 @@ public enum SecurityAccess
|
|||||||
DeleteWorkflowTemplate = 76,
|
DeleteWorkflowTemplate = 76,
|
||||||
|
|
||||||
[Display(Name = "CreateActivity", Description = "Create an activity based on a Workflow Template", GroupName = "Activities")]
|
[Display(Name = "CreateActivity", Description = "Create an activity based on a Workflow Template", GroupName = "Activities")]
|
||||||
CreateActivity = 77
|
CreateActivity = 77,
|
||||||
|
|
||||||
|
[Display(Name = "ViewTasks", Description = "View activity tasks that are in progress", GroupName = "Activities")]
|
||||||
|
ViewTasks = 78
|
||||||
}
|
}
|
||||||
@ -4,7 +4,6 @@ using e_suite.API.Common.exceptions;
|
|||||||
using e_suite.API.Common.repository;
|
using e_suite.API.Common.repository;
|
||||||
using e_suite.Database.Audit;
|
using e_suite.Database.Audit;
|
||||||
using e_suite.Database.Core.Extensions;
|
using e_suite.Database.Core.Extensions;
|
||||||
using e_suite.Modules.WorkflowTemplatesManager.Repository;
|
|
||||||
using e_suite.Utilities.Pagination;
|
using e_suite.Utilities.Pagination;
|
||||||
using e_suite.Workflow.Core.Attributes;
|
using e_suite.Workflow.Core.Attributes;
|
||||||
using e_suite.Workflow.Core.Extensions;
|
using e_suite.Workflow.Core.Extensions;
|
||||||
@ -13,7 +12,6 @@ using eSuite.Core.Miscellaneous;
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using e_suite.Database.Core.Tables.Workflow;
|
using e_suite.Database.Core.Tables.Workflow;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
//using WorkflowVersion = e_suite.Workflow.Core.WorkflowVersion;
|
//using WorkflowVersion = e_suite.Workflow.Core.WorkflowVersion;
|
||||||
|
|
||||||
@ -243,11 +241,15 @@ public class WorkflowTemplateManager : IWorkflowTemplateManager
|
|||||||
.Select(FormatInterfaceName)
|
.Select(FormatInterfaceName)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
var taskAttribute = t.GetCustomAttributes(typeof(TaskTypeAttribute), inherit: true).FirstOrDefault() as TaskTypeAttribute;
|
||||||
|
|
||||||
var newTaskMetadata = new TaskMetadata
|
var newTaskMetadata = new TaskMetadata
|
||||||
{
|
{
|
||||||
TaskType = t.FullName!,
|
TaskType = t.FullName!,
|
||||||
DisplayName = t.Name,
|
DisplayName = t.Name,
|
||||||
|
Icon = taskAttribute?.TaskIcon ?? string.Empty
|
||||||
};
|
};
|
||||||
|
|
||||||
newTaskMetadata.Capabilities.AddRange(capabilities);
|
newTaskMetadata.Capabilities.AddRange(capabilities);
|
||||||
|
|
||||||
var outcomeInterface = interfaces
|
var outcomeInterface = interfaces
|
||||||
|
|||||||
@ -2,18 +2,28 @@
|
|||||||
|
|
||||||
public abstract class TaskTypeAttribute : Attribute
|
public abstract class TaskTypeAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
protected TaskTypeAttribute(string taskIcon = "")
|
||||||
|
{
|
||||||
|
TaskIcon = taskIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TaskIcon { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GeneralTaskAttribute : TaskTypeAttribute
|
public class GeneralTaskAttribute : TaskTypeAttribute
|
||||||
{
|
{
|
||||||
public bool AllowMultiple { get; }
|
public GeneralTaskAttribute(string taskIcon = "", bool allowMultiple = true) : base(taskIcon)
|
||||||
|
|
||||||
public GeneralTaskAttribute(bool allowMultiple = true)
|
|
||||||
{
|
{
|
||||||
AllowMultiple = allowMultiple;
|
AllowMultiple = allowMultiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AllowMultiple { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApprovalTaskAttribute : TaskTypeAttribute
|
public class ApprovalTaskAttribute : TaskTypeAttribute
|
||||||
{
|
{
|
||||||
|
public ApprovalTaskAttribute(string taskIcon = "") : base(taskIcon)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ using e_suite.Workflow.Core.Interfaces;
|
|||||||
|
|
||||||
namespace e_suite.Workflow.Core.Tasks;
|
namespace e_suite.Workflow.Core.Tasks;
|
||||||
|
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faEyeSlash")]
|
||||||
public class AdhocApprovalTask : TaskBase, IAssignees<ApprovalTaskAssignee>, IOutcome<ApprovalVerdict>
|
public class AdhocApprovalTask : TaskBase, IAssignees<ApprovalTaskAssignee>, IOutcome<ApprovalVerdict>
|
||||||
{
|
{
|
||||||
public List<ApprovalTaskAssignee> Assignees { get; set; } = [];
|
public List<ApprovalTaskAssignee> Assignees { get; set; } = [];
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using e_suite.Workflow.Core.Interfaces;
|
|||||||
|
|
||||||
namespace e_suite.Workflow.Core.Tasks;
|
namespace e_suite.Workflow.Core.Tasks;
|
||||||
|
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faEye")]
|
||||||
public class ApprovalTask : TaskBase, IStage<ApprovalTaskAttribute>, IOutcome<ApprovalVerdict>
|
public class ApprovalTask : TaskBase, IStage<ApprovalTaskAttribute>, IOutcome<ApprovalVerdict>
|
||||||
{
|
{
|
||||||
public ICollection<ITask> Tasks { get; } = new List<ITask>();
|
public ICollection<ITask> Tasks { get; } = new List<ITask>();
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using e_suite.Workflow.Core.Interfaces;
|
|||||||
|
|
||||||
namespace e_suite.Workflow.Core.Tasks;
|
namespace e_suite.Workflow.Core.Tasks;
|
||||||
|
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faCloudArrowUp")]
|
||||||
public class AssetUploadTask : TaskBase, IOutcome<DefaultOutcome>
|
public class AssetUploadTask : TaskBase, IOutcome<DefaultOutcome>
|
||||||
{
|
{
|
||||||
public List<OutcomeAction<DefaultOutcome>> OutcomeActions { get; set; } = [];
|
public List<OutcomeAction<DefaultOutcome>> OutcomeActions { get; set; } = [];
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace e_suite.Workflow.Core.Tasks;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A user has to open this task, manually set it to ready to complete
|
/// A user has to open this task, manually set it to ready to complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faSquareCheck")]
|
||||||
public class BasicTask : TaskBase, IAssignees<TaskAssignee>, IOutcome<DefaultOutcome>
|
public class BasicTask : TaskBase, IAssignees<TaskAssignee>, IOutcome<DefaultOutcome>
|
||||||
{
|
{
|
||||||
public List<TaskAssignee> Assignees { get; set; } = [];
|
public List<TaskAssignee> Assignees { get; set; } = [];
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using eSuite.Core.Miscellaneous;
|
|||||||
|
|
||||||
namespace e_suite.Workflow.Core.Tasks;
|
namespace e_suite.Workflow.Core.Tasks;
|
||||||
|
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faFileLines")]
|
||||||
public class FormDataInputTask : TaskBase, IAssignees<TaskAssignee>, IFormTemplate, IOutcome<DefaultOutcome>
|
public class FormDataInputTask : TaskBase, IAssignees<TaskAssignee>, IFormTemplate, IOutcome<DefaultOutcome>
|
||||||
{
|
{
|
||||||
public List<TaskAssignee> Assignees { get; set; } = [];
|
public List<TaskAssignee> Assignees { get; set; } = [];
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace e_suite.Workflow.Core.Tasks;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Milestone task does not have any specific processing, so is ready to complete as soon at it starts.
|
/// A Milestone task does not have any specific processing, so is ready to complete as soon at it starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[GeneralTask]
|
[GeneralTask(taskIcon: "faFlagCheckered")]
|
||||||
public class MilestoneTask : TaskBase, IOutcome<DefaultOutcome>
|
public class MilestoneTask : TaskBase, IOutcome<DefaultOutcome>
|
||||||
{
|
{
|
||||||
public List<OutcomeAction<DefaultOutcome>> OutcomeActions { get; set; } = [];
|
public List<OutcomeAction<DefaultOutcome>> OutcomeActions { get; set; } = [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user