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

exui-1717-show warning if task not available #1708

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.15-fix-event-hiding",
"version": "7.1.15-exui-1717-rc1",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.15-fix-event-hiding",
"version": "7.1.15-exui-1717-rc1",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
// If caseField.hidden is NOT truthy and also NOT equal to false, then it must be null/undefined (remember that
// both null and undefined are equal to *neither false nor true*)
if (caseField && caseField.retain_hidden_value &&
(caseField.hidden || (caseField.hidden !== false && parentField && parentField.hidden))) {
(caseField.hidden || (caseField.hidden !== false && parentField?.hidden))) {
if (caseField.field_type.type === 'Complex') {
this.handleComplexField(caseField, formGroup, key, rawFormValueData);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class EventCompletionStateMachineService {
const assignNeeded = context.sessionStorageService.getItem('assignNeeded');
context.workAllocationService.getTask(context.task.id).subscribe(
taskResponse => {
if (taskResponse && taskResponse.task && taskResponse.task.task_state) {
if (taskResponse?.task?.task_state) {
switch (taskResponse.task.task_state.toUpperCase()) {
case TaskState.Unassigned:
// Task unassigned
Expand Down Expand Up @@ -115,6 +115,12 @@ export class EventCompletionStateMachineService {
state.trigger(EventCompletionStates.CompleteEventAndTask);
break;
}
} else if (!taskResponse?.task) {
context.alertService.setPreserveAlerts(true);
context.alertService.warning({ phrase: 'Task statecheck : no task available for completion', replacements: {} });
} else {
context.alertService.setPreserveAlerts(true);
context.alertService.warning({ phrase: 'Task statecheck : no task state available for completion', replacements: {} });
}
},
error => {
Expand All @@ -140,6 +146,8 @@ export class EventCompletionStateMachineService {
// just set event can be completed
context.component.eventCanBeCompleted.emit(true);
} else {
context.alertService.setPreserveAlerts(true);
context.alertService.warning({phrase: 'CompleteEventAndTask : no task available for completion', replacements: {}});
// Emit event cannot be completed event
context.component.eventCanBeCompleted.emit(false);
}
Expand All @@ -161,7 +169,9 @@ export class EventCompletionStateMachineService {
context.sessionStorageService.setItem('assignNeeded', 'true');
context.component.eventCanBeCompleted.emit(true);
} else {
// Emit event cannot be completed event
context.alertService.setPreserveAlerts(true);
context.alertService.warning({phrase: 'Unassigned task : no task available for completion', replacements: {}});
// Emit event cannot be completed event
context.component.eventCanBeCompleted.emit(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export class WorkAllocationService {
*/
public completeTask(taskId: string, eventName?: string): Observable<any> {
if (!this.isWAEnabled()) {
this.alertService.setPreserveAlerts(true);
this.alertService.warning({ phrase:'completeTask: Work Allocation is not enabled, so the task could not be completed. Please complete the task associated with the case manually.'});
return of(null);
}
this.appConfig.logMessage(`completeTask: completing ${taskId}`);
Expand All @@ -129,6 +131,8 @@ export class WorkAllocationService {
*/
public assignAndCompleteTask(taskId: string, eventName?: string): Observable<any> {
if (!this.isWAEnabled()) {
this.alertService.setPreserveAlerts(true);
this.alertService.warning({ phrase:'assignAndCompleteTask: Work Allocation is not enabled, so the task could not be completed. Please complete the task associated with the case manually.'});
return of(null);
}
this.appConfig.logMessage(`assignAndCompleteTask: completing ${taskId}`);
Expand Down
Loading