Skip to content

Commit e53abf3

Browse files
authored
Merge pull request #26 from zenml-io/talha/feedback-fixes
Talha/feedback fixes
2 parents 4b92d2c + 213b221 commit e53abf3

File tree

22 files changed

+172
-108
lines changed

22 files changed

+172
-108
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
If,
1010
H3,
1111
Truncate,
12+
FullWidthSpinner,
1213
// FullWidthSpinner,
1314
} from '../../../components';
1415
import { getPaginationData } from '../../../../utils/pagination';
@@ -60,15 +61,15 @@ export const Table: React.FC<TableProps> = ({
6061
rowsToDisplay = itemsForPage;
6162
}
6263

63-
// if (loading) {
64-
// return <FullWidthSpinner color="black" size="md" />;
65-
// }
64+
if (loading) {
65+
return <FullWidthSpinner color="black" size="md" />;
66+
}
6667

6768
return (
6869
<FlexBox.Column className={styles.tableWrapper} fullWidth>
6970
<IfElse
70-
// condition={tableRows.length > 0 && !loading}
71-
condition={tableRows.length > 0}
71+
condition={tableRows.length > 0 && !loading}
72+
// condition={tableRows.length > 0}
7273
renderWhenTrue={() => (
7374
<>
7475
<table className={styles.table}>

src/ui/layouts/common/layouts/AuthenticatedLayout/AuthenticatedSidebar/Menu/MenuItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { NavLink, useLocation } from 'react-router-dom';
33
import { Paragraph, Box, FlexBox } from '../../../../../../components';
44
import cn from 'classnames';
55
import styles from './MenuItem.module.scss';
6+
import { camelCaseToParagraph } from '../../../../../../../utils';
67

78
export const MenuItem: React.FC<{
89
subItem?: boolean;
@@ -39,7 +40,7 @@ export const MenuItem: React.FC<{
3940
</Box>
4041
<Box paddingLeft="md">
4142
<Paragraph color="darkGrey" size="small">
42-
{text}
43+
{camelCaseToParagraph(text)}
4344
</Paragraph>
4445
</Box>
4546
</FlexBox>

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useEffect } from 'react';
2+
// import { pipelinesActions, runsActions } from '../../../../../redux/actions';
13
import {
24
pipelinePagesSelectors,
35
runSelectors,
@@ -11,21 +13,12 @@ interface ServiceInterface {
1113

1214
export const useService = (): ServiceInterface => {
1315
const fetching = useSelector(pipelinePagesSelectors.fetching);
14-
// const currentWorkspace = useSelector(pipelinePagesSelectors.currentWorkspace);
15-
16-
// const runs1 = useSelector((state: any) => {
17-
// debugger;
18-
// return state.persisted.runs.allNewRuns || [];
19-
// });
2016

2117
const runs = useSelector(runSelectors.myRuns);
22-
23-
// const filteredRuns = runs.filter(
24-
// (run: TRun) => currentWorkspace && run.workspaceId === currentWorkspace.id,
25-
// );
18+
useEffect(() => {}, [runs]);
2619

2720
const runIds = runs.map((run: TRun) => run.id);
28-
// debugger;
21+
2922
return {
3023
fetching,
3124
runIds,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const useService = (
5757
// );
5858

5959
setFilteredPipelines(orderedPipelines);
60-
}, [filter]);
60+
}, [filter, pipelines]);
6161

6262
const setSelectedRunIds = (runIds: TId[]) => {
6363
dispatch(pipelinePagesActions.setSelectedRunIds({ runIds }));

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
44
import {
55
pipelinePagesActions,
66
runsActions,
7-
workspacesActions,
7+
pipelinesActions,
88
} from '../../../../redux/actions';
99
import {
1010
pipelinePagesSelectors,
@@ -16,15 +16,15 @@ interface ServiceInterface {
1616
setFetching: (arg: boolean) => void;
1717
setCurrentWorkspace: (arg: TWorkspace | null) => void;
1818
currentWorkspace: TWorkspace | null;
19-
workspaces: TWorkspace[];
19+
// workspaces: TWorkspace[];
2020
}
2121

2222
export const useService = (): ServiceInterface => {
2323
const currentWorkspace = useSelector(pipelinePagesSelectors.currentWorkspace);
2424

2525
const dispatch = useDispatch();
2626

27-
const workspaces = useSelector(workspaceSelectors.myWorkspaces);
27+
// const workspaces = useSelector(workspaceSelectors.myWorkspaces);
2828

2929
// useRequestOnMount(workspacesActions.getMy, {});
3030

@@ -63,6 +63,6 @@ export const useService = (): ServiceInterface => {
6363
setFetching,
6464
setCurrentWorkspace,
6565
currentWorkspace,
66-
workspaces,
66+
// workspaces,
6767
};
6868
};

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export const RunsTable: React.FC<{
4040
fromAllruns
4141
? history.push(routePaths.run.run.statistics(run.id))
4242
: history.push(
43-
routePaths.run.pipeline.statistics(run.id, run.pipeline_id),
43+
routePaths.run.pipeline.statistics(
44+
run.id,
45+
run.pipeline_id ? run.pipeline_id : run.pipelineId,
46+
),
4447
);
4548
};
4649

src/ui/layouts/pipelines/useService.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
import { useEffect } from 'react';
2+
import { pipelinesActions, runsActions } from '../../../redux/actions';
13
import { organizationSelectors } from '../../../redux/selectors';
2-
import { useSelector } from '../../hooks';
4+
import { useSelector, useDispatch } from '../../hooks';
35

46
interface ServiceInterface {
57
organization: TOrganization | null;
68
}
79

810
export const useService = (): ServiceInterface => {
911
const organization = useSelector(organizationSelectors.myOrganization);
12+
const dispatch = useDispatch();
13+
// useEffect(() => {
14+
// dispatch(pipelinesActions.getMy());
15+
// }, []);
16+
useEffect(() => {
17+
const intervalId = setInterval(() => {
18+
//assign interval to a variable to clear it.
19+
dispatch(runsActions.allRuns({}));
20+
dispatch(pipelinesActions.getMy());
21+
}, 5000);
1022

23+
return () => clearInterval(intervalId); //This is important
24+
});
1125
return {
1226
organization,
1327
};

src/ui/layouts/runs/Stacks/index.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { translate } from './translate';
33
import { List } from './List';
44
import { BasePage } from '../BasePage';
55
import { routePaths } from '../../../../routes/routePaths';
6-
import { WorkspaceDropdown } from './WorkspaceDropdown';
6+
// import { WorkspaceDropdown } from './WorkspaceDropdown';
77
import { useService } from './useService';
88

99
const PAGES = [
@@ -33,12 +33,8 @@ const BREADCRUMBS = [
3333
];
3434

3535
export const Stacks: React.FC = () => {
36-
const {
37-
setFetching,
38-
setCurrentWorkspace,
39-
currentWorkspace,
40-
workspaces,
41-
} = useService();
36+
const { setFetching } = useService();
37+
console.log(setFetching);
4238

4339
return (
4440
<BasePage
@@ -47,16 +43,17 @@ export const Stacks: React.FC = () => {
4743
breadcrumbs={BREADCRUMBS}
4844
headerWithButtons
4945
renderHeaderRight={() => (
50-
<WorkspaceDropdown
51-
workspaces={workspaces}
52-
currentWorkspace={currentWorkspace}
53-
setCurrentWorkspace={(workspace: TWorkspace): void => {
54-
if (currentWorkspace && workspace.id !== currentWorkspace.id) {
55-
setFetching(true);
56-
}
57-
setCurrentWorkspace(workspace);
58-
}}
59-
/>
46+
<></>
47+
// <WorkspaceDropdown
48+
// workspaces={workspaces}
49+
// currentWorkspace={currentWorkspace}
50+
// setCurrentWorkspace={(workspace: TWorkspace): void => {
51+
// if (currentWorkspace && workspace.id !== currentWorkspace.id) {
52+
// setFetching(true);
53+
// }
54+
// setCurrentWorkspace(workspace);
55+
// }}
56+
// />
6057
)}
6158
/>
6259
);

src/ui/layouts/runs/Stacks/useService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ interface ServiceInterface {
2121
setFetching: (arg: boolean) => void;
2222
setCurrentWorkspace: (arg: TWorkspace | null) => void;
2323
currentWorkspace: TWorkspace | null;
24-
workspaces: TWorkspace[];
24+
// workspaces: TWorkspace[];
2525
}
2626

2727
export const useService = (): ServiceInterface => {
2828
const currentWorkspace = useSelector(stackPagesSelectors.currentWorkspace);
2929
const locationPath = useLocationPath();
3030
const dispatch = useDispatch();
3131

32-
const workspaces = useSelector(workspaceSelectors.myWorkspaces);
32+
// const workspaces = useSelector(workspaceSelectors.myWorkspaces);
3333

34-
useRequestOnMount(workspacesActions.getMy, {});
34+
// useRequestOnMount(workspacesActions.getMy, {});
3535

3636
useEffect(() => {
3737
setFetching(true);
@@ -56,6 +56,6 @@ export const useService = (): ServiceInterface => {
5656
setFetching,
5757
setCurrentWorkspace,
5858
currentWorkspace,
59-
workspaces,
59+
// workspaces,
6060
};
6161
};

src/ui/layouts/settings/Organization/DeleteMember.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { useDispatch } from 'react-redux';
33
import {
44
Box,
@@ -21,6 +21,14 @@ export const DeleteMember: React.FC<{ member: TInvite }> = ({ member }) => {
2121
const [submitting, setSubmitting] = useState(false);
2222
const dispatch = useDispatch();
2323

24+
useEffect(() => {
25+
const intervalId = setInterval(() => {
26+
//assign interval to a variable to clear it.
27+
dispatch(organizationActions.getMembers({}));
28+
}, 5000);
29+
30+
return () => clearInterval(intervalId); //This is important
31+
});
2432
const onDelete = () => {
2533
setSubmitting(true);
2634
dispatch(
@@ -60,7 +68,9 @@ export const DeleteMember: React.FC<{ member: TInvite }> = ({ member }) => {
6068
</H3>
6169
</FlexBox.Row>
6270
<Box marginTop="md">
63-
<Paragraph>{`${translate('deleteMemberPopup.text')} ${member?.email}`}</Paragraph>
71+
<Paragraph>{`${translate('deleteMemberPopup.text')} ${
72+
member?.email
73+
}`}</Paragraph>
6474
</Box>
6575
<FlexBox justifyContent="flex-end" marginTop="xl" flexWrap>
6676
<Box marginRight="sm" marginBottom="md">
@@ -81,7 +91,7 @@ export const DeleteMember: React.FC<{ member: TInvite }> = ({ member }) => {
8191
</Popup>
8292
)}
8393
<Box>
84-
<LinkBox onClick={() => setPopupOpen(true)} >
94+
<LinkBox onClick={() => setPopupOpen(true)}>
8595
<icons.closeWithBorder color={iconColors.grey} />
8696
</LinkBox>
8797
</Box>

0 commit comments

Comments
 (0)