Skip to content

Commit 821c672

Browse files
authored
Merge pull request #90 from zenml-io/pagination-integration
Pagination integration
2 parents 98602ed + a3878fd commit 821c672

File tree

3 files changed

+47
-20
lines changed

3 files changed

+47
-20
lines changed

src/ui/components/Filters/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,12 @@ const FilterComponent = ({
688688
className="text-muted h5"
689689
>
690690
{/* Filter your stack */}
691-
{!applyFilter && !filters[0]?.column?.selectedValue?.label ? (
691+
{!applyFilter && !filters[0]?.filterValue ? (
692692
<Paragraph className={styles.filterplaceholder}>
693693
Filter list
694+
{console.log(filters, 'filters1')}
694695
</Paragraph>
695-
) : filters[0]?.column?.selectedValue.label &&
696-
!applyFilter &&
697-
!searchText ? (
696+
) : filters[0]?.filterValue && !applyFilter && !searchText ? (
698697
filters.map((filter: any, index: number) => {
699698
return (
700699
<FlexBox.Row key={index} className={styles.tile}>
@@ -726,8 +725,7 @@ const FilterComponent = ({
726725
Filter list
727726
</Paragraph>
728727
)}
729-
{!applyFilter &&
730-
!filters[0]?.column?.selectedValue?.label ? null : filters[0]
728+
{!applyFilter && !filters[0]?.filterValue ? null : filters[0]
731729
?.column?.selectedValue.label &&
732730
!applyFilter &&
733731
!searchText ? (

src/ui/layouts/common/Table/index.tsx

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,42 +183,63 @@ export const Table: React.FC<TableProps> = ({
183183
// console.log(check, '333');
184184
useEffect(() => {
185185
// console.log(locationPath.pathname.split('/')[4], 'locationPath1');
186-
setItemPerPage(DEFAULT_ITEMS_PER_PAGE);
186+
setItemPerPage(itemPerPage);
187+
if (filters) {
188+
setPageIndex(0);
189+
}
187190
switch (componentName) {
188191
case 'stacks':
189192
if (CheckIfRun) {
190-
dispatchStackRunsData(id, 1, 5, filters as any, activeSorting);
193+
dispatchStackRunsData(
194+
id,
195+
1,
196+
itemPerPage,
197+
filters as any,
198+
activeSorting,
199+
);
191200
break;
192201
} else {
193-
dispatchStackData(1, 5, filters as any, activeSorting);
202+
dispatchStackData(1, itemPerPage, filters as any, activeSorting);
194203
break;
195204
}
196205
case 'components':
197206
if (CheckIfRun) {
198207
dispatchStackComponentRunsData(
199208
id,
200209
1,
201-
5,
210+
itemPerPage,
202211
filters as any,
203212
activeSorting,
204213
);
205214
break;
206215
} else {
207-
dispatchStackComponentsData(1, 5, filters as any, activeSorting);
216+
dispatchStackComponentsData(
217+
1,
218+
itemPerPage,
219+
filters as any,
220+
activeSorting,
221+
);
208222
break;
209223
}
210224
case 'pipelines':
211225
if (CheckIfRun) {
212-
dispatchPipelineRunsData(id, 1, 5, filters as any, activeSorting);
226+
dispatchPipelineRunsData(
227+
id,
228+
1,
229+
itemPerPage,
230+
filters as any,
231+
activeSorting,
232+
);
213233
break;
214234
} else {
235+
console.log(itemPerPage, 'itemPerPage');
215236
if (!renderAfterRow) break;
216-
dispatchPipelineData(1, 5, filters as any, activeSorting);
237+
dispatchPipelineData(1, itemPerPage, filters as any, activeSorting);
217238
break;
218239
}
219240

220241
case 'all-runs':
221-
dispatchAllrunsData(1, 5, filters as any, activeSorting);
242+
dispatchAllrunsData(1, itemPerPage, filters as any, activeSorting);
222243
break;
223244

224245
default:
@@ -252,7 +273,7 @@ export const Table: React.FC<TableProps> = ({
252273
<tr className={showHeader ? styles.tableHeaderRow : ''}>
253274
{headerCols.map((headerCol: HeaderCol, index: number, i) => (
254275
<th
255-
className={styles.tableHeadingTh}
276+
className={styles.tableHeadingTh}
256277
style={{
257278
width: headerCol.width,
258279
color: '#424240',
@@ -261,8 +282,12 @@ export const Table: React.FC<TableProps> = ({
261282
}}
262283
key={index}
263284
>
264-
<Box style={{ backgroundColor: '#f6f67' }} paddingVertical={showHeader ? 'sm' : null} paddingLeft="lg">
265-
{headerCol.render && headerCol.render()}
285+
<Box
286+
style={{ backgroundColor: '#f6f67' }}
287+
paddingVertical={showHeader ? 'sm' : null}
288+
paddingLeft="lg"
289+
>
290+
{headerCol.render && headerCol.render()}
266291
</Box>
267292
</th>
268293
))}
@@ -284,7 +309,9 @@ export const Table: React.FC<TableProps> = ({
284309
styles.tableRow,
285310
trOnClick && styles.clickableTableRow,
286311
)}
287-
style={{ backgroundColor: index % 2 !== 0 ? '#F5F3F9' : 'white' }}
312+
style={{
313+
backgroundColor: index % 2 !== 0 ? '#F5F3F9' : 'white',
314+
}}
288315
key={index}
289316
>
290317
{headerCols.map((headerCol: HeaderCol, index: number) => (
@@ -295,7 +322,7 @@ export const Table: React.FC<TableProps> = ({
295322
>
296323
<Box paddingVertical="sm" paddingLeft="lg">
297324
<Truncate maxLines={1}>
298-
{headerCol.renderRow(headerRow)}
325+
{headerCol.renderRow(headerRow)}
299326
</Truncate>
300327
</Box>
301328
</td>

src/ui/layouts/pipelines/RunsTable/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export const RunsTable: React.FC<{
6969
});
7070

7171
useEffect(() => {
72-
getSorted(activeSorting, activeSortingDirection);
72+
if (getSorted) {
73+
getSorted(activeSorting, activeSortingDirection);
74+
}
7375
// eslint-disable-next-line react-hooks/exhaustive-deps
7476
}, [getSorted]);
7577

0 commit comments

Comments
 (0)