Bump Scenes to 5.42.0 (#100205)
* update scenes and weekStart prop type * update test * adjust weekStart type in schemaV2 * clean up weekStart error message * clean up weekStart in test data
This commit is contained in:
+6
-2
@@ -632,6 +632,9 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "1"],
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "2"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/DateTimePickers/WeekStartPicker.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/FileDropzone/FileDropzone.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings in text props. Wrap text with <Trans /> or use t()", "0"]
|
||||
],
|
||||
@@ -3655,9 +3658,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||
],
|
||||
"public/app/features/dashboard/api/v0.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
|
||||
+2
-2
@@ -276,8 +276,8 @@
|
||||
"@grafana/prometheus": "workspace:*",
|
||||
"@grafana/runtime": "workspace:*",
|
||||
"@grafana/saga-icons": "workspace:*",
|
||||
"@grafana/scenes": "5.41.2",
|
||||
"@grafana/scenes-react": "5.41.2",
|
||||
"@grafana/scenes": "5.42.0",
|
||||
"@grafana/scenes-react": "5.42.0",
|
||||
"@grafana/schema": "workspace:*",
|
||||
"@grafana/sql": "workspace:*",
|
||||
"@grafana/ui": "workspace:*",
|
||||
|
||||
@@ -467,7 +467,7 @@ TimeSettingsSpec: {
|
||||
// Whether timepicker is visible or not.
|
||||
hideTimepicker: bool // v1: timepicker.hidden
|
||||
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
|
||||
weekStart: string
|
||||
weekStart?: "saturday" | "monday" | "sunday"
|
||||
// The month that the fiscal year starts on. 0 = January, 11 = December
|
||||
fiscalYearStartMonth: int
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
|
||||
@@ -644,7 +644,7 @@ export interface TimeSettingsSpec {
|
||||
// v1: timepicker.hidden
|
||||
hideTimepicker: boolean;
|
||||
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
|
||||
weekStart: string;
|
||||
weekStart?: "saturday" | "monday" | "sunday";
|
||||
// The month that the fiscal year starts on. 0 = January, 11 = December
|
||||
fiscalYearStartMonth: number;
|
||||
// Override the now time by entering a time delay. Use this option to accommodate known delays in data aggregation to avoid null values.
|
||||
@@ -681,7 +681,6 @@ export const defaultTimeSettingsSpec = (): TimeSettingsSpec => ({
|
||||
"30d",
|
||||
],
|
||||
hideTimepicker: false,
|
||||
weekStart: "",
|
||||
fiscalYearStartMonth: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Combobox } from '../Combobox/Combobox';
|
||||
import { ComboboxOption } from '../Combobox/types';
|
||||
|
||||
export interface Props {
|
||||
onChange: (weekStart: string) => void;
|
||||
onChange: (weekStart: WeekStart) => void;
|
||||
value: string;
|
||||
width?: number;
|
||||
autoFocus?: boolean;
|
||||
@@ -57,7 +57,7 @@ export const WeekStartPicker = (props: Props) => {
|
||||
const onChangeWeekStart = useCallback(
|
||||
(selectable: ComboboxOption | null) => {
|
||||
if (selectable && selectable.value !== undefined) {
|
||||
onChange(selectable.value);
|
||||
onChange(selectable.value as WeekStart);
|
||||
}
|
||||
},
|
||||
[onChange]
|
||||
|
||||
@@ -663,7 +663,6 @@ const customHomeDashboardV2Spec = {
|
||||
autoRefreshIntervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
|
||||
quickRanges: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
|
||||
hideTimepicker: false,
|
||||
weekStart: '',
|
||||
fiscalYearStartMonth: 0,
|
||||
},
|
||||
variables: [],
|
||||
|
||||
@@ -586,7 +586,6 @@ describe('DashboardSceneSerializer', () => {
|
||||
autoRefreshIntervals: [],
|
||||
quickRanges: [],
|
||||
hideTimepicker: false,
|
||||
weekStart: '',
|
||||
fiscalYearStartMonth: 0,
|
||||
timezone: '',
|
||||
},
|
||||
@@ -650,7 +649,6 @@ describe('DashboardSceneSerializer', () => {
|
||||
quickRanges: [],
|
||||
timezone: 'browser',
|
||||
to: 'now',
|
||||
weekStart: '',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+6
-2
@@ -508,8 +508,12 @@ function validateDashboardSchemaV2(dash: unknown): dash is DashboardV2Spec {
|
||||
if (!('hideTimepicker' in dash.timeSettings) || typeof dash.timeSettings.hideTimepicker !== 'boolean') {
|
||||
throw new Error('HideTimepicker is not a boolean');
|
||||
}
|
||||
if (!('weekStart' in dash.timeSettings) || typeof dash.timeSettings.weekStart !== 'string') {
|
||||
throw new Error('WeekStart is not a string');
|
||||
if (
|
||||
'weekStart' in dash.timeSettings &&
|
||||
typeof dash.timeSettings.weekStart === 'string' &&
|
||||
!['saturday', 'sunday', 'monday'].includes(dash.timeSettings.weekStart)
|
||||
) {
|
||||
throw new Error('WeekStart should be one of "saturday", "sunday" or "monday"');
|
||||
}
|
||||
if (!('fiscalYearStartMonth' in dash.timeSettings) || typeof dash.timeSettings.fiscalYearStartMonth !== 'number') {
|
||||
throw new Error('FiscalYearStartMonth is not a number');
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
Switch,
|
||||
TagsInput,
|
||||
TextArea,
|
||||
WeekStart,
|
||||
} from '@grafana/ui';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
|
||||
@@ -122,7 +123,7 @@ export class GeneralSettingsEditView
|
||||
});
|
||||
};
|
||||
|
||||
public onWeekStartChange = (value: string) => {
|
||||
public onWeekStartChange = (value: WeekStart) => {
|
||||
this.getTimeRange().setState({ weekStart: value });
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ describe('DashboardModelCompatibilityWrapper', () => {
|
||||
expect(wrapper.links).toEqual([NEW_LINK]);
|
||||
expect(wrapper.time.from).toBe('now-6h');
|
||||
expect(wrapper.timezone).toBe('America/New_York');
|
||||
expect(wrapper.weekStart).toBe('friday');
|
||||
expect(wrapper.weekStart).toBe('saturday');
|
||||
expect(wrapper.timepicker.refresh_intervals![0]).toEqual('5s');
|
||||
expect(wrapper.timepicker.hidden).toEqual(true);
|
||||
expect(wrapper.panels).toHaveLength(5);
|
||||
@@ -141,7 +141,7 @@ function setup() {
|
||||
},
|
||||
},
|
||||
$timeRange: new SceneTimeRange({
|
||||
weekStart: 'friday',
|
||||
weekStart: 'saturday',
|
||||
timeZone: 'America/New_York',
|
||||
}),
|
||||
$data: new DashboardDataLayerSet({
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
GridLayoutItemKind,
|
||||
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha0';
|
||||
import { DashboardLink, DataTransformerConfig } from '@grafana/schema/src/raw/dashboard/x/dashboard_types.gen';
|
||||
import { WeekStart } from '@grafana/ui';
|
||||
import {
|
||||
AnnoKeyCreatedBy,
|
||||
AnnoKeyDashboardGnetId,
|
||||
@@ -160,7 +161,8 @@ export function ensureV2Response(
|
||||
fiscalYearStartMonth: dashboard.fiscalYearStartMonth || timeSettingsDefaults.fiscalYearStartMonth,
|
||||
hideTimepicker: dashboard.timepicker?.hidden || timeSettingsDefaults.hideTimepicker,
|
||||
quickRanges: dashboard.timepicker?.time_options || timeSettingsDefaults.quickRanges,
|
||||
weekStart: dashboard.weekStart || timeSettingsDefaults.weekStart,
|
||||
// casting WeekStart here to avoid editing old schema
|
||||
weekStart: (dashboard.weekStart as WeekStart) || timeSettingsDefaults.weekStart,
|
||||
nowDelay: dashboard.timepicker?.nowDelay || timeSettingsDefaults.nowDelay,
|
||||
},
|
||||
links: dashboard.links || [],
|
||||
|
||||
@@ -4,13 +4,13 @@ import * as React from 'react';
|
||||
|
||||
import { rangeUtil, TimeZone } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { CollapsableSection, Field, Input, Switch, TimeZonePicker, WeekStartPicker } from '@grafana/ui';
|
||||
import { CollapsableSection, Field, Input, Switch, TimeZonePicker, WeekStart, WeekStartPicker } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
|
||||
import { AutoRefreshIntervals } from './AutoRefreshIntervals';
|
||||
|
||||
interface Props {
|
||||
onWeekStartChange: (weekStart: string) => void;
|
||||
onWeekStartChange: (weekStart: WeekStart) => void;
|
||||
onTimeZoneChange: (timeZone: TimeZone) => void;
|
||||
onRefreshIntervalChange: (interval: string[]) => void;
|
||||
onNowDelayChange: (nowDelay: string) => void;
|
||||
@@ -62,7 +62,7 @@ export class TimePickerSettings extends PureComponent<Props, State> {
|
||||
this.props.onTimeZoneChange(timeZone);
|
||||
};
|
||||
|
||||
onWeekStartChange = (weekStart: string) => {
|
||||
onWeekStartChange = (weekStart: WeekStart) => {
|
||||
this.props.onWeekStartChange(weekStart);
|
||||
};
|
||||
|
||||
|
||||
@@ -3831,11 +3831,11 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@grafana/scenes-react@npm:5.41.2":
|
||||
version: 5.41.2
|
||||
resolution: "@grafana/scenes-react@npm:5.41.2"
|
||||
"@grafana/scenes-react@npm:5.42.0":
|
||||
version: 5.42.0
|
||||
resolution: "@grafana/scenes-react@npm:5.42.0"
|
||||
dependencies:
|
||||
"@grafana/scenes": "npm:5.41.2"
|
||||
"@grafana/scenes": "npm:5.42.0"
|
||||
lru-cache: "npm:^10.2.2"
|
||||
react-use: "npm:^17.4.0"
|
||||
peerDependencies:
|
||||
@@ -3846,13 +3846,13 @@ __metadata:
|
||||
"@grafana/ui": ^11.0.0
|
||||
react: ^18.0.0
|
||||
react-dom: ^18.0.0
|
||||
checksum: 10/43684bb4d169666b9edb44f5804eb533fcba531b6d161837306def3611bfa606ea2fb3ad2a9aa374ec7d6757d7560df55217593927c0874254d3a0cae8a215f0
|
||||
checksum: 10/c94db6d57b02be5f960e44dc0c4be46e5e4708ede34f2f4e30934134543db88c8b553aceb89d9b3ae4dbf5d1eab1f48e534eb9a31d5c99b8908f715e45cb6dcf
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@grafana/scenes@npm:5.41.2":
|
||||
version: 5.41.2
|
||||
resolution: "@grafana/scenes@npm:5.41.2"
|
||||
"@grafana/scenes@npm:5.42.0":
|
||||
version: 5.42.0
|
||||
resolution: "@grafana/scenes@npm:5.42.0"
|
||||
dependencies:
|
||||
"@floating-ui/react": "npm:^0.26.16"
|
||||
"@leeoniya/ufuzzy": "npm:^1.0.16"
|
||||
@@ -3869,7 +3869,7 @@ __metadata:
|
||||
"@grafana/ui": ">=10.4"
|
||||
react: ^18.0.0
|
||||
react-dom: ^18.0.0
|
||||
checksum: 10/68d6f722e7298123271785f0c38d47f9b1c000ad51bc1f4bfdd90b6ad83d17e69a18261263f4e9cbda6c7062a72514cd91a22e7189b3a0429f28b96f7f928dc1
|
||||
checksum: 10/3232a499b839a45c8eed924441e4423d1b1d9f6b4ea6725437d357c1afea93d9ab300c46319b1ddab76b0da1197905b22c3abe8095d78c3320b1befb4731bd24
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -18166,8 +18166,8 @@ __metadata:
|
||||
"@grafana/prometheus": "workspace:*"
|
||||
"@grafana/runtime": "workspace:*"
|
||||
"@grafana/saga-icons": "workspace:*"
|
||||
"@grafana/scenes": "npm:5.41.2"
|
||||
"@grafana/scenes-react": "npm:5.41.2"
|
||||
"@grafana/scenes": "npm:5.42.0"
|
||||
"@grafana/scenes-react": "npm:5.42.0"
|
||||
"@grafana/schema": "workspace:*"
|
||||
"@grafana/sql": "workspace:*"
|
||||
"@grafana/tsconfig": "npm:^2.0.0"
|
||||
|
||||
Reference in New Issue
Block a user