C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-settings-custom-forms/live-apps-settings-custom-forms.component.ts
Configuration of forms
<tcla-live-apps-settings-forms></tcla-live-apps-settings-forms>
selector | tcla-live-apps-settings-forms |
styleUrls | ./live-apps-settings-custom-forms.component.css |
templateUrl | ./live-apps-settings-custom-forms.component.html |
Properties |
|
Methods |
|
HostListeners |
constructor(route: ActivatedRoute, formConfigService: TcFormConfigService, snackBar: MatSnackBar)
|
||||||||||||
Parameters :
|
window:resize |
Arguments : '$event'
|
window:resize(event)
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:45
|
Public formConfigChange | ||||||
formConfigChange(formConfig: FormConfig)
|
||||||
Parameters :
Returns :
void
|
Public ngOnInit |
ngOnInit()
|
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
|
Public addRefFunction |
Default value : () => {...}
|
Public claims |
Type : Claim
|
deleteRefFunction |
Default value : () => {...}
|
Public formConfig |
Type : FormConfig
|
Public generalConfig |
Type : GeneralConfig
|
Public liveAppsConfig |
Type : LiveAppsConfig
|
Public newRef |
Type : FormRef
|
Default value : new FormRef()
|
Public runSaveFunction |
Default value : () => {...}
|
Public sandboxId |
Type : number
|
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, OnInit} from '@angular/core';
import {FormConfig, FormRef, LiveAppsConfig, ProcessFormConfig} from '../../models/tc-liveapps-config';
import {ActivatedRoute} from '@angular/router';
import {GeneralConfig, Claim, Sandbox, TibcoCloudNewElementComponent, RoleAttribute} from '@tibco-tcstk/tc-core-lib';
import {LiveAppsComponent} from '../live-apps-component/live-apps-component.component';
import { MatSnackBar } from '@angular/material/snack-bar';
import {TcFormConfigService} from '../../services/tc-form-config.service';
/**
* Configuration of forms
*
* 
*
*@example <tcla-live-apps-settings-forms></tcla-live-apps-settings-forms>
*/
@Component({
selector: 'tcla-live-apps-settings-forms',
templateUrl: './live-apps-settings-custom-forms.component.html',
styleUrls: ['./live-apps-settings-custom-forms.component.css']
})
export class LiveAppsSettingsCustomFormsComponent extends LiveAppsComponent implements OnInit {
public sandboxId: number;
public liveAppsConfig: LiveAppsConfig;
public generalConfig: GeneralConfig;
public formConfig: FormConfig;
public claims: Claim;
public newRef: FormRef = new FormRef();
constructor(protected route: ActivatedRoute, protected formConfigService: TcFormConfigService, protected snackBar: MatSnackBar) {
super();
}
public formConfigChange(formConfig: FormConfig) {
this.formConfig = formConfig;
this.runSaveFunction();
}
public ngOnInit() {
this.generalConfig = this.route.snapshot.data.laConfigHolder.generalConfig;
this.liveAppsConfig = this.route.snapshot.data.laConfigHolder.liveAppsConfig;
this.formConfig = this.route.snapshot.data.formConfig;
this.claims = this.route.snapshot.data.claims;
this.sandboxId = Number(this.claims.primaryProductionSandbox.id).valueOf();
}
public addRefFunction = (): void => {
this.formConfig = TcFormConfigService.setCustomFormTag(this.newRef, this.formConfig);
this.newRef = new FormRef();
}
deleteRefFunction = (config: ProcessFormConfig): void => {
this.formConfig = TcFormConfigService.unsetCustomFormTag(config.formTag, this.formConfig);
}
public runSaveFunction = (): void => {
this.formConfigService.updateFormConfig(this.sandboxId, this.generalConfig.uiAppId, this.formConfig, this.formConfig.id).subscribe(
result => {
this.snackBar.open('Live Apps form layout configuration settings saved', 'OK', {
duration: 3000
});
},
error => {
this.snackBar.open('Error saving form layout configuration', 'OK', {
duration: 3000
});
}
);
}
}
<div fxLayout="column" class="tcs-live-apps-settings-pane" fxFill>
<tc-tibco-cloud-widget-header style="height: 40px;" [icon]="'tcs-capabilities'" [headerText]="'Live Apps Custom Form Configuration'">
</tc-tibco-cloud-widget-header>
<div fxFlex style="padding: 20px;" fxLayout="column">
<div fxLayout="row" fxLayoutAlign="start start" fxLayoutGap="5px" style="height: 20px">
<p class="tcs-settings-text">Register formTags as custom forms:</p>
</div>
<div fxLayout="column" style="padding: 10px;">
<div *ngFor="let tag of formConfig.processFormConfigs">
<div class="existing-ref" *ngIf="tag.externalForm">
<div>{{tag.formTag}}</div>
<mat-icon (click)="deleteRefFunction(tag)" svgIcon="tcs-close-icon"></mat-icon>
</div>
</div>
<div class="new-ref">
<!-- Format of ref is <applicationName>.<applicationInternalName>.<processType>.<processName> -->
<mat-form-field>
<input matInput placeholder="applicationName" [(ngModel)]="newRef.applicationName">
</mat-form-field>
<div>.</div>
<mat-form-field>
<input matInput placeholder="applicationInternalName" [(ngModel)]="newRef.applicationInternalName">
</mat-form-field>
<div>.</div>
<mat-form-field>
<mat-select [(ngModel)]="newRef.processType" placeholder="processType">
<mat-option value="creator">creator</mat-option>
<mat-option value="action">action</mat-option>
<mat-option value="casedata">casedata</mat-option>
<mat-option value="workitem">workitem</mat-option>
</mat-select>
</mat-form-field>
<div>.</div>
<mat-form-field>
<input matInput [placeholder]="(newRef.processType && newRef.processType) === 'workitem' ? 'activity name' : 'process name'" [(ngModel)]="newRef.processName">
</mat-form-field>
<button mat-raised-button
[disabled]="!newRef ||
!newRef.applicationName ||
!newRef.applicationInternalName ||
!newRef.processType ||
!newRef.processName" class="add-ref-button" color="secondary"
(click)="addRefFunction()">Add</button>
</div>
</div>
<div fxFlex class="tcs-filler-panel"></div>
<div fxLayout="row" fxLayoutAlign="end end" fxLayoutGap="10px" style="min-height: 50px">
<button mat-raised-button color="primary" (click)="runSaveFunction()">Save</button>
</div>
</div>
</div>
./live-apps-settings-custom-forms.component.css
.tcs-live-apps-summary-cards-settings {
overflow: hidden;
}
.tcs-card-config-widget-pane {
overflow: hidden;
}
.tcs-settings-text {
font-family: Source Sans Pro;
font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: 0.3px;
}
.tcs-checkbox-label {
font-family: Source Sans Pro;
font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: 0.3px;
}
:host ::ng-deep .tcs-radio-label-content .mat-radio-label-content {
font-family: Source Sans Pro;
font-size: 14px;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.5;
letter-spacing: 0.3px;
}
.new-ref {
display: flex;
flex-direction: row;
align-items: center;
}
.new-ref div {
margin-left: 10px;
margin-right: 10px;
}
.add-ref-button {
height: 40px;
margin-left: 10px;
margin-right: 10px;
}
.existing-ref {
display: flex;
flex-direction: row;
align-items: center;
}
.existing-ref mat-icon {
height: 15px;
width: 15px;
margin-left: 5px;
}