Adds "source" property on external autocomplete field of Dataset Description Template.
This commit is contained in:
parent
0db79b9498
commit
bd6170f711
|
@ -111,8 +111,8 @@ public class DatasetProfileManager {
|
||||||
ResponseEntity<Object> response = restTemplate.exchange(data.getUrl() + "?search=" + like, HttpMethod.GET, entity, Object.class);
|
ResponseEntity<Object> response = restTemplate.exchange(data.getUrl() + "?search=" + like, HttpMethod.GET, entity, Object.class);
|
||||||
DocumentContext jsonContext = JsonPath.parse(response.getBody());
|
DocumentContext jsonContext = JsonPath.parse(response.getBody());
|
||||||
|
|
||||||
List<Map<String, String>> jsonItems = jsonContext.read(data.getOptionsRoot() + "['" + data.getAutoCompleteOptions().getLabel() + "','" + data.getAutoCompleteOptions().getValue() + "']");
|
List<Map<String, String>> jsonItems = jsonContext.read(data.getOptionsRoot() + "['" + data.getAutoCompleteOptions().getLabel() + "','" + data.getAutoCompleteOptions().getValue() + "','" + data.getAutoCompleteOptions().getSource() + "']");
|
||||||
jsonItems.forEach(item -> result.add(new ExternalAutocompleteFieldModel(item.get(data.getAutoCompleteOptions().getValue()), item.get(data.getAutoCompleteOptions().getLabel()), data.getUrl())));
|
jsonItems.forEach(item -> result.add(new ExternalAutocompleteFieldModel(item.get(data.getAutoCompleteOptions().getValue()), item.get(data.getAutoCompleteOptions().getLabel()), item.get(data.getAutoCompleteOptions().getSource()))));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
Element element = doc.createElement("option");
|
Element element = doc.createElement("option");
|
||||||
element.setAttribute("label", this.autoCompleteOptions.getLabel());
|
element.setAttribute("label", this.autoCompleteOptions.getLabel());
|
||||||
element.setAttribute("value", autoCompleteOptions.getValue());
|
element.setAttribute("value", autoCompleteOptions.getValue());
|
||||||
|
element.setAttribute("source", autoCompleteOptions.getSource());
|
||||||
root.appendChild(element);
|
root.appendChild(element);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +62,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
this.autoCompleteOptions = new Option();
|
this.autoCompleteOptions = new Option();
|
||||||
this.autoCompleteOptions.setLabel(optionElement.getAttribute("label"));
|
this.autoCompleteOptions.setLabel(optionElement.getAttribute("label"));
|
||||||
this.autoCompleteOptions.setValue(optionElement.getAttribute("value"));
|
this.autoCompleteOptions.setValue(optionElement.getAttribute("value"));
|
||||||
|
this.autoCompleteOptions.setSource(optionElement.getAttribute("source"));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +79,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
this.autoCompleteOptions.setLabel(options.get("label"));
|
this.autoCompleteOptions.setLabel(options.get("label"));
|
||||||
this.autoCompleteOptions.setValue(options.get("value"));
|
this.autoCompleteOptions.setValue(options.get("value"));
|
||||||
|
this.autoCompleteOptions.setSource(options.get("source"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +113,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
HashMap dataMap = new HashMap();
|
HashMap dataMap = new HashMap();
|
||||||
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
||||||
dataMap.put("value", item != null ? item.getAttribute("value") : "");
|
dataMap.put("value", item != null ? item.getAttribute("value") : "");
|
||||||
|
dataMap.put("source", item != null ? item.getAttribute("source") : "");
|
||||||
return dataMap;
|
return dataMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
public class Option implements XmlSerializable<Option> {
|
public class Option implements XmlSerializable<Option> {
|
||||||
private String label;
|
private String label;
|
||||||
private String value;
|
private String value;
|
||||||
|
private String source;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,23 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element option = doc.createElement("option");
|
Element option = doc.createElement("option");
|
||||||
option.setAttribute("label", this.label);
|
option.setAttribute("label", this.label);
|
||||||
option.setAttribute("value", this.value);
|
option.setAttribute("value", this.value);
|
||||||
|
option.setAttribute("source", this.source);
|
||||||
return option;
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +47,7 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
public Option fromXml(Element item) {
|
public Option fromXml(Element item) {
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
||||||
this.value = item.getAttribute("value");
|
this.value = item.getAttribute("value");
|
||||||
|
this.source = item.getAttribute("source");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ export interface WordListFieldData extends FieldData {
|
||||||
export interface FieldDataOption extends FieldData {
|
export interface FieldDataOption extends FieldData {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
source: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DatePickerFieldData extends FieldData {
|
export interface DatePickerFieldData extends FieldData {
|
||||||
|
|
|
@ -5,17 +5,20 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
export class FieldDataOptionEditorModel extends FieldDataEditorModel<FieldDataOptionEditorModel> {
|
export class FieldDataOptionEditorModel extends FieldDataEditorModel<FieldDataOptionEditorModel> {
|
||||||
public label: string;
|
public label: string;
|
||||||
public value: string;
|
public value: string;
|
||||||
|
public source: string;
|
||||||
|
|
||||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.label')) }],
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.label')) }],
|
||||||
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.value')) }]
|
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.value')) }],
|
||||||
|
source: [{ value: this.source, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.source')) }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fromModel(item: FieldDataOption): FieldDataOptionEditorModel {
|
fromModel(item: FieldDataOption): FieldDataOptionEditorModel {
|
||||||
this.label = item.label;
|
this.label = item.label;
|
||||||
this.value = item.value;
|
this.value = item.value;
|
||||||
|
this.source = item.source;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,17 @@
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}" [formControl]="this.form.get('data').get('url')">
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}" [formControl]="this.form.get('data').get('url')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="col-md-4">
|
<mat-form-field class="col-md-3">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}"
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}"
|
||||||
[formControl]="this.form.get('data').get('optionsRoot')">
|
[formControl]="this.form.get('data').get('optionsRoot')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="col-md-4">
|
<mat-form-field class="col-md-3">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}" [formControl]="this.form.get('data').get('autoCompleteOptions').get('label')">
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}" [formControl]="this.form.get('data').get('autoCompleteOptions').get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="col-md-4">
|
<mat-form-field class="col-md-3">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}" [formControl]="this.form.get('data').get('autoCompleteOptions').get('value')">
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}" [formControl]="this.form.get('data').get('autoCompleteOptions').get('value')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-form-field class="col-md-3">
|
||||||
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}" [formControl]="this.form.get('data').get('autoCompleteOptions').get('source')">
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -223,6 +223,7 @@
|
||||||
"FIELD-AUTOCOMPLETE-PLACEHOLDER": "Input Placeholder",
|
"FIELD-AUTOCOMPLETE-PLACEHOLDER": "Input Placeholder",
|
||||||
"FIELD-AUTOCOMPLETE-LABEL": "Label",
|
"FIELD-AUTOCOMPLETE-LABEL": "Label",
|
||||||
"FIELD-AUTOCOMPLETE-VALUE": "Value",
|
"FIELD-AUTOCOMPLETE-VALUE": "Value",
|
||||||
|
"FIELD-AUTOCOMPLETE-SOURCE": "Source",
|
||||||
"FIELD-AUTOCOMPLETE-URL": "Url",
|
"FIELD-AUTOCOMPLETE-URL": "Url",
|
||||||
"FIELD-AUTOCOMPLETE-OPTIONS-ROOT": "Options Root",
|
"FIELD-AUTOCOMPLETE-OPTIONS-ROOT": "Options Root",
|
||||||
"FIELD-DATE-PICKER-TITLE": "Date Picker",
|
"FIELD-DATE-PICKER-TITLE": "Date Picker",
|
||||||
|
@ -347,7 +348,7 @@
|
||||||
"EDITOR": {
|
"EDITOR": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"EXTERNAL-DATASET-TYPE": "Type",
|
"EXTERNAL-DATASET-TYPE": "Type",
|
||||||
"EXTERNAL-AUTOCOMPLETE-SUBTITLE": "External url: "
|
"EXTERNAL-AUTOCOMPLETE-SUBTITLE": "Source: "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"FIRST-STEP": {
|
"FIRST-STEP": {
|
||||||
|
|
Loading…
Reference in New Issue