Skip to content

Commit

Permalink
Merge pull request #20 from Sanketika-Obsrv/dev_test
Browse files Browse the repository at this point in the history
#OBS-I285 : added grafana and superset url redirection
  • Loading branch information
HarishGangula authored Oct 24, 2024
2 parents 58ddff0 + 5f507ab commit 665e4a0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
28 changes: 15 additions & 13 deletions web-console-v2/src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import * as React from 'react';
import { Typography, Breadcrumbs, Grid, Box } from '@mui/material';
import { NavLink, useLocation } from 'react-router-dom';
import { NavLink, useLocation, useNavigate } from 'react-router-dom';
import NotificationsNoneOutlinedIcon from '@mui/icons-material/NotificationsNoneOutlined';
import styles from './Navbar.module.css';
import Grafana from 'assets/icons/Grafana';
import Superset from 'assets/icons/Superset';
import _ from 'lodash';
import { getConfigValue } from 'services/dataset';

const OBSRV_WEB_CONSOLE = process.env.REACT_APP_OBSRV_WEB_CONSOLE as string || "/console/datasets?status=Live";

function BasicBreadcrumbs(): JSX.Element {
const location = useLocation();
const pathname = location.pathname;
const pathnames = pathname.split('/').filter((x) => x);
const navigate = (path: any) => {
if (path) {
window.open(path);
}
}

const formatBreadcrumb = (string: string): string =>
string
.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');

const handleNavigate = () => {
window.location.href = OBSRV_WEB_CONSOLE;
window.location.assign(OBSRV_WEB_CONSOLE);
};

return (
Expand Down Expand Up @@ -66,17 +67,18 @@ function BasicBreadcrumbs(): JSX.Element {
})}
</Breadcrumbs>
</Grid>
{/* <Grid item xs={1} className={styles.navIcons}>
<div className={styles.icons}>
<Grid item xs={1} className={styles.navIcons}>
<div className={styles.icons}
onClick={() => { navigate(getConfigValue("GRAFANA_URL")) }}>
<Grafana color="secondary" />
</div>
<div className={styles.icons}>
<div className={styles.icons} onClick={() => { navigate(getConfigValue("SUPERSET_URL")) }}>
<Superset />
</div>
<div className={styles.icons}>
{/* <div className={styles.icons}>
<NotificationsNoneOutlinedIcon />
</div>
</Grid> */}
</div> */}
</Grid>
</Grid>
);
}
Expand Down
7 changes: 6 additions & 1 deletion web-console-v2/src/services/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,9 @@ const omitSuggestions = (schema: any): any => {
return result;
}
return schema;
}
}

export const getConfigValue = (variable: string) => {
const config: string | any = sessionStorage.getItem('systemSettings');
return _.get(JSON.parse(config), variable);
};

0 comments on commit 665e4a0

Please sign in to comment.