Skip to content

Commit 3e293ec

Browse files
committed
ui: fix various bugs on db console schedules page
- Updated max result size of sql query to fetch schedules to ensure all schedules are rendered in db console - Fixed a bug where changing the "show" and "status" values in the url query params resulted in a "something went wrong" page. Now, if an invalid value is set in the "show" or "status" query parameters, the corresponding dropdown will reset to the default value. ("Show: Latest 50" and "Status: All" respectively) Fixes: CRDB-49163, CRDB-49164 Epic: None Release note (bug fix): Fixes bugs in the db console page: - Previously, the schedules page only showed a subset of the total schedules for a cluster due to a missing parameter in the server api call. Now the schedules table should correctly show all schedules in a cluster - Fixed a bug where manually upadting the "show" or "status" query
1 parent 6321d87 commit 3e293ec

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { RequestError } from "../util";
1010

1111
import {
1212
executeInternalSql,
13+
MAX_RESULT_SIZE,
1314
SqlExecutionRequest,
1415
sqlResultsAreEmpty,
1516
} from "./sqlApi";
@@ -73,6 +74,7 @@ export function getSchedules(req: {
7374
arguments: args,
7475
},
7576
],
77+
max_result_size: MAX_RESULT_SIZE,
7678
execute: true,
7779
};
7880
return executeInternalSql<ScheduleColumns>(request).then(result => {

pkg/ui/workspaces/cluster-ui/src/api/sqlApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export function executeSql<RowType>(
9191
export const INTERNAL_SQL_API_APP = "$ internal-console";
9292
export const LONG_TIMEOUT = "300s";
9393
export const LARGE_RESULT_SIZE = 50000; // 50 kib
94+
export const MAX_RESULT_SIZE = 2_147_483_647; // Max result size is max int32, which is 2Gib
9495
export const FALLBACK_DB = "system";
9596

9697
/**

pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/schedulesPage.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ export const SchedulesPage: React.FC<SchedulesPageProps> = props => {
7474
// Filter Status.
7575
const paramStatus = searchParams.get("status") || undefined;
7676
useEffect(() => {
77-
if (paramStatus === undefined) {
77+
if (
78+
paramStatus === undefined ||
79+
statusOptions.find(option => option["value"] === paramStatus) ===
80+
undefined
81+
) {
7882
return;
7983
}
8084
setStatus(paramStatus);
@@ -83,7 +87,10 @@ export const SchedulesPage: React.FC<SchedulesPageProps> = props => {
8387
// Filter Show.
8488
const paramShow = searchParams.get("show") || undefined;
8589
useEffect(() => {
86-
if (paramShow === undefined) {
90+
if (
91+
paramShow === undefined ||
92+
showOptions.find(option => option["value"] === paramShow) === undefined
93+
) {
8794
return;
8895
}
8996
setShow(paramShow);
@@ -140,13 +147,23 @@ export const SchedulesPage: React.FC<SchedulesPageProps> = props => {
140147
<PageConfigItem>
141148
<Dropdown items={statusOptions} onChange={onStatusSelected}>
142149
Status:{" "}
143-
{statusOptions.find(option => option["value"] === status)["name"]}
150+
{
151+
(
152+
statusOptions.find(option => option["value"] === status) ??
153+
statusOptions[0]
154+
).name
155+
}
144156
</Dropdown>
145157
</PageConfigItem>
146158
<PageConfigItem>
147159
<Dropdown items={showOptions} onChange={onShowSelected}>
148160
Show:{" "}
149-
{showOptions.find(option => option["value"] === show)["name"]}
161+
{
162+
(
163+
showOptions.find(option => option["value"] === show) ??
164+
showOptions[0]
165+
).name
166+
}
150167
</Dropdown>
151168
</PageConfigItem>
152169
</PageConfig>

0 commit comments

Comments
 (0)