Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
declare module 'frappe-ui'
declare module '@/utils/dayjs'
declare module 'dom-to-image'

Expand Down
17 changes: 16 additions & 1 deletion frontend/src2/dashboard/Filter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ function clearFilter() {
filterValue.value = undefined
emit('close')
}

// For a bried period, the value of a date filter with 'between' operator is stored as `from_date,to_date` string. This computed property helps to convert it to array and vice versa for the DateRangePicker component.
const dateRangeVal = computed({
get() {
let val = state.value
if (typeof val === 'string') {
const [from_date, to_date] = val.split(',')
return [from_date, to_date]
}
return val
},
set(val: string) {
state.value = val.split(',')
},
})
</script>

<template>
Expand Down Expand Up @@ -79,7 +94,7 @@ function clearFilter() {
/>
<DateRangePicker
v-else-if="valueSelectorType === 'date_range'"
v-model="state.value as string[]"
v-model="dateRangeVal as string[]"
/>
<RelativeDatePicker
v-else-if="valueSelectorType === 'relative_date'"
Expand Down
1 change: 1 addition & 0 deletions frontend/src2/query/components/QueryDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ function onFilterChange(filters: Record<string, string>) {

<template>
<DataTable
v-if="props.query.isloaded"
:loading="props.query.executing && !isFiltering"
:filtering="props.query.executing && isFiltering"
:columns="columns"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src2/query/components/filter_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export function getOperatorOptions(filterType: FilterType) {
options.push({ label: __('is not set'), value: 'is_not_set' })
}
if (filterType === 'Date') {
options.push({ label: __('between'), value: 'between' })
options.push({ label: __('equals'), value: '=' })
options.push({ label: __('not equals'), value: '!=' })
options.push({ label: __('greater than'), value: '>' })
options.push({ label: __('greater than or equals'), value: '>=' })
options.push({ label: __('less than'), value: '<' })
options.push({ label: __('less than or equals'), value: '<=' })
options.push({ label: __('between'), value: 'between' })
options.push({ label: __('within'), value: 'within' })
options.push({ label: __('is set'), value: 'is_set' })
options.push({ label: __('is not set'), value: 'is_not_set' })
Expand Down
Loading