Skip to content

Commit 285982c

Browse files
committed
fix: dashboard period field mismatch and log empty-state message
- Fix dashboard: use period (not statsPeriod) for WidgetQueryOptions, matching the expected interface field name - Fix log list: add period context to empty-state message ("No logs found in the last 30d." / "No logs found in the specified range.")
1 parent 419df00 commit 285982c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/commands/dashboard/view.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { buildDashboardUrl } from "../../lib/sentry-urls.js";
2525
import {
2626
PERIOD_BRIEF,
2727
parsePeriod,
28-
timeRangeToApiParams,
2928
timeRangeToSeconds,
3029
} from "../../lib/time-range.js";
3130
import type {
@@ -221,8 +220,12 @@ export const viewCommand = buildCommand({
221220
const regionUrl = await resolveOrgRegion(orgSlug);
222221
const effectivePeriod = flags.period ?? dashboard.period ?? "24h";
223222
const timeRange = parsePeriod(effectivePeriod);
224-
const timeApiParams = timeRangeToApiParams(timeRange);
225223
const periodSeconds = timeRangeToSeconds(timeRange);
224+
// WidgetQueryOptions uses `period` (not `statsPeriod`) for the relative field
225+
const widgetTimeOpts =
226+
timeRange.type === "relative"
227+
? { period: timeRange.period }
228+
: { start: timeRange.start, end: timeRange.end };
226229
const widgets = dashboard.widgets ?? [];
227230

228231
if (flags.refresh !== undefined) {
@@ -253,7 +256,7 @@ export const viewCommand = buildCommand({
253256
regionUrl,
254257
orgSlug,
255258
dashboard,
256-
{ ...timeApiParams, periodSeconds }
259+
{ ...widgetTimeOpts, periodSeconds }
257260
);
258261

259262
// Build output data before clearing so clear→render is instantaneous
@@ -282,7 +285,7 @@ export const viewCommand = buildCommand({
282285
{ message: "Querying widget data...", json: flags.json },
283286
() =>
284287
queryAllWidgets(regionUrl, orgSlug, dashboard, {
285-
...timeApiParams,
288+
...widgetTimeOpts,
286289
periodSeconds,
287290
})
288291
);

src/commands/log/list.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,16 @@ async function executeSingleFetch(
187187
sort: flags.sort,
188188
});
189189

190+
const periodLabel =
191+
timeRange.type === "relative"
192+
? `in the last ${timeRange.period}`
193+
: "in the specified range";
194+
190195
if (logs.length === 0) {
191-
return { result: { logs: [], hasMore: false }, hint: "No logs found." };
196+
return {
197+
result: { logs: [], hasMore: false },
198+
hint: `No logs found ${periodLabel}.`,
199+
};
192200
}
193201

194202
const hasMore = logs.length >= flags.limit;

0 commit comments

Comments
 (0)