Daniel Kantor
commited on
Commit
·
4cc78af
1
Parent(s):
c5c70b9
fixes: https://github.com/orgs/stacklok/projects/46/views/1?pane=issue&itemId=103540751&issue=stacklok%7Csecure-code-leaderboard%7C41
Browse files- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Table/Table.js +27 -27
- frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Table/hooks/useDataProcessing.js +6 -5
- frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js +8 -8
- frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useLeaderboardData.js +4 -4
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Table/Table.js
CHANGED
@@ -297,7 +297,7 @@ const LeaderboardTable = ({
|
|
297 |
const paddingBottom =
|
298 |
virtualRows.length > 0
|
299 |
? unpinnedRows.length * currentRowHeight -
|
300 |
-
|
301 |
: 0;
|
302 |
|
303 |
// Handle column reset
|
@@ -402,8 +402,8 @@ const LeaderboardTable = ({
|
|
402 |
backgroundColor: isSticky
|
403 |
? theme.palette.background.paper
|
404 |
: (sortedIndex + 1) % 2 === 0
|
405 |
-
|
406 |
-
|
407 |
position: isSticky ? "sticky" : "relative",
|
408 |
top: isSticky
|
409 |
? `${headerHeight + stickyIndex * currentRowHeight}px`
|
@@ -411,24 +411,24 @@ const LeaderboardTable = ({
|
|
411 |
zIndex: isSticky ? 2 : 1,
|
412 |
boxShadow: isSticky
|
413 |
? `0 1px 1px ${alpha(
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
: "none",
|
418 |
"&::after": isSticky
|
419 |
? {
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
: {},
|
433 |
})}
|
434 |
>
|
@@ -604,8 +604,8 @@ const LeaderboardTable = ({
|
|
604 |
"& td, & th":
|
605 |
pinnedRows.length > 0
|
606 |
? {
|
607 |
-
|
608 |
-
|
609 |
: {},
|
610 |
}}
|
611 |
>
|
@@ -616,14 +616,14 @@ const LeaderboardTable = ({
|
|
616 |
style={
|
617 |
index < 4
|
618 |
? {
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
: {
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
}
|
628 |
/>
|
629 |
))}
|
|
|
297 |
const paddingBottom =
|
298 |
virtualRows.length > 0
|
299 |
? unpinnedRows.length * currentRowHeight -
|
300 |
+
virtualRows[virtualRows.length - 1].end
|
301 |
: 0;
|
302 |
|
303 |
// Handle column reset
|
|
|
402 |
backgroundColor: isSticky
|
403 |
? theme.palette.background.paper
|
404 |
: (sortedIndex + 1) % 2 === 0
|
405 |
+
? "transparent"
|
406 |
+
: alpha(theme.palette.mode === "dark" ? "#fff" : "#000", 0.02),
|
407 |
position: isSticky ? "sticky" : "relative",
|
408 |
top: isSticky
|
409 |
? `${headerHeight + stickyIndex * currentRowHeight}px`
|
|
|
411 |
zIndex: isSticky ? 2 : 1,
|
412 |
boxShadow: isSticky
|
413 |
? `0 1px 1px ${alpha(
|
414 |
+
theme.palette.common.black,
|
415 |
+
theme.palette.mode === "dark" ? 0.1 : 0.05
|
416 |
+
)}`
|
417 |
: "none",
|
418 |
"&::after": isSticky
|
419 |
? {
|
420 |
+
content: '""',
|
421 |
+
position: "absolute",
|
422 |
+
left: 0,
|
423 |
+
right: 0,
|
424 |
+
height: "1px",
|
425 |
+
bottom: -1,
|
426 |
+
backgroundColor: alpha(
|
427 |
+
theme.palette.divider,
|
428 |
+
theme.palette.mode === "dark" ? 0.1 : 0.2
|
429 |
+
),
|
430 |
+
zIndex: 1,
|
431 |
+
}
|
432 |
: {},
|
433 |
})}
|
434 |
>
|
|
|
604 |
"& td, & th":
|
605 |
pinnedRows.length > 0
|
606 |
? {
|
607 |
+
width: `${100 / table.getAllColumns().length}%`,
|
608 |
+
}
|
609 |
: {},
|
610 |
}}
|
611 |
>
|
|
|
616 |
style={
|
617 |
index < 4
|
618 |
? {
|
619 |
+
width: column.columnDef.size,
|
620 |
+
minWidth: column.columnDef.size,
|
621 |
+
maxWidth: column.columnDef.size,
|
622 |
+
}
|
623 |
: {
|
624 |
+
minWidth: column.columnDef.size,
|
625 |
+
width: `${100 / (table.getAllColumns().length - 4)}%`,
|
626 |
+
}
|
627 |
}
|
628 |
/>
|
629 |
))}
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/components/Table/hooks/useDataProcessing.js
CHANGED
@@ -17,7 +17,7 @@ import {
|
|
17 |
export const useDataProcessing = (
|
18 |
data,
|
19 |
searchValue,
|
20 |
-
selectedPrecisions,
|
21 |
selectedTypes,
|
22 |
paramsRange,
|
23 |
selectedBooleanFilters,
|
@@ -37,12 +37,11 @@ export const useDataProcessing = (
|
|
37 |
const processedData = useProcessedData(data, averageMode, visibleColumns);
|
38 |
const columnVisibility = useColumnVisibility(visibleColumns);
|
39 |
|
40 |
-
console.log({visibleColumns});
|
41 |
|
42 |
// Memoize filters
|
43 |
const filterConfig = useMemo(
|
44 |
() => ({
|
45 |
-
selectedPrecisions,
|
46 |
selectedTypes,
|
47 |
paramsRange,
|
48 |
searchValue,
|
@@ -52,7 +51,7 @@ export const useDataProcessing = (
|
|
52 |
isOfficialProviderActive,
|
53 |
}),
|
54 |
[
|
55 |
-
selectedPrecisions,
|
56 |
selectedTypes,
|
57 |
paramsRange,
|
58 |
searchValue,
|
@@ -63,10 +62,12 @@ export const useDataProcessing = (
|
|
63 |
]
|
64 |
);
|
65 |
|
|
|
|
|
66 |
// Call useFilteredData at root level
|
67 |
const filteredData = useFilteredData(
|
68 |
processedData,
|
69 |
-
filterConfig.selectedPrecisions,
|
70 |
filterConfig.selectedTypes,
|
71 |
filterConfig.paramsRange,
|
72 |
filterConfig.searchValue,
|
|
|
17 |
export const useDataProcessing = (
|
18 |
data,
|
19 |
searchValue,
|
20 |
+
//selectedPrecisions,
|
21 |
selectedTypes,
|
22 |
paramsRange,
|
23 |
selectedBooleanFilters,
|
|
|
37 |
const processedData = useProcessedData(data, averageMode, visibleColumns);
|
38 |
const columnVisibility = useColumnVisibility(visibleColumns);
|
39 |
|
|
|
40 |
|
41 |
// Memoize filters
|
42 |
const filterConfig = useMemo(
|
43 |
() => ({
|
44 |
+
//selectedPrecisions,
|
45 |
selectedTypes,
|
46 |
paramsRange,
|
47 |
searchValue,
|
|
|
51 |
isOfficialProviderActive,
|
52 |
}),
|
53 |
[
|
54 |
+
//selectedPrecisions,
|
55 |
selectedTypes,
|
56 |
paramsRange,
|
57 |
searchValue,
|
|
|
62 |
]
|
63 |
);
|
64 |
|
65 |
+
console.log({filterConfig});
|
66 |
+
|
67 |
// Call useFilteredData at root level
|
68 |
const filteredData = useFilteredData(
|
69 |
processedData,
|
70 |
+
//filterConfig.selectedPrecisions,
|
71 |
filterConfig.selectedTypes,
|
72 |
filterConfig.paramsRange,
|
73 |
filterConfig.searchValue,
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js
CHANGED
@@ -95,7 +95,7 @@ export const useProcessedData = (data, averageMode, visibleColumns) => {
|
|
95 |
// Common filtering logic
|
96 |
export const useFilteredData = (
|
97 |
processedData,
|
98 |
-
selectedPrecisions,
|
99 |
selectedTypes,
|
100 |
paramsRange,
|
101 |
searchValue,
|
@@ -124,12 +124,12 @@ export const useFilteredData = (
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
-
|
128 |
-
if (selectedPrecisions.length > 0) {
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
|
134 |
// Filter by type
|
135 |
if (
|
@@ -273,7 +273,7 @@ export const useFilteredData = (
|
|
273 |
return finalData;
|
274 |
}, [
|
275 |
processedData,
|
276 |
-
selectedPrecisions,
|
277 |
selectedTypes,
|
278 |
paramsRange,
|
279 |
searchValue,
|
|
|
95 |
// Common filtering logic
|
96 |
export const useFilteredData = (
|
97 |
processedData,
|
98 |
+
//selectedPrecisions,
|
99 |
selectedTypes,
|
100 |
paramsRange,
|
101 |
searchValue,
|
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
+
//// Filter by precision
|
128 |
+
//if (selectedPrecisions.length > 0) {
|
129 |
+
// filteredUnpinned = filteredUnpinned.filter((row) =>
|
130 |
+
// selectedPrecisions.includes(row.model.precision)
|
131 |
+
// );
|
132 |
+
//}
|
133 |
|
134 |
// Filter by type
|
135 |
if (
|
|
|
273 |
return finalData;
|
274 |
}, [
|
275 |
processedData,
|
276 |
+
//selectedPrecisions,
|
277 |
selectedTypes,
|
278 |
paramsRange,
|
279 |
searchValue,
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useLeaderboardData.js
CHANGED
@@ -67,10 +67,11 @@ export const useLeaderboardProcessing = () => {
|
|
67 |
|
68 |
const memoizedData = useMemo(() => state.models, [state.models]);
|
69 |
console.log({memoizedData});
|
|
|
70 |
const memoizedFilters = useMemo(
|
71 |
() => ({
|
72 |
search: state.filters.search,
|
73 |
-
precisions: state.filters.precisions,
|
74 |
types: state.filters.types,
|
75 |
paramsRange: state.filters.paramsRange,
|
76 |
booleanFilters: state.filters.booleanFilters,
|
@@ -78,7 +79,7 @@ export const useLeaderboardProcessing = () => {
|
|
78 |
}),
|
79 |
[
|
80 |
state.filters.search,
|
81 |
-
state.filters.precisions,
|
82 |
state.filters.types,
|
83 |
state.filters.paramsRange,
|
84 |
state.filters.booleanFilters,
|
@@ -98,7 +99,7 @@ export const useLeaderboardProcessing = () => {
|
|
98 |
} = useDataProcessing(
|
99 |
memoizedData,
|
100 |
memoizedFilters.search,
|
101 |
-
memoizedFilters.precisions,
|
102 |
memoizedFilters.types,
|
103 |
memoizedFilters.paramsRange,
|
104 |
memoizedFilters.booleanFilters,
|
@@ -113,7 +114,6 @@ export const useLeaderboardProcessing = () => {
|
|
113 |
memoizedFilters.isOfficialProviderActive
|
114 |
);
|
115 |
|
116 |
-
console.log({columns});
|
117 |
|
118 |
return {
|
119 |
table,
|
|
|
67 |
|
68 |
const memoizedData = useMemo(() => state.models, [state.models]);
|
69 |
console.log({memoizedData});
|
70 |
+
|
71 |
const memoizedFilters = useMemo(
|
72 |
() => ({
|
73 |
search: state.filters.search,
|
74 |
+
//precisions: state.filters.precisions,
|
75 |
types: state.filters.types,
|
76 |
paramsRange: state.filters.paramsRange,
|
77 |
booleanFilters: state.filters.booleanFilters,
|
|
|
79 |
}),
|
80 |
[
|
81 |
state.filters.search,
|
82 |
+
//state.filters.precisions,
|
83 |
state.filters.types,
|
84 |
state.filters.paramsRange,
|
85 |
state.filters.booleanFilters,
|
|
|
99 |
} = useDataProcessing(
|
100 |
memoizedData,
|
101 |
memoizedFilters.search,
|
102 |
+
//memoizedFilters.precisions,
|
103 |
memoizedFilters.types,
|
104 |
memoizedFilters.paramsRange,
|
105 |
memoizedFilters.booleanFilters,
|
|
|
114 |
memoizedFilters.isOfficialProviderActive
|
115 |
);
|
116 |
|
|
|
117 |
|
118 |
return {
|
119 |
table,
|