Skip to content

Commit

Permalink
[#12939][yugabyted-ui] Adding alert and admin page to Yugabyted UI
Browse files Browse the repository at this point in the history
Summary: Added page that links to YugabyteDB Managed signup for alert and admin tabs.

Test Plan: no test plan

Reviewers: nikhil

Reviewed By: nikhil

Subscribers: djiang

Differential Revision: https://phabricator.dev.yugabyte.com/D17768
  • Loading branch information
djiang9001 committed Jun 16, 2022
1 parent b9fb454 commit 72d1538
Show file tree
Hide file tree
Showing 6 changed files with 1,786 additions and 1,613 deletions.
18 changes: 13 additions & 5 deletions yugabyted-ui/ui/src/features/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Route, Switch, useRouteMatch } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

import { YBDropdown } from '@app/components';
import { ClusterBreadcrumbs } from '@app/features/clusters/ClusterBreadcrumbs';
// import { ClusterBreadcrumbs } from '@app/features/clusters/ClusterBreadcrumbs';
import HelpIcon from '@app/assets/help.svg';
import FileIcon from '@app/assets/file.svg';
import SlackIcon from '@app/assets/slack.svg';
Expand Down Expand Up @@ -66,7 +66,7 @@ export const Header: FC = () => {
{t('common.addAccount')}
</Typography>
</Route>
<Route path={`${path}/admin`}>
<Route path={`/admin`}>
<Typography variant="h4" color="inherit">
{t('common.admin')}
</Typography>
Expand All @@ -77,9 +77,17 @@ export const Header: FC = () => {
{t('common.analytics')}
</Typography>
</Route>
<Route path={`${path}/p/:projectId/clusters/:clusterId?`}>
<Route path={`/cluster`}>
{/* <ProjectPicker /> */}
<ClusterBreadcrumbs />
{/*<ClusterBreadcrumbs />*/}
<Typography variant="h4" color="inherit">
{t('common.cluster')}
</Typography>
</Route>
<Route path={`/performance`}>
<Typography variant="h4" color="inherit">
{t('clusterDetail.tabPerformance')}
</Typography>
</Route>
<Route path={`${path}/dbsecurity`}>
<Typography variant="h4" color="inherit">
Expand All @@ -101,7 +109,7 @@ export const Header: FC = () => {
{t('welcome.gettingStarted')}
</Typography>
</Route>
<Route path={`${path}/p/:projectId/alerts`}>
<Route path={`/alerts`}>
<Typography variant="h4" color="inherit">
{t('common.alerts')}
</Typography>
Expand Down
4 changes: 3 additions & 1 deletion yugabyted-ui/ui/src/features/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Sidebar } from '@app/features/Sidebar';
import { ClustersRouting } from '@app/features/clusters/ClustersRouting';
import { themeVariables } from '@app/theme/variables';
import { PerformanceRouting } from './clusters/PerformanceRouting';
import { GettingStarted } from './welcome/GettingStarted';

const useStyles = makeStyles((theme) => ({
root: {
Expand Down Expand Up @@ -85,9 +86,10 @@ export const MainLayout: FC = () => {
<Announcement />
*/}
<Switch>
{/* <Route path={'/welcome'} component={GettingStarted} /> */}
<Route path={'/cluster'} component={ClustersRouting} />
<Route path={'/performance'} component={PerformanceRouting} />
<Route path={'/alerts'} component={GettingStarted} />
<Route path={'/admin'} component={GettingStarted} />
<Route exact path={'/'} render={() => {
return (
<Redirect to="/cluster/tabOverview" />
Expand Down
11 changes: 6 additions & 5 deletions yugabyted-ui/ui/src/features/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const Sidebar: FC<{ projectId: string }> = ({ projectId }) => {
<NavLinkWithDisable
disabled={isDisabled}
to={`/cluster/tabOverview`}
isActive={(_, location) => /\/a\/.+\/p\/.+\/clusters/.test(location.pathname)}
isActive={(_, location) => /^\/cluster/.test(location.pathname)}
className={classes.link}
activeClassName={classes.linkActive}
data-testid="SidebarLinkClusters"
Expand All @@ -241,7 +241,7 @@ export const Sidebar: FC<{ projectId: string }> = ({ projectId }) => {
<NavLinkWithDisable
disabled={isDisabled}
to={`/performance/metrics`}
isActive={(_, location) => /\/a\/.+\/p\/.+\/clusters/.test(location.pathname)}
isActive={(_, location) => /^\/performance/.test(location.pathname)}
className={classes.link}
activeClassName={classes.linkActive}
data-testid="SidebarLinkClusters"
Expand All @@ -254,8 +254,8 @@ export const Sidebar: FC<{ projectId: string }> = ({ projectId }) => {
{isAlertsEnabled && (
<NavLinkWithDisable
disabled={isDisabled}
to={`${url}/p/${projectId}/alerts`}
isActive={(_, location) => /\/a\/.+\/p\/.+\/alerts/.test(location.pathname)}
to={`/alerts`}
isActive={(_, location) => /^\/alerts/.test(location.pathname)}
className={classes.link}
activeClassName={classes.linkActive}
data-testid="alertsPageNav"
Expand Down Expand Up @@ -300,7 +300,8 @@ export const Sidebar: FC<{ projectId: string }> = ({ projectId }) => {
</div>
<NavLinkWithDisable
disabled={isDisabled}
to={`${url}/admin`}
to={`/admin`}
isActive={(_, location) => /^\/admin/.test(location.pathname)}
className={classes.link}
activeClassName={classes.linkActive}
data-testid="SidebarLinkAdmin"
Expand Down
89 changes: 89 additions & 0 deletions yugabyted-ui/ui/src/features/welcome/GettingStarted.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React, { FC } from 'react';
import { Divider, Box, Typography } from '@material-ui/core';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';

import { YBButton } from '@app/components';
import { useGettingStartedStyles } from './gettingStartedStyles';

import WelcomeCloudImage from '@app/assets/welcome-cloud-image.svg';
import CheckIcon from '@app/assets/check.svg';

const LINK_SIGNUP = 'https://cloud.yugabyte.com/signup?';

// TODO: remove page once PLG feature is stable
export const GettingStarted: FC = () => {
const classes = useGettingStartedStyles();
const { t } = useTranslation();

return (
<div className={classes.root}>
<Typography variant="h4" className={classes.headerTitle}>
{t('managed.signupForManaged')}
</Typography>
<Divider />
<Typography variant="h2" className={classes.getStartedTitle}>
{t('managed.featureAvailableWith')}
</Typography>

<div className={classes.getStartedBlock}>
<Box pt={4} display="flex">
<WelcomeCloudImage />
<Box maxWidth={390} pt={1} pl={5} pr={5}>
<Box mb={1}>
<Typography variant="body2">{t('welcome.getStarted.line1')}</Typography>
</Box>
<Box mb={3}>
<Typography variant="body2" color="textSecondary">
{t('welcome.getStarted.line2')}
</Typography>
</Box>
<YBButton data-testid="BtnAddCluster" variant="gradient" size="large" component={Link}
to={{ pathname: LINK_SIGNUP }} target="_blank">
{t('managed.signupForManaged')}
</YBButton>
</Box>
</Box>

<div className={classes.features}>
<div className={classes.featureItem}>
<CheckIcon className={classes.iconCheck} />
<Box>
<Box mb={0.5}>
<Typography variant="body1">{t('welcome.getStarted.feature1Title')}</Typography>
</Box>
<Typography variant="body2">{t('welcome.getStarted.feature1Subtitle')}</Typography>
</Box>
</div>
<div className={classes.featureItem}>
<CheckIcon className={classes.iconCheck} />
<Box>
<Box mb={0.5}>
<Typography variant="body1">{t('welcome.getStarted.feature2Title')}</Typography>
</Box>
<Typography variant="body2">{t('welcome.getStarted.feature2Subtitle')}</Typography>
</Box>
</div>
<div className={classes.featureItem}>
<CheckIcon className={classes.iconCheck} />
<Box>
<Box mb={0.5}>
<Typography variant="body1">{t('welcome.getStarted.feature3Title')}</Typography>
</Box>
<Typography variant="body2">{t('welcome.getStarted.feature3Subtitle')}</Typography>
</Box>
</div>
<div className={classes.featureItem}>
<CheckIcon className={classes.iconCheck} />
<Box>
<Box mb={0.5}>
<Typography variant="body1">{t('welcome.getStarted.feature4Title')}</Typography>
</Box>
<Typography variant="body2">{t('welcome.getStarted.feature4Subtitle')}</Typography>
</Box>
</div>
</div>
</div>
</div>
);
};
69 changes: 69 additions & 0 deletions yugabyted-ui/ui/src/features/welcome/gettingStartedStyles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { makeStyles } from '@material-ui/core';

export const useGettingStartedStyles = makeStyles((theme) => ({
root: {
maxWidth: 1200,
minHeight: 425,
padding: theme.spacing(0, 4),
margin: theme.spacing(2, 'auto', 0, 'auto'),
backgroundColor: theme.palette.background.paper,
border: `1px solid ${theme.palette.grey[200]}`,
borderRadius: theme.shape.borderRadius
},
headerTitle: {
display: 'flex',
alignItems: 'center',
padding: theme.spacing(4, 2)
},
getStartedTitle: {
padding: theme.spacing(7, 2, 5, 2)
},
getStartedBlock: {
display: 'flex',
padding: theme.spacing(0, 2, 5, 2)
},
features: {
borderLeft: `1px solid ${theme.palette.grey[200]}`,
padding: theme.spacing(1, 1, 1, 5)
},
featureItem: {
display: 'flex',
alignItems: 'flex-start',
marginBottom: theme.spacing(2.5),
'&:last-child': {
marginBottom: 0
}
},
iconCheck: {
marginRight: theme.spacing(3),
color: theme.palette.grey[600]
},
tile: {
width: '100%',
height: 165,
display: 'flex',
flexDirection: 'column',
border: `1px solid ${theme.palette.grey[200]}`,
borderRadius: theme.shape.borderRadius,
padding: theme.spacing(3, 4),
backgroundColor: theme.palette.background.default,
marginRight: theme.spacing(4),
'&:last-child': {
marginRight: 0
}
},
link: {
display: 'flex',
alignItems: 'center',
marginTop: 'auto'
},
users: {
color: theme.palette.grey[600],
borderRadius: theme.shape.borderRadius,
border: `1px solid ${theme.palette.grey[200]}`,
padding: theme.spacing(2),
marginTop: theme.spacing(2),
display: 'flex',
alignItems: 'center'
}
}));
Loading

0 comments on commit 72d1538

Please sign in to comment.