File
Description
Component for displaying application properties and capturing their values.
Implements
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()
|
|
|
setData
|
setData(propertiesSource: PropertiesSource)
|
|
Parameters :
Name |
Type |
Optional |
Description |
propertiesSource |
PropertiesSource
|
|
|
|
showProperties
|
showProperties:
|
Default value : false
|
|
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">×</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 with directive