Profile EditorFieldDefaultValue

Finalize Dialog DMP Fix Style
Put Error On Required Fields
Fix Parse DefaulValue false!="false"
This commit is contained in:
Diamantis Tziotzios 2019-02-08 12:31:22 +02:00
parent 17ce0ef455
commit 6620c6625a
8 changed files with 23 additions and 17 deletions

View File

@ -2,9 +2,11 @@
<!-- BooleanDecision --> <!-- BooleanDecision -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.BooleanDecision"> <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.BooleanDecision">
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required"> <mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
<mat-option value="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' | <mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' |
translate}}</mat-option> translate}}</mat-option>
<mat-option value="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO' | <mat-option [value]="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' |
translate}}</mat-option>
<mat-option [value]="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO' |
translate}}</mat-option> translate}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
@ -13,9 +15,9 @@
<!-- CheckBox --> <!-- CheckBox -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.CheckBox"> <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.CheckBox">
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required"> <mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
<mat-option value="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.CHECKED' | <mat-option [value]="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.CHECKED' |
translate}}</mat-option> translate}}</mat-option>
<mat-option value="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.UNCHECKED' | <mat-option [value]="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.UNCHECKED' |
translate}}</mat-option> translate}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
@ -27,6 +29,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.WordList"> <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.WordList">
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required"> <mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate }}</mat-option>
<mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option> <mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
@ -42,6 +45,7 @@
<!-- RadioBox --> <!-- RadioBox -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.RadioBox"> <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.RadioBox">
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required"> <mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate}}</mat-option>
<mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option> <mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>

View File

@ -13,9 +13,11 @@
<div *ngIf="datasetsDraft.length > 0"> <div *ngIf="datasetsDraft.length > 0">
<h4>{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4> <h4>{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
<mat-selection-list #datasetsDraftSelectionList [formControl]="this.formGroup.get('datasets')"> <mat-selection-list #datasetsDraftSelectionList [formControl]="this.formGroup.get('datasets')">
<mat-list-option class="styleBorder" *ngFor="let dataset of datasetsDraft; let len = length" [value]='dataset'> <div class="styleBorder" *ngFor="let dataset of datasetsDraft; let len = length">
<mat-list-option [value]='dataset'>
{{ dataset.label }} {{ dataset.label }}
</mat-list-option> </mat-list-option>
</div>
</mat-selection-list> </mat-selection-list>
</div> </div>
<mat-error *ngIf="formGroup.get('datasets').errors?.minLengthArray">{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED' <mat-error *ngIf="formGroup.get('datasets').errors?.minLengthArray">{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED'

View File

@ -1,5 +1,5 @@
.styleBorder { .styleBorder {
border: 1px solid lightgray; border: 0.2em solid lightgray;
border-radius: 0.5em; border-radius: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }

View File

@ -14,7 +14,7 @@ import { DatasetService } from '../../../../core/services/dataset/dataset.servic
@Component({ @Component({
selector: 'app-dmp-finalize-dialog-component', selector: 'app-dmp-finalize-dialog-component',
templateUrl: 'dmp-finalize-dialog.component.html', templateUrl: 'dmp-finalize-dialog.component.html',
styleUrls: ['./dmp-finalize-dialog.component.scss']
}) })
export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit { export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit {

View File

@ -48,17 +48,16 @@
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.BooleanDecision" class="col-12"> <div *ngSwitchCase="datasetProfileFieldViewStyleEnum.BooleanDecision" class="col-12">
<mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value"> <mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="true">Yes</mat-radio-button> <mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="true">Yes</mat-radio-button>
<!-- <br> -->
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="false">No</mat-radio-button> <mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="false">No</mat-radio-button>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-radio-group> </mat-radio-group>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</div> </div>
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.RadioBox" class="col-12"> <div *ngSwitchCase="datasetProfileFieldViewStyleEnum.RadioBox" class="col-12">
<mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value"> <mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
<mat-radio-button *ngFor="let option of form.get('data').value.options let index = index" class="radio-button-item" <mat-radio-button *ngFor="let option of form.get('data').value.options let index = index" class="radio-button-item"
[value]="option.value">{{option.label}}</mat-radio-button> [value]="option.value">{{option.label}}</mat-radio-button>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-radio-group> </mat-radio-group>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@
} }
} }
.styleBorder{ .styleBorder{
border: 1px solid lightgray; border: 0.2em solid lightgray;
border-radius: 0.5em; border-radius: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }

View File

@ -117,7 +117,7 @@ export class VisibilityRulesService {
} }
private resetFieldFormGroup(formGroup: FormGroup) { private resetFieldFormGroup(formGroup: FormGroup) {
formGroup.get('value').setValue(formGroup.get('defaultValue').value ? formGroup.get('defaultValue').value.value : undefined); formGroup.get('value').setValue(formGroup.get('defaultValue').value ? this.parseValue(formGroup.get('defaultValue').value.value) : undefined);
} }
private resetCompositeFieldFormGroup(formGroup: FormGroup) { private resetCompositeFieldFormGroup(formGroup: FormGroup) {

View File

@ -3,7 +3,7 @@
"VALIDATION": { "VALIDATION": {
"REQUIRED": "Required", "REQUIRED": "Required",
"PROJECT-START-AFTER-END": "Project start date cannot be after the end date", "PROJECT-START-AFTER-END": "Project start date cannot be after the end date",
"PATTERN-_":"Caracter \"_\" is not allowed" "PATTERN-_": "Caracter \"_\" is not allowed"
}, },
"DELETE-CONFIRMATION": { "DELETE-CONFIRMATION": {
"TITLE": "Warning", "TITLE": "Warning",
@ -18,8 +18,8 @@
"SUCCESSFUL-LOGOUT": "Successful Logout", "SUCCESSFUL-LOGOUT": "Successful Logout",
"UNSUCCESSFUL-LOGOUT": "Unsuccessful Logout", "UNSUCCESSFUL-LOGOUT": "Unsuccessful Logout",
"UNSUCCESSFUL-LOGIN": "Unsuccessful Login", "UNSUCCESSFUL-LOGIN": "Unsuccessful Login",
"SUCCESSFUL-DATASET-PROFILE-DELETE":"Successful Delete", "SUCCESSFUL-DATASET-PROFILE-DELETE": "Successful Delete",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE":"This profile can not deleted, because Datasets are associated with it" "UNSUCCESSFUL-DATASET-PROFILE-DELETE": "This profile can not deleted, because Datasets are associated with it"
}, },
"ERRORS": { "ERRORS": {
"HTTP-REQUEST-ERROR": "An Unexpected Error Has Occured" "HTTP-REQUEST-ERROR": "An Unexpected Error Has Occured"
@ -138,9 +138,10 @@
"FIELD-AUTOCOMPLETE-OPTIONS-ROOT": "Options Root" "FIELD-AUTOCOMPLETE-OPTIONS-ROOT": "Options Root"
}, },
"DEFAULT-VALUES": { "DEFAULT-VALUES": {
"NONE": "None",
"BOOLEAN-DECISION": { "BOOLEAN-DECISION": {
"YES": "YES", "YES": "Yes",
"NO": "NO" "NO": "No"
}, },
"CHECK-BOX": { "CHECK-BOX": {
"CHECKED": "Checked", "CHECKED": "Checked",