C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-action-standalone/live-apps-action-standalone.component.ts
Handles rendering of case action.
LiveAppsCreatorStandaloneComponent
<tcla-live-apps-action-standalone></tcla-live-apps-action-standalone>
| selector | tcla-live-apps-action-standalone |
| styleUrls | ./live-apps-action-standalone.component.css |
| templateUrl | ./live-apps-action-standalone.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
| 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
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:30
|
|
|
LA application ID |
|
| customFormTag | |
Type : string
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:50
|
|
|
Custom Form tag if using an external form app |
|
| dataOverride | |
Type : any
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:45
|
|
|
Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire) |
|
| formsFramework | |
Type : string
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:72
|
|
| layout | |
Type : any[]
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:55
|
|
|
Custom Form Layout |
|
| legacyCreators | |
Type : boolean
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:61
|
|
| processName | |
Type : string
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:40
|
|
|
The process definition of the action or creator to execute |
|
| sandboxId | |
Type : number
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:25
|
|
|
sandboxId - this comes from claims resolver |
|
| typeId | |
Type : string
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:35
|
|
|
The LA Application Type Id (generally 1) |
|
| caseCreated | |
Type : EventEmitter<ProcessId>
|
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
|
Defined in
LiveAppsCreatorStandaloneComponent:82
|
|
|
~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) |
|
| window:resize |
Arguments : '$event'
|
window:resize(event)
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:45
|
| ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
|
Parameters :
Returns :
void
|
| ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
||||||
|
Defined in
LiveAppsCreatorStandaloneComponent:161
|
||||||
|
Parameters :
Returns :
void
|
| ngOnInit |
ngOnInit()
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:153
|
|
Returns :
void
|
| ngAfterViewInit |
ngAfterViewInit()
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:91
|
|
Returns :
void
|
| ngOnDestroy |
ngOnDestroy()
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:99
|
|
Returns :
void
|
| ngOnInit |
ngOnInit()
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:104
|
|
Returns :
void
|
| setupWidthObserver |
setupWidthObserver()
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:70
|
|
Returns :
void
|
| 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
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:88
|
| data |
Type : any
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:84
|
| Public formsFramework |
Type : string
|
Default value : 'material-design'
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:71
|
|
Allow override of forms framework Options: bootstrap-4 or material-design |
| handleLegacyProcessCancelled |
Default value : () => {...}
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:143
|
| handleLegacyProcessComplete |
Default value : () => {...}
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:138
|
| handleSubmit |
Default value : () => {...}
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:91
|
| isCustomForm |
Default value : false
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:87
|
| Public legacyCreators |
Type : boolean
|
Default value : false
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:60
|
|
Enable legacy creators |
| options |
Type : any
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:85
|
| process |
Type : Process
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:86
|
| useLegacy |
Default value : false
|
|
Inherited from
LiveAppsCreatorStandaloneComponent
|
|
Defined in
LiveAppsCreatorStandaloneComponent:89
|
| Protected _destroyed$ |
Default value : new Subject()
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:39
|
| componentChildDivs |
Type : LiveAppsComponent[]
|
Decorators :
@ViewChildren('componentChildDiv')
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:36
|
| componentDiv |
Type : ElementRef
|
Decorators :
@ViewChild('componentDiv', {static: false})
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:35
|
| Protected containerChanges$ |
Type : Observable<TcComponent>
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:40
|
| Private observer |
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:42
|
| Public resize |
Default value : () => {...}
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:56
|
| Public widget |
Type : TcComponent
|
|
Inherited from
LiveAppsComponent
|
|
Defined in
LiveAppsComponent:41
|
| LegacyActions | ||||||
setLegacyActions(legacyActions: boolean)
|
||||||
|
Parameters :
Returns :
void
|
| FormsFramework | ||||||
setFormsFramework(formsFramework: string)
|
||||||
|
Parameters :
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