2019-11-04 00:17:50 -08:00
|
|
|
import React, { FC, useState } from 'react';
|
2021-08-30 05:05:49 -07:00
|
|
|
import { Link } from 'react-router-dom';
|
2019-10-27 14:03:39 -07:00
|
|
|
import {
|
|
|
|
Collapse,
|
|
|
|
Navbar,
|
|
|
|
NavbarToggler,
|
|
|
|
Nav,
|
|
|
|
NavItem,
|
|
|
|
NavLink,
|
|
|
|
UncontrolledDropdown,
|
|
|
|
DropdownToggle,
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownItem,
|
|
|
|
} from 'reactstrap';
|
2021-04-15 09:14:07 -07:00
|
|
|
import { ThemeToggle } from './Theme';
|
2022-02-02 05:53:30 -08:00
|
|
|
import logo from './images/prometheus_logo_grey.svg';
|
2019-10-27 14:03:39 -07:00
|
|
|
|
2020-02-08 02:00:48 -08:00
|
|
|
interface NavbarProps {
|
|
|
|
consolesLink: string | null;
|
2021-11-30 02:21:07 -08:00
|
|
|
agentMode: boolean;
|
2020-02-08 02:00:48 -08:00
|
|
|
}
|
|
|
|
|
2021-11-30 02:21:07 -08:00
|
|
|
const Navigation: FC<NavbarProps> = ({ consolesLink, agentMode }) => {
|
2019-10-27 14:03:39 -07:00
|
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
const toggle = () => setIsOpen(!isOpen);
|
|
|
|
return (
|
2019-11-02 08:53:32 -07:00
|
|
|
<Navbar className="mb-3" dark color="dark" expand="md" fixed="top">
|
2021-04-15 09:14:07 -07:00
|
|
|
<NavbarToggler onClick={toggle} className="mr-2" />
|
2021-11-30 02:21:07 -08:00
|
|
|
<Link className="pt-0 navbar-brand" to={agentMode ? '/agent' : '/graph'}>
|
2022-02-02 05:53:30 -08:00
|
|
|
<img src={logo} className="d-inline-block align-top" alt="Prometheus logo" title="Prometheus" />
|
2021-11-30 02:21:07 -08:00
|
|
|
Prometheus{agentMode && ' Agent'}
|
2019-10-28 07:02:42 -07:00
|
|
|
</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>
|
|
|
|
)}
|
2021-11-30 02:21:07 -08:00
|
|
|
{!agentMode && (
|
|
|
|
<>
|
|
|
|
<NavItem>
|
|
|
|
<NavLink tag={Link} to="/alerts">
|
|
|
|
Alerts
|
|
|
|
</NavLink>
|
|
|
|
</NavItem>
|
|
|
|
<NavItem>
|
|
|
|
<NavLink tag={Link} to="/graph">
|
|
|
|
Graph
|
|
|
|
</NavLink>
|
|
|
|
</NavItem>
|
|
|
|
</>
|
|
|
|
)}
|
2019-10-27 14:03:39 -07:00
|
|
|
<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>
|
2021-08-30 05:05:49 -07:00
|
|
|
<DropdownItem tag={Link} to="/status">
|
2019-10-28 07:02:42 -07:00
|
|
|
Runtime & Build Information
|
|
|
|
</DropdownItem>
|
2021-11-30 02:21:07 -08:00
|
|
|
{!agentMode && (
|
|
|
|
<DropdownItem tag={Link} to="/tsdb-status">
|
|
|
|
TSDB Status
|
|
|
|
</DropdownItem>
|
|
|
|
)}
|
2021-08-30 05:05:49 -07:00
|
|
|
<DropdownItem tag={Link} to="/flags">
|
2019-10-28 07:02:42 -07:00
|
|
|
Command-Line Flags
|
|
|
|
</DropdownItem>
|
2021-08-30 05:05:49 -07:00
|
|
|
<DropdownItem tag={Link} to="/config">
|
2019-10-28 07:02:42 -07:00
|
|
|
Configuration
|
|
|
|
</DropdownItem>
|
2021-11-30 02:21:07 -08:00
|
|
|
{!agentMode && (
|
|
|
|
<DropdownItem tag={Link} to="/rules">
|
|
|
|
Rules
|
|
|
|
</DropdownItem>
|
|
|
|
)}
|
2021-08-30 05:05:49 -07:00
|
|
|
<DropdownItem tag={Link} to="/targets">
|
2019-10-28 07:02:42 -07:00
|
|
|
Targets
|
|
|
|
</DropdownItem>
|
2021-08-30 05:05:49 -07:00
|
|
|
<DropdownItem tag={Link} to="/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>
|
|
|
|
</Nav>
|
|
|
|
</Collapse>
|
2021-04-15 09:14:07 -07:00
|
|
|
<ThemeToggle />
|
2019-10-27 14:03:39 -07:00
|
|
|
</Navbar>
|
|
|
|
);
|
2019-10-28 07:02:42 -07:00
|
|
|
};
|
2019-10-27 14:03:39 -07:00
|
|
|
|
|
|
|
export default Navigation;
|