Skip to content

Commit

Permalink
resolves #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilumilak committed May 20, 2024
1 parent 19e95fe commit feffaf7
Show file tree
Hide file tree
Showing 20 changed files with 649 additions and 38 deletions.
Binary file added frontend/public/serviceImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 45 additions & 38 deletions frontend/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Suspense, useContext } from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';
import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
import {
accessErrorPage,
clusterPath,
Expand All @@ -24,6 +24,7 @@ import { GlobalSettingsProvider } from './contexts/GlobalSettingsContext';
import { UserInfoRolesAccessProvider } from './contexts/UserInfoRolesAccessContext';
import PageContainer from './PageContainer/PageContainer';

const AuthPage = React.lazy(() => import('components/AuthPage/AuthPage'));
const Dashboard = React.lazy(() => import('components/Dashboard/Dashboard'));
const ClusterPage = React.lazy(
() => import('components/ClusterPage/ClusterPage')
Expand All @@ -49,51 +50,57 @@ const queryClient = new QueryClient({
});
const App: React.FC = () => {
const { isDarkMode } = useContext(ThemeModeContext);
const location = useLocation();
const isAuthPage = location.pathname === '/auth';

return (
<QueryClientProvider client={queryClient}>
<GlobalSettingsProvider>
<ThemeProvider theme={isDarkMode ? darkTheme : theme}>
<Suspense fallback={<PageLoader fullSize />}>
<UserInfoRolesAccessProvider>
<ConfirmContextProvider>
<GlobalCSS />
<S.Layout>
<PageContainer>
<Routes>
{['/', '/ui', '/ui/clusters'].map((path) => (
{isAuthPage ? (
<AuthPage />
) : (
<UserInfoRolesAccessProvider>
<ConfirmContextProvider>
<GlobalCSS />
<S.Layout>
<PageContainer>
<Routes>
{['/', '/ui', '/ui/clusters'].map((path) => (
<Route
key="Home" // optional: avoid full re-renders on route changes
path={path}
element={<Dashboard />}
/>
))}
<Route
key="Home" // optional: avoid full re-renders on route changes
path={path}
element={<Dashboard />}
path={getNonExactPath(clusterNewConfigPath)}
element={<ClusterConfigForm />}
/>
))}
<Route
path={getNonExactPath(clusterNewConfigPath)}
element={<ClusterConfigForm />}
/>
<Route
path={getNonExactPath(clusterPath())}
element={<ClusterPage />}
/>
<Route
path={accessErrorPage}
element={
<ErrorPage status={403} text="Access is Denied" />
}
/>
<Route path={errorPage} element={<ErrorPage />} />
<Route
path="*"
element={<Navigate to={errorPage} replace />}
/>
</Routes>
</PageContainer>
<Toaster position="bottom-right" />
</S.Layout>
<ConfirmationModal />
</ConfirmContextProvider>
</UserInfoRolesAccessProvider>
<Route
path={getNonExactPath(clusterPath())}
element={<ClusterPage />}
/>
<Route
path={accessErrorPage}
element={
<ErrorPage status={403} text="Access is Denied" />
}
/>
<Route path={errorPage} element={<ErrorPage />} />
<Route
path="*"
element={<Navigate to={errorPage} replace />}
/>
</Routes>
</PageContainer>
<Toaster position="bottom-right" />
</S.Layout>
<ConfirmationModal />
</ConfirmContextProvider>
</UserInfoRolesAccessProvider>
)}
</Suspense>
</ThemeProvider>
</GlobalSettingsProvider>
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/components/AuthPage/AuthPage.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styled, { css } from 'styled-components';

export const AuthPageStyled = styled.div(
({ theme }) => css`
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
min-height: 100vh;
background-color: ${theme.auth_page.backgroundColor};
font-family: ${theme.auth_page.fontFamily};
overflow-x: hidden;
`
);
18 changes: 18 additions & 0 deletions frontend/src/components/AuthPage/AuthPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

import Footer from './Footer/Footer';
import Header from './Header/Header';
import SignIn from './SignIn/SignIn';
import * as S from './AuthPage.styled';

function AuthPage() {
return (
<S.AuthPageStyled>
<Header />
<SignIn type="service" />
<Footer />
</S.AuthPageStyled>
);
}

export default AuthPage;
45 changes: 45 additions & 0 deletions frontend/src/components/AuthPage/Footer/Footer.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import styled, { css } from 'styled-components';
import GitHubIcon from 'components/common/Icons/GitHubIcon';

export const FooterStyledWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 19px 150px;
font-size: 12px;
`;

export const AppVersionStyled = styled.div(
({ theme }) => css`
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
width: 200px;
${GitHubIcon} {
width: 14px;
height: 14px;
fill: ${theme.auth_page.icons.githubColor};
}
`
);

export const AppVersionTextStyled = styled.span(
({ theme }) => css`
font-weight: ${theme.auth_page.footer.span.fontWeight};
line-height: 18px;
color: ${theme.auth_page.footer.span.color};
`
);

export const InformationTextStyled = styled.p(
({ theme }) => css`
font-size: 12px;
font-weight: ${theme.auth_page.footer.p.fontWeight};
line-height: 16px;
color: ${theme.auth_page.footer.p.color};
text-align: center;
`
);
28 changes: 28 additions & 0 deletions frontend/src/components/AuthPage/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import GitHubIcon from 'components/common/Icons/GitHubIcon';
import { useLatestVersion } from 'lib/hooks/api/latestVersion';

import * as S from './Footer.styled';

function Footer() {
const { data: latestVersionInfo = {} } = useLatestVersion();
const { versionTag } = latestVersionInfo.latestRelease;
const { commitId } = latestVersionInfo.build;

return (
<S.FooterStyledWrapper>
<S.AppVersionStyled>
<GitHubIcon />
<S.AppVersionTextStyled>
{versionTag} ({commitId})
</S.AppVersionTextStyled>
</S.AppVersionStyled>
<S.InformationTextStyled>
Access to the system is provided by your system administrator. If you
have any questions, please contact your system administrator
</S.InformationTextStyled>
</S.FooterStyledWrapper>
);
}

export default Footer;
33 changes: 33 additions & 0 deletions frontend/src/components/AuthPage/Header/Header.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import styled, { css } from 'styled-components';

export const HeaderStyled = styled.div`
display: grid;
grid-template-columns: repeat(47, 41.11px);
grid-template-rows: repeat(4, 41.11px);
justify-content: center;
margin-bottom: 13.5px;
`;

export const HeaderCell = styled.div<{ $sections?: number }>(
({ theme, $sections }) => css`
border: 1.23px solid ${theme.auth_page.header.cellBorderColor};
border-radius: 75.98px;
${$sections && `grid-column: span ${$sections};`}
`
);

export const StyledSVG = styled.svg`
grid-column: span 3;
`;

export const StyledRect = styled.rect(
({ theme }) => css`
fill: ${theme.auth_page.header.LogoBgColor};
`
);

export const StyledPath = styled.path(
({ theme }) => css`
fill: ${theme.auth_page.header.LogoTextColor};
`
);
81 changes: 81 additions & 0 deletions frontend/src/components/AuthPage/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react';

import * as S from './Header.styled';
import HeaderLogo from './HeaderLogo';

function Header() {
return (
<S.HeaderStyled>
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />
{Array(2).fill(<S.HeaderCell />)}
{Array(4).fill(<S.HeaderCell $sections={2} />)}
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(3).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
{Array(2).fill(<S.HeaderCell $sections={3} />)}
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />

{Array(3).fill(<S.HeaderCell $sections={2} />)}
{Array(8).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(3).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(6).fill(<S.HeaderCell />)}
{Array(3).fill(<S.HeaderCell $sections={3} />)}
<S.HeaderCell />
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />

<S.HeaderCell $sections={2} />
<S.HeaderCell />
<S.HeaderCell $sections={2} />
<S.HeaderCell />
<S.HeaderCell $sections={3} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
<S.HeaderCell />
<S.HeaderCell $sections={2} />
{Array(3).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />
<S.HeaderCell />
{Array(3).fill(<S.HeaderCell $sections={2} />)}
<S.HeaderCell />
{Array(3).fill(<S.HeaderCell $sections={3} />)}
{Array(3).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />
<S.HeaderCell $sections={2} />

<S.HeaderCell />
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />
{Array(2).fill(<S.HeaderCell />)}
{Array(5).fill(<S.HeaderCell $sections={2} />)}
{Array(2).fill(<S.HeaderCell />)}

<HeaderLogo />

{Array(5).fill(<S.HeaderCell $sections={2} />)}
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={2} />
{Array(2).fill(<S.HeaderCell />)}
<S.HeaderCell $sections={3} />
<S.HeaderCell />
<S.HeaderCell $sections={2} />
</S.HeaderStyled>
);
}

export default Header;
29 changes: 29 additions & 0 deletions frontend/src/components/AuthPage/Header/HeaderLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';

import * as S from './Header.styled';

const HeaderLogo = () => (
<S.StyledSVG
width="125"
height="41"
viewBox="0 0 125 41"
xmlns="http://www.w3.org/2000/svg"
>
<S.StyledRect
x="0.33313"
y="0.333313"
width="123.74"
height="39.8993"
rx="19.9496"
/>
<S.StyledPath d="M22.5302 7.67111C22.5302 7.67111 27.7857 15.256 37.1346 18.8977C37.1346 18.8977 43.3721 13.6116 37.341 21.2112C31.31 28.8109 22.1277 33.4135 22.5302 32.848C23.727 31.1663 27.6746 27.9528 25.6569 25.9708C29.6175 22.0802 20.7073 19.5151 20.7073 19.5151C23.0162 14.4527 22.5302 7.67111 22.5302 7.67111Z" />
<S.StyledPath d="M103.507 16.2373V18.1592H97.4464V16.2373H103.507ZM98.9427 14.4659H101.427V23.609C101.427 23.9431 101.478 24.1993 101.578 24.3778C101.684 24.5517 101.821 24.6706 101.99 24.7347C102.16 24.7987 102.347 24.8308 102.553 24.8308C102.709 24.8308 102.85 24.8193 102.979 24.7965C103.111 24.7736 103.212 24.753 103.281 24.7347L103.699 26.6771C103.567 26.7229 103.377 26.7732 103.13 26.8281C102.887 26.883 102.59 26.9151 102.237 26.9242C101.615 26.9425 101.054 26.8487 100.556 26.6428C100.057 26.4323 99.6611 26.1074 99.3683 25.6682C99.08 25.2289 98.9381 24.6798 98.9427 24.0209V14.4659Z" />
<S.StyledPath d="M90.5643 26.9929C89.8962 26.9929 89.2945 26.8739 88.7591 26.6359C88.2283 26.3934 87.8073 26.0365 87.4962 25.5652C87.1896 25.0939 87.0363 24.5128 87.0363 23.8218C87.0363 23.2269 87.1461 22.735 87.3658 22.3461C87.5854 21.9571 87.8851 21.646 88.2649 21.4126C88.6447 21.1793 89.0725 21.0031 89.5484 20.8841C90.0289 20.7606 90.5254 20.6713 91.0379 20.6164C91.6556 20.5524 92.1567 20.4952 92.541 20.4448C92.9254 20.3899 93.2045 20.3076 93.3784 20.1977C93.5569 20.0833 93.6461 19.9072 93.6461 19.6692V19.628C93.6461 19.111 93.4928 18.7106 93.1862 18.4269C92.8796 18.1432 92.4381 18.0013 91.8615 18.0013C91.2529 18.0013 90.7702 18.134 90.4133 18.3994C90.0609 18.6648 89.823 18.9783 89.6994 19.3398L87.3795 19.0103C87.5625 18.3697 87.8645 17.8343 88.2855 17.4042C88.7065 16.9695 89.2213 16.6446 89.8298 16.4295C90.4384 16.2099 91.1111 16.1001 91.8478 16.1001C92.3557 16.1001 92.8613 16.1596 93.3647 16.2785C93.868 16.3975 94.3279 16.5943 94.7443 16.8688C95.1607 17.1388 95.4947 17.5071 95.7464 17.9739C96.0027 18.4406 96.1308 19.024 96.1308 19.7241V26.7801H93.7422V25.3318H93.6598C93.5088 25.6247 93.296 25.8992 93.0215 26.1555C92.7515 26.4072 92.4106 26.6108 91.9988 26.7664C91.5915 26.9174 91.1134 26.9929 90.5643 26.9929ZM91.2095 25.1671C91.7082 25.1671 92.1406 25.0687 92.5067 24.872C92.8728 24.6706 93.1542 24.4052 93.351 24.0758C93.5523 23.7463 93.653 23.3871 93.653 22.9982V21.7558C93.5752 21.8199 93.4425 21.8794 93.2549 21.9343C93.0718 21.9892 92.8659 22.0372 92.6371 22.0784C92.4083 22.1196 92.1818 22.1562 91.9576 22.1882C91.7334 22.2203 91.5389 22.2477 91.3742 22.2706C91.0036 22.3209 90.6718 22.4033 90.3789 22.5177C90.0861 22.6321 89.855 22.7922 89.6857 22.9982C89.5164 23.1995 89.4318 23.4603 89.4318 23.7806C89.4318 24.2382 89.5988 24.5837 89.9328 24.817C90.2668 25.0504 90.6924 25.1671 91.2095 25.1671Z" />
<S.StyledPath d="M75.8523 26.7801V13.6661H78.337V17.9807H78.4399C78.568 17.7245 78.7488 17.4522 78.9822 17.164C79.2155 16.8711 79.5313 16.6217 79.9294 16.4158C80.3274 16.2053 80.8354 16.1001 81.4531 16.1001C82.2676 16.1001 83.002 16.3083 83.6564 16.7247C84.3153 17.1365 84.8369 17.7474 85.2213 18.5573C85.6103 19.3626 85.8047 20.351 85.8047 21.5224C85.8047 22.6801 85.6148 23.6639 85.235 24.4739C84.8552 25.2838 84.3382 25.9015 83.6838 26.3271C83.0295 26.7526 82.2882 26.9654 81.46 26.9654C80.856 26.9654 80.3549 26.8647 79.9568 26.6634C79.5587 26.4621 79.2384 26.2195 78.9959 25.9358C78.7579 25.6476 78.5726 25.3753 78.4399 25.1191H78.2958V26.7801H75.8523ZM78.2889 21.5087C78.2889 22.1905 78.385 22.7877 78.5772 23.3002C78.7739 23.8127 79.0554 24.213 79.4214 24.5013C79.7921 24.785 80.2405 24.9269 80.7667 24.9269C81.3158 24.9269 81.7757 24.7804 82.1463 24.4876C82.517 24.1902 82.7961 23.7852 82.9837 23.2727C83.1759 22.7556 83.272 22.1676 83.272 21.5087C83.272 20.8544 83.1782 20.2732 82.9906 19.7653C82.803 19.2574 82.5239 18.8593 82.1532 18.571C81.7826 18.2827 81.3204 18.1386 80.7667 18.1386C80.2359 18.1386 79.7852 18.2782 79.4146 18.5573C79.0439 18.8364 78.7625 19.2277 78.5703 19.731C78.3827 20.2343 78.2889 20.8269 78.2889 21.5087Z" />
<S.StyledPath d="M74.1831 17.7462V19.668H67.9508V17.7462H74.1831ZM69.5089 26.7801V16.751C69.5089 16.0417 69.6553 15.4514 69.9482 14.9801C70.2456 14.5088 70.6437 14.1564 71.1425 13.9231C71.6413 13.6897 72.1949 13.573 72.8035 13.573C73.2337 13.573 73.6157 13.6073 73.9498 13.676C74.2838 13.7446 74.5309 13.8064 74.6911 13.8613L74.1969 15.7832C74.0916 15.7511 73.9589 15.7191 73.7988 15.6871C73.6386 15.6505 73.4602 15.6322 73.2634 15.6322C72.8012 15.6322 72.4741 15.7443 72.2819 15.9685C72.0943 16.1881 72.0005 16.5039 72.0005 16.9157V26.7801H69.5089Z" />
<S.StyledPath d="M61.1648 26.9929C60.4967 26.9929 59.895 26.8739 59.3596 26.6359C58.8288 26.3934 58.4078 26.0365 58.0967 25.5652C57.7901 25.0939 57.6368 24.5128 57.6368 23.8218C57.6368 23.2269 57.7466 22.735 57.9663 22.3461C58.1859 21.9571 58.4856 21.646 58.8654 21.4126C59.2452 21.1793 59.6731 21.0031 60.149 20.8841C60.6294 20.7606 61.1259 20.6713 61.6384 20.6164C62.2561 20.5524 62.7572 20.4952 63.1416 20.4448C63.5259 20.3899 63.805 20.3076 63.9789 20.1977C64.1574 20.0833 64.2466 19.9072 64.2466 19.6692V19.628C64.2466 19.111 64.0933 18.7106 63.7867 18.4269C63.4802 18.1432 63.0386 18.0013 62.462 18.0013C61.8535 18.0013 61.3707 18.134 61.0138 18.3994C60.6614 18.6648 60.4235 18.9783 60.3 19.3398L57.98 19.0103C58.163 18.3697 58.465 17.8343 58.886 17.4042C59.307 16.9695 59.8218 16.6446 60.4304 16.4295C61.0389 16.2099 61.7116 16.1001 62.4483 16.1001C62.9562 16.1001 63.4619 16.1596 63.9652 16.2785C64.4685 16.3975 64.9284 16.5943 65.3448 16.8688C65.7612 17.1388 66.0953 17.5071 66.3469 17.9739C66.6032 18.4406 66.7313 19.024 66.7313 19.7241V26.7801H64.3427V25.3318H64.2603C64.1093 25.6247 63.8966 25.8992 63.622 26.1555C63.352 26.4072 63.0111 26.6108 62.5993 26.7664C62.1921 26.9174 61.7139 26.9929 61.1648 26.9929ZM61.81 25.1671C62.3087 25.1671 62.7412 25.0687 63.1072 24.872C63.4733 24.6706 63.7547 24.4052 63.9515 24.0758C64.1528 23.7463 64.2535 23.3871 64.2535 22.9982V21.7558C64.1757 21.8199 64.043 21.8794 63.8554 21.9343C63.6723 21.9892 63.4664 22.0372 63.2376 22.0784C63.0089 22.1196 62.7823 22.1562 62.5581 22.1882C62.3339 22.2203 62.1394 22.2477 61.9747 22.2706C61.6041 22.3209 61.2723 22.4033 60.9795 22.5177C60.6866 22.6321 60.4555 22.7922 60.2862 22.9982C60.1169 23.1995 60.0323 23.4603 60.0323 23.7806C60.0323 24.2382 60.1993 24.5837 60.5333 24.817C60.8674 25.0504 61.2929 25.1671 61.81 25.1671Z" />
<S.StyledPath d="M49.7783 23.4718L49.7714 20.4723H50.1695L53.9583 16.2373H56.8617L52.2012 21.4264H51.6864L49.7783 23.4718ZM47.5132 26.7801V13.6661H49.9979V26.7801H47.5132ZM54.1299 26.7801L50.698 21.9823L52.3728 20.2321L57.1019 26.7801H54.1299Z" />
</S.StyledSVG>
);

export default HeaderLogo;
Loading

0 comments on commit feffaf7

Please sign in to comment.