2019-11-04 00:17:50 -08:00
|
|
|
import React, { FC, useState } from 'react';
|
2019-10-28 07:02:42 -07:00
|
|
|
import { Link } from '@reach/router';
|
2019-10-27 14:03:39 -07:00
|
|
|
import {
|
|
|
|
Collapse,
|
|
|
|
Navbar,
|
|
|
|
NavbarToggler,
|
|
|
|
Nav,
|
|
|
|
NavItem,
|
|
|
|
NavLink,
|
|
|
|
UncontrolledDropdown,
|
|
|
|
DropdownToggle,
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownItem,
|
|
|
|
} from 'reactstrap';
|
2020-10-22 08:22:32 -07:00
|
|
|
import { usePathPrefix } from './contexts/PathPrefixContext';
|
2019-10-27 14:03:39 -07:00
|
|
|
|
2020-02-08 02:00:48 -08:00
|
|
|
interface NavbarProps {
|
|
|
|
consolesLink: string | null;
|
|
|
|
}
|
|
|
|
|
2020-10-22 08:22:32 -07:00
|
|
|
const Navigation: FC<NavbarProps> = ({ consolesLink }) => {
|
2019-10-27 14:03:39 -07:00
|
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
const toggle = () => setIsOpen(!isOpen);
|
2020-10-22 08:22:32 -07:00
|
|
|
const pathPrefix = usePathPrefix();
|
2019-10-27 14:03:39 -07:00
|
|
|
return (
|
2019-11-02 08:53:32 -07:00
|
|
|
<Navbar className="mb-3" dark color="dark" expand="md" fixed="top">
|
2019-10-28 07:02:42 -07:00
|
|
|
<NavbarToggler onClick={toggle} />
|
2020-10-22 08:22:32 -07:00
|
|
|
<Link className="pt-0 navbar-brand" to={`${pathPrefix}/graph`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Prometheus
|
|
|
|
</Link>
|
2019-10-27 14:03:39 -07:00
|
|
|
<Collapse isOpen={isOpen} navbar style={{ justifyContent: 'space-between' }}>
|
|
|
|
<Nav className="ml-0" navbar>
|
2020-02-09 04:39:44 -08:00
|
|
|
{consolesLink !== null && (
|
2020-02-08 02:00:48 -08:00
|
|
|
<NavItem>
|
2020-02-09 04:39:44 -08:00
|
|
|
<NavLink href={consolesLink}>Consoles</NavLink>
|
2020-02-08 02:00:48 -08:00
|
|
|
</NavItem>
|
|
|
|
)}
|
2019-10-27 14:03:39 -07:00
|
|
|
<NavItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<NavLink tag={Link} to={`${pathPrefix}/alerts`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Alerts
|
|
|
|
</NavLink>
|
2019-10-27 14:03:39 -07:00
|
|
|
</NavItem>
|
|
|
|
<NavItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<NavLink tag={Link} to={`${pathPrefix}/graph`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Graph
|
|
|
|
</NavLink>
|
2019-10-27 14:03:39 -07:00
|
|
|
</NavItem>
|
|
|
|
<UncontrolledDropdown nav inNavbar>
|
2019-10-28 07:02:42 -07:00
|
|
|
<DropdownToggle nav caret>
|
|
|
|
Status
|
|
|
|
</DropdownToggle>
|
2019-10-27 14:03:39 -07:00
|
|
|
<DropdownMenu>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/status`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Runtime & Build Information
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/tsdb-status`}>
|
2019-11-12 02:15:20 -08:00
|
|
|
TSDB Status
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/flags`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Command-Line Flags
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/config`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Configuration
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/rules`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Rules
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/targets`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Targets
|
|
|
|
</DropdownItem>
|
2020-10-22 08:22:32 -07:00
|
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/service-discovery`}>
|
2019-10-28 07:02:42 -07:00
|
|
|
Service Discovery
|
|
|
|
</DropdownItem>
|
2019-10-27 14:03:39 -07:00
|
|
|
</DropdownMenu>
|
|
|
|
</UncontrolledDropdown>
|
|
|
|
<NavItem>
|
|
|
|
<NavLink href="https://prometheus.io/docs/prometheus/latest/getting_started/">Help</NavLink>
|
|
|
|
</NavItem>
|
|
|
|
<NavItem>
|
2020-11-03 05:51:48 -08:00
|
|
|
<NavLink href={`${pathPrefix}/classic/graph${window.location.search}`}>Classic UI</NavLink>
|
2019-10-27 14:03:39 -07:00
|
|
|
</NavItem>
|
|
|
|
</Nav>
|
|
|
|
</Collapse>
|
|
|
|
</Navbar>
|
|
|
|
);
|
2019-10-28 07:02:42 -07:00
|
|
|
};
|
2019-10-27 14:03:39 -07:00
|
|
|
|
|
|
|
export default Navigation;
|