From 2bc57251e01b090cc78b5420fda60b4fe1950dc7 Mon Sep 17 00:00:00 2001 From: annampak Date: Thu, 11 Jan 2018 13:15:15 +0200 Subject: [PATCH 1/2] no message --- .../dataset-wizard.component.html | 2 +- .../dynamic-form-section.html | 2 +- .../dynamic-form-section.ts | 12 +++++----- .../pprogress-bar/progress-bar.component.ts | 23 ++++++++++--------- .../visibility-rules.service.ts | 12 +++++++++- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html index be5dc53cd..e24a9eab4 100644 --- a/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/dataset-wizard/dataset-wizard.component.html @@ -28,7 +28,7 @@ {{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}
- +
diff --git a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html index 6db1d3053..4138caa48 100644 --- a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html +++ b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html @@ -53,7 +53,7 @@ -->
-
+
Add one more fieldset + diff --git a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts index c87a41890..9f5668b7e 100644 --- a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts +++ b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.ts @@ -19,7 +19,7 @@ export class DynamicFormSectionComponent implements OnInit { @Input() form: FormGroup; @Input() pathName: string; @Input() path: string; - constructor(private visibilityRulesService:VisibilityRulesService) { } + constructor(private visibilityRulesService: VisibilityRulesService) { } ngOnInit() { console.log(this.section); @@ -31,11 +31,11 @@ export class DynamicFormSectionComponent implements OnInit { ((this.form.get("compositeFields").get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm()); } - isVisible(fieldSet:CompositeField):boolean{ - if(!this.visibilityRulesService.isElementVisible(null,fieldSet.id)) return false; - for(var i=0; i { - let control = form.controls[key] - if (control instanceof FormGroup) - { value += this.getFormControlDepthLength(control);} + let control = form.controls[key]; + if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) { let formArray = (control); for (let i = 0; i < formArray.length; i++) { - value += this.getFormControlDepthLength(formArray.get("" + i)) + if (formArray.get("" + i).value && this.visibilityRulesService.isElementVisible(null, formArray.get("" + i).value.id)) + value += this.getFormControlDepthLength(formArray.get("" + i)) } } - else if (key === "value" && this.visibilityRulesService.isElementVisible(null, form.controls["id"].value)) value++; + else if (key === "value" && this.visibilityRulesService.isElementVisible(null, form.controls["id"].value)) + value++; }); return value; } diff --git a/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts b/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts index e4e52b35a..c77a8dc46 100644 --- a/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts +++ b/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts @@ -17,7 +17,8 @@ export class VisibilityRulesService { if (this.checkElementVisibility(visibilityRule)) { return true } else { - if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null) + this.clearValues(pathKey) + // if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null) return false; } } @@ -40,4 +41,13 @@ export class VisibilityRulesService { private getParentPath(parentId: string): string { return ''; } + + private clearValues(pathKey) { + if (pathKey && this.formGroup.get(pathKey + '.value')) this.formGroup.get(pathKey + '.value').patchValue(null) + if (pathKey && this.formGroup.get(pathKey)["controls"].fields){ + for (var i = 0; i < this.formGroup.get(pathKey)["controls"].fields.length; i++) + this.clearValues(pathKey+'.fields.'+i); + } + + } } \ No newline at end of file From d621ef687db0fa60c5d3ad9536a2d577eb198ef2 Mon Sep 17 00:00:00 2001 From: annampak Date: Thu, 11 Jan 2018 18:14:23 +0200 Subject: [PATCH 2/2] progress bar, comment field --- dmp-admin/src/app/services/rest-base.ts | 2 +- .../src/app/datasets/dataset-listing.component.scss | 2 +- .../dynamic-form-composite-field.ts | 10 ---------- .../dynamic-form-section/dynamic-form-section.html | 8 +++++++- .../app/form/pprogress-bar/progress-bar.component.ts | 2 +- dmp-frontend/src/app/models/CompositeField.ts | 5 ++++- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dmp-admin/src/app/services/rest-base.ts b/dmp-admin/src/app/services/rest-base.ts index 039c1f877..057c0e0bb 100644 --- a/dmp-admin/src/app/services/rest-base.ts +++ b/dmp-admin/src/app/services/rest-base.ts @@ -18,7 +18,7 @@ export class RestBase { /* */ protocol: string = "http"; - hostname: string = "192.168.32.171"; + hostname: string = "192.168.32.96"; port: number = 8080; webappname: string = ""; restpath: string = ""; diff --git a/dmp-frontend/src/app/datasets/dataset-listing.component.scss b/dmp-frontend/src/app/datasets/dataset-listing.component.scss index 988f94bd2..7ef472931 100644 --- a/dmp-frontend/src/app/datasets/dataset-listing.component.scss +++ b/dmp-frontend/src/app/datasets/dataset-listing.component.scss @@ -35,5 +35,5 @@ mat-row:hover { // } mat-row:nth-child(odd){ - background-color: #f1f1f1; + background-color:#eef0fb; } \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts index 9c2ef8c34..e338d8880 100644 --- a/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts +++ b/dmp-frontend/src/app/form/dynamic-form-composite-field/dynamic-form-composite-field.ts @@ -23,16 +23,6 @@ export class DynamicFormCompositeFieldComponent implements OnInit { ngOnInit() { console.log(this.form); - if (this.compositeField.hasCommentField == true) { - let newfield: Field = new Field(); - newfield.id = 'comment_' + this.compositeField.id; - newfield.data = {label: "Comments"}; - newfield.viewStyle = {renderStyle: 'freetext', cssClass: ''}; - newfield.validations = ["None"] - - this.compositeField.fields.push(newfield); - (this.form.get("fields")).push(newfield.buildForm()); - } } addMultipleField(fieldIndex: number) { diff --git a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html index 4138caa48..25d62b9ab 100644 --- a/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html +++ b/dmp-frontend/src/app/form/dynamic-form-section/dynamic-form-section.html @@ -38,7 +38,7 @@ - {{path}} {{section.title}} + {{path}} {{section.title}}

{{section.description}}

@@ -65,6 +65,12 @@ [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j">
+
+ + + + +
diff --git a/dmp-frontend/src/app/form/pprogress-bar/progress-bar.component.ts b/dmp-frontend/src/app/form/pprogress-bar/progress-bar.component.ts index 02651743b..58f757f96 100644 --- a/dmp-frontend/src/app/form/pprogress-bar/progress-bar.component.ts +++ b/dmp-frontend/src/app/form/pprogress-bar/progress-bar.component.ts @@ -44,7 +44,7 @@ export class ProgressBarComponent implements OnInit { value += this.countFormControlsWithValue(formArray.get("" + i)) } } - else if (key === "value" && control.value != null) value++; + else if (key === "value" && control.value != null && control.value != "") value++; }); return value; } diff --git a/dmp-frontend/src/app/models/CompositeField.ts b/dmp-frontend/src/app/models/CompositeField.ts index a59fb2cc5..c91f9f504 100644 --- a/dmp-frontend/src/app/models/CompositeField.ts +++ b/dmp-frontend/src/app/models/CompositeField.ts @@ -14,6 +14,7 @@ export class CompositeField extends BaseModel implements Serializable();