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

UI validation enhancements #69

Merged
merged 4 commits into from
Oct 26, 2023
Merged

UI validation enhancements #69

merged 4 commits into from
Oct 26, 2023

Conversation

sfmskywalker
Copy link
Member

@sfmskywalker sfmskywalker commented Oct 26, 2023

This PR adds workflow publishing validation enhancements.

=== auto-pr-body ===

Summary:
This pull request includes the following enhancements:

  • Added IMediator interface to facilitate publishing notifications and subscription to notifications
  • Added tabler icons and heroicons to provide icons for Elsa studio
  • Added summary comments to describe interface, Elsa Studio icons and heroicons classes
  • Added result class to hold successful or failure values and used to check if the result was successful or not
  • Added methods such as Subscribe and Unsubscribe for particular notifications, Unsubscribe for any notification, NotifyAsync, and methods of type Func<TSuccess, Task>/Action<TSuccess> and Func<TFailure, Task>/Action<TFailure>.
  • Added [CascadingParameter] attribute to the DragDropManager property, [Parameter] attributes to the workflow definition and workflow definition updated properties, and constructor and properties to ActivityDisplaySettings class.
  • Updated return type of CreateNewDefinitionAsync from Task<WorkflowDefinition> to Task<Result<WorkflowDefinition, ValidationErrors>> and added two new properties to DefaultActivityColors class.
  • Removed ActivityIcons class.
  • Updated OnFileSelected to set the _isDirty flag to false, and OnCreateWorkflowClicked to use the Result object to handle the result from the CreateNewDefinitionAsync operation.

List of Changes:

  • Added IMediator interface to facilitate publishing notifications and subscription to notifications
  • Added tabler icons and heroicons to provide icons for Elsa Studio
  • Added summary comments to describe interface, Elsa Studio icons and heroicons classes
  • Added result class to hold successful or failure values and used to check if the result was successful or not
  • Added methods such as Subscribe and Unsubscribe for particular notifications, Unsubscribe for any notification, NotifyAsync, and methods of type Func<TSuccess, Task>/Action<TSuccess> and Func<TFailure, Task>/Action<TFailure>.
  • Added [CascadingParameter] attribute to the DragDropManager property, [Parameter] attributes to the workflow definition and workflow definition updated properties, and constructor and properties to ActivityDisplaySettings class.
  • Updated return type of CreateNewDefinitionAsync from Task<WorkflowDefinition> to Task<Result<WorkflowDefinition, ValidationErrors>> and added two new properties to DefaultActivityColors class.
  • Removed ActivityIcons class.
  • Updated OnFileSelected to set the _isDirty flag to false, and OnCreateWorkflowClicked to use the Result object to handle the result from the CreateNewDefinitionAsync operation.

Refactoring Target:

  • Extract methods of type Func<TSuccess, Task> and Action<TSuccess> and Func<TFailure, Task> and Action<TFailure> into their own functions for improved readability.
  • Rename the methods of type Func<TSuccess, Task> and Action<TSuccess> and Func<TFailure, Task> and Action<TFailure> to be more expressive and descriptive of the functionality they represent.
  • Create a generic SaveChangesAsync method for both the SaveAsync and PublishAsync methods, that receives a bool readDiagram, bool showLoader and bool publish parameter, and returns a Result<WorkflowDefinition, ValidationErrors> type.
  • Create a generic method to handle errors, since the same logic is repeated when calling SaveAsync, PublishAsync and RetractAsync methods.
  • Rename the NotifyWorkflowChangedAsync method to indicate the task it performs (e.g. 'InitializeWorkflowAsync`) and include all the logic it previously contained (selecting the activity, etc.).
  • Make use of async/await in OnCreateWorkflowClicked to ensure that the result of the CreateNewDefinitionAsync operation is handled properly.
  • Consider using a try/catch block for the RetractAsync operation in OnRetractClicked to handle any potential errors.

@sfmskywalker sfmskywalker added the enhancement New feature or request label Oct 26, 2023
@sfmskywalker sfmskywalker merged commit ad10236 into main Oct 26, 2023
2 checks passed
@sfmskywalker sfmskywalker deleted the not-found-activity-changes branch October 26, 2023 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant