From bee8a0f9d874bf8eebdc68a9917f1520a2e760ae Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 23 Feb 2026 16:59:21 -0700 Subject: [PATCH] send prefill for tasks and hide operations to hidden fields --- .../services/modals/action-input.component.ts | 32 +++++++++++-------- .../ui/src/app/services/action.service.ts | 7 ++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts b/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts index dcf265ae4..00df3ee56 100644 --- a/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/services/modals/action-input.component.ts @@ -66,7 +66,7 @@ export type PackageActionData = { @if (requestInfo) { } @@ -156,18 +156,25 @@ export class ActionInputModal { const originalValue = res.value || {} this.eventId = res.eventId + const operations = this.requestInfo?.input + ? compare( + JSON.parse(JSON.stringify(originalValue)), + utils.deepMerge( + JSON.parse(JSON.stringify(originalValue)), + this.requestInfo.input.value, + ) as object, + ) + : null + return { spec: res.spec, originalValue, - operations: this.requestInfo?.input - ? compare( - JSON.parse(JSON.stringify(originalValue)), - utils.deepMerge( - JSON.parse(JSON.stringify(originalValue)), - this.requestInfo.input.value, - ) as object, - ) - : null, + operations, + visibleOperations: + operations?.filter(op => { + const key = op.path.split('/')[1] + return (res.spec[key!] as any)?.type !== 'hidden' + }) ?? null, } }), catchError(e => { @@ -180,14 +187,11 @@ export class ActionInputModal { async execute(input: object) { if (await this.checkConflicts(input)) { - const merged = this.context.data.prefill - ? { ...input, ...this.context.data.prefill } - : input await this.actionService.execute( this.pkgInfo.id, this.eventId, this.actionId, - merged, + input, ) this.context.$implicit.complete() } diff --git a/web/projects/ui/src/app/services/action.service.ts b/web/projects/ui/src/app/services/action.service.ts index 02d659087..df9b965e0 100644 --- a/web/projects/ui/src/app/services/action.service.ts +++ b/web/projects/ui/src/app/services/action.service.ts @@ -27,6 +27,7 @@ export class ActionService { private readonly formDialog = inject(FormDialogService) async present(data: PackageActionData) { + data.prefill = data.prefill ?? data.requestInfo?.input?.value const { pkgInfo, actionInfo } = data if (actionInfo.metadata.hasInput) { @@ -43,11 +44,9 @@ export class ActionService { data, }) .pipe(filter(Boolean)) - .subscribe(() => - this.execute(pkgInfo.id, null, actionInfo.id, data.prefill), - ) + .subscribe(() => this.execute(pkgInfo.id, null, actionInfo.id)) } else { - this.execute(pkgInfo.id, null, actionInfo.id, data.prefill) + this.execute(pkgInfo.id, null, actionInfo.id) } } }