mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-18 19:44:06 -08:00
3470ee1fbf
The React app's assets are now served under /assets, while all old custom web assets (including the ones for console templates) are now served from /classic/static. I tested different combinations of --web.external-url and --web.route-prefix with proxies in front, and I couldn't find a problem yet with the routing. Console templates also still work. While migrating old endpoints to /classic, I noticed that /version was being treated like a lot of the old UI pages, with readiness check handler in front of it, etc. I kept it in /version and removed that readiness wrapper, since it doesn't seem to be needed for that endpoint. Signed-off-by: Julius Volz <julius.volz@gmail.com>
89 lines
2.8 KiB
TypeScript
89 lines
2.8 KiB
TypeScript
import React, { FC, useState } from 'react';
|
|
import { Link } from '@reach/router';
|
|
import {
|
|
Collapse,
|
|
Navbar,
|
|
NavbarToggler,
|
|
Nav,
|
|
NavItem,
|
|
NavLink,
|
|
UncontrolledDropdown,
|
|
DropdownToggle,
|
|
DropdownMenu,
|
|
DropdownItem,
|
|
} from 'reactstrap';
|
|
import { usePathPrefix } from './contexts/PathPrefixContext';
|
|
|
|
interface NavbarProps {
|
|
consolesLink: string | null;
|
|
}
|
|
|
|
const Navigation: FC<NavbarProps> = ({ consolesLink }) => {
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
const toggle = () => setIsOpen(!isOpen);
|
|
const pathPrefix = usePathPrefix();
|
|
return (
|
|
<Navbar className="mb-3" dark color="dark" expand="md" fixed="top">
|
|
<NavbarToggler onClick={toggle} />
|
|
<Link className="pt-0 navbar-brand" to={`${pathPrefix}/graph`}>
|
|
Prometheus
|
|
</Link>
|
|
<Collapse isOpen={isOpen} navbar style={{ justifyContent: 'space-between' }}>
|
|
<Nav className="ml-0" navbar>
|
|
{consolesLink !== null && (
|
|
<NavItem>
|
|
<NavLink href={consolesLink}>Consoles</NavLink>
|
|
</NavItem>
|
|
)}
|
|
<NavItem>
|
|
<NavLink tag={Link} to={`${pathPrefix}/alerts`}>
|
|
Alerts
|
|
</NavLink>
|
|
</NavItem>
|
|
<NavItem>
|
|
<NavLink tag={Link} to={`${pathPrefix}/graph`}>
|
|
Graph
|
|
</NavLink>
|
|
</NavItem>
|
|
<UncontrolledDropdown nav inNavbar>
|
|
<DropdownToggle nav caret>
|
|
Status
|
|
</DropdownToggle>
|
|
<DropdownMenu>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/status`}>
|
|
Runtime & Build Information
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/tsdb-status`}>
|
|
TSDB Status
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/flags`}>
|
|
Command-Line Flags
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/config`}>
|
|
Configuration
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/rules`}>
|
|
Rules
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/targets`}>
|
|
Targets
|
|
</DropdownItem>
|
|
<DropdownItem tag={Link} to={`${pathPrefix}/service-discovery`}>
|
|
Service Discovery
|
|
</DropdownItem>
|
|
</DropdownMenu>
|
|
</UncontrolledDropdown>
|
|
<NavItem>
|
|
<NavLink href="https://prometheus.io/docs/prometheus/latest/getting_started/">Help</NavLink>
|
|
</NavItem>
|
|
<NavItem>
|
|
<NavLink href={`${pathPrefix}/classic/graph${window.location.search}`}>Classic UI</NavLink>
|
|
</NavItem>
|
|
</Nav>
|
|
</Collapse>
|
|
</Navbar>
|
|
);
|
|
};
|
|
|
|
export default Navigation;
|