File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-action-standalone/live-apps-action-standalone.component.ts

Description

Handles rendering of case action.

Extends

LiveAppsCreatorStandaloneComponent

Implements

OnChanges

Example

<tcla-live-apps-action-standalone></tcla-live-apps-action-standalone>

Metadata

selector tcla-live-apps-action-standalone
styleUrls ./live-apps-action-standalone.component.css
templateUrl ./live-apps-action-standalone.component.html

Index

Properties
Methods
Inputs
Outputs
HostListeners
Accessors

Inputs

applicationId
Type : string

LA application ID

caseRef
Type : string

The case reference on which to run the action

customFormTag
Type : string

Custom Form tag if using an external form app

dataOverride
Type : any

Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire)

formsFramework
Type : string
layout
Type : any[]

Custom Form Layout

legacyActions
Type : boolean
processName
Type : string

The process definition of the action or creator to execute

sandboxId
Type : number

sandboxId - this comes from claims resolver

typeId
Type : string

The LA Application Type Id (generally 1)

applicationId
Type : string

LA application ID

customFormTag
Type : string

Custom Form tag if using an external form app

dataOverride
Type : any

Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire)

formsFramework
Type : string
layout
Type : any[]

Custom Form Layout

legacyCreators
Type : boolean
processName
Type : string

The process definition of the action or creator to execute

sandboxId
Type : number

sandboxId - this comes from claims resolver

typeId
Type : string

The LA Application Type Id (generally 1)

Outputs

caseCreated
Type : EventEmitter<ProcessId>

~event caseChanged : Case action started (process started) ~payload ProcessId : ProcessId object passed when a case has been updated or created by a process (action/creator)

caseCreated
Type : EventEmitter<ProcessId>

~event caseChanged : Case action started (process started) ~payload ProcessId : ProcessId object passed when a case has been updated or created by a process (action/creator)

HostListeners

window:resize
Arguments : '$event'
window:resize(event)
Inherited from LiveAppsComponent

Methods

ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void
ngOnInit
ngOnInit()
Returns : void
ngAfterViewInit
ngAfterViewInit()
Inherited from LiveAppsComponent
Returns : void
ngOnDestroy
ngOnDestroy()
Inherited from LiveAppsComponent
Returns : void
ngOnInit
ngOnInit()
Inherited from LiveAppsComponent
Returns : void
setupWidthObserver
setupWidthObserver()
Inherited from LiveAppsComponent
Returns : void

Properties

caseState
Type : string
customFormDefs
Type : any
data
Type : any
Public formsFramework
Type : string
Default value : 'material-design'

Allow override of forms framework Options: bootstrap-4 or material-design

isCustomForm
Default value : false
Public legacyActions
Type : boolean
Default value : false

Enable legacy actions

options
Type : any
process
Type : Process
useLegacy
Default value : false
customFormDefs
Type : any
data
Type : any
Public formsFramework
Type : string
Default value : 'material-design'

Allow override of forms framework Options: bootstrap-4 or material-design

handleLegacyProcessCancelled
Default value : () => {...}
handleLegacyProcessComplete
Default value : () => {...}
handleSubmit
Default value : () => {...}
isCustomForm
Default value : false
Public legacyCreators
Type : boolean
Default value : false

Enable legacy creators

options
Type : any
process
Type : Process
useLegacy
Default value : false
Protected _destroyed$
Default value : new Subject()
Inherited from LiveAppsComponent
componentChildDivs
Type : LiveAppsComponent[]
Decorators :
@ViewChildren('componentChildDiv')
Inherited from LiveAppsComponent
componentDiv
Type : ElementRef
Decorators :
@ViewChild('componentDiv', {static: false})
Inherited from LiveAppsComponent
Protected containerChanges$
Type : Observable<TcComponent>
Inherited from LiveAppsComponent
Private observer
Inherited from LiveAppsComponent
Public resize
Default value : () => {...}
Inherited from LiveAppsComponent
Public widget
Type : TcComponent
Inherited from LiveAppsComponent

Accessors

LegacyActions
setLegacyActions(legacyActions: boolean)
Parameters :
Name Type Optional
legacyActions boolean No
Returns : void
FormsFramework
setFormsFramework(formsFramework: string)
Parameters :
Name Type Optional
formsFramework string No
Returns : void
import {Component, EventEmitter, Input, Output, OnDestroy, SimpleChanges, OnChanges, OnInit} from '@angular/core';
import {LiveAppsComponent} from '../live-apps-component/live-apps-component.component';
import {CaseCreator, CaseInfo, Process, ProcessId} from '../../models/liveappsdata';
import {LiveAppsService} from '../../services/live-apps.service';
import {take, takeUntil} from 'rxjs/operators';
import {TcCaseProcessesService} from '../../services/tc-case-processes.service';
import {LiveAppsCreatorStandaloneComponent} from '../live-apps-creator-standalone/live-apps-creator-standalone.component';
import {forkJoin, throwError} from 'rxjs';
import {CaseInfoWithSchema} from '../../models/tc-case-data';

/**
 * Handles rendering of case action.
 *
 *@example <tcla-live-apps-action-standalone></tcla-live-apps-action-standalone>
 */

@Component({
  selector: 'tcla-live-apps-action-standalone',
  templateUrl: './live-apps-action-standalone.component.html',
  styleUrls: ['./live-apps-action-standalone.component.css']
})
export class LiveAppsActionStandaloneComponent extends LiveAppsCreatorStandaloneComponent implements OnChanges {

  /**
   * sandboxId - this comes from claims resolver
   */
  @Input() sandboxId: number;

  /**
   * LA application ID
   */
  @Input() applicationId: string;

  /**
   * The LA Application Type Id (generally 1)
   */
  @Input() typeId: string;

  /**
   * The process definition of the action or creator to execute
   */
  @Input() processName: string;

  /**
   * The case reference on which to run the action
   */
  @Input() caseRef: string;


  /**
   * Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire)
   */
  @Input() dataOverride: any;

  /**
   * Custom Form tag if using an external form app
   */
  @Input() customFormTag: string;

  /**
   * Custom Form Layout
   */
  @Input() layout: any[];

  /**
   * Enable legacy actions
   */
  public legacyActions: boolean = false;
  @Input('legacyActions') set LegacyActions(legacyActions: boolean) {
    if (legacyActions){
      this.legacyActions = legacyActions;
    }
  }

  /**
   * Allow override of forms framework
   * Options: bootstrap-4 or material-design
   */
  public formsFramework: string = 'material-design';
  @Input('formsFramework') set FormsFramework(formsFramework: string) {
    if (formsFramework){
      this.formsFramework = formsFramework;
    }
  }

  /**
   * ~event caseChanged : Case action started (process started)
   * ~payload ProcessId : ProcessId object passed when a case has been updated or created by a process (action/creator)
   */
  @Output() caseCreated: EventEmitter<ProcessId> = new EventEmitter<ProcessId>();

  data: any;
  options: any;
  process: Process;
  isCustomForm = false;
  customFormDefs: any;
  useLegacy = false;
  caseState: string;

  ngOnChanges(changes: SimpleChanges) {
    // initialize once data is available
    if (this.applicationId && this.processName && this.typeId && this.sandboxId && this.caseRef) {
      if (this.legacyActions) {
        // use legacy creator iframe
        this.useLegacy = this.legacyActions;
      }
      // use rendered form
      if (this.customFormTag) {
        // use custom form
        this.customFormDefs = { customForms: [this.customFormTag] };
      }
      // get process details and case data
      const forkJoinArray = [];
      const processDetails$ = this.processesService.getProcess(this.sandboxId, this.applicationId, this.typeId, this.processName, 'action').pipe(
        take(1),
        takeUntil(this._destroyed$)
      );

      /*.subscribe(
        next => {
          this.process = next;
        },
        error => {
          console.error('Unable to get action info');
          console.error(error);
        }
      );*/
      forkJoinArray.push(processDetails$);
      const caseData$ = this.caseDataService.getCaseWithSchema(this.caseRef, this.sandboxId, this.applicationId, this.typeId, undefined)
        .pipe(
          take(1),
          takeUntil(this._destroyed$)
        );
      forkJoinArray.push(caseData$);

      forkJoin(forkJoinArray).subscribe(
        (result: any[])  => {
          // handle results

          // process details
          if (result[0]) {
            this.process = new Process().deserialize(result[0]);
          } else {
            console.error('Unable to get action info');
            throwError('Unable to get action info');
          }

          // case data
          if (result[1]) {
            const caseDetails = new CaseInfoWithSchema().deserialize(result[1]);
            if (caseDetails.caseInfo.metadata.applicationId === this.applicationId.toString()) {
              const casedata = caseDetails.caseInfo.untaggedCasedataObj;
              this.caseState = casedata.state;
              // JS: use name rather than internalObjectName to handle appliction name change
              const caseTypeName = caseDetails.name;
              this.data = {
                [caseTypeName]: casedata
              };
            } else {
              console.error('The selected case is not the right case type for this action');
            }
          }

        }
      );
    }
  }

}
<div fxFill>
  <tcfrm-rendered-form *ngIf="process && !useLegacy" style="overflow: auto;" [formsFramework]="formsFramework" [customFormDefs]=customFormDefs [layout]="layout" [formRef]="process.formTag" [appId]="applicationId" [customFormDefs]="customFormDefs" [schema]="process.jsonSchema" [data]="data" [caseRef]="caseRef" [options]="options" (formSubmit)="handleSubmit($event, caseRef)"></tcfrm-rendered-form>
  <tcla-live-apps-legacy-process *ngIf="process && useLegacy && caseRef" [process]="{ process: process }" [type]="'action'" [applicationId]="applicationId" [typeId]="typeId" [caseRef]="caseRef" [caseState]="caseState" (processCancelled)="handleLegacyProcessCancelled()" (processComplete)="handleLegacyProcessComplete()" class="live-apps-widget" fxFill></tcla-live-apps-legacy-process>
</div>

./live-apps-action-standalone.component.css

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""