Skip to content

Commit edad879

Browse files
authored
Merge pull request #63 from zenml-io/talha/feedback-fixes
Talha/feedback fixes
2 parents 462a335 + aef3630 commit edad879

File tree

3 files changed

+46
-33
lines changed

3 files changed

+46
-33
lines changed

src/ui/layouts/Home.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,23 @@ export const Home: React.FC = () => {
7272
const authToken = useSelector(sessionSelectors.authenticationToken);
7373

7474
useEffect(() => {
75-
const getDashboardData = async () => {
76-
setFetching(true);
77-
const { data } = await axios.get(
78-
`${process.env.REACT_APP_BASE_API_URL}/projects/${DEFAULT_PROJECT_NAME}/statistics`,
79-
{
80-
headers: {
81-
Authorization: `bearer ${authToken}`,
75+
if (authToken) {
76+
const getDashboardData = async () => {
77+
setFetching(true);
78+
const { data } = await axios.get(
79+
`${process.env.REACT_APP_BASE_API_URL}/projects/${DEFAULT_PROJECT_NAME}/statistics`,
80+
{
81+
headers: {
82+
Authorization: `bearer ${authToken}`,
83+
},
8284
},
83-
},
84-
);
85+
);
8586

86-
setDashboardData(data);
87-
setFetching(false);
88-
};
89-
getDashboardData();
87+
setDashboardData(data);
88+
setFetching(false);
89+
};
90+
getDashboardData();
91+
}
9092
}, [authToken]);
9193

9294
const preData = Object.entries(dashboardData);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export interface TableProps {
3535
}
3636

3737
const ITEMS_PER_PAGE = parseInt(process.env.REACT_APP_ITEMS_PER_PAGE as string);
38+
const DEFAULT_ITEMS_PER_PAGE = 10;
3839

3940
export const Table: React.FC<TableProps> = ({
4041
headerCols,
@@ -50,7 +51,7 @@ export const Table: React.FC<TableProps> = ({
5051

5152
const { itemsForPage, pages, totalOfPages } = getPaginationData({
5253
pageIndex,
53-
itemsPerPage: ITEMS_PER_PAGE,
54+
itemsPerPage: ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE,
5455
items: tableRows,
5556
});
5657

src/ui/layouts/common/layouts/AuthenticatedLayout/AuthenticatedSidebar/SideFooter/index.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,30 @@ import { useSelector } from '../../../../../../hooks';
1010
import axios from 'axios';
1111

1212
export const SideFooter: React.FC = () => {
13-
1413
const authToken = useSelector(sessionSelectors.authenticationToken);
15-
const [apiVersion, setApiVersion] = useState('')
14+
const [apiVersion, setApiVersion] = useState('');
15+
16+
useEffect(() => {
17+
if (authToken) {
18+
const getApiVersion = async () => {
19+
const { data } = await axios.get(
20+
`${process.env.REACT_APP_BASE_API_URL}/version`,
21+
{
22+
headers: {
23+
Authorization: `bearer ${authToken}`,
24+
},
25+
},
26+
);
27+
setApiVersion(data);
28+
};
1629

17-
useEffect(() => {
18-
const getApiVersion = async () => {
19-
const { data } = await axios.get(`${process.env.REACT_APP_BASE_API_URL}/version`, {
20-
headers: {
21-
'Authorization': `bearer ${authToken}`
22-
}
23-
})
24-
setApiVersion(data)
30+
getApiVersion();
2531
}
32+
}, [authToken]);
2633

27-
getApiVersion()
28-
}, [authToken])
29-
3034
return (
3135
<>
32-
<Box marginHorizontal="md" paddingBottom='md'>
36+
<Box marginHorizontal="md" paddingBottom="md">
3337
<Separator.LightNew />
3438
</Box>
3539

@@ -53,13 +57,19 @@ export const SideFooter: React.FC = () => {
5357
<MenuItem
5458
Icon={() => (
5559
<icons.settings color={iconColors.white} size={iconSizes.md} />
56-
)} to={routePaths.settings.personalDetails} text={translate('menu.setting.text')}
60+
)}
61+
to={routePaths.settings.personalDetails}
62+
text={translate('menu.setting.text')}
5763
/>
5864

59-
<Box style={{ paddingLeft: '12px' }} paddingTop="md" paddingBottom='xs' >
60-
<Paragraph color='white' style={{ fontSize: '8px', fontWeight: 400 }}>UI Version v{process.env.REACT_APP_VERSION}</Paragraph>
61-
<Paragraph color='white' style={{ fontSize: '8px', fontWeight: 400 }}>ZenML v{apiVersion}</Paragraph>
65+
<Box style={{ paddingLeft: '12px' }} paddingTop="md" paddingBottom="xs">
66+
<Paragraph color="white" style={{ fontSize: '8px', fontWeight: 400 }}>
67+
UI Version v{process.env.REACT_APP_VERSION}
68+
</Paragraph>
69+
<Paragraph color="white" style={{ fontSize: '8px', fontWeight: 400 }}>
70+
ZenML v{apiVersion}
71+
</Paragraph>
6272
</Box>
63-
</>
73+
</>
6474
);
6575
};

0 commit comments

Comments
 (0)