Skip to content

Commit 1673b2c

Browse files
committed
fix: corrected state variable names for filter functionality in ExecutionLogs component
1 parent 3614658 commit 1673b2c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ui/src/components/ExecutionLogs/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
1919
const [loading, setLoading] = useState(true);
2020
const [totalCounts, setTotalCounts] = useState<number | 0>(0);
2121
const [searchText, setSearchText] = useState<string>('');
22-
const [filterValue, setFilterValue] = useState<FilterOption[]>([]);
22+
const [filterOption, setFilterOption] = useState<FilterOption[]>([]);
2323
const [isCursorInside, setIsCursorInside] = useState(false);
2424
const [isFilterApplied, setIsFilterApplied] = useState(false);
2525
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);
26-
const [filterV, setFilterV] = useState<string>('all');
26+
const [filterValue, setFilterValue] = useState<string>('all');
2727

2828
const selectedOrganisation = useSelector(
2929
(state: RootState) => state?.authentication?.selectedOrganisation
@@ -69,7 +69,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
6969
//Method to maintain filter value
7070
const updateValue = ({ value, isChecked }: { value: FilterOption; isChecked: boolean }) => {
7171
try {
72-
let filterValueCopy: FilterOption[] = [...filterValue];
72+
let filterValueCopy: FilterOption[] = [...filterOption];
7373

7474
if (!filterValueCopy.length && isChecked) {
7575
filterValueCopy.push(value);
@@ -81,7 +81,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
8181
filterValueCopy = filterValueCopy.filter((v) => v.value !== value.value);
8282
}
8383

84-
setFilterValue(filterValueCopy);
84+
setFilterOption(filterValueCopy);
8585
} catch (error) {
8686
console.error('Error updating filter value:', error);
8787
}
@@ -90,19 +90,19 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
9090
// Method to handle Apply
9191
const onApply = () => {
9292
try {
93-
if (!filterValue.length) {
93+
if (!filterOption.length) {
9494
const newFilter = 'all';
95-
setFilterV(newFilter);
95+
setFilterValue(newFilter);
9696
fetchData({ filter: newFilter });
9797
closeModal();
9898
return;
9999
}
100100

101-
const usersQueryArray = filterValue.map((item) => item.value);
101+
const usersQueryArray = filterOption.map((item) => item.value);
102102
const newFilter =
103103
usersQueryArray.length > 1 ? usersQueryArray.join('-') : usersQueryArray[0];
104104

105-
setFilterV(newFilter);
105+
setFilterValue(newFilter);
106106
fetchData({ filter: newFilter });
107107
setIsFilterApplied(true);
108108
closeModal();
@@ -149,8 +149,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
149149
closeModal={closeModal}
150150
updateValue={updateValue}
151151
onApply={onApply}
152-
selectedLevels={filterValue}
153-
setFilterValue={setFilterValue}
152+
selectedLevels={filterOption}
153+
setFilterValue={setFilterOption}
154154
/>
155155
</div>
156156
);
@@ -220,7 +220,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
220220
startIndex = 0,
221221
stopIndex = 30,
222222
searchText = 'null',
223-
filter = filterV
223+
filter = filterValue
224224
}) => {
225225
searchText = searchText === '' ? 'null' : searchText;
226226

0 commit comments

Comments
 (0)