️ feat: make the default status to undefined

This commit is contained in:
Wahyu Kurniawan 2024-03-06 11:17:08 +07:00
parent 18dde52c9a
commit 80097a32ac
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33
2 changed files with 13 additions and 11 deletions

View File

@ -22,7 +22,7 @@ export enum StatusOptions {
export interface FilterValue { export interface FilterValue {
searchedBranch: string; searchedBranch: string;
status: StatusOptions; status: StatusOptions | string;
updateAtRange?: Value; updateAtRange?: Value;
} }
@ -64,13 +64,11 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
} }
}; };
const statusOptions = Object.values(StatusOptions) const statusOptions = Object.values(StatusOptions).map((status) => ({
.map((status) => ({
label: status, label: status,
value: status, value: status,
leftIcon: getOptionIcon(status), leftIcon: getOptionIcon(status),
})) }));
.filter((status) => status.value !== StatusOptions.ALL_STATUS);
const handleReset = () => { const handleReset = () => {
setSearchedBranch(''); setSearchedBranch('');
@ -104,11 +102,15 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
options={statusOptions} options={statusOptions}
clearable clearable
placeholder="All status" placeholder="All status"
value={{ label: selectedStatus, value: selectedStatus }} value={
selectedStatus
? { label: selectedStatus, value: selectedStatus }
: undefined
}
onChange={(item) => onChange={(item) =>
setSelectedStatus((item as SelectOption).value as StatusOptions) setSelectedStatus((item as SelectOption).value as StatusOptions)
} }
onClear={() => setSelectedStatus(StatusOptions.ALL_STATUS)} onClear={() => setSelectedStatus('')}
/> />
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@ import { RefreshIcon } from 'components/shared/CustomIcon';
const DEFAULT_FILTER_VALUE: FilterValue = { const DEFAULT_FILTER_VALUE: FilterValue = {
searchedBranch: '', searchedBranch: '',
status: StatusOptions.ALL_STATUS, status: '',
}; };
const FETCH_DEPLOYMENTS_INTERVAL = 5000; const FETCH_DEPLOYMENTS_INTERVAL = 5000;