File

src/app/tasks/components/flo/properties/task-properties-dialog-component.ts

Description

Component for displaying application properties and capturing their values.

Extends

PropertiesDialogComponent

Example

Metadata

encapsulation ViewEncapsulation.None
selector app-task-properties-dialog-content
styleUrls .../../../shared/flo/properties/properties-dialog.component.scss
templateUrl ../../../../shared/flo/properties/properties-dialog.component.html

Index

Properties
Methods

Constructor

constructor(bsModalRef: BsModalRef)
Parameters :
Name Type Optional Description
bsModalRef BsModalRef

Methods

setData
setData(propertiesSource: PropertiesSource)
Parameters :
Name Type Optional Description
propertiesSource PropertiesSource
Returns : void

Properties

Public title
title: string
Type : string
import { Component, ViewEncapsulation } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';
import { Properties } from 'spring-flo';
import { Validators } from '@angular/forms';
import { PropertiesDialogComponent } from '../../../../shared/flo/properties/properties-dialog.component';
import { PropertiesGroupModel } from '../../../../shared/flo/support/properties-group-model';
import { AppUiProperty } from '../../../../shared/flo/support/app-ui-property';
import PropertiesSource = Properties.PropertiesSource;


/**
 * Utility class for working with Properties.
 *
 * @author Alex Boyko
 * @author Andy Clement
 */
class TaskPropertiesGroupModel extends PropertiesGroupModel {

  protected createControlModel(property: AppUiProperty): Properties.ControlModel<any> {
    const inputType = Properties.InputType.TEXT;
    let validation: Properties.Validation;
    if (property.isSemantic) {
      return super.createControlModel(property);
    } else {
      // Notational properties
      if (property.id === 'label') {
        validation = {
          validator: Validators.pattern(/^[\w_]+[\w_-]*$/),
          errorData: [
            {id: 'pattern', message: 'Invalid app label!'}
          ]
        };
      }
    }
    return new Properties.GenericControlModel(property, inputType, validation);
  }

}

/**
 * Component for displaying application properties and capturing their values.
 *
 * @author Alex Boyko
 * @author Andy Clement
 */
@Component({
  selector: 'app-task-properties-dialog-content',
  templateUrl: '../../../../shared/flo/properties/properties-dialog.component.html',
  styleUrls: [ '../../../../shared/flo/properties/properties-dialog.component.scss' ],
  encapsulation: ViewEncapsulation.None
})
export class TaskPropertiesDialogComponent extends PropertiesDialogComponent {

  public title: string;

  constructor(bsModalRef: BsModalRef) {
    super(bsModalRef);
  }

  setData(propertiesSource: PropertiesSource) {
    this.propertiesGroupModel = new TaskPropertiesGroupModel(propertiesSource);
    this.propertiesGroupModel.load();
  }

}
<div class="modal-header">
  <h4 class="modal-title pull-left">{{ title }}</h4>
  <button type="button" class="close pull-right" aria-label="Close" (click)="handleCancel()">
    <span aria-hidden="true">&times;</span>
  </button>
</div>
<form name="app-properties" (submit)="handleOk()" class="modal-body app-properties">
  <div *ngIf="propertiesGroupModel && !propertiesGroupModel.isLoading">

    <div *ngIf="propertiesGroupModel.getControlsModels().length > 50 && !showProperties"
         class="dataflow-alert dataflow-alert-info" style="display: block">
      <p style="padding-bottom: 5px;">
        There are <strong>more than 50 properties</strong> to display, the UI can be slow.<br>Do you want to
        <strong>display all the properties</strong> ?
      </p>
      <button class="btn btn-primary" (click)="showProperties = true">Show all the properties</button>
    </div>

    <div *ngIf="propertiesGroupModel.getControlsModels().length <= 50 || showProperties">

      <properties-group *ngIf="propertiesGroupModel" [propertiesGroupModel]="propertiesGroupModel"
                        [form]="propertiesFormGroup"></properties-group>
    </div>
  </div>

  <div *ngIf="!propertiesGroupModel || propertiesGroupModel.isLoading"
       style="padding-bottom: 20px;padding-left:10px;padding-top: 10px;">
    <app-loader></app-loader>
  </div>

  <div class="modal-footer">
    <button type="button" class="btn btn-default" (click)="handleCancel()">Close</button>
    <button type="submit" class="btn btn-primary" [disabled]="okDisabled">OK</button>
  </div>
</form>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""