File

src/app/shared/flo/properties/properties-dialog.component.ts

Description

Component for displaying application properties and capturing their values.

Implements

OnInit

Example

Metadata

encapsulation ViewEncapsulation.None
selector app-properties-dialog-content
styleUrls properties-dialog.component.scss
templateUrl properties-dialog.component.html

Index

Properties
Methods
Accessors

Constructor

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

Methods

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

Properties

propertiesFormGroup
propertiesFormGroup: FormGroup
Type : FormGroup
propertiesGroupModel
propertiesGroupModel: PropertiesGroupModel
Type : PropertiesGroupModel
showProperties
showProperties:
Default value : false
Public title
title: string
Type : string

Accessors

okDisabled
getokDisabled()
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';
import { FormGroup } from '@angular/forms';
import { Subscription } from 'rxjs';
import { PropertiesGroupModel } from '../support/properties-group-model';
import { Properties } from 'spring-flo';
import PropertiesSource = Properties.PropertiesSource;

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

  public title: string;

  propertiesGroupModel: PropertiesGroupModel;

  propertiesFormGroup: FormGroup;

  showProperties = false;

  constructor(private bsModalRef: BsModalRef
  ) {
    this.propertiesFormGroup = new FormGroup({});
  }

  handleOk() {
    this.propertiesGroupModel.applyChanges();
    this.bsModalRef.hide();
  }

  handleCancel() {
    this.bsModalRef.hide();
  }

  get okDisabled() {
    return !this.propertiesGroupModel
      || !this.propertiesFormGroup
      || this.propertiesFormGroup.invalid
      || !this.propertiesFormGroup.dirty;
  }

  ngOnInit() {
  }

  setData(propertiesSource: PropertiesSource) {
    this.propertiesGroupModel = new PropertiesGroupModel(propertiesSource);
    this.propertiesGroupModel.load();
    this.propertiesGroupModel.loadedSubject.subscribe();
  }

}
<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 ""