Adds "Description" field on Dataset Template and make it visible on autocomplete dropdowns. (Issue #137)
This commit is contained in:
parent
47fd02934c
commit
4aa0febc39
|
@ -66,6 +66,7 @@ public class Admin extends BaseController {
|
||||||
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
datasetprofile.setDefinition(modelDefinition.getDefinition());
|
||||||
datasetprofile.setStatus(modelDefinition.getStatus());
|
datasetprofile.setStatus(modelDefinition.getStatus());
|
||||||
datasetprofile.setLabel(modelDefinition.getLabel());
|
datasetprofile.setLabel(modelDefinition.getLabel());
|
||||||
|
datasetprofile.setDescription(modelDefinition.getDescription());
|
||||||
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
|
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(datasetprofile);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.NO_MESSAGE));
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class AdminManager {
|
||||||
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
||||||
|
|
||||||
eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel())
|
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();
|
.build();
|
||||||
|
|
||||||
return datasetProfile;
|
return datasetProfile;
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class DatasetProfileManager {
|
||||||
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
|
||||||
datasetprofile.setLabel(profile.getLabel());
|
datasetprofile.setLabel(profile.getLabel());
|
||||||
datasetprofile.setStatus(profile.getStatus());
|
datasetprofile.setStatus(profile.getStatus());
|
||||||
|
datasetprofile.setDescription(profile.getDescription());
|
||||||
|
|
||||||
return datasetprofile;
|
return datasetprofile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,12 @@ import java.util.List;
|
||||||
|
|
||||||
public class DatasetProfile {
|
public class DatasetProfile {
|
||||||
private String label;
|
private String label;
|
||||||
private List<Section> sections;
|
private String description;
|
||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
|
private List<Section> sections;
|
||||||
private Short status;
|
private Short status;
|
||||||
private Short version;
|
private Short version;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
public void setSections(List<Section> sections) { this.sections = sections; }
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
|
@ -27,6 +24,13 @@ public class DatasetProfile {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Page> getPages() {
|
public List<Page> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +38,11 @@ public class DatasetProfile {
|
||||||
this.pages = pages;
|
this.pages = pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Section> getSections() {
|
||||||
|
return sections;
|
||||||
|
}
|
||||||
|
public void setSections(List<Section> sections) { this.sections = sections; }
|
||||||
|
|
||||||
public Short getStatus() {
|
public Short getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +61,7 @@ public class DatasetProfile {
|
||||||
public DatasetProfile toShort() {
|
public DatasetProfile toShort() {
|
||||||
DatasetProfile shortProfile = new DatasetProfile();
|
DatasetProfile shortProfile = new DatasetProfile();
|
||||||
shortProfile.setLabel(this.label);
|
shortProfile.setLabel(this.label);
|
||||||
|
shortProfile.setDescription(this.description);
|
||||||
List<Section> shortSection = new LinkedList<>();
|
List<Section> shortSection = new LinkedList<>();
|
||||||
for (Section toshortSection : this.getSections()) {
|
for (Section toshortSection : this.getSections()) {
|
||||||
shortSection.add(toshortSection.toShort());
|
shortSection.add(toshortSection.toShort());
|
||||||
|
|
|
@ -9,13 +9,12 @@ import java.util.UUID;
|
||||||
public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile, DatasetProfileAutocompleteItem> {
|
public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile, DatasetProfileAutocompleteItem> {
|
||||||
|
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
private String label;
|
private String label;
|
||||||
|
private String description;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public void setId(UUID id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
@ -23,15 +22,22 @@ public class DatasetProfileAutocompleteItem implements DataModel<DatasetProfile,
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetProfileAutocompleteItem fromDataModel(DatasetProfile entity) {
|
public DatasetProfileAutocompleteItem fromDataModel(DatasetProfile entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
|
this.description = entity.getDescription();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
UPDATE public."DatasetProfile"
|
||||||
|
SET "Description" = ''
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE public."DatasetProfile"
|
||||||
|
ALTER COLUMN "Description"
|
||||||
|
SET NOT NULL
|
|
@ -6,6 +6,7 @@ export interface DatasetProfile {
|
||||||
pages: Page[];
|
pages: Page[];
|
||||||
status: number;
|
status: number;
|
||||||
version: number;
|
version: number;
|
||||||
|
description: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Page {
|
export interface Page {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
export interface DatasetProfileModel {
|
export interface DatasetProfileModel {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
|
description: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
// export class DatasetProfileModel implements Serializable<DatasetProfileModel> {
|
||||||
|
|
|
@ -12,6 +12,7 @@ export class DatasetProfileEditorModel extends BaseFormModel {
|
||||||
public label: string;
|
public label: string;
|
||||||
public status: number;
|
public status: number;
|
||||||
public version: number;
|
public version: number;
|
||||||
|
private description: string;
|
||||||
|
|
||||||
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
|
fromModel(item: DatasetProfile): DatasetProfileEditorModel {
|
||||||
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
|
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.label = item.label;
|
||||||
this.status = item.status;
|
this.status = item.status;
|
||||||
this.version = item.version;
|
this.version = item.version;
|
||||||
|
this.description = item.description;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup: FormGroup = new FormBuilder().group({
|
const formGroup: FormGroup = new FormBuilder().group({
|
||||||
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.label')) }, [Validators.required]],
|
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')) }],
|
status: [{ value: this.status, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.status')) }],
|
||||||
version: [{ value: this.version, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.version')) }]
|
version: [{ value: this.version, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.version')) }]
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,12 @@
|
||||||
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
<mat-error *ngIf="form.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</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">
|
<div class="d-flex justify-content-end pb-3" *ngIf="form.get('status').value==1">
|
||||||
<button mat-raised-button color="primary" (click)="downloadXML();"
|
<button mat-raised-button color="primary" (click)="downloadXML();"
|
||||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
|
type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
|
||||||
|
|
|
@ -73,7 +73,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
filterFn: this.filterDatasetTemplate.bind(this),
|
filterFn: this.filterDatasetTemplate.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item['label'],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label']
|
titleFn: (item) => item['label'],
|
||||||
|
subtitleFn: (item) => item['description']
|
||||||
};
|
};
|
||||||
|
|
||||||
dmpAutoCompleteConfiguration = {
|
dmpAutoCompleteConfiguration = {
|
||||||
|
|
|
@ -70,7 +70,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit {
|
||||||
filterFn: this.filterProfiles.bind(this),
|
filterFn: this.filterProfiles.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item['label'],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label']
|
titleFn: (item) => item['label'],
|
||||||
|
subtitleFn: (item) => item['description']
|
||||||
};
|
};
|
||||||
|
|
||||||
this.organisationsAutoCompleteConfiguration = {
|
this.organisationsAutoCompleteConfiguration = {
|
||||||
|
|
|
@ -55,7 +55,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
||||||
filterFn: this.filterDatasetTemplate.bind(this),
|
filterFn: this.filterDatasetTemplate.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
initialItems: (excludedItems: any[]) => this.filterDatasetTemplate('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item['label'],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label']
|
titleFn: (item) => item['label'],
|
||||||
|
subtitleFn: (item) => item['description']
|
||||||
};
|
};
|
||||||
|
|
||||||
projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
||||||
|
|
|
@ -55,7 +55,8 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
||||||
filterFn: this.filterProfiles.bind(this),
|
filterFn: this.filterProfiles.bind(this),
|
||||||
initialItems: (extraData) => this.filterProfiles(''),
|
initialItems: (extraData) => this.filterProfiles(''),
|
||||||
displayFn: (item) => item['label'],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label']
|
titleFn: (item) => item['label'],
|
||||||
|
subtitleFn: (item) => item['description']
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.formGroup == null) {
|
if (this.formGroup == null) {
|
||||||
|
|
|
@ -126,6 +126,7 @@
|
||||||
},
|
},
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"DATASET-TITLE": "Dataset Description Template Name",
|
"DATASET-TITLE": "Dataset Description Template Name",
|
||||||
|
"DATASET-DESCRIPTION": "Description",
|
||||||
"ROLES": "Roles"
|
"ROLES": "Roles"
|
||||||
},
|
},
|
||||||
"STEPS": {
|
"STEPS": {
|
||||||
|
|
Loading…
Reference in New Issue