dataset profile editor fix delete section in section
dataset profile fix validation for save
This commit is contained in:
parent
8c5c57375a
commit
7a60c3a435
|
@ -74,8 +74,8 @@ public class DatasetProfileController extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json")
|
||||
public ResponseEntity<Object> getDataForAutocomplete(@RequestBody RequestItem<AutoCompleteLookupItem> lookupItem) throws XPathExpressionException {
|
||||
eu.eudat.data.entities.Dataset dataset = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = DatasetProfileManager.queryForField(dataset.getProfile().getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(lookupItem.getCriteria().getProfileID()));
|
||||
eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field modelfield = DatasetProfileManager.queryForField(datasetProfile.getDefinition(), lookupItem.getCriteria().getFieldID());
|
||||
AutoCompleteData data = (AutoCompleteData) modelfield.getData();
|
||||
List<Tuple<String, String>> items = DatasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(items);
|
||||
|
|
|
@ -31,7 +31,8 @@ public class Field implements ViewStyleDefinition<eu.eudat.models.data.entities.
|
|||
case 1:
|
||||
return REQUIRED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Status");
|
||||
return NONE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
public ordinal: number;
|
||||
public visible: VisibilityEditorModel = new VisibilityEditorModel();
|
||||
public data: FieldDataEditorModel<any>;
|
||||
public validations: ValidationType[];
|
||||
public validations: ValidationType[] = [];
|
||||
|
||||
fromModel(item: Field): FieldEditorModel {
|
||||
this.id = item.id;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<mat-expansion-panel-header>
|
||||
<div class="row">
|
||||
<span class="col">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</span>
|
||||
<button mat-icon-button type="button" class="col-auto" (click)="deleteFieldSet(i);">
|
||||
<button mat-icon-button type="button" class="col-auto" (click)="DeleteSectionInSection(i);">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<mat-step class="step-container">
|
||||
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
|
||||
<div *ngIf="this.isActiveStep(2)" class="row">
|
||||
<app-dataset-description-form class="col-12" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel.datasetProfileDefinition"></app-dataset-description-form>
|
||||
<app-dataset-description-form class="col-12" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel.datasetProfileDefinition" [datasetProfileId]="formGroup.get('profile').value"></app-dataset-description-form>
|
||||
<div class="col-12 description-action-row">
|
||||
<div class="row">
|
||||
<div class="col-auto"><button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button></div>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<h6 *ngIf="compositeField.extendedDescription" class="col-12">
|
||||
<i>{{compositeField.extendedDescription}}</i>
|
||||
</h6>
|
||||
<app-form-field class="col-12" [field]="compositeField.fields[0]"></app-form-field>
|
||||
<app-form-field class="col-12" [field]="compositeField.fields[0]" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="compositeField.fields.length > 1" class="col-12">
|
||||
|
@ -31,10 +31,10 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
<app-form-field [field]="field" class="col-12"></app-form-field>
|
||||
<app-form-field [field]="field" class="col-12" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
<div *ngIf="field" class="col-12">
|
||||
<div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn" class="row">
|
||||
<app-form-field class="col-12" [field]="multipleField"></app-form-field>
|
||||
<app-form-field class="col-12" [field]="multipleField" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,6 +11,7 @@ import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.
|
|||
export class FormCompositeFieldComponent implements OnInit {
|
||||
|
||||
@Input() compositeField: DatasetDescriptionCompositeFieldEditorModel;
|
||||
@Input() datasetProfileId: String;
|
||||
form: FormGroup;
|
||||
trackByFn = (index, item) => item ? item['id'] : null;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.
|
|||
})
|
||||
export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||
@Input() field: Field;
|
||||
@Input() datasetProfileId: String;
|
||||
form: FormGroup;
|
||||
|
||||
change: Subscription;
|
||||
|
@ -59,8 +60,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
const autocompleteRequestItem: RequestItem<DatasetExternalAutocompleteCriteria> = new RequestItem();
|
||||
autocompleteRequestItem.criteria = new DatasetExternalAutocompleteCriteria();
|
||||
autocompleteRequestItem.criteria.fieldID = this.field.id;
|
||||
//TODO: why do we need dataset id?
|
||||
//autocompleteRequestItem.criteria.profileID = this.datasetId;
|
||||
autocompleteRequestItem.criteria.profileID = this.datasetProfileId;
|
||||
return this.datasetExternalAutocompleteService.queryAutocomplete(autocompleteRequestItem);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
Add one more fieldset +
|
||||
</button>
|
||||
</div>
|
||||
<app-form-composite-field class="col-12" [compositeField]="compositeField"></app-form-composite-field>
|
||||
<app-form-composite-field class="col-12" [compositeField]="compositeField" [datasetProfileId]="datasetProfileId"></app-form-composite-field>
|
||||
<div *ngIf="compositeField" class="col-12">
|
||||
<div class="row">
|
||||
<app-form-composite-field class="col-12" *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn" [compositeField]="multipleCompositeField"></app-form-composite-field>
|
||||
<app-form-composite-field class="col-12" *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"
|
||||
[compositeField]="multipleCompositeField" [datasetProfileId]="datasetProfileId"></app-form-composite-field>
|
||||
<mat-form-field *ngIf="compositeField.hasCommentField" class="col-12" [formGroup]="form.get('compositeFields').get(''+i)">
|
||||
<input matInput formControlName="commentFieldValue" placeholder="comment">
|
||||
</mat-form-field>
|
||||
|
@ -35,7 +36,7 @@
|
|||
</div>
|
||||
<div *ngIf="section?.sections" class="col-12">
|
||||
<div *ngFor="let itemsection of section.sections; let j = index;" class="row">
|
||||
<app-form-section class="col-12" [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></app-form-section>
|
||||
<app-form-section class="col-12" [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j" [datasetProfileId]="datasetProfileId"></app-form-section>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
|
|
@ -12,6 +12,7 @@ import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.
|
|||
})
|
||||
export class FormSectionComponent implements OnInit, AfterViewInit {
|
||||
|
||||
@Input() datasetProfileId: String;
|
||||
@Input() section: DatasetDescriptionSectionEditorModel;
|
||||
form: FormGroup;
|
||||
@Input() pathName: string;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<mat-step [stepControl]="section">
|
||||
<ng-template matStepLabel>{{page.title}}</ng-template>
|
||||
<div *ngIf="stepper.selectedIndex == z" class="row">
|
||||
<app-form-section class="col-12" [section]="section" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i"></app-form-section>
|
||||
<app-form-section class="col-12" [section]="section" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i" [datasetProfileId]="datasetProfileId"></app-form-section>
|
||||
</div>
|
||||
</mat-step>
|
||||
</div>
|
||||
|
|
|
@ -32,6 +32,7 @@ export class DatasetDescriptionFormComponent extends BaseComponent implements On
|
|||
@Input() dataModel: DatasetProfileDefinitionModel;
|
||||
@Input() path: string;
|
||||
@Input() form: FormGroup;
|
||||
@Input() datasetProfileId: String;
|
||||
id: string;
|
||||
trackByFn = (index, item) => item ? item['id'] : null;
|
||||
pageTrackByFn = (index, item) => item['id'];
|
||||
|
|
|
@ -52,7 +52,7 @@ export class VisibilityRulesService {
|
|||
|
||||
public updateValueAndVisibility(id: string) {
|
||||
const visibilityRules = this.visibilityRuleContext.rules.filter(item => item.sourceVisibilityRules.filter(source => source.sourceControlId === id).length > 0);
|
||||
visibilityRules.forEach(item => this.evaluateVisibility(item));
|
||||
//visibilityRules.forEach(item => this.evaluateVisibility(item));
|
||||
}
|
||||
|
||||
private evaluateVisibility(visibilityRule: VisibilityRule) {
|
||||
|
|
Loading…
Reference in New Issue