-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6152 from ProcessMaker/observation/FOUR-13348
Refactor some parts of the column filtering functionality
- Loading branch information
Showing
12 changed files
with
198 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { get } from "lodash"; | ||
|
||
export default { | ||
data() { | ||
return { | ||
advancedFilter: [], | ||
}; | ||
}, | ||
mounted() { | ||
this.setAdvancedFilter(); | ||
window.ProcessMaker.EventBus.$on('advanced-filter-updated', this.setAdvancedFilter); | ||
}, | ||
methods: { | ||
setAdvancedFilter() { | ||
this.advancedFilter = get(window, 'ProcessMaker.advanced_filter.filters', []); | ||
}, | ||
formatForBadge(filters, result) { | ||
for(const filter of filters) { | ||
result.push([ | ||
this.formatBadgeSubject(filter), | ||
[{name: this.formatBadgeValue(filter), advanced_filter: true}] | ||
]); | ||
|
||
if (filter.or && filter.or.length > 0) { | ||
this.formatForBadge(filter.or, result); | ||
} | ||
} | ||
}, | ||
formatBadgeSubject(filter) { | ||
return get(filter, '_column_label', ''); | ||
}, | ||
formatBadgeValue(filter) { | ||
let result = filter.operator; | ||
result = result + " " + filter.value; | ||
return result; | ||
}, | ||
}, | ||
computed: { | ||
formatAdvancedFilterForBadges() { | ||
if (!this.advancedFilter || this.advancedFilter.length === 0) { | ||
return []; | ||
} | ||
const result = []; | ||
this.formatForBadge(this.advancedFilter, result); | ||
return result; | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.