Skip to content

Commit

Permalink
feat: add NOT LIKE to table filters, closes #672
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Sep 25, 2023
1 parent 98c1f43 commit 9c66fd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/common/interfaces/tableApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export interface TableDeleteParams {
rows: {[key: string]: any};
}

export type TableFilterOperator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL'

export interface TableFilterClausole {
active: boolean;
field: string;
op: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'IN' | 'NOT IN' | 'LIKE' | 'BETWEEN' | 'IS NULL' | 'IS NOT NULL';
op:TableFilterOperator;
value: '';
value2: '';
}
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/components/WorkspaceTabTableFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import customizations from 'common/customizations';
import { FLOAT, NUMBER } from 'common/fieldTypes';
import { ClientCode, TableField } from 'common/interfaces/antares';
import { TableFilterClausole } from 'common/interfaces/tableApis';
import { TableFilterClausole, TableFilterOperator } from 'common/interfaces/tableApis';
import { computed, Prop, ref } from 'vue';
import { useI18n } from 'vue-i18n';
Expand All @@ -93,8 +93,8 @@ const props = defineProps({
const emit = defineEmits(['filter-change', 'filter']);
const rows = ref([]);
const operators = ref([
'=', '!=', '>', '<', '>=', '<=', 'IN', 'NOT IN', 'LIKE', 'BETWEEN', 'IS NULL', 'IS NOT NULL'
const operators = ref<TableFilterOperator[]>([
'=', '!=', '>', '<', '>=', '<=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE', 'BETWEEN', 'IS NULL', 'IS NOT NULL'
]);
const clientCustomizations = computed(() => customizations[props.connClient]);
Expand Down Expand Up @@ -152,6 +152,7 @@ const createClausole = (filter: TableFilterClausole) => {
value = '';
break;
case 'LIKE':
case 'NOT LIKE':
value = `${sw}%${filter.value}%${sw}`;
break;
default:
Expand Down

0 comments on commit 9c66fd5

Please sign in to comment.