mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: filter empty state handling in issue filter selection
This commit is contained in:
parent
3c9e62d308
commit
fce6907465
@ -33,12 +33,13 @@ export const FilterAssignees = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,12 +16,13 @@ export const FilterCreatedBy = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,12 +21,13 @@ export const FilterLabels = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,12 +57,13 @@ export const FilterPriority = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,12 +88,13 @@ export const FilterStateGroup = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,12 +18,13 @@ export const FilterState = observer(() => {
|
|||||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||||
|
|
||||||
const handleFilter = (key: string, value: string) => {
|
const handleFilter = (key: string, value: string) => {
|
||||||
const _value =
|
let _value =
|
||||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||||
: [value];
|
: [value];
|
||||||
|
_value = _value && _value.length > 0 ? _value : null;
|
||||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user