diff --git a/xc/xc-form/definitions/containers/xc-table-panel-definition/xc-table-panel-definition.component.ts b/xc/xc-form/definitions/containers/xc-table-panel-definition/xc-table-panel-definition.component.ts index 627e146..9c8e55d 100644 --- a/xc/xc-form/definitions/containers/xc-table-panel-definition/xc-table-panel-definition.component.ts +++ b/xc/xc-form/definitions/containers/xc-table-panel-definition/xc-table-panel-definition.component.ts @@ -155,7 +155,9 @@ export class XcTablePanelDefinitionComponent extends XcFormPanelDefinitionCompon this.detailsDefinition = definitionBundle.definition; // get notified when details close - const observerSubscription = this.detailsDefinition.observerChange + let observerSubscription: Subscription; + // eslint-disable-next-line prefer-const + observerSubscription = this.detailsDefinition.observerChange .pipe(filter(observer => !!observer)) .subscribe(observer => { observer.definitionClosed().pipe(first()).subscribe(data => { diff --git a/xc/xc-form/definitions/xc-definition-stack/xc-definition-stack-item/xc-definition-stack-item.component.ts b/xc/xc-form/definitions/xc-definition-stack/xc-definition-stack-item/xc-definition-stack-item.component.ts index e43024b..461a35d 100644 --- a/xc/xc-form/definitions/xc-definition-stack/xc-definition-stack-item/xc-definition-stack-item.component.ts +++ b/xc/xc-form/definitions/xc-definition-stack/xc-definition-stack-item/xc-definition-stack-item.component.ts @@ -19,8 +19,8 @@ import { AfterViewInit, Component, Injector, OnDestroy } from '@angular/core'; import { environment } from '@environments/environment'; import { XcStackItemComponent, XcStackItemComponentData } from '../../../../xc-stack/xc-stack-item/xc-stack-item.component'; -import { Observable, of, Subject, Subscription } from 'rxjs'; -import { map, switchMap, tap } from 'rxjs/operators'; +import { Observable, of, Subject, Subscription, throwError } from 'rxjs'; +import { filter, map, switchMap, tap } from 'rxjs/operators'; import { XoFormDefinition } from '../../xo/containers.model'; import { ApiService, StartOrderOptionsBuilder, Xo, XoXPRCRuntimeContext, XoXPRCRuntimeContextFromRuntimeContext } from '../../../../../api'; import { XcStackItem, XcStackItemInterface, XcStackItemObserver } from '../../../../xc-stack/xc-stack-item/xc-stack-item'; @@ -131,14 +131,33 @@ export class XcDefinitionStackItemComponent extends XcStackItemComponent { - this.dialogs.info('Definition Closed', 'not implemented yet in DefinitionObserver'); - return of(); + return of({ + definition: this.injectedData.definition, + data: this.injectedData.data + }); } resolveDefinition(definitionWorkflowRTC: XoXPRCRuntimeContext, definitionWorkflowFQN: string, data: Xo[]): Observable { - this.dialogs.info('Resolve Definition from Workflow', 'not implemented yet in DefinitionObserver'); - return of(); + return this.api.startOrder( + definitionWorkflowRTC.toRuntimeContext(), + definitionWorkflowFQN, + data, null, + new StartOrderOptionsBuilder().withErrorMessage(true).options + ).pipe( + filter(result => { + if (result.errorMessage || result.output?.length === 0) { + throwError(() => new Error('no definition found')); + this.dialogs.error('No definition found in resolved definition-Workflow'); + return false; + } + return true; + }), + map(result => { + definition: result.output[0], + data: result.output.slice(1) + }) + ); }