Adds "Description" field on Dataset Template and make it visible on autocomplete dropdowns. (Issue #137)

This commit is contained in:
gkolokythas 2019-07-30 18:30:47 +03:00
parent 47fd02934c
commit 4aa0febc39
16 changed files with 52 additions and 13 deletions

View File

@ -66,6 +66,7 @@ public class Admin extends BaseController {
datasetprofile.setDefinition(modelDefinition.getDefinition());
datasetprofile.setStatus(modelDefinition.getStatus());
datasetprofile.setLabel(modelDefinition.getLabel());
datasetprofile.setDescription(modelDefinition.getDescription());
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
}

View File

@ -27,7 +27,7 @@ public class AdminManager {
String xml = XmlBuilder.generateXml(viewStyleDoc);
eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel())
.status(profile.getStatus()).created(new Date())
.status(profile.getStatus()).created(new Date()).description(profile.getDescription())
.build();
return datasetProfile;

View File

@ -56,6 +56,7 @@ public class DatasetProfileManager {
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
datasetprofile.setStatus(profile.getStatus());
datasetprofile.setDescription(profile.getDescription());
return datasetprofile;
}

View File

@ -10,15 +10,12 @@ import java.util.List;
public class DatasetProfile {
private String label;
private List<Section> sections;
private String description;
private List<Page> pages;
private List<Section> sections;
private Short status;
private Short version;
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) { this.sections = sections; }
public String getLabel() {
return label;
@ -27,6 +24,13 @@ public class DatasetProfile {
this.label = label;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Page> getPages() {
return pages;
}
@ -34,6 +38,11 @@ public class DatasetProfile {
this.pages = pages;
}
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) { this.sections = sections; }
public Short getStatus() {
return status;
}
@ -52,6 +61,7 @@ public class DatasetProfile {
public DatasetProfile toShort() {
DatasetProfile shortProfile = new DatasetProfile();
shortProfile.setLabel(this.label);
shortProfile.setDescription(this.description);
List<Section> shortSection = new LinkedList<>();
for (Section toshortSection : this.getSections()) {
shortSection.add(toshortSection.toShort());

View File

@ -9,13 +9,12 @@ import java.util.UUID;
public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile, DatasetProfileAutocompleteItem> {
private UUID id;
private String label;
private String description;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
@ -23,15 +22,22 @@ public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile,
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public DatasetProfileAutocompleteItem fromDataModel(DatasetProfile entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.description = entity.getDescription();
return this;
}

View File

@ -0,0 +1,2 @@
UPDATE public."DatasetProfile"
SET "Description" = ''

View File

@ -0,0 +1,3 @@
ALTER TABLE public."DatasetProfile"
ALTER COLUMN "Description"
SET NOT NULL

View File

@ -6,6 +6,7 @@ export interface DatasetProfile {
pages: Page[];
status: number;
version: number;
description: string;
}
export interface Page {

View File

@ -2,6 +2,7 @@
export interface DatasetProfileModel {
id: string;
label: string;
description: string;
}
// export class DatasetProfileModel implements Serializable<DatasetProfileModel> {

View File

@ -12,6 +12,7 @@ export class DatasetProfileEditorModel extends BaseFormModel {
public label: string;
public status: number;
public version: number;
private description: string;
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
@ -19,12 +20,14 @@ export class DatasetProfileEditorModel extends BaseFormModel {
this.label = item.label;
this.status = item.status;
this.version = item.version;
this.description = item.description;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup: FormGroup = new FormBuilder().group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.label')) }, [Validators.required]],
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.description')) }, [Validators.required]],
status: [{ value: this.status, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.status')) }],
version: [{ value: this.version, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.version')) }]
});

View File

@ -6,6 +6,12 @@
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<input matInput formControlName="description" [disabled]="newVersionId"
placeholder="{{'DATASET-PROFILE-EDITOR.FIELDS.DATASET-DESCRIPTION' | translate}}" required>
<mat-error *ngIf="form.get('description').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<div class="d-flex justify-content-end pb-3" *ngIf="form.get('status').value==1">
<button mat-raised-button color="primary" (click)="downloadXML();"
type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>

View File

@ -73,7 +73,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
filterFn: this.filterDatasetTemplate.bind(this),
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['label'],
titleFn: (item) => item['label']
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description']
};
dmpAutoCompleteConfiguration = {

View File

@ -70,7 +70,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['label'],
titleFn: (item) => item['label']
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description']
};
this.organisationsAutoCompleteConfiguration = {

View File

@ -55,7 +55,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
filterFn: this.filterDatasetTemplate.bind(this),
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['label'],
titleFn: (item) => item['label']
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description']
};
projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {

View File

@ -55,7 +55,8 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
filterFn: this.filterProfiles.bind(this),
initialItems: (extraData) => this.filterProfiles(''),
displayFn: (item) => item['label'],
titleFn: (item) => item['label']
titleFn: (item) => item['label'],
subtitleFn: (item) => item['description']
};
if (this.formGroup == null) {

View File

@ -126,6 +126,7 @@
},
"FIELDS": {
"DATASET-TITLE": "Dataset Description Template Name",
"DATASET-DESCRIPTION": "Description",
"ROLES": "Roles"
},
"STEPS": {