Skip to content

Commit

Permalink
#1863 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1844 committed Oct 6, 2021
1 parent 604cbe4 commit b8e5d89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
9 changes: 4 additions & 5 deletions menas/ui/components/mappingTable/filterEdit/FilterEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FilterEdit {
/**
*
* @param idBase oController, or core
* @param idPrefix prefix for ID, e.g. "MappingConformanceRule--". Default: empty
* @param idPrefix prefix for ID, e.g. "MappingConformanceRule--". Default: empty string
*/
constructor(idBase, idPrefix = "") {
this.idBase = idBase;
Expand Down Expand Up @@ -111,7 +111,7 @@ class FilterEdit {

treeTableModel.refresh();
if (selectedIndices) {
treeTable.expand(selectedIndices[0]); // nice of the user to directly see the child among the expanded parent
treeTable.expand(selectedIndices[0]); // nice for the user to directly see the child among the expanded parent
}
}

Expand All @@ -125,13 +125,13 @@ class FilterEdit {
return;
}

// delete the data.
// delete the data
selectedIndices.forEach(idx => {
const context = treeTable.getContextByIndex(idx);
const data = context.getProperty();

if (data) {
// The property is simply set to undefined to preserve the tree state (expand/collapse states of nodes).
// The property is set to undefined to preserve the tree state (expand/collapse states of nodes).
treeTableModel.setProperty(context.getPath(), undefined, context, true);
}
}
Expand All @@ -150,7 +150,6 @@ class FilterEdit {
// filter data can be [filter], [null] or null
if (filterData && filterData.map(x => x).length != 0) {
// resetting non-empty filter validations

const resetValidatedFilter = this.resetFilterDataValidation(filterData[0]);
treeTableModel.setProperty("/editingFilters", [resetValidatedFilter]);
}
Expand Down
2 changes: 0 additions & 2 deletions menas/ui/service/EntityDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ class MappingTableDialog extends EntityDialog {

submit() {
let updatedFilters = this.oDialog.getModel("filterEdit").getProperty("/editingFilters");
console.debug(`MappingTableDialog submit: updatedFilters:${JSON.stringify(updatedFilters)} `);

if (updatedFilters) {
if (updatedFilters.length > 1) {
Expand All @@ -397,7 +396,6 @@ class MappingTableDialog extends EntityDialog {
let updatedFilter = FilterTreeUtils.removeNiceNamesFromFilterData(updatedFilters[0]);

this.oDialog.getModel("entity").setProperty("/filter", updatedFilter);
console.debug(`Submitted MT entity after filters replace: ${JSON.stringify(this.oDialog.getModel("entity").oData)}`);
}
} // do nothing on empty filter

Expand Down
8 changes: 2 additions & 6 deletions menas/ui/service/FilterTreeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class FilterTreeUtils {

// recursively do the same:
// AndJoinedFilters, OrJoinedFilters have field `filterItems` defined; NotFilter has field `inputFilter` defined.
if(filterNode.filterItems) filterNode.filterItems.forEach(recursiveFnWrapper);
if(filterNode.inputFilter) recursiveFnWrapper(filterNode.inputFilter);
if (filterNode.filterItems) filterNode.filterItems.forEach(recursiveFnWrapper);
if (filterNode.inputFilter) recursiveFnWrapper(filterNode.inputFilter);
};

// if the method is to be pure from the outside: making a deep copy to do the changes on at first:
Expand All @@ -48,10 +48,6 @@ class FilterTreeUtils {
return this.#applyToFilterData(filterData, applyFn, false)
}

static applyToFilterDataMutably(filterData, applyFn) {
return this.#applyToFilterData(filterData, applyFn, true)
}

static addIconsAndNiceNamesToFilterData(filterData){

// fn to add icon and human readable text
Expand Down

0 comments on commit b8e5d89

Please sign in to comment.