Feat: Add "All assignees" in Task team member dropdown (#1763)

* implemented all select option FilterDropdownEntitySearchSelect and enabled it for tasks page filter

* created new filter operand IsNotNull for make a select all qraphql query, added internal state for tracking isAllEntitySelected

* used filterCurrentlyEdited to track if isAllEntitySelected is selected

* fixed filter button icon SelectAll Icon
This commit is contained in:
Ayush Agrawal
2023-10-03 20:25:31 +05:30
committed by GitHub
parent aea088df16
commit 77997674e5
11 changed files with 209 additions and 94 deletions
@@ -14,6 +14,8 @@ export const getOperandLabel = (operand: FilterOperand | null | undefined) => {
return 'Is';
case FilterOperand.IsNot:
return 'Is not';
case FilterOperand.IsNotNull:
return 'Is not null';
default:
return '';
}
@@ -29,6 +31,8 @@ export const getOperandLabelShort = (
case FilterOperand.IsNot:
case FilterOperand.DoesNotContain:
return ': Not';
case FilterOperand.IsNotNull:
return ': NotNull';
case FilterOperand.GreaterThan:
return '\u00A0> ';
case FilterOperand.LessThan:
@@ -4,88 +4,97 @@ import { Filter } from '../types/Filter';
import { FilterOperand } from '../types/FilterOperand';
export const turnFilterIntoWhereClause = (filter: Filter) => {
switch (filter.type) {
case 'text':
switch (filter.operand) {
case FilterOperand.Contains:
return {
[filter.key]: {
contains: filter.value,
mode: QueryMode.Insensitive,
},
};
case FilterOperand.DoesNotContain:
return {
[filter.key]: {
not: {
contains: filter.value,
mode: QueryMode.Insensitive,
},
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'number':
switch (filter.operand) {
case FilterOperand.GreaterThan:
return {
[filter.key]: {
gte: parseFloat(filter.value),
},
};
case FilterOperand.LessThan:
return {
[filter.key]: {
lte: parseFloat(filter.value),
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'date':
switch (filter.operand) {
case FilterOperand.GreaterThan:
return {
[filter.key]: {
gte: filter.value,
},
};
case FilterOperand.LessThan:
return {
[filter.key]: {
lte: filter.value,
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'entity':
switch (filter.operand) {
case FilterOperand.Is:
return {
[filter.key]: {
equals: filter.value,
},
};
case FilterOperand.IsNot:
return {
[filter.key]: {
not: { equals: filter.value },
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
switch (filter.operand) {
case FilterOperand.IsNotNull:
return {
[filter.key]: {
not: null,
},
};
default:
throw new Error('Unknown filter type');
switch (filter.type) {
case 'text':
switch (filter.operand) {
case FilterOperand.Contains:
return {
[filter.key]: {
contains: filter.value,
mode: QueryMode.Insensitive,
},
};
case FilterOperand.DoesNotContain:
return {
[filter.key]: {
not: {
contains: filter.value,
mode: QueryMode.Insensitive,
},
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'number':
switch (filter.operand) {
case FilterOperand.GreaterThan:
return {
[filter.key]: {
gte: parseFloat(filter.value),
},
};
case FilterOperand.LessThan:
return {
[filter.key]: {
lte: parseFloat(filter.value),
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'date':
switch (filter.operand) {
case FilterOperand.GreaterThan:
return {
[filter.key]: {
gte: filter.value,
},
};
case FilterOperand.LessThan:
return {
[filter.key]: {
lte: filter.value,
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
case 'entity':
switch (filter.operand) {
case FilterOperand.Is:
return {
[filter.key]: {
equals: filter.value,
},
};
case FilterOperand.IsNot:
return {
[filter.key]: {
not: { equals: filter.value },
},
};
default:
throw new Error(
`Unknown operand ${filter.operand} for ${filter.type} filter`,
);
}
default:
throw new Error('Unknown filter type');
}
}
};