Skip to content

Commit 54fc61a

Browse files
authored
Merge pull request #108 from zenml-io/dev
Dev
2 parents b39d620 + c20eb9e commit 54fc61a

File tree

26 files changed

+201
-116
lines changed

26 files changed

+201
-116
lines changed

src/api/endpoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const endpoints = {
3636
StackComponents: {
3737
types: '/component-types',
3838
my: (type: string, project: string): string =>
39-
`/projects/${project}/components?type=${type}`,
39+
`/projects/${project}/components?scope_type=${type}`,
4040
get: (stackComponentId: TId): string => `/components/${stackComponentId}`,
4141
},
4242
runs: {
Lines changed: 6 additions & 0 deletions
Loading

src/ui/components/icons/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { ReactComponent as Graph } from './assets/Graph.svg';
5858
import { ReactComponent as GitCommit } from './assets/GitCommit.svg';
5959
import { ReactComponent as ChatDots } from './assets/ChatDots.svg';
6060
import { ReactComponent as Run } from './assets/Run.svg';
61+
import { ReactComponent as ImageBuilder } from './assets/ImageBuilder.svg';
6162
// import { ReactComponent as Inprogress } from './assets/InProgress.svg';
6263
// import { ReactComponent as Cached } from './assets/Cached.svg';
6364
// import { ReactComponent as RightArrow } from './assets/RightArrow.svg';
@@ -187,6 +188,10 @@ const icons = {
187188
Component: ChartBarHorizontal,
188189
useStroke: true,
189190
}),
191+
image_builder: createIcon({
192+
Component: ImageBuilder,
193+
useStroke: true,
194+
}),
190195

191196
// paginations
192197
paginationFirst: createIcon({ Component: PaginationFirst, useStroke: true }),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const CollapseTable: React.FC<TableProps & CollapseTableProps> = ({
1010
headerCols,
1111
tableRows,
1212
activeSorting,
13+
activeSortingDirection,
1314
showHeader = true,
1415
pagination = true,
1516
loading = false,
@@ -22,6 +23,7 @@ export const CollapseTable: React.FC<TableProps & CollapseTableProps> = ({
2223
// console.log('activeSorting', activeSorting);
2324
return (
2425
<Table
26+
activeSortingDirection={activeSortingDirection}
2527
activeSorting={activeSorting}
2628
headerCols={headerCols}
2729
tableRows={tableRows}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
131131
dispatchStackRunsData(id, page, size, filters as any, activeSorting);
132132
break;
133133
} else {
134-
dispatchStackData(1, size, filters as any, activeSorting);
134+
dispatchStackData(page, size, filters as any, activeSorting);
135135
break;
136136
}
137137
case 'components':
@@ -145,7 +145,12 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
145145
);
146146
break;
147147
} else {
148-
dispatchStackComponentsData(1, size, filters as any, activeSorting);
148+
dispatchStackComponentsData(
149+
page,
150+
size,
151+
filters as any,
152+
activeSorting,
153+
);
149154
break;
150155
}
151156
case 'pipelines':

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

Lines changed: 79 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface HeaderCol {
4040
export interface TableProps {
4141
headerCols: HeaderCol[];
4242
tableRows: any[];
43+
activeSortingDirection?: any;
4344
activeSorting?: any;
4445
paginated?: any;
4546
filters?: any[];
@@ -58,6 +59,7 @@ export const Table: React.FC<TableProps> = ({
5859
tableRows,
5960
paginated,
6061
activeSorting,
62+
activeSortingDirection,
6163
filters,
6264
showHeader = true,
6365
pagination = true,
@@ -160,7 +162,11 @@ export const Table: React.FC<TableProps> = ({
160162
// itemsPerPage: itemPerPage,
161163
// items: tableRows,
162164
// });
163-
const isValidFilter = filters?.map((f) => f.value).join('');
165+
166+
const isValidFilterFroValue: any = filters?.map((f) => f.value).join('');
167+
const isValidFilterForCategory: any =
168+
isValidFilterFroValue && filters?.map((f) => f.type.value).join('');
169+
const checkValidFilter = isValidFilterFroValue + isValidFilterForCategory;
164170

165171
const { dispatchStackData } = callActionForStacksForPagination();
166172
const {
@@ -183,87 +189,89 @@ export const Table: React.FC<TableProps> = ({
183189
componentName === 'components'
184190
? locationPath.pathname.split('/')[5]
185191
: locationPath.pathname.split('/')[4];
186-
// console.log(check, '333');
192+
const checkForLocationPath = locationPath.pathname.split('/')[4];
187193
useEffect(() => {
188194
// console.log(locationPath.pathname.split('/')[4], 'locationPath1');
189195
setItemPerPage(itemPerPage);
190196
if (filters) {
191197
setPageIndex(0);
192198
}
193-
switch (componentName) {
194-
case 'stacks':
195-
if (CheckIfRun) {
196-
dispatchStackRunsData(
197-
id,
198-
1,
199-
itemPerPage,
200-
filters as any,
201-
activeSorting,
202-
);
203-
break;
204-
} else {
205-
dispatchStackData(1, itemPerPage, filters as any, activeSorting);
206-
break;
207-
}
208-
case 'components':
209-
if (CheckIfRun) {
210-
dispatchStackComponentRunsData(
211-
id,
212-
1,
213-
itemPerPage,
214-
filters as any,
215-
activeSorting,
216-
);
217-
break;
218-
} else {
219-
dispatchStackComponentsData(
220-
1,
221-
itemPerPage,
222-
filters as any,
223-
activeSorting,
224-
);
225-
break;
226-
}
227-
case 'pipelines':
228-
if (CheckIfRun) {
229-
dispatchPipelineRunsData(
230-
id,
231-
1,
232-
itemPerPage,
233-
filters as any,
234-
activeSorting,
235-
);
236-
break;
237-
} else {
238-
console.log(itemPerPage, 'itemPerPage');
239-
if (!renderAfterRow) break;
240-
dispatchPipelineData(1, itemPerPage, filters as any, activeSorting);
241-
break;
242-
}
199+
if (checkValidFilter || activeSorting || checkForLocationPath) {
200+
switch (componentName) {
201+
case 'stacks':
202+
if (CheckIfRun) {
203+
dispatchStackRunsData(
204+
id,
205+
1,
206+
itemPerPage,
207+
filters as any,
208+
activeSorting,
209+
);
210+
break;
211+
} else {
212+
dispatchStackData(1, itemPerPage, filters as any, activeSorting);
213+
break;
214+
}
215+
case 'components':
216+
if (CheckIfRun) {
217+
dispatchStackComponentRunsData(
218+
id,
219+
1,
220+
itemPerPage,
221+
filters as any,
222+
activeSorting,
223+
);
224+
break;
225+
} else {
226+
dispatchStackComponentsData(
227+
1,
228+
itemPerPage,
229+
filters as any,
230+
activeSorting,
231+
);
232+
break;
233+
}
234+
case 'pipelines':
235+
if (CheckIfRun) {
236+
dispatchPipelineRunsData(
237+
id,
238+
1,
239+
itemPerPage,
240+
filters as any,
241+
activeSorting,
242+
);
243+
break;
244+
} else {
245+
console.log(itemPerPage, 'itemPerPage');
246+
if (!renderAfterRow) break;
247+
dispatchPipelineData(1, itemPerPage, filters as any, activeSorting);
248+
break;
249+
}
243250

244-
case 'all-runs':
245-
dispatchAllrunsData(1, itemPerPage, filters as any, activeSorting);
246-
break;
251+
case 'all-runs':
252+
dispatchAllrunsData(1, itemPerPage, filters as any, activeSorting);
253+
break;
247254

248-
default:
249-
break;
250-
}
251-
if (locationPath.pathname.split('/')[2] === 'organization') {
252-
// debugger;
253-
setFetchingMembers(true);
254-
dispatch(
255-
organizationActions.getMembers({
256-
page: 1,
257-
size: ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE,
258-
sort_by: activeSorting,
259-
onSuccess: () => setFetchingMembers(false),
260-
onFailure: () => setFetchingMembers(false),
261-
}),
262-
);
255+
default:
256+
break;
257+
}
258+
if (locationPath.pathname.split('/')[2] === 'organization') {
259+
// debugger;
260+
setFetchingMembers(true);
261+
dispatch(
262+
organizationActions.getMembers({
263+
page: 1,
264+
size: ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE,
265+
sort_by: activeSorting,
266+
onSuccess: () => setFetchingMembers(false),
267+
onFailure: () => setFetchingMembers(false),
268+
}),
269+
);
270+
}
263271
}
264272

265273
// eslint-disable-next-line react-hooks/exhaustive-deps
266-
}, [locationPath.pathname.split('/')[4], isValidFilter, activeSorting]);
274+
}, [checkForLocationPath, checkValidFilter, activeSorting]);
267275
let rowsToDisplay = tableRows;
268276
// function getFetchedState(state: any) {
269277
// setFetchingMembers(state);

src/ui/layouts/pipelines/PipelineDetail/Runs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Runs: React.FC<{ pipelineId: TId; filter: any }> = ({
99
}) => {
1010
const [sortBy, setSortBy] = useState('created');
1111
function getSorted(activeSorting: any, activeSortingDirection: any) {
12-
setSortBy(activeSorting);
12+
setSortBy(activeSortingDirection?.toLowerCase() + ':' + activeSorting);
1313
// console.log(activeSorting, activeSortingDirection, 'aaaaaaa');
1414
}
1515
const { fetching, runIds, runsPaginated } = useService({

src/ui/layouts/pipelines/Pipelines/AllRuns/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Props {
1515
export const AllRuns: React.FC<Props> = ({ filter }: Props) => {
1616
const [sortBy, setSortBy] = useState('created');
1717
function getSorted(activeSorting: any, activeSortingDirection: any) {
18-
setSortBy(activeSorting);
18+
setSortBy(activeSortingDirection?.toLowerCase() + ':' + activeSorting);
1919
// console.log(activeSorting, activeSortingDirection, 'aaaaaaa');
2020
}
2121

src/ui/layouts/pipelines/Pipelines/List/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ export const List: React.FC<Props> = ({ filter }: Props) => {
6565
nestedRow={true}
6666
/>
6767
)}
68+
activeSortingDirection={activeSortingDirection}
6869
activeSorting={
69-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
70-
? activeSorting
71-
: 'created'
70+
activeSortingDirection?.toLowerCase() + ':' + activeSorting
7271
}
72+
// activeSorting={
73+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
74+
// ? activeSorting
75+
// : 'created'
76+
// }
7377
paginated={pipelinesPaginated}
7478
loading={fetching}
7579
showHeader={true}

src/ui/layouts/pipelines/Pipelines/List/useService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const useService = (
4848
const [
4949
activeSortingDirection,
5050
setActiveSortingDirection,
51-
] = React.useState<SortingDirection | null>('DESC');
51+
] = React.useState<SortingDirection | null>('ASC');
5252

5353
const dispatch = useDispatch();
5454

@@ -70,10 +70,11 @@ export const useService = (
7070
useEffect(() => {
7171
if (!isValidFilter) {
7272
const intervalId = setInterval(() => {
73-
//assign interval to a variable to clear it.
73+
const applySorting =
74+
activeSortingDirection?.toLowerCase() + ':' + activeSorting;
7475
dispatch(
7576
pipelinesActions.getMy({
76-
sort_by: activeSorting ? activeSorting : 'created',
77+
sort_by: applySorting ? applySorting : 'created',
7778
logical_operator: 'and',
7879
// name: '',
7980
project: selectedProject,

0 commit comments

Comments
 (0)