multiplicity admin/front-end

This commit is contained in:
annampak 2017-12-13 14:57:19 +02:00
parent b9fa3d1dac
commit d4cf2294b2
5 changed files with 18 additions and 10 deletions

View File

@ -22,6 +22,9 @@ export class CompositeFieldFormComponent {
ngOnInit() { ngOnInit() {
//this.addNewField(); //this.addNewField();
if(this.form.get("multiplicity"))
if (this.form.get("multiplicity").value.min >1 || this.form.get("multiplicity").value.max >1 )
this.isMultiplicityEnabled= true;
this.isComposite = this.dataModel.fields.length > 1; this.isComposite = this.dataModel.fields.length > 1;
} }

View File

@ -23,6 +23,9 @@ export class FieldFormComponent {
constructon() { } constructon() { }
ngOnInit() { ngOnInit() {
if(this.form.get("multiplicity"))
if (this.form.get("multiplicity").value.min >1 || this.form.get("multiplicity").value.max >1)
this.isFieldMultiplicityEnabled = true;
// this.addNewRule(); // this.addNewRule();
} }

View File

@ -2,7 +2,7 @@
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [form]="form.get('fields').get(''+0)" <df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [form]="form.get('fields').get(''+0)"
[pathName]="pathName+'.fields.'+0"></df-field> [pathName]="pathName+'.fields.'+0"></df-field>
<div *ngIf="compositeField.fields.length > 1" class="fieldset-component"> <div *ngIf="compositeField.fields.length > 1" class="fieldset-component">
<h4 *ngIf="compositeField.title">{{compositeField.title}}</h4> <h4 *ngIf="compositeField.title">{{compositeField.title}}</h4>
@ -12,15 +12,17 @@
<i>{{compositeField.extendedDescription}}</i> <i>{{compositeField.extendedDescription}}</i>
</h4> </h4>
<div *ngFor="let field of compositeField.fields; let i = index;"> <div *ngFor="let field of compositeField.fields; let i = index;">
<div *ngIf="(field?.multiplicity?.max - 1) > (field?.multiplicityItems?.length)"> <div *ngIf="visibilityRulesService.isElementVisible(null,field.id)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <div *ngIf="(field?.multiplicity?.max - 1) > (field?.multiplicityItems?.length)">
Add one more field + <a (click)="addMultipleField(i)" style="cursor: pointer">
</a> Add one more field +
</a>
</div>
</div> </div>
<df-field [field]="field" [form]="form.get('fields').get(''+i)" [pathName]="pathName+'.fields.'+i"></df-field>
<df-field [field]="field" [form]="form.get('fields').get(''+i)" [pathName]="pathName+'.fields.'+i"></df-field>
<div *ngFor="let multipleField of field.multiplicityItems; let j = index;"> <div *ngFor="let multipleField of field.multiplicityItems; let j = index;">
<df-field [field]="multipleField" [form]="form.get('fields').get(''+i).get('multiplicityItems').get(''+j)" <df-field [field]="multipleField" [form]="form.get('fields').get(''+i).get('multiplicityItems').get(''+j)" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field>
[pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
<div *ngIf="visibilityRulesService.isElementVisible(null,compositeField.id)"> <div *ngIf="visibilityRulesService.isElementVisible(null,compositeField.id)">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)"> <div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more field + Add one more fieldset +
</a> </a>
</div> </div>
</div> </div>

View File

@ -18,7 +18,7 @@ export class RestBase {
protocol: string = "http"; protocol: string = "http";
hostname: string ="localhost" hostname: string ="192.168.32.103"
port: number = 8080; port: number = 8080;
webappname: string = "dmp-backend"; webappname: string = "dmp-backend";