-
Notifications
You must be signed in to change notification settings - Fork 4
[ETASK-29] Menu item creation in menu #339
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,8 @@ import {ChangedFieldsService} from '../../changed-fields/services/changed-fields | |||||||||||||||||||||||||||||||||
| import { EventService} from '../../event/services/event.service'; | ||||||||||||||||||||||||||||||||||
| import {ChangedFieldsMap} from '../../event/services/interfaces/changed-fields-map'; | ||||||||||||||||||||||||||||||||||
| import {TaskEventOutcome} from '../../event/model/event-outcomes/task-outcomes/task-event-outcome'; | ||||||||||||||||||||||||||||||||||
| import {FrontActionService} from "../../actions/services/front-action.service"; | ||||||||||||||||||||||||||||||||||
| import {FrontAction} from "../../data-fields/models/changed-fields"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * Service that handles the logic of canceling a task. | ||||||||||||||||||||||||||||||||||
|
|
@@ -45,6 +47,7 @@ export class CancelTaskService extends TaskHandlingService { | |||||||||||||||||||||||||||||||||
| protected _eventQueue: EventQueueService, | ||||||||||||||||||||||||||||||||||
| protected _eventService: EventService, | ||||||||||||||||||||||||||||||||||
| protected _changedFieldsService: ChangedFieldsService, | ||||||||||||||||||||||||||||||||||
| protected _frontActionService: FrontActionService, | ||||||||||||||||||||||||||||||||||
| @Inject(NAE_TASK_OPERATIONS) protected _taskOperations: TaskOperations, | ||||||||||||||||||||||||||||||||||
| @Optional() _selectedCaseService: SelectedCaseService, | ||||||||||||||||||||||||||||||||||
| @Optional() protected _taskViewService: TaskViewService, | ||||||||||||||||||||||||||||||||||
|
|
@@ -126,6 +129,10 @@ export class CancelTaskService extends TaskHandlingService { | |||||||||||||||||||||||||||||||||
| if (!!changedFieldsMap) { | ||||||||||||||||||||||||||||||||||
| this._changedFieldsService.emitChangedFields(changedFieldsMap); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| 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); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+132
to
137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Protect cancel success path from front-action runtime failures. On Line 134, a thrown front action can interrupt the success branch before reload and 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| } else if (outcomeResource.error !== undefined) { | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,8 @@ import {ChangedFieldsService} from '../../changed-fields/services/changed-fields | |||||||||||||||||||||||||||||||||||||
| import {EventService} from '../../event/services/event.service'; | ||||||||||||||||||||||||||||||||||||||
| import {ChangedFieldsMap} from '../../event/services/interfaces/changed-fields-map'; | ||||||||||||||||||||||||||||||||||||||
| import {TaskEventOutcome} from '../../event/model/event-outcomes/task-outcomes/task-event-outcome'; | ||||||||||||||||||||||||||||||||||||||
| import {FrontActionService} from '../../actions/services/front-action.service'; | ||||||||||||||||||||||||||||||||||||||
| import {FrontAction} from '../../data-fields/models/changed-fields'; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -43,6 +45,7 @@ export class FinishTaskService extends TaskHandlingService { | |||||||||||||||||||||||||||||||||||||
| protected _eventQueue: EventQueueService, | ||||||||||||||||||||||||||||||||||||||
| protected _eventService: EventService, | ||||||||||||||||||||||||||||||||||||||
| protected _changedFieldsService: ChangedFieldsService, | ||||||||||||||||||||||||||||||||||||||
| protected _frontActionService: FrontActionService, | ||||||||||||||||||||||||||||||||||||||
| @Inject(NAE_TASK_OPERATIONS) protected _taskOperations: TaskOperations, | ||||||||||||||||||||||||||||||||||||||
| @Optional() _selectedCaseService: SelectedCaseService, | ||||||||||||||||||||||||||||||||||||||
| _taskContentService: TaskContentService) { | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -140,6 +143,10 @@ export class FinishTaskService extends TaskHandlingService { | |||||||||||||||||||||||||||||||||||||
| if (!!changedFieldsMap) { | ||||||||||||||||||||||||||||||||||||||
| this._changedFieldsService.emitChangedFields(changedFieldsMap); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| 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(); | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+146
to
152
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isolate front-action failures in finish success handling. On Line 148, uncaught exceptions from 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
🤖 Prompt for AI Agents