Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign
This commit is contained in:
commit
6bc03ccbfc
|
@ -122,7 +122,7 @@ public class DatasetProfileManager {
|
||||||
|
|
||||||
String url = singleData.getUrl();
|
String url = singleData.getUrl();
|
||||||
String mediaType = "";
|
String mediaType = "";
|
||||||
if (url.contains("openaire")) {
|
if (url.contains("openaire") || url.contains("zenodo")) {
|
||||||
mediaType = "application/json; charset=utf-8";
|
mediaType = "application/json; charset=utf-8";
|
||||||
url = url.replace("{like}", like.equals("") ? "*" : like);
|
url = url.replace("{like}", like.equals("") ? "*" : like);
|
||||||
url = url.replace("%20", " ");
|
url = url.replace("%20", " ");
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public class WordListData extends ComboBoxData<WordListData> {
|
public class WordListData extends ComboBoxData<WordListData> {
|
||||||
private List<Option> options;
|
private List<Option> options;
|
||||||
|
private Boolean multiList;
|
||||||
|
|
||||||
public List<Option> getOptions() {
|
public List<Option> getOptions() {
|
||||||
return options;
|
return options;
|
||||||
|
@ -21,10 +22,18 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getMultiList() {
|
||||||
|
return multiList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiList(Boolean multiList) {
|
||||||
|
this.multiList = multiList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element root = super.toXml(doc);
|
Element root = super.toXml(doc);
|
||||||
|
root.setAttribute("multiList", this.multiList.toString());
|
||||||
Element element = doc.createElement("options");
|
Element element = doc.createElement("options");
|
||||||
if (this.options != null) {
|
if (this.options != null) {
|
||||||
for (Option option : this.options) {
|
for (Option option : this.options) {
|
||||||
|
@ -50,6 +59,8 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Boolean temp = Boolean.parseBoolean(item.getAttribute("multiList"));
|
||||||
|
this.multiList = temp != null ? temp : false;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +68,6 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
public WordListData fromData(Object data) {
|
public WordListData fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
this.options = new LinkedList();
|
this.options = new LinkedList();
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
List<Map<String, String>> options = ((Map<String, List<Map<String, String>>>) data).get("options");
|
List<Map<String, String>> options = ((Map<String, List<Map<String, String>>>) data).get("options");
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
|
@ -68,8 +78,8 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
this.options.add(newOption);
|
this.options.add(newOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.multiList = (Boolean) ((Map<String, Object>) data).get("multiList");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -615,6 +615,25 @@
|
||||||
</data>
|
</data>
|
||||||
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
</urlConfig>
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>eosc</key>
|
||||||
|
<label>EOSC Providers</label>
|
||||||
|
<ordinal>2</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://beta.providers.eosc-portal.eu/api/service/all?query={like}&from={page}&quantity={pageSize}</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['results'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'webpage'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['from','to','total']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
<!-- <urlConfig>
|
<!-- <urlConfig>
|
||||||
<key>openAire</key>
|
<key>openAire</key>
|
||||||
<label>OpenAIRE</label>
|
<label>OpenAIRE</label>
|
||||||
|
|
|
@ -41,6 +41,7 @@ export interface TextAreaFieldData extends FieldData {
|
||||||
export interface WordListFieldData extends FieldData {
|
export interface WordListFieldData extends FieldData {
|
||||||
type: DatasetProfileComboBoxType;
|
type: DatasetProfileComboBoxType;
|
||||||
options: Array<FieldDataOption>;
|
options: Array<FieldDataOption>;
|
||||||
|
multiList: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FieldDataOption extends FieldData {
|
export interface FieldDataOption extends FieldData {
|
||||||
|
|
|
@ -7,11 +7,13 @@ import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
|
||||||
export class WordListFieldDataEditorModel extends FieldDataEditorModel<WordListFieldDataEditorModel> {
|
export class WordListFieldDataEditorModel extends FieldDataEditorModel<WordListFieldDataEditorModel> {
|
||||||
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.WordList;
|
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.WordList;
|
||||||
public options: Array<FieldDataOptionEditorModel>;
|
public options: Array<FieldDataOptionEditorModel>;
|
||||||
|
public multipleList: boolean;
|
||||||
|
|
||||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.type')) }],
|
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.type')) }],
|
||||||
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.label')) }]
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.label')) }],
|
||||||
|
multiList: [{ value: this.multipleList, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.multipleList'))}]
|
||||||
});
|
});
|
||||||
const optionsFormArray = new Array<FormGroup>();
|
const optionsFormArray = new Array<FormGroup>();
|
||||||
if (this.options) {
|
if (this.options) {
|
||||||
|
@ -29,6 +31,7 @@ export class WordListFieldDataEditorModel extends FieldDataEditorModel<WordListF
|
||||||
this.type = item.type;
|
this.type = item.type;
|
||||||
if (item.options) { this.options = item.options.map(x => new FieldDataOptionEditorModel().fromModel(x)); }
|
if (item.options) { this.options = item.options.map(x => new FieldDataOptionEditorModel().fromModel(x)); }
|
||||||
this.label = item.label;
|
this.label = item.label;
|
||||||
|
this.multipleList = item.multiList;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-TITLE'
|
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-TITLE'
|
||||||
| translate}}</h5>
|
| translate}}</h5>
|
||||||
|
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiList')">
|
||||||
|
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-WORDLIST' | translate}}
|
||||||
|
</mat-checkbox>
|
||||||
|
|
||||||
<mat-form-field class="col-12">
|
<mat-form-field class="col-12">
|
||||||
<input matInput type="string"
|
<input matInput type="string"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
<mat-hint>{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field *ngIf="form.get('data').value.type === datasetProfileComboBoxTypeEnum.WordList" class="col-md-12">
|
<mat-form-field *ngIf="form.get('data').value.type === datasetProfileComboBoxTypeEnum.WordList" class="col-md-12">
|
||||||
<mat-select [formControl]="form.get('value')" placeholder="{{ form.get('data').value.label | translate }}" [required]="form.get('validationRequired').value">
|
<mat-select [formControl]="form.get('value')" placeholder="{{ form.get('data').value.label | translate }}" [required]="form.get('validationRequired').value" [multiple]="form.get('data').value.multiList">
|
||||||
<mat-option *ngFor="let opt of form.get('data').value.options" [value]="opt.value">{{opt.label}}
|
<mat-option *ngFor="let opt of form.get('data').value.options" [value]="opt.value">{{opt.label}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
|
@ -93,6 +93,18 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||||
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, this.form.get('value').value);
|
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, this.form.get('value').value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.WordList) {
|
||||||
|
if (this.form.get('data').value.multiList) {
|
||||||
|
const originalValue = <string>this.form.get('value').value;
|
||||||
|
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ');
|
||||||
|
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
|
||||||
|
values = undefined;
|
||||||
|
values = [originalValue];
|
||||||
|
}
|
||||||
|
this.form.patchValue({ 'value': values });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Setup autocomplete configuration if needed
|
// Setup autocomplete configuration if needed
|
||||||
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Autocomplete) {
|
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Autocomplete) {
|
||||||
if (!(this.form.controls['data'].value.multiAutoComplete)) {
|
if (!(this.form.controls['data'].value.multiAutoComplete)) {
|
||||||
|
|
|
@ -334,7 +334,8 @@
|
||||||
"FIELD-DATE-PICKER-PLACEHOLDER": "Input Placeholder",
|
"FIELD-DATE-PICKER-PLACEHOLDER": "Input Placeholder",
|
||||||
"FIELD-DATE-PICKER-LABEL": "Label",
|
"FIELD-DATE-PICKER-LABEL": "Label",
|
||||||
"FIELD-DATE-PICKER-VALUE": "Value",
|
"FIELD-DATE-PICKER-VALUE": "Value",
|
||||||
"FIELD-MULTIPLE-AUTOCOMPLETE": "Multiple Autocomplete"
|
"FIELD-MULTIPLE-AUTOCOMPLETE": "Multiple Autocomplete",
|
||||||
|
"FIELD-MULTIPLE-WORDLIST": "Multiple Selection"
|
||||||
},
|
},
|
||||||
"DEFAULT-VALUES": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Keine",
|
"NONE": "Keine",
|
||||||
|
|
|
@ -354,7 +354,8 @@
|
||||||
"FIELD-DATE-PICKER-PLACEHOLDER": "Input Placeholder",
|
"FIELD-DATE-PICKER-PLACEHOLDER": "Input Placeholder",
|
||||||
"FIELD-DATE-PICKER-LABEL": "Label",
|
"FIELD-DATE-PICKER-LABEL": "Label",
|
||||||
"FIELD-DATE-PICKER-VALUE": "Value",
|
"FIELD-DATE-PICKER-VALUE": "Value",
|
||||||
"FIELD-MULTIPLE-AUTOCOMPLETE": "Multiple Autocomplete"
|
"FIELD-MULTIPLE-AUTOCOMPLETE": "Multiple Autocomplete",
|
||||||
|
"FIELD-MULTIPLE-WORDLIST": "Multiple Selection"
|
||||||
},
|
},
|
||||||
"DEFAULT-VALUES": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "None",
|
"NONE": "None",
|
||||||
|
|
|
@ -354,7 +354,8 @@
|
||||||
"FIELD-DATE-PICKER-PLACEHOLDER": "Marcador de entrada",
|
"FIELD-DATE-PICKER-PLACEHOLDER": "Marcador de entrada",
|
||||||
"FIELD-DATE-PICKER-LABEL": "Etiqueta",
|
"FIELD-DATE-PICKER-LABEL": "Etiqueta",
|
||||||
"FIELD-DATE-PICKER-VALUE": "Valor",
|
"FIELD-DATE-PICKER-VALUE": "Valor",
|
||||||
"FIELD-MULTIPLE-AUTOCOMPLETE": "Autocompeltado múltiple"
|
"FIELD-MULTIPLE-AUTOCOMPLETE": "Autocompeltado múltiple",
|
||||||
|
"FIELD-MULTIPLE-WORDLIST": "Multiple Selection"
|
||||||
},
|
},
|
||||||
"DEFAULT-VALUES": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Ninguno",
|
"NONE": "Ninguno",
|
||||||
|
|
|
@ -351,7 +351,8 @@
|
||||||
"FIELD-DATE-PICKER-PLACEHOLDER": "Τοποθέτηση placeholder",
|
"FIELD-DATE-PICKER-PLACEHOLDER": "Τοποθέτηση placeholder",
|
||||||
"FIELD-DATE-PICKER-LABEL": "Ετικέτα",
|
"FIELD-DATE-PICKER-LABEL": "Ετικέτα",
|
||||||
"FIELD-DATE-PICKER-VALUE": "Τιμή",
|
"FIELD-DATE-PICKER-VALUE": "Τιμή",
|
||||||
"FIELD-MULTIPLE-AUTOCOMPLETE": "Πολλαπλή Αυτόματη Συμπλήρωση"
|
"FIELD-MULTIPLE-AUTOCOMPLETE": "Πολλαπλή Αυτόματη Συμπλήρωση",
|
||||||
|
"FIELD-MULTIPLE-WORDLIST": "Multiple Selection"
|
||||||
},
|
},
|
||||||
"DEFAULT-VALUES": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Κανένα",
|
"NONE": "Κανένα",
|
||||||
|
|
|
@ -351,7 +351,8 @@
|
||||||
"FIELD-DATE-PICKER-PLACEHOLDER": "Girdi Yer tutucu",
|
"FIELD-DATE-PICKER-PLACEHOLDER": "Girdi Yer tutucu",
|
||||||
"FIELD-DATE-PICKER-LABEL": "Etiket",
|
"FIELD-DATE-PICKER-LABEL": "Etiket",
|
||||||
"FIELD-DATE-PICKER-VALUE": "Değer",
|
"FIELD-DATE-PICKER-VALUE": "Değer",
|
||||||
"FIELD-MULTIPLE-AUTOCOMPLETE": "Çoklu Otomatik Tamamlama"
|
"FIELD-MULTIPLE-AUTOCOMPLETE": "Çoklu Otomatik Tamamlama",
|
||||||
|
"FIELD-MULTIPLE-WORDLIST": "Multiple Selection"
|
||||||
},
|
},
|
||||||
"DEFAULT-VALUES": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Hiç",
|
"NONE": "Hiç",
|
||||||
|
|
Loading…
Reference in New Issue