File

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

Description

Configuration of forms

alt-text

Extends

LiveAppsComponent

Implements

OnInit

Example

<tcla-live-apps-settings-forms></tcla-live-apps-settings-forms>

Metadata

selector tcla-live-apps-settings-forms
styleUrls ./live-apps-settings-custom-forms.component.css
templateUrl ./live-apps-settings-custom-forms.component.html

Index

Properties
Methods
HostListeners

Constructor

constructor(route: ActivatedRoute, formConfigService: TcFormConfigService, snackBar: MatSnackBar)
Parameters :
Name Type Optional
route ActivatedRoute No
formConfigService TcFormConfigService No
snackBar MatSnackBar No

HostListeners

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

Methods

Public formConfigChange
formConfigChange(formConfig: FormConfig)
Parameters :
Name Type Optional
formConfig FormConfig No
Returns : void
Public 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

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
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
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
 *
 * ![alt-text](../live-apps-settings-forms.png "")
 *
 *@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;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""