From 7a60c3a435787cbc7cca5b927e9007c75922feed Mon Sep 17 00:00:00 2001 From: dtziotzios Date: Mon, 28 Jan 2019 14:18:48 +0200 Subject: [PATCH] dataset profile editor fix delete section in section dataset profile fix validation for save --- .../eu/eudat/controllers/DatasetProfileController.java | 4 ++-- .../data/admin/components/datasetprofile/Field.java | 3 ++- .../ui/admin/dataset-profile/admin/field-editor-model.ts | 2 +- .../dataset-profile-editor-section.component.html | 2 +- .../dataset/dataset-wizard/dataset-wizard.component.html | 2 +- .../form-composite-field.component.html | 6 +++--- .../form-composite-field.component.ts | 1 + .../components/form-field/form-field.component.ts | 4 ++-- .../components/form-section/form-section.component.html | 9 +++++---- .../components/form-section/form-section.component.ts | 1 + .../dataset-description-form.component.html | 2 +- .../dataset-description-form.component.ts | 1 + .../visibility-rules/visibility-rules.service.ts | 2 +- 13 files changed, 22 insertions(+), 17 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java index 1a72ac2a5..f53a59ae5 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/DatasetProfileController.java @@ -74,8 +74,8 @@ public class DatasetProfileController extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json") public ResponseEntity getDataForAutocomplete(@RequestBody RequestItem 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> items = DatasetProfileManager.getAutocomplete(data, lookupItem.getCriteria().getLike()); return ResponseEntity.status(HttpStatus.OK).body(items); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java index fb7819e83..66cecd752 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/admin/components/datasetprofile/Field.java @@ -31,7 +31,8 @@ public class Field implements ViewStyleDefinition; - public validations: ValidationType[]; + public validations: ValidationType[] = []; fromModel(item: Field): FieldEditorModel { this.id = item.id; diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section/dataset-profile-editor-section.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section/dataset-profile-editor-section.component.html index 96c98a93f..52d24c71c 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section/dataset-profile-editor-section.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section/dataset-profile-editor-section.component.html @@ -43,7 +43,7 @@
{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}} -
diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index 0fd3866d0..21032c60a 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html @@ -69,7 +69,7 @@ {{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}
- +
diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.html index 4f52c1b06..13131fc95 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.html @@ -11,7 +11,7 @@
{{compositeField.extendedDescription}}
- +
@@ -31,10 +31,10 @@
- +
- +
diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.ts index bd04a60f5..7f3e9a39e 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-composite-field/form-composite-field.component.ts @@ -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; diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts index b85f5982c..ea1b40568 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts @@ -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 = 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); } diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.html index 65f26c7e2..01d959db5 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.html @@ -18,10 +18,11 @@ Add one more fieldset +
- +
- + @@ -35,9 +36,9 @@
- +
-
+ \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.ts index a55e30d8c..086238541 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-section/form-section.component.ts @@ -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; diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.html index ec6c4e87d..8cd24c943 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.html @@ -9,7 +9,7 @@ {{page.title}}
- +
diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.ts index e062af7a5..7a5d08d8b 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/dataset-description-form.component.ts @@ -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']; diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service.ts index 08949891c..d719c2341 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service.ts @@ -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) {