Board V2 - Part 1 (#2619)

* improve useComputeDefinitionsFromFieldMetadata to prevent infinit loops

* fix viewFields

* improve initial seeding

* fix height 100%

* fix filters and sorts

* allow filter on currency

* remove probability from filter

* fix opportunities count

* fix persist filters and sorts
This commit is contained in:
bosiraphael
2023-11-21 18:01:30 +01:00
committed by GitHub
parent 9912f7a336
commit ad8331aa89
12 changed files with 152 additions and 95 deletions

View File

@ -9,9 +9,6 @@ export type FieldType =
| 'DOUBLE_TEXT'
| 'EMAIL'
| 'ENUM'
| 'MONEY_AMOUNT_'
| 'MONEY_AMOUNT'
| 'MONEY'
| 'NUMBER'
| 'PHONE'
| 'PROBABILITY'

View File

@ -33,9 +33,9 @@ export const MultipleFiltersDropdownContent = () => {
{filterDefinitionUsedInDropdown.type === 'TEXT' && (
<ObjectFilterDropdownTextSearchInput />
)}
{filterDefinitionUsedInDropdown.type === 'NUMBER' && (
<ObjectFilterDropdownNumberSearchInput />
)}
{['NUMBER', 'CURRENCY'].includes(
filterDefinitionUsedInDropdown.type,
) && <ObjectFilterDropdownNumberSearchInput />}
{filterDefinitionUsedInDropdown.type === 'DATE_TIME' && (
<ObjectFilterDropdownDateSearchInput />
)}

View File

@ -1 +1,6 @@
export type FilterType = 'TEXT' | 'DATE_TIME' | 'ENTITY' | 'NUMBER';
export type FilterType =
| 'TEXT'
| 'DATE_TIME'
| 'ENTITY'
| 'NUMBER'
| 'CURRENCY';

View File

@ -8,6 +8,7 @@ export const getOperandsForFilterType = (
switch (filterType) {
case 'TEXT':
return [ViewFilterOperand.Contains, ViewFilterOperand.DoesNotContain];
case 'CURRENCY':
case 'NUMBER':
case 'DATE_TIME':
return [ViewFilterOperand.GreaterThan, ViewFilterOperand.LessThan];

View File

@ -62,6 +62,23 @@ export const turnFiltersIntoWhereClauseV2 = (
`Unknown operand ${filter.operand} for ${filter.definition.type} filter`,
);
}
case 'CURRENCY':
switch (filter.operand) {
case ViewFilterOperand.GreaterThan:
whereClause[correspondingField.name] = {
amountMicros: { gte: parseFloat(filter.value) * 1000000 },
};
return;
case ViewFilterOperand.LessThan:
whereClause[correspondingField.name] = {
amountMicros: { lte: parseFloat(filter.value) * 1000000 },
};
return;
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.definition.type} filter`,
);
}
case 'DATE_TIME':
switch (filter.operand) {
case ViewFilterOperand.GreaterThan: