C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-case-action/live-apps-case-action.component.ts
Wraps rendering an execution of an action
<tcla-live-apps-case-action></tcla-live-apps-case-action>
selector | tcla-live-apps-case-action |
styleUrls | ./live-apps-case-action.component.css |
templateUrl | ./live-apps-case-action.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
constructor(lasvc: LiveAppsService, tcfcs: TcFormConfigService)
|
|||||||||
Parameters :
|
caseRef | |
Type : string
|
|
The case reference |
formsFramework | |
Type : string
|
|
legacyActions | |
Type : boolean
|
|
showHeader | |
Type : boolean
|
|
Whether to show the header bar in the widget - eg. favorites on home page (contains icon etc) - if off icons still appear without bar |
applicationId | |
Type : string
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:32
|
|
LA application ID |
customFormDefs | |
Type : CustomFormDefs
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:62
|
|
Custom Form configuration file |
dataOverride | |
Type : any
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:47
|
|
Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire) |
formConfig | |
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:53
|
formsFramework | |
Type : string
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:79
|
legacyCreators | |
Type : boolean
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:68
|
process | |
Type : LaProcessSelection
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:42
|
|
The process definition of the action or creator to execute |
sandboxId | |
Type : number
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:27
|
|
sandboxId - this comes from claims resolver |
typeId | |
Type : string
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:37
|
|
The LA Application Type Id (generally 1) |
caseChanged | |
Type : EventEmitter<ProcessId>
|
|
Inherited from
LiveAppsCaseCreatorComponent
|
|
Defined in
LiveAppsCaseCreatorComponent:89
|
|
~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
|
Private getMainCaseTypeFromSchema | |||||||||
getMainCaseTypeFromSchema(typeId: string, process: LaProcessSelection)
|
|||||||||
Parameters :
Returns :
CaseType
|
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
initialize |
initialize()
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:177
|
Returns :
void
|
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Inherited from
LiveAppsCaseCreatorComponent
|
||||||
Defined in
LiveAppsCaseCreatorComponent:195
|
||||||
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:169
|
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
|
actionFormWc |
Type : LiveAppsFormWcComponent
|
Decorators :
@ViewChild('actionFormWc', {static: false})
|
Private buildWcFormConfig |
Default value : () => {...}
|
Public cancelAction |
Default value : () => {...}
|
caseState |
Type : string
|
Public formsFramework |
Type : string
|
Default value : 'material-design'
|
Allow override of forms framework Options: bootstrap-4 or material-design |
Private getCaseData |
Default value : () => {...}
|
Public legacyActions |
Type : boolean
|
Default value : false
|
Enable legacy actions |
legacyProcessComponent |
Type : LiveAppsLegacyProcessComponent
|
Decorators :
@ViewChild(LiveAppsLegacyProcessComponent, {static: false})
|
originalData |
Type : any
|
selectedFormConfig |
Type : ProcessFormConfig
|
test |
Default value : () => {...}
|
wcFormConfig |
Type : LiveAppsFormConfig
|
data |
Type : any
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:91
|
Public formConfig |
Type : FormConfig
|
Default value : new FormConfig()
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:52
|
Custom Form Layout Configuration |
formRef |
Type : any
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:96
|
Public formsFramework |
Type : string
|
Default value : 'material-design'
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:78
|
Allow override of forms framework Options: bootstrap-4 or material-design |
Public handleFormOpen |
Default value : () => {...}
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:98
|
handleLegacyProcessCancelled |
Default value : () => {...}
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:156
|
handleLegacyProcessComplete |
Default value : () => {...}
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:149
|
handleSubmit |
Default value : () => {...}
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:102
|
isCustomForm |
Default value : false
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:95
|
layout |
Type : any[]
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:93
|
Public legacyCreators |
Type : boolean
|
Default value : false
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:67
|
Enable legacy creators |
options |
Type : any
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:94
|
schema |
Type : any
|
Inherited from
LiveAppsCaseCreatorComponent
|
Defined in
LiveAppsCaseCreatorComponent:92
|
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, OnChanges, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core';
import {LiveAppsCaseCreatorComponent} from '../live-apps-case-creator/live-apps-case-creator.component';
import {LiveAppsService} from '../../services/live-apps.service';
import {map, take, takeUntil} from 'rxjs/operators';
import {CaseType, ProcessId} from '../../models/liveappsdata';
import {LaProcessSelection} from '../../models/tc-case-processes';
import {LiveAppsLegacyProcessComponent} from '../live-apps-legacy-process/live-apps-legacy-process.component';
import {TcFormConfigService} from '../../services/tc-form-config.service';
import {LiveAppsFormConfig} from '../../models/tc-liveapps-form';
import {FormConfig, ProcessFormConfig} from '../../models/tc-liveapps-config';
import {LiveAppsFormWcComponent} from '../live-apps-form-wc/live-apps-form-wc.component';
/**
* Wraps rendering an execution of an action
*
*@example <tcla-live-apps-case-action></tcla-live-apps-case-action>
*/
@Component({
selector: 'tcla-live-apps-case-action',
templateUrl: './live-apps-case-action.component.html',
styleUrls: ['./live-apps-case-action.component.css']
})
export class LiveAppsCaseActionComponent extends LiveAppsCaseCreatorComponent implements OnInit, OnChanges {
/**
* The case reference
*/
@Input() caseRef: string;
/**
* Whether to show the header bar in the widget - eg. favorites on home page (contains icon etc) - if off icons still appear without bar
*/
@Input() showHeader: boolean;
/**
* 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;
}
}
@ViewChild(LiveAppsLegacyProcessComponent, {static: false}) legacyProcessComponent: LiveAppsLegacyProcessComponent;
@ViewChild('actionFormWc', {static: false}) actionFormWc: LiveAppsFormWcComponent;
originalData: any;
caseState: string;
wcFormConfig: LiveAppsFormConfig;
selectedFormConfig: ProcessFormConfig;
private getMainCaseTypeFromSchema(typeId: string, process: LaProcessSelection): CaseType {
let requestedType: CaseType;
process.appSchema.casetypes.forEach((cType) => {
if (cType.id === typeId) {
requestedType = cType;
}
});
return requestedType;
}
test = (event) => {
console.log(event);
}
private getCaseData = (caseRef) => {
// retrieve the case data for this case reference
this.data = undefined;
this.caseState = undefined;
this.liveapps.getCase(this.caseRef, this.sandboxId, this.applicationId, this.typeId )
.pipe(
take(1),
takeUntil(this._destroyed$)
)
.subscribe(result => {
if (result.metadata.applicationId === this.applicationId.toString()) {
const casedata = result.untaggedCasedataObj;
this.caseState = casedata.state;
this.originalData = {
[this.process.process.name]: casedata
};
// JS: use name rather than internalObjectName to handle appliction name change
const caseTypeName = this.getMainCaseTypeFromSchema(this.typeId, this.process).name;
this.data = {
[caseTypeName]: casedata
};
} else {
console.error('The selected case is not the right case type for this action');
}
}, error => {
// Emit any error retrieving case data to the parent
console.error('Unable to retrieve case data');
console.error(error);
});
}
public cancelAction = () => {
if (this.legacyProcessComponent) {
this.legacyProcessComponent.cancelProcess();
}
if (this.actionFormWc) {
this.actionFormWc.cancel();
}
if (this.formRef) {
// this.formRef.detail.form.destroy();
this.formRef.detail.form.invokeAction('cancel');
this.formRef = undefined;
}
}
constructor(protected lasvc: LiveAppsService, protected tcfcs: TcFormConfigService) {
super(lasvc, tcfcs);
}
private buildWcFormConfig = (process: LaProcessSelection, selectedFormConfig: ProcessFormConfig, caseRef: string) => {
this.wcFormConfig = new LiveAppsFormConfig().deserialize({
type: 'action',
id: process.action.id,
sandbox: this.sandboxId.toString(),
formDivId: 'actionDialogDiv',
useCustomForm: (selectedFormConfig && selectedFormConfig.externalForm) ? selectedFormConfig.externalForm.toString() : false,
name: process.action.name,
label: process.action.label,
version: process.action.version.toString(),
applicationId: process.action.applicationId,
applicationName: process.action.applicationName,
activityId: process.action.activityId,
activityName: process.action.activityName,
caseRef: caseRef,
formRef: process.ref
});
}
ngOnInit() {
// set default layout
// this.layout = [];
}
ngOnChanges(changes: SimpleChanges) {
// the extended class will detect change in the process and layout passed
super.ngOnChanges(changes);
// setup form config for WC forms
if (this.legacyActions && this.formConfig && this.process && this.caseRef) {
this.selectedFormConfig = TcFormConfigService.getProcessFormConfig(this.process.ref, this.formConfig);
this.buildWcFormConfig(this.process, this.selectedFormConfig, this.caseRef);
} else {
// non WC forms:
if (this.process && this.caseRef) {
this.getCaseData(this.caseRef);
}
}
}
}
<div class="tcs-case-action-pane" fxLayout="column" fxFill>
<tc-tibco-cloud-widget-header *ngIf="showHeader" fxFlex="nogrow" [headerText]="'Action'" [icon]="'tcs-case-action-item'"></tc-tibco-cloud-widget-header>
<tcfrm-rendered-form *ngIf="!wcFormConfig && data && process && (!legacyActions || isCustomForm)" [schema]="schema" [layout]="layout" [data]="data" [caseRef]="caseRef" [appId]="applicationId" [customFormDefs]="customFormDefs" [formsFramework]="formsFramework" [formRef]="process.ref" (formSubmit)="handleSubmit($event, caseRef)"></tcfrm-rendered-form>
<!--tcla-live-apps-legacy-process *ngIf="data && process && legacyActions && !isCustomForm" [process]="process" [caseState]="caseState" [type]="'action'" [applicationId]="applicationId" [typeId]="typeId" [caseRef]="caseRef" (processCancelled)="handleLegacyProcessCancelled()" (processComplete)="handleLegacyProcessComplete()" class="live-apps-widget" fxFill></tcla-live-apps-legacy-process-->
<!--div *ngIf="process && legacyActions && !isCustomForm">
<div class="live-apps-form" id="actionFormDiv"></div>
<tib-la-caseaction-form
[sandbox]="sandboxId"
[formDivId]="'actionFormDiv'"
[noData]="false"
[chatBotEnabled]="false"
[caseRef]="caseRef"
[id]="process.process.id"
[name]="process.action.name"
[label]="process.action.label"
[version]="process.action.version"
[applicationId]="process.action.applicationId"
[applicationName]="process.action.applicationName"
[activityId]="process.action.activityId"
[activityName]="process.action.activityName"
(formLoad) ="handleFormOpen($event)"
(formSubmit)="handleLegacyProcessComplete($event)"
(formCancel)="handleLegacyProcessCancelled($event)"
>
</tib-la-caseaction-form-->
<tcla-live-apps-form-wc #actionFormWc *ngIf="process && legacyActions && !isCustomForm && wcFormConfig" [config]="wcFormConfig" (completed)="handleLegacyProcessComplete($event)"></tcla-live-apps-form-wc>
</div>
./live-apps-case-action.component.css
.tcs-case-action-pane {
border-radius: 3px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.33);
background-color: #ffffff;
}
.tcs-case-action-header {
height: 40px;
border-radius: 3px 3px 0px 0px;
box-shadow: 0 1px 2px 0 #dedede;
padding-left: 20px;
padding-right: 20px;
}
.tcs-case-action-header-text {
margin-left: 10px;
font-family: Source Sans Pro;
font-size: 18px;
font-weight: 600;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: 0.3px;
}