Skip to content

[ETASK-29] Menu item creation in menu#339

Merged
machacjozef merged 2 commits into
release/6.5.0from
ETASK-29
Jun 19, 2026
Merged

[ETASK-29] Menu item creation in menu#339
machacjozef merged 2 commits into
release/6.5.0from
ETASK-29

Conversation

@Retoocs

@Retoocs Retoocs commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Handle frontend actions on task events

Implements ETASK-29

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

manually

Test Configuration

Name Tested on
OS Ubuntu 24.04.1 LTS
Runtime Node 23.6.1
Dependency Manager NPM 11.0.0
Framework version Angular 19.2.2
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @...
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features
    • Task operations (assign, cancel, and finish) now execute additional actions returned by the system in response to those operations.

- handle frontend actions on task events
@Retoocs Retoocs self-assigned this Jun 19, 2026
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

AssignTaskService, CancelTaskService, and FinishTaskService each gain a new FrontActionService constructor dependency. On a successful operation outcome, each service now parses front actions from the outcome tree and executes them via FrontActionService.runAll before completing the task lifecycle.

Changes

Front Action Execution in Task Services

Layer / File(s) Summary
Assign task: FrontActionService injection and runAll on success
projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts
Imports FrontAction and FrontActionService, injects the service in the constructor, and calls runAll with parsed front actions inside the successful assign handler.
Cancel task: FrontActionService injection and runAll on success
projects/netgrif-components-core/src/lib/task/services/cancel-task.service.ts
Applies the same pattern as assign: new imports, constructor DI, and front action execution in the cancel success path.
Finish task: FrontActionService injection and runAll on success
projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts
Mirrors the assign and cancel changes: FrontActionService injected and runAll invoked when front actions are present in the finish outcome.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • netgrif/components#305: Directly modifies the same three task services (assign/cancel/finish) with constructor DI and FrontAction parsing/execution, matching this PR's change pattern.
  • netgrif/components#326: Enhances parseFrontActionsFromOutcomeTree and FrontActionService plumbing that the outcome handlers in this PR rely on.

Suggested labels

improvement, Medium

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references menu item creation while the changeset exclusively implements front-action handling in task services (AssignTaskService, CancelTaskService, FinishTaskService). Update the title to reflect the actual changes, such as 'Add front-action support to task services' or 'Execute front actions on task operations'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Retoocs Retoocs changed the base branch from master to release/6.5.0 June 19, 2026 13:04
@Retoocs Retoocs marked this pull request as ready for review June 19, 2026 13:05
Kovy95
Kovy95 previously approved these changes Jun 19, 2026
@coderabbitai coderabbitai Bot added improvement New feature or request Medium labels Jun 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts`:
- Around line 130-135: The _frontActionService.runAll(frontActions) call is not
isolated from the success flow and can abort execution if any front action
throws an error, preventing the subsequent reload/forceReload and
completeActions from running. Wrap the runAll() call in a try-catch block to
ensure that even if front action execution fails, the task operations
(forceReload or reload) and the completeActions method still execute to maintain
the proper event progression after a successful backend response.

In
`@projects/netgrif-components-core/src/lib/task/services/cancel-task.service.ts`:
- Around line 132-137: The front action execution via
this._frontActionService.runAll(frontActions) can throw an error and prevent the
subsequent reload and completeActions from being called, leaving cancel
lifecycle callbacks unresolved. Wrap the front action execution in a try-catch
block to ensure that if a front action fails, the error is handled gracefully
and the reload (either forceReload or reload via this._taskOperations) and the
completeActions method with afterAction, nextEvent, and outcomeResource.outcome
are still executed to properly complete the cancel lifecycle.

In
`@projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts`:
- Around line 146-152: The _frontActionService.runAll(frontActions) call on line
148 is not wrapped in error handling, which means any uncaught exceptions from
runAll will prevent the subsequent calls to _taskOperations.reload(),
completeActions(), and _taskOperations.close() from executing, leaving the
system in a broken post-finish state. Wrap the runAll() invocation in a
try-catch block to isolate front-action failures while ensuring that reload,
completeActions, and close operations continue to execute regardless of whether
runAll throws an exception.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3575f961-3faa-44d7-b785-94891c7efe6b

📥 Commits

Reviewing files that changed from the base of the PR and between 917726a and 20a1497.

📒 Files selected for processing (3)
  • projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts
  • projects/netgrif-components-core/src/lib/task/services/cancel-task.service.ts
  • projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts

Comment on lines +130 to 135
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as AssignTaskEventOutcome);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Guard front-action execution so success flow cannot be aborted.

On Line 132, runAll() is not isolated; if any front action throws (including unknown action-id dispatch), the code after it won’t run (reload/forceReload, completeActions, snackbar), breaking event progression despite a successful backend response.

Proposed fix
 const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
 if (frontActions?.length > 0) {
-    this._frontActionService.runAll(frontActions);
+    try {
+        this._frontActionService.runAll(frontActions);
+    } catch (e) {
+        this._log.error('Executing front actions after assign failed', e);
+    }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as AssignTaskEventOutcome);
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
try {
this._frontActionService.runAll(frontActions);
} catch (e) {
this._log.error('Executing front actions after assign failed', e);
}
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as AssignTaskEventOutcome);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts`
around lines 130 - 135, The _frontActionService.runAll(frontActions) call is not
isolated from the success flow and can abort execution if any front action
throws an error, preventing the subsequent reload/forceReload and
completeActions from running. Wrap the runAll() call in a try-catch block to
ensure that even if front action execution fails, the task operations
(forceReload or reload) and the completeActions method still execute to maintain
the proper event progression after a successful backend response.

Comment on lines +132 to 137
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as CancelTaskEventOutcome);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Protect cancel success path from front-action runtime failures.

On Line 134, a thrown front action can interrupt the success branch before reload and completeActions, leaving cancel lifecycle callbacks unresolved.

Proposed fix
 const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
 if (frontActions?.length > 0) {
-    this._frontActionService.runAll(frontActions);
+    try {
+        this._frontActionService.runAll(frontActions);
+    } catch (e) {
+        this._log.error('Executing front actions after cancel failed', e);
+    }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as CancelTaskEventOutcome);
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
try {
this._frontActionService.runAll(frontActions);
} catch (e) {
this._log.error('Executing front actions after cancel failed', e);
}
}
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as CancelTaskEventOutcome);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/netgrif-components-core/src/lib/task/services/cancel-task.service.ts`
around lines 132 - 137, The front action execution via
this._frontActionService.runAll(frontActions) can throw an error and prevent the
subsequent reload and completeActions from being called, leaving cancel
lifecycle callbacks unresolved. Wrap the front action execution in a try-catch
block to ensure that if a front action fails, the error is handled gracefully
and the reload (either forceReload or reload via this._taskOperations) and the
completeActions method with afterAction, nextEvent, and outcomeResource.outcome
are still executed to properly complete the cancel lifecycle.

Comment on lines +146 to 152
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as FinishTaskEventOutcome);
this._taskOperations.close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Isolate front-action failures in finish success handling.

On Line 148, uncaught exceptions from runAll() can prevent reload, completeActions, and close, causing a broken post-finish state after a successful backend finish.

Proposed fix
 const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
 if (frontActions?.length > 0) {
-    this._frontActionService.runAll(frontActions);
+    try {
+        this._frontActionService.runAll(frontActions);
+    } catch (e) {
+        this._log.error('Executing front actions after finish failed', e);
+    }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
this._frontActionService.runAll(frontActions);
}
this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as FinishTaskEventOutcome);
this._taskOperations.close();
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
if (frontActions?.length > 0) {
try {
this._frontActionService.runAll(frontActions);
} catch (e) {
this._log.error('Executing front actions after finish failed', e);
}
}
this._taskOperations.reload();
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as FinishTaskEventOutcome);
this._taskOperations.close();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts`
around lines 146 - 152, The _frontActionService.runAll(frontActions) call on
line 148 is not wrapped in error handling, which means any uncaught exceptions
from runAll will prevent the subsequent calls to _taskOperations.reload(),
completeActions(), and _taskOperations.close() from executing, leaving the
system in a broken post-finish state. Wrap the runAll() invocation in a
try-catch block to isolate front-action failures while ensuring that reload,
completeActions, and close operations continue to execute regardless of whether
runAll throws an exception.

@sonarqubecloud

Copy link
Copy Markdown

@machacjozef machacjozef merged commit 516c603 into release/6.5.0 Jun 19, 2026
10 of 11 checks passed
@machacjozef machacjozef deleted the ETASK-29 branch June 19, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement New feature or request Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants