C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-case-creators/live-apps-case-creators.component.ts
Wraps case creator and case creator list
<tcla-live-apps-case-creators></tcla-live-apps-case-creators>
selector | tcla-live-apps-case-creators |
styleUrls | ./live-apps-case-creators.component.css |
templateUrl | ./live-apps-case-creators.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
constructor(liveapps: LiveAppsService, caseProcessesService: TcCaseProcessesService)
|
|||||||||
Parameters :
|
appId | |
Type : string
|
|
The LA Application Id |
sandboxId | |
Type : number
|
|
sandboxId - this comes from claims resolver |
typeId | |
Type : string
|
|
The LA Application Type Id (generally 1) |
window:resize |
Arguments : '$event'
|
window:resize(event)
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:45
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Public selectCreator | ||||||
selectCreator(creator: CaseCreator)
|
||||||
Parameters :
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
|
appSchema |
Type : CaseTypesList
|
caseActionList |
Type : Process[]
|
Public casecreators |
Type : CaseCreator[]
|
caseType |
Type : CaseType
|
Public errorMessage |
Type : string
|
Public refresh |
Default value : () => {...}
|
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
|
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild} from '@angular/core';
import {Subject} from 'rxjs';
import {LiveAppsService} from '../../services/live-apps.service';
import {map, take, takeUntil, tap} from 'rxjs/operators';
import {CaseCreator, CaseType, CaseTypesList, Process} from '../../models/liveappsdata';
import {LaProcessSelection} from '../../models/tc-case-processes';
import {LiveAppsComponent} from '../live-apps-component/live-apps-component.component';
import {TcCaseProcessesService} from '../../services/tc-case-processes.service';
import {CustomFormDefs} from '@tibco-tcstk/tc-forms-lib';
/**
* Wraps case creator and case creator list
*
*@example <tcla-live-apps-case-creators></tcla-live-apps-case-creators>
*/
@Component({
selector: 'tcla-live-apps-case-creators',
templateUrl: './live-apps-case-creators.component.html',
styleUrls: ['./live-apps-case-creators.component.css']
})
export class LiveAppsCaseCreatorsComponent extends LiveAppsComponent implements OnInit {
/**
* The LA Application Id
*/
@Input() appId: string;
/**
* The LA Application Type Id (generally 1)
*/
@Input() typeId: string;
/**
* sandboxId - this comes from claims resolver
*/
@Input() sandboxId: number;
/**
* ~event creatorClicked : Case Creator selected
* ~payload LaProcessSelection : LaProcessSelection object output when an action is clicked (ie. message to parent to run creator component)
*/
@Output() creatorClicked: EventEmitter<LaProcessSelection> = new EventEmitter<LaProcessSelection>();
public casecreators: CaseCreator[];
public errorMessage: string;
appSchema: CaseTypesList;
caseType: CaseType;
caseActionList: Process[];
constructor(protected liveapps: LiveAppsService, protected caseProcessesService: TcCaseProcessesService) {
super();
}
public refresh = () => {
this.caseProcessesService.getCaseCreators(this.sandboxId, this.appId, this.typeId)
.pipe(
take(1),
takeUntil(this._destroyed$)
).subscribe(
casecreators => {
this.casecreators = casecreators.creators;
if (this.casecreators.length === 1) {
this.selectCreator(this.casecreators[0]);
}
}, error => { this.errorMessage = 'Error retrieving case actions: ' + error.error.errorMsg; });
}
public selectCreator(creator: CaseCreator) {
this.caseProcessesService.getProcessDetails(null, this.appId, this.typeId, this.sandboxId, null, creator, 100).pipe(
take(1),
takeUntil(this._destroyed$),
tap(processDetails => {
if (!processDetails || !processDetails.process || (processDetails.process.jsonSchema.$schema === 'NOSCHEMA')) {
// This will be triggered when no form schema is available
// Typically happens when:
// 1) The form has elements that are not supported by the Live Apps API for form schemas such as participant selectors
// 2) The Live Apps application is legacy and has no form schema at all, redeploying the live apps application would fix this.
console.error('No schema available for this case type: The form may not be supported or you may need to update/re-deploy the live apps application. Alternatively use a custom form.');
}
}
)
)
.subscribe(processSchema => {
this.creatorClicked.emit(processSchema);
return processSchema;
}
, error => { this.errorMessage = 'Error retrieving case actions: ' + error.error.errorMsg; });
}
ngOnInit() {
this.refresh();
}
}
<div *ngIf="casecreators && casecreators.length > 1" fxFlex style="margin-left: 10px;">
<span class="tcs-case-creation-dialog-instruction">Select a case creator</span>
<mat-select #creatorSelector class="tcs-creator-selector-option" [disableOptionCentering]="true"
placeholder="Case Creators" (selectionChange)="selectCreator($event.value)">
<mat-option *ngFor="let creator of casecreators" [value]="creator">
<span>{{creator.label}}</span>
</mat-option>
</mat-select>
</div>
./live-apps-case-creators.component.css
:host ::ng-deep .tcs-creator-selector-option .mat-select-value span {
font-family: Source Sans Pro;
font-size: 16px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: 0.3px;
color: #0081cb;
}
:host ::ng-deep .tcs-creator-selector-option .mat-select-arrow-wrapper div {
color: #0081cb;
}
:host ::ng-deep .mat-select-value {
min-width: 100px;
max-width: 100%;
width: auto;
}
.tcs-creators-box {
width: 200px;
height: 44px;
box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.5);
background-color: #ffffff;
}
tcs-creator-selector-option {
width: 170px;
margin-left: 5px;
margin-right: 5px;
height: 20px;
background-color: #eeeeee;
padding-left: 20px;
padding-right: 20px;
height: 35px;
}
.tcs-case-creation-dialog-instruction {
font-family: Source Sans Pro;
font-size: 16px;
font-weight: 600;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: normal;
color:#727272;
}