Skip to content

Commit 0d33de9

Browse files
committed
ui: Redirect Range Report page to Hot Ranges page
Fixes: #102377. Previously, when a user selected a range ID from the Hot Ranges page, the left side menu would switch to Advanced Debug and the back button would also redirect to the Advanced Dedug page. This commit ensures that when a range ID is selected, the left side menu will stay on the Hot Ranges page and also changes the back button to redirect back to the Hot Ranges page. Release note (ui change): The Range Report page (route `/reports/range/:rangeID`) shows the "Hot Ranges" menu item as highlighted in the left side menu. The back button in the Range Report page redirects back to the Hot Ranges page.
1 parent 827a688 commit 0d33de9

File tree

2 files changed

+18
-4
lines changed
  • pkg/ui/workspaces/db-console/src/views

2 files changed

+18
-4
lines changed

pkg/ui/workspaces/db-console/src/views/app/components/layoutSidebar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export class Sidebar extends React.Component<SidebarProps> {
5959
{
6060
path: "/hotranges",
6161
text: "Hot Ranges",
62-
activeFor: ["/hotranges"],
62+
activeFor: ["/hotranges", "/reports/range"],
6363
},
6464
{ path: "/jobs", text: "Jobs", activeFor: [] },
6565
{ path: "/schedules", text: "Schedules", activeFor: [] },
6666
{
6767
path: "/debug",
6868
text: "Advanced Debug",
6969
activeFor: ["/reports", "/data-distribution", "/raft", "/keyvisualizer"],
70-
ignoreFor: ["/reports/network"],
70+
ignoreFor: ["/reports/network", "/reports/range"],
7171
},
7272
];
7373

pkg/ui/workspaces/db-console/src/views/reports/containers/range/index.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import AllocatorOutput from "src/views/reports/containers/range/allocator";
3535
import RangeInfo from "src/views/reports/containers/range/rangeInfo";
3636
import LeaseTable from "src/views/reports/containers/range/leaseTable";
3737
import { getMatchParamByName } from "src/util/query";
38-
import { BackToAdvanceDebug } from "../util";
38+
import { Button, commonStyles } from "@cockroachlabs/cluster-ui";
39+
import { ArrowLeft } from "@cockroachlabs/icons";
3940

4041
interface RangeDispatchProps {
4142
refreshRange: typeof refreshRange;
@@ -111,6 +112,10 @@ export class Range extends React.Component<RangeProps, {}> {
111112
}
112113
}
113114

115+
backToHotRanges = (): void => {
116+
this.props.history.push("/hotranges");
117+
};
118+
114119
render() {
115120
const { range, match } = this.props;
116121
const rangeID = getMatchParamByName(match, rangeIDAttr);
@@ -188,7 +193,16 @@ export class Range extends React.Component<RangeProps, {}> {
188193
return (
189194
<div className="section">
190195
<Helmet title={`r${responseRangeID.toString()} Range | Debug`} />
191-
<BackToAdvanceDebug history={this.props.history} />
196+
<Button
197+
onClick={this.backToHotRanges}
198+
type="unstyled-link"
199+
size="small"
200+
icon={<ArrowLeft fontSize={"10px"} />}
201+
iconPosition="left"
202+
className={commonStyles("small-margin")}
203+
>
204+
Hot Ranges
205+
</Button>
192206
<h1 className="base-heading">
193207
Range Report for r{responseRangeID.toString()}
194208
</h1>

0 commit comments

Comments
 (0)