Skip to content

Commit

Permalink
Merge branch 'next-minor' into story/modeler-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mbritense committed Dec 3, 2024
2 parents 7aca4bf + 39581a1 commit 43e1f8e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

.container-fluid {
color: #959595;
padding: 0;
margin: 0;
}

i {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class TaskDetailContentComponent implements OnInit, OnDestroy {

this.loadTaskDetails(value.task as any, value.processLinkActivityResult);
}
@Input() public set modalClosed(_: boolean) {
// save form flow data on modal closed
if (this.formFlow) this.formFlow.saveData();
}
@Output() public readonly closeModalEvent = new EventEmitter();
@Output() public readonly formSubmit = new EventEmitter();
@Output() public readonly activeChange = new EventEmitter<boolean>();
Expand Down Expand Up @@ -247,7 +251,9 @@ export class TaskDetailContentComponent implements OnInit, OnDestroy {
)
.subscribe({
next: (intermediateSubmission: IntermediateSubmission) => {
this.taskIntermediateSaveService.setSubmission({data: intermediateSubmission.submission});
this.taskIntermediateSaveService.setSubmission({
data: intermediateSubmission?.submission || {},
});

if (formViewModelComponentRef) {
formViewModelComponentRef.instance.submission = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ export class TaskDetailIntermediateSaveComponent {
.getIntermediateSubmission(task.id ?? '')
.pipe(take(1))
.subscribe(intermediateSave => {
this.currentIntermediateSave = this.formatIntermediateSubmission(intermediateSave);
if (intermediateSave !== null) {
this.currentIntermediateSave = this.formatIntermediateSubmission(intermediateSave);
} else {
this.currentIntermediateSave = null;
this.taskIntermediateSaveService.setSubmission({});
}

this.currentIntermediateSaveEvent.emit(this.currentIntermediateSave);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
@if (processLinkPreloaded$ | async) {
<valtimo-task-detail-content
[taskAndProcessLink]="taskAndProcessLink$ | async"
[modalClosed]="modalCloseEvent$ | async"
(formSubmit)="onFormSubmit()"
(closeModalEvent)="closeModal()"
></valtimo-task-detail-content>
} @else {
<valtimo-task-detail-content
[task]="task$ | async"
[modalClosed]="modalCloseEvent$ | async"
(formSubmit)="onFormSubmit()"
(closeModalEvent)="closeModal()"
></valtimo-task-detail-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export class TaskDetailModalComponent implements OnInit {

public readonly canAssignUserToTask$ = new BehaviorSubject<boolean>(false);

public readonly modalCloseEvent$ = new BehaviorSubject<boolean>(false);

private readonly _subscriptions = new Subscription();

constructor(
Expand Down Expand Up @@ -118,7 +120,7 @@ export class TaskDetailModalComponent implements OnInit {
public openTaskAndProcessLinkDetails(taskWithProcessLink: TaskWithProcessLink | null): void {
this.processLinkPreloaded$.next(true);
this.taskAndProcessLink$.next(taskWithProcessLink);
this.task$.next(taskWithProcessLink.task as any);
this.task$.next({...(taskWithProcessLink.task as any)});
this.page$.next({
title: taskWithProcessLink.task?.name,
subtitle: `${this.translateService.instant('taskDetail.taskCreated')} ${taskWithProcessLink.task?.created}`,
Expand Down Expand Up @@ -147,6 +149,7 @@ export class TaskDetailModalComponent implements OnInit {
public closeModal(): void {
this._modal.open = false;
this.taskIntermediateSaveService.setSubmission({});
this.modalCloseEvent$.next(!this.modalCloseEvent$.getValue());
}

private openModal(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {BaseApiService, ConfigService} from '@valtimo/config';
import {InterceptorSkip} from '@valtimo/security';
import {BehaviorSubject, Observable, filter} from 'rxjs';
import {BehaviorSubject, catchError, filter, Observable, of} from 'rxjs';
import {IntermediateSaveRequest, IntermediateSubmission} from '../models';

@Injectable({providedIn: 'root'})
Expand All @@ -39,16 +39,17 @@ export class TaskIntermediateSaveService extends BaseApiService {
super(httpClient, configService);
}

public getIntermediateSubmission(taskInstanceId: string): Observable<IntermediateSubmission> {
return this.httpClient.get<IntermediateSubmission>(
this.getApiUrl('/v1/form/intermediate/submission'),
{
public getIntermediateSubmission(
taskInstanceId: string
): Observable<IntermediateSubmission | null> {
return this.httpClient
.get<IntermediateSubmission>(this.getApiUrl('/v1/form/intermediate/submission'), {
params: {
taskInstanceId,
},
headers: new HttpHeaders().set(InterceptorSkip, '404'),
}
);
})
.pipe(catchError(() => of(null)));
}

public storeIntermediateSubmission(
Expand Down

0 comments on commit 43e1f8e

Please sign in to comment.