Skip to content

Commit

Permalink
#1863 mt filter tree edit: column type hinting from a predefined list…
Browse files Browse the repository at this point in the history
… (but open to new values)
  • Loading branch information
dk1844 committed Sep 16, 2021
1 parent 17035fe commit 3e8747b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
10 changes: 9 additions & 1 deletion menas/ui/components/mappingTable/addMappingTable.fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@

<t:Column label="ValueType">
<t:template>
<Input type="Text" value="{entity>valueType}" visible="{= !!${entity>valueType}}"/>
<Input type="Text" value="{entity>valueType}"
visible="{= !!${entity>valueType}}"
showSuggestion="true"
suggestionItems="{suggestedColumnTypes>/}">
<suggestionItems>
<core:Item key="{suggestedColumnTypes>name}" text="{suggestedColumnTypes>name}"/>
</suggestionItems>
</Input>

</t:template>
</t:Column>
</t:columns>
Expand Down
16 changes: 14 additions & 2 deletions menas/ui/service/EntityDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,23 @@ class MappingTableDialog extends EntityDialog {
}
);
}

// on MTDialog open - base
onPress() {
const suggestedColumnTypes = FilterTreeUtils.columnTypeNames.map(function (val) {
return {name: val}
}); // [ {name: string}, ...]

const typeModel = new sap.ui.model.json.JSONModel(suggestedColumnTypes);
this.oDialog.setModel(typeModel, "suggestedColumnTypes");
}
}

class AddMappingTableDialog extends MappingTableDialog {

onPress() {
super.onPress();

this.schemaService.getList(this.oDialog).then(() => {
this.oDialog.setModel(new sap.ui.model.json.JSONModel({
name: "",
Expand All @@ -631,10 +643,10 @@ class AddMappingTableDialog extends MappingTableDialog {
class EditMappingTableDialog extends MappingTableDialog {

onPress() {
super.onPress();

this.schemaService.getList(this.oDialog).then(() => {
const current = this.oController._model.getProperty("/currentMappingTable");
//current.filterJson = JSON.stringify(current.filter);
//console.log(`current MT: ${JSON.stringify(current)}`);
current.updatedFilters = [this.addNiceNamesToFilterData(current.filter)];
console.log(`current filters: ${JSON.stringify(current.updatedFilters)}`);

Expand Down
6 changes: 6 additions & 0 deletions menas/ui/service/FilterTreeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ class FilterTreeUtils {
return filterDataNode;
}

// simple spark-sql types for hinting, origin: https://spark.apache.org/docs/latest/sql-ref-datatypes.htm
static columnTypeNames = [
"boolean", "byte", "short", "integer", "long", "bigint", "float", "double", "decimal", "numeric",
"date", "timestamp", "string", "binary", "interval"
]

}

0 comments on commit 3e8747b

Please sign in to comment.