The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
GDGT-2577 Replace deprecated SchedulePicker component (#77911)
Egor Grushin8dd86422fecf
diff --git a/__config.yml b/__config.ymlnew file mode 100644index 00000000000..d1d8548ad87--- /dev/null+++ b/__config.yml@@ -0,0 +1,28 @@+# -*- mode: yaml -*-+# copy that file as 'config.yml' and edit it to auto-initialize your fresh instance+version: 1+config:+ settings:+ email-smtp-host: localhost+ email-smtp-port: 1025+ email-smtp-username: metabase+ email-smtp-password: metabase@secret+ email-smtp-security: none+ users:+ - first_name: Egor+ last_name: Grushin+ password: Lalaept2+ email: [email protected]+ databases:+ - name: External DB+ engine: postgres+ details:+ host: localhost+ port: 5455+ dbname: metabase+ user: metabase+ password: password+ settings:+ database-enable-actions: true+ database-enable-workspaces: true+ database-enable-table-editing: truediff --git a/e2e/test-component/scenarios/embedding-sdk/subscriptions.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/subscriptions.cy.spec.tsxindex d2e798ce99f..f8304c4ff9d 100644--- a/e2e/test-component/scenarios/embedding-sdk/subscriptions.cy.spec.tsx+++ b/e2e/test-component/scenarios/embedding-sdk/subscriptions.cy.spec.tsx@@ -87,7 +87,8 @@ describe("scenarios > embedding-sdk > subscriptions", () => {cy.findByText("Email this dashboard").should("be.visible");// EMB-1413- cy.findByDisplayValue("Hourly").click();+ cy.findByTestId("select-frequency").click();+ H.popover().findByRole("option", { name: "hourly" }).click();cy.log("can customize filter values");cy.findByRole("heading", {@@ -121,7 +122,8 @@ describe("scenarios > embedding-sdk > subscriptions", () => {cy.findByText("Email this dashboard").should("be.visible");// EMB-1413- cy.findByDisplayValue("Hourly").click();+ cy.findByTestId("select-frequency").click();+ H.popover().findByRole("option", { name: "hourly" }).click();cy.log("can customize filter values");cy.findByRole("heading", {@@ -155,7 +157,8 @@ describe("scenarios > embedding-sdk > subscriptions", () => {cy.findByText("Email this dashboard").should("be.visible");// EMB-1413- cy.findByDisplayValue("Hourly").click();+ cy.findByTestId("select-frequency").click();+ H.popover().findByRole("option", { name: "hourly" }).click();cy.log("can customize filter values");cy.findByRole("heading", {diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding/embed-options.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding/embed-options.cy.spec.tsindex bea02eea6de..600ef62b4a2 100644--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding/embed-options.cy.spec.ts+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding/embed-options.cy.spec.ts@@ -114,10 +114,10 @@ describe("EE", () => {cy.log("set up the second subscription");cy.button("Set up a new schedule").click();- cy.findByDisplayValue("Hourly").click();+ cy.findByTestId("select-frequency").click();});- H.popover().findByRole("option", { name: "Daily" }).click();+ H.popover().findByRole("option", { name: "daily" }).click();cy.findByRole("button", { name: "Done" }).click();dashboardSidebar().within(() => {diff --git a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js b/e2e/test/scenarios/sharing/subscriptions.cy.spec.jsindex aa1ab7c8d51..47eb55b514a 100644--- a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js+++ b/e2e/test/scenarios/sharing/subscriptions.cy.spec.js@@ -117,8 +117,8 @@ describe("scenarios > dashboard > subscriptions", () => {cy.findByPlaceholderText("Enter user names or email addresses");// Change the schedule to "Monthly"- cy.findByDisplayValue("Hourly").click();- H.popover().findByText("Monthly").click();+ cy.findByTestId("select-frequency").click();+ H.popover().findByText("monthly").click();H.sidebar().button("Done").should("be.disabled");});@@ -137,7 +137,7 @@ describe("scenarios > dashboard > subscriptions", () => {cy.findByPlaceholderText("Enter user names or email addresses").click();H.popover().should("be.visible").and("contain", `${admin.first_name}`);cy.realPress("Escape");- H.popover({ skipVisibilityCheck: true }).should("not.be.visible");+ H.popover({ skipVisibilityCheck: true }).should("not.exist");cy.findByPlaceholderText("Enter user names or email addresses").should("not.have.value",);@@ -402,14 +402,14 @@ describe("scenarios > dashboard > subscriptions", () => {assignRecipient();H.sidebar().findByText("To:").click();- cy.findByDisplayValue("Hourly").click();- H.popover().findByText("Monthly").click();+ cy.findByTestId("select-frequency").click();+ H.popover().findByText("monthly").click();- cy.findByDisplayValue("First").click();- H.popover().findByText("15th (Midpoint)").click();+ cy.findByTestId("select-frame").click();+ H.popover().findByText("15th").click();- cy.findByDisplayValue("15th (Midpoint)").click();- H.popover().findByText("First").click();+ cy.findByTestId("select-frame").click();+ H.popover().findByText("first").click();clickButton("Done");// Implicit assertion (word mustn't contain string "null")diff --git a/frontend/src/metabase/common/components/Schedule/Schedule.tsx b/frontend/src/metabase/common/components/Schedule/Schedule.tsxindex 2f3d8893bbf..472b1b72e94 100644--- a/frontend/src/metabase/common/components/Schedule/Schedule.tsx+++ b/frontend/src/metabase/common/components/Schedule/Schedule.tsx@@ -216,19 +216,14 @@ export const Schedule = ({.jt`${verb} ${selectFrequency} every ${selectEveryMinute} ${ngettext(msgid`Minute`, "Minutes", schedule_minute as number).toLocaleLowerCase()}`,).with("hourly", () => {- return minutesOnHourPicker ? (- // For example, "Send hourly at 15 minutes past the hour"- c(- "{0} is a verb like 'Send', {1} is an adverb like 'hourly', {2} is a number of minutes",- )- .jt`${verb} ${selectFrequency} at ${selectMinute} minutes past the hour`- ) : (- // For example, "Send hourly"- // NOTE: babel-ttag-plugin prevents us from localizing this JSX because it consists only of placeholders- <>- {verb} {selectFrequency}- </>- );+ return minutesOnHourPicker+ ? // For example, "Send hourly at 15 minutes past the hour"+ c(+ "{0} is a verb like 'Send', {1} is an adverb like 'hourly', {2} is a number of minutes",+ )+ .jt`${verb} ${selectFrequency} at ${selectMinute} minutes past the hour`+ : // For example, "Send hourly"+ [verb, selectFrequency];}).with("daily",diff --git a/frontend/src/metabase/common/components/Schedule/Schedule.unit.spec.tsx b/frontend/src/metabase/common/components/Schedule/Schedule.unit.spec.tsxindex 575e928f0a0..199bfee42ed 100644--- a/frontend/src/metabase/common/components/Schedule/Schedule.unit.spec.tsx+++ b/frontend/src/metabase/common/components/Schedule/Schedule.unit.spec.tsx@@ -152,6 +152,18 @@ describe("Schedule", () => {"Your Metabase timezone",],],+ [+ "monthly last weekday",+ "0 0 8 ? * 2L *",+ [+ "Frequency",+ "First, 15th, or last of the month",+ "Day of the month",+ "Time",+ "AM/PM",+ "Your Metabase timezone",+ ],+ ],["monthly mid (15th)","0 0 8 15 * ? *",@@ -357,6 +369,50 @@ describe("Schedule", () => {},"0 0 15 1 * ? *",],+ // Default-filling when only the frequency changes+ [+ "switch daily to weekly defaults to Monday",+ "0 0 8 * * ? *",+ { frequency: "weekly" },+ "0 0 8 ? * 2 *",+ ],+ [+ "switch daily to monthly defaults to first of month",+ "0 0 8 * * ? *",+ { frequency: "monthly" },+ "0 0 8 1 * ? *",+ ],+ [+ "switch monthly to daily clears frame and weekday",+ "0 0 8 ? * 2#1 *",+ { frequency: "daily" },+ "0 0 8 * * ? *",+ ],+ // Default-filling when only the monthly frame changes+ [+ "switch 15th to first keeps calendar day",+ "0 0 8 15 * ? *",+ { frame: "first" },+ "0 0 8 1 * ? *",+ ],+ [+ "switch 15th to last keeps calendar day",+ "0 0 8 15 * ? *",+ { frame: "last" },+ "0 0 8 L * ? *",+ ],+ [+ "switch first to 15th clears the weekday",+ "0 0 8 ? * 2#1 *",+ { frame: "15th" },+ "0 0 8 15 * ? *",+ ],+ [+ "switch first to last keeps the weekday",+ "0 0 8 ? * 2#1 *",+ { frame: "last" },+ "0 0 8 ? * 2L *",+ ],];it.each(cases)(diff --git a/frontend/src/metabase/common/components/Schedule/cron.ts b/frontend/src/metabase/common/components/Schedule/cron.tsindex 7d944875bcf..551d211eb47 100644--- a/frontend/src/metabase/common/components/Schedule/cron.ts+++ b/frontend/src/metabase/common/components/Schedule/cron.ts@@ -88,6 +88,18 @@ const defaultSchedule: ScheduleSettings = {};export const defaultCron = scheduleSettingsToCron(defaultSchedule);+export const toCronString = (schedule: ScheduleSettings): string => {+ const { schedule_type } = schedule;+ const keepDay = schedule_type === "weekly" || schedule_type === "monthly";+ const keepHour = keepDay || schedule_type === "daily";+ return scheduleSettingsToCron({+ ...schedule,+ schedule_day: keepDay ? schedule.schedule_day : null,+ schedule_frame: keepDay ? schedule.schedule_frame : null,+ schedule_hour: keepHour ? schedule.schedule_hour : null,+ });+};+/** Returns null if we can't convert the cron expression to a ScheduleSettings object */export const cronToScheduleSettings_unmemoized = (cron: string | null | undefined,diff --git a/frontend/src/metabase/common/components/Schedule/cron.unit.spec.ts b/frontend/src/metabase/common/components/Schedule/cron.unit.spec.tsindex 3f75ad9a3ed..cd350c12b3d 100644--- a/frontend/src/metabase/common/components/Schedule/cron.unit.spec.ts+++ b/frontend/src/metabase/common/components/Schedule/cron.unit.spec.ts@@ -5,6 +5,7 @@ import {hourTo24HourFormat,hourToTwelveHourFormat,scheduleSettingsToCron,+ toCronString,} from "./cron";describe("scheduleSettingsToCron", () => {@@ -92,6 +93,62 @@ describe("scheduleSettingsToCron", () => {});});+describe("toCronString", () => {+ it("strips day, frame, and hour for hourly schedules", () => {+ const cron = toCronString({+ schedule_type: "hourly",+ schedule_minute: 30,+ schedule_hour: 8,+ schedule_day: "mon",+ schedule_frame: "first",+ });+ expect(cron).toEqual("0 30 * * * ? *");+ });++ it("strips day, frame, and hour for every_n_minutes schedules", () => {+ const cron = toCronString({+ schedule_type: "every_n_minutes",+ schedule_minute: 10,+ schedule_hour: 8,+ schedule_day: "mon",+ schedule_frame: "first",+ });+ expect(cron).toEqual("0 0/10 * * * ? *");+ });++ it("keeps hour but strips day and frame for daily schedules", () => {+ const cron = toCronString({+ schedule_type: "daily",+ schedule_minute: 30,+ schedule_hour: 14,+ schedule_day: "mon",+ schedule_frame: "first",+ });+ expect(cron).toEqual("0 30 14 * * ? *");+ });++ it("keeps day and hour for weekly schedules", () => {+ const cron = toCronString({+ schedule_type: "weekly",+ schedule_day: "mon",+ schedule_minute: 0,+ schedule_hour: 12,+ });+ expect(cron).toEqual("0 0 12 ? * 2 *");+ });++ it("keeps day, frame, and hour for monthly schedules", () => {+ const cron = toCronString({+ schedule_type: "monthly",+ schedule_day: "wed",+ schedule_frame: "first",+ schedule_minute: 15,+ schedule_hour: 9,+ });+ expect(cron).toEqual("0 15 9 ? * 4#1 *");+ });+});+describe("cronToScheduleSettings", () => {it("returns default schedule when input is null or undefined", () => {const defaultSchedule = {diff --git a/frontend/src/metabase/common/components/Schedule/index.ts b/frontend/src/metabase/common/components/Schedule/index.tsindex 58c693be473..71345334158 100644--- a/frontend/src/metabase/common/components/Schedule/index.ts+++ b/frontend/src/metabase/common/components/Schedule/index.ts@@ -1 +1,2 @@export * from "./Schedule";+export * from "./cron";diff --git a/frontend/src/metabase/common/components/SchedulePicker/DynamicWidthSelect.tsx b/frontend/src/metabase/common/components/SchedulePicker/DynamicWidthSelect.tsxdeleted file mode 100644index 5e968fd97c1..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/DynamicWidthSelect.tsx+++ /dev/null@@ -1,94 +0,0 @@-import { useMemo } from "react";--import { useSelector } from "metabase/redux";-import { getSetting } from "metabase/selectors/settings";-import type { SelectProps } from "metabase/ui";-import { Select } from "metabase/ui";--import {- getLongestSelectLabel,- measureTextWidthSafely,-} from "../Schedule/utils";--// Icon + padding + extra buffer + scrollbar (for dropdown)-const BUFFER = 60;--// Use when somehow `measureTextWidthSafely` fails-const DEFAULT_WIDTH = 50;--const MIN_DROPDOWN_WIDTH = 150;--/**- * A Select component with independent width calculations for button and dropdown.- * - Button width: Based on currently selected option (with optional min-width)- * - Dropdown width: Based on longest option in the list- *- * Created specifically for SchedulePicker (which is deprecated).- */-export const DynamicWidthSelect = <Value extends string = string>({- value,- minButtonWidth,- ...props-}: Omit<- SelectProps<Value>,- "value" | "onChange" | "comboboxProps" | "styles"-> & {- value: Value | null | undefined;- onChange: (newValue: Value | null) => void;- minButtonWidth?: number;-}) => {- const fontFamily = useSelector((state) =>- getSetting(state, "application-font"),- );-- const { buttonWidth, dropdownWidth } = useMemo(() => {- const fontStyle = { family: fontFamily };-- // Calculate button width based on selected value- const selectedLabel = getSelectedLabel(props.data, value);- const measuredButtonWidth =- measureTextWidthSafely(selectedLabel, DEFAULT_WIDTH, fontStyle) + BUFFER;- const buttonWidth = Math.max(measuredButtonWidth, minButtonWidth || 0);-- // Calculate dropdown width based on longest option- const longestLabel = getLongestSelectLabel(props.data);- const dropdownWidth =- measureTextWidthSafely(longestLabel, DEFAULT_WIDTH, fontStyle) + BUFFER;-- return { buttonWidth, dropdownWidth };- }, [props.data, value, fontFamily, minButtonWidth]);-- return (- <Select- styles={{- wrapper: { width: buttonWidth },- }}- comboboxProps={{- position: "bottom-end",- width: Math.max(MIN_DROPDOWN_WIDTH, dropdownWidth),- }}- value={value}- {...props}- />- );-};--const getSelectedLabel = (- data: SelectProps["data"],- value: string | null | undefined,-): string => {- if (!value) {- return "";- }- for (const option of data) {- if (- typeof option === "object" &&- option &&- "value" in option &&- option.value === value- ) {- return option.label;- }- }- return value;-};diff --git a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.stories.tsx b/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.stories.tsxdeleted file mode 100644index 3c6dadac061..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.stories.tsx+++ /dev/null@@ -1,44 +0,0 @@-import { useArgs } from "@storybook/preview-api";-import type { StoryFn } from "@storybook/react";--import { SchedulePicker } from "./SchedulePicker";--export default {- title: "Deprecated/Components/SchedulePicker",- component: SchedulePicker,-};--const Template: StoryFn<typeof SchedulePicker> = (args) => {- const [- {- schedule,- scheduleOptions = ["daily", "weekly", "monthly"],- timezone = "UTC",- },- updateArgs,- ] = useArgs();- const handleChange = (schedule: unknown) => updateArgs({ schedule });- return (- <SchedulePicker- {...args}- schedule={schedule}- scheduleOptions={scheduleOptions}- timezone={timezone}- onScheduleChange={handleChange}- />- );-};--export const Default = {- render: Template,-- args: {- schedule: {- schedule_day: "mon",- schedule_frame: null,- schedule_hour: 0,- schedule_type: "daily",- },- textBeforeInterval: "Deliver",- },-};diff --git a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.styled.tsx b/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.styled.tsxdeleted file mode 100644index bc2c4c79690..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.styled.tsx+++ /dev/null@@ -1,24 +0,0 @@-// eslint-disable-next-line no-restricted-imports-import styled from "@emotion/styled";--export const PickerRow = styled.div`- display: flex;- align-items: center;-`;--export const PickerSpacedRow = styled(PickerRow)`- margin-top: 1rem;-`;--export const PickerText = styled.span`- font-weight: bold;- min-width: 48px;- margin-right: 12px;- text-overflow: ellipsis;- overflow: hidden;-`;--export const ScheduleDescriptionContainer = styled.div`- margin-top: 1rem;- color: var(--mb-color-text-secondary);-`;diff --git a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.tsx b/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.tsxdeleted file mode 100644index 221bf658483..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.tsx+++ /dev/null@@ -1,350 +0,0 @@-import cx from "classnames";-import { type CSSProperties, Component } from "react";-import { t } from "ttag";--import CS from "metabase/css/core/index.css";-import { useSelector } from "metabase/redux";-import { getApplicationName } from "metabase/selectors/whitelabel";-import {- Box,- type BoxProps,- SegmentedControl,- type SelectOption,-} from "metabase/ui";-import {- AM_PM_OPTIONS,- HOUR_OPTIONS,- MINUTE_OPTIONS,- MONTH_DAY_OPTIONS,- getDayOfWeekOptions,-} from "metabase/utils/date-time";-import { capitalize } from "metabase/utils/formatting/strings";-import type {- ScheduleDayType,- ScheduleFrameType,- ScheduleSettings,- ScheduleType,-} from "metabase-types/api";--import { DynamicWidthSelect } from "./DynamicWidthSelect";-import {- PickerRow,- PickerSpacedRow,- PickerText,- ScheduleDescriptionContainer,-} from "./SchedulePicker.styled";--const optionNameTranslations: Partial<Record<ScheduleType, string>> = {- get hourly() {- return t`Hourly`;- },- get daily() {- return t`Daily`;- },- get weekly() {- return t`Weekly`;- },- get monthly() {- return t`Monthly`;- },-};--export type ScheduleProperty = keyof ScheduleSettings;-export type ScheduleChangeProp = { name: ScheduleProperty; value: unknown };--export interface SchedulePickerProps {- schedule: ScheduleSettings;- scheduleOptions: ScheduleType[];- timezone?: string;- textBeforeInterval?: string;- textBeforeSendTime?: string;- minutesOnHourPicker?: boolean;- className?: string;- style?: CSSProperties;-- onScheduleChange: (- nextSchedule: ScheduleSettings,- change: ScheduleChangeProp,- ) => void;-- mt?: BoxProps["mt"];-}--const DEFAULT_DAY = "mon";--/**- * Transforms legacy Select data format to Mantine Select data format- */-type LegacyScheduleOption = { name?: string; value: string | number };--function toMantineData(options: LegacyScheduleOption[]): SelectOption[] {- return options.map((option) => ({- label: option.name ?? "",- value: option.value.toString(),- }));-}--/**- * @deprecated use "metabase/common/components/Schedule" instead- */-export class SchedulePicker extends Component<SchedulePickerProps> {- handleChangeProperty(- name: ScheduleProperty,- value: ScheduleSettings[typeof name],- ) {- let newSchedule: ScheduleSettings = {- ...this.props.schedule,- [name]: value,- };-- if (name === "schedule_type") {- // clear out other values than schedule_type for hourly schedule- if (value === "hourly") {- newSchedule = {- ...newSchedule,- schedule_day: null,- schedule_frame: null,- schedule_hour: null,- schedule_minute: 0,- };- }-- // default to midnight for all schedules other than hourly- if (value !== "hourly") {- newSchedule = {- ...newSchedule,- schedule_hour: newSchedule.schedule_hour || 0,- };- }-- // clear out other values than schedule_type and schedule_day for daily schedule- if (value === "daily") {- newSchedule = {- ...newSchedule,- schedule_day: null,- schedule_frame: null,- };- }-- // default to Monday when user wants a weekly schedule + clear out schedule_frame- if (value === "weekly") {- newSchedule = {- ...newSchedule,- schedule_day: DEFAULT_DAY,- schedule_frame: null,- };- }-- // default to First, Monday when user wants a monthly schedule- if (value === "monthly") {- newSchedule = {- ...newSchedule,- schedule_frame: "first",- schedule_day: DEFAULT_DAY,- };- }- } else if (name === "schedule_frame") {- // when the monthly schedule frame is the 15th, clear out the schedule_day- if (value === "mid") {- newSchedule = { ...newSchedule, schedule_day: null };- } else {- // first or last, needs a day of the week- newSchedule = {- ...newSchedule,- schedule_day: newSchedule.schedule_day || DEFAULT_DAY,- };- }- }-- this.props.onScheduleChange(newSchedule, { name, value });- }-- renderMonthlyPicker() {- const { schedule } = this.props;-- const DAY_OPTIONS = [- { label: t`Calendar Day`, value: "" },- ...toMantineData(getDayOfWeekOptions()),- ];-- return (- <PickerSpacedRow>- <PickerText>{t`on the`}</PickerText>- <DynamicWidthSelect- minButtonWidth={110}- value={schedule.schedule_frame ?? ""}- onChange={(value) =>- this.handleChangeProperty(- "schedule_frame",- // Unjustified type cast. FIXME- value as ScheduleFrameType,- )- }- data={toMantineData(MONTH_DAY_OPTIONS)}- />- {schedule.schedule_frame !== "mid" && (- <span className={CS.mx1}>- <DynamicWidthSelect- minButtonWidth={110}- value={schedule.schedule_day ?? ""}- onChange={(value) =>- this.handleChangeProperty(- "schedule_day",- // We only need to convert this option back to null because it's the only option we change from `null` to `""` in this file.- (value || null) as ScheduleDayType,- )- }- data={DAY_OPTIONS}- />- </span>- )}- </PickerSpacedRow>- );- }-- renderDayPicker() {- const { schedule } = this.props;-- return (- <PickerRow>- <span className={cx(CS.textBold, CS.mx1)}>{t`on`}</span>- <DynamicWidthSelect- minButtonWidth={110}- value={schedule.schedule_day ?? ""}- onChange={(value) =>- // Unjustified type cast. FIXME- this.handleChangeProperty("schedule_day", value as ScheduleDayType)- }- data={toMantineData(getDayOfWeekOptions())}- />- </PickerRow>- );- }-- renderMinutePicker() {- const { schedule } = this.props;- // Unjustified type cast. FIXME- const minuteOfHour = isNaN(schedule.schedule_minute as number)- ? 0- : (schedule.schedule_minute ?? 0);- return (- <PickerSpacedRow>- <PickerText>{t`at`}</PickerText>- <DynamicWidthSelect- minButtonWidth={110}- className={CS.mr1}- value={minuteOfHour.toString()}- data={toMantineData(MINUTE_OPTIONS)}- onChange={(value) =>- this.handleChangeProperty(- "schedule_minute",- value ? parseInt(value) : 0,- )- }- />- <span className={CS.textBold}>{t`minutes past the hour`}</span>- </PickerSpacedRow>- );- }-- renderHourPicker() {- const { schedule, timezone, textBeforeSendTime } = this.props;-- // Unjustified type cast. FIXME- const hourOfDay = isNaN(schedule.schedule_hour as number)- ? 8- : schedule.schedule_hour || 0;-- const hour = hourOfDay % 12;- const amPm = hourOfDay >= 12 ? 1 : 0;-- return (- <>- <PickerSpacedRow>- <PickerText>{t`at`}</PickerText>- <DynamicWidthSelect- minButtonWidth={110}- className={CS.mr1}- value={hour.toString()}- data={toMantineData(HOUR_OPTIONS)}- onChange={(value) =>- this.handleChangeProperty(- "schedule_hour",- (value ? parseInt(value) : 0) + amPm * 12,- )- }- />-- <SegmentedControl- value={amPm.toString()}- onChange={(value) =>- this.handleChangeProperty(- "schedule_hour",- hour + parseInt(value) * 12,- )- }- data={AM_PM_OPTIONS.map(({ value, name }) => ({- value: value.toString(),- label: name,- }))}- fullWidth- />- </PickerSpacedRow>- {textBeforeSendTime && (- <ScheduleDescriptionContainer>- {textBeforeSendTime} {hour === 0 ? 12 : hour}:00{" "}- {amPm ? "PM" : "AM"} {timezone}, <MetabaseTimeZone />.- </ScheduleDescriptionContainer>- )}- </>- );- }-- render() {- const {- schedule,- scheduleOptions,- textBeforeInterval,- className,- style,- mt = "md",- } = this.props;-- const scheduleType = schedule.schedule_type;-- return (- <Box mt={mt} className={className} style={style}>- <PickerRow>- <PickerText>{textBeforeInterval}</PickerText>- <DynamicWidthSelect- minButtonWidth={110}- value={scheduleType}- onChange={(value) =>- this.handleChangeProperty("schedule_type", value)- }- data={scheduleOptions.map((scheduleOption) => ({- label:- optionNameTranslations[scheduleOption] ||- capitalize(scheduleOption),- value: scheduleOption,- }))}- />- {scheduleType === "weekly" && this.renderDayPicker()}- </PickerRow>- {scheduleType === "hourly" &&- this.props.minutesOnHourPicker &&- this.renderMinutePicker()}- {scheduleType === "monthly" && this.renderMonthlyPicker()}- {(scheduleType === "daily" ||- scheduleType === "weekly" ||- scheduleType === "monthly") &&- this.renderHourPicker()}- </Box>- );- }-}--function MetabaseTimeZone() {- const applicationName = useSelector(getApplicationName);- return <>{t`your ${applicationName} timezone`}</>;-}diff --git a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.unit.spec.tsx b/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.unit.spec.tsxdeleted file mode 100644index 8eb1c694fab..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/SchedulePicker.unit.spec.tsx+++ /dev/null@@ -1,418 +0,0 @@-import userEvent from "@testing-library/user-event";--import { renderWithProviders, screen, within } from "__support__/ui";--import type { SchedulePickerProps } from "./SchedulePicker";-import { SchedulePicker } from "./SchedulePicker";--const DEFAULT_SCHEDULE_OPTIONS = [- "hourly",- "daily",- "weekly",- "monthly",-] as const;--const setup = (props?: Partial<SchedulePickerProps>) => {- const onScheduleChange = jest.fn();- const defaultProps: SchedulePickerProps = {- schedule: {- schedule_type: "daily",- schedule_day: null,- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- scheduleOptions: [...DEFAULT_SCHEDULE_OPTIONS],- onScheduleChange,- ...props,- };-- const { rerender } = renderWithProviders(- <SchedulePicker {...defaultProps} />,- );-- return {- onScheduleChange,- rerender: (newProps?: Partial<SchedulePickerProps>) =>- rerender(<SchedulePicker {...defaultProps} {...newProps} />),- props: defaultProps,- };-};--describe("SchedulePicker", () => {- describe("monthly schedule - schedule_frame selection", () => {- it("should convert empty string to null when changing schedule_frame", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- });-- // Find the "First" select input by display value- const frameSelect = screen.getByDisplayValue("First");- await userEvent.click(frameSelect);-- // Select "15th (Midpoint)" which should result in null for non-day frames- const listbox = await screen.findByRole("listbox");- const midOption = within(listbox).getByText("15th (Midpoint)");- await userEvent.click(midOption);-- // Verify that onScheduleChange was called with the correct value- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "mid",- schedule_day: null, // Should be null when frame is "mid"- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_frame",- value: "mid",- },- );- });-- it("should handle selecting 'first' frame correctly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "mid",- schedule_day: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- const frameSelect = screen.getByDisplayValue("15th (Midpoint)");- await userEvent.click(frameSelect);-- const listbox = await screen.findByRole("listbox");- const firstOption = within(listbox).getByText("First");- await userEvent.click(firstOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon", // Should default to "mon" when switching to first/last- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_frame",- value: "first",- },- );- });-- it("should handle selecting 'last' frame correctly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "mid",- schedule_day: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- const frameSelect = screen.getByDisplayValue("15th (Midpoint)");- await userEvent.click(frameSelect);-- const listbox = await screen.findByRole("listbox");- const lastOption = within(listbox).getByText("Last");- await userEvent.click(lastOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "last",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_frame",- value: "last",- },- );- });- });-- describe("monthly schedule - schedule_day selection (Calendar Day)", () => {- it("should convert empty string to null when selecting 'Calendar Day'", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- });-- // Find the "Monday" select input- const daySelect = screen.getByDisplayValue("Monday");- await userEvent.click(daySelect);-- // Select "Calendar Day" which has an empty string value- const listbox = await screen.findByRole("listbox");- const calendarDayOption = within(listbox).getByText("Calendar Day");- await userEvent.click(calendarDayOption);-- // Verify that onScheduleChange was called with null, not "" because Mantine Select uses ""- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: null,- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_day",- value: null,- },- );- });-- it("should handle selecting a specific weekday correctly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- // When schedule_day is null, it displays as "Calendar Day"- const daySelect = screen.getByDisplayValue("Calendar Day");- await userEvent.click(daySelect);-- // Select a specific weekday- const listbox = await screen.findByRole("listbox");- const wednesdayOption = within(listbox).getByText("Wednesday");- await userEvent.click(wednesdayOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "wed",- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_day",- value: "wed",- },- );- });- });-- describe("monthly schedule - day picker visibility", () => {- it("should hide day picker when schedule_frame is 'mid'", () => {- setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "mid",- schedule_day: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- // Should have "on the" text- expect(screen.getByText("on the")).toBeInTheDocument();-- // Should have the "15th (Midpoint)" select- expect(screen.getByDisplayValue("15th (Midpoint)")).toBeInTheDocument();-- // Verify that there's no "Calendar Day" or weekday option visible- // (the day picker is not rendered when frame is "mid")- expect(- screen.queryByDisplayValue("Calendar Day"),- ).not.toBeInTheDocument();- expect(screen.queryByDisplayValue("Monday")).not.toBeInTheDocument();- });-- it("should show day picker when schedule_frame is 'first'", () => {- setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- });-- // When frame is "first", day picker should be visible- expect(screen.getByDisplayValue("First")).toBeInTheDocument();- expect(screen.getByDisplayValue("Monday")).toBeInTheDocument();- expect(screen.getByText("on the")).toBeInTheDocument();- });-- it("should show day picker when schedule_frame is 'last'", () => {- setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "last",- schedule_day: "fri",- schedule_hour: 8,- schedule_minute: 0,- },- });-- expect(screen.getByDisplayValue("Last")).toBeInTheDocument();- expect(screen.getByDisplayValue("Friday")).toBeInTheDocument();- expect(screen.getByText("on the")).toBeInTheDocument();- });- });-- describe("weekly schedule - schedule_day selection", () => {- it("should handle selecting a weekday correctly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "weekly",- schedule_day: "mon",- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- // Find the "Monday" select in weekly view- const daySelect = screen.getByDisplayValue("Monday");- await userEvent.click(daySelect);-- const listbox = await screen.findByRole("listbox");- const fridayOption = within(listbox).getByText("Friday");- await userEvent.click(fridayOption);-- // Verify the day was changed correctly- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "weekly",- schedule_day: "fri",- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_day",- value: "fri",- },- );- });- });-- describe("schedule type changes", () => {- it("should clear frame and day when switching to daily", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- });-- const typeSelect = screen.getByDisplayValue("Monthly");- await userEvent.click(typeSelect);-- const listbox = await screen.findByRole("listbox");- const dailyOption = within(listbox).getByText("Daily");- await userEvent.click(dailyOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "daily",- schedule_day: null,- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_type",- value: "daily",- },- );- });-- it("should set default day and clear frame when switching to weekly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "daily",- schedule_day: null,- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- const typeSelect = screen.getByDisplayValue("Daily");- await userEvent.click(typeSelect);-- const listbox = await screen.findByRole("listbox");- const weeklyOption = within(listbox).getByText("Weekly");- await userEvent.click(weeklyOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "weekly",- schedule_day: "mon",- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_type",- value: "weekly",- },- );- });-- it("should set default values when switching to monthly", async () => {- const { onScheduleChange } = setup({- schedule: {- schedule_type: "daily",- schedule_day: null,- schedule_frame: null,- schedule_hour: 8,- schedule_minute: 0,- },- });-- // Find and click the "Daily" select- const typeSelect = screen.getByDisplayValue("Daily");- await userEvent.click(typeSelect);-- const listbox = await screen.findByRole("listbox");- const monthlyOption = within(listbox).getByText("Monthly");- await userEvent.click(monthlyOption);-- expect(onScheduleChange).toHaveBeenCalledWith(- {- schedule_type: "monthly",- schedule_frame: "first",- schedule_day: "mon",- schedule_hour: 8,- schedule_minute: 0,- },- {- name: "schedule_type",- value: "monthly",- },- );- });- });-});diff --git a/frontend/src/metabase/common/components/SchedulePicker/index.ts b/frontend/src/metabase/common/components/SchedulePicker/index.tsdeleted file mode 100644index d8a4d075da3..00000000000--- a/frontend/src/metabase/common/components/SchedulePicker/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./SchedulePicker";diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditEmailSidebar.tsx b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditEmailSidebar.tsxindex ba0a7b9ae08..714a71c7322 100644--- a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditEmailSidebar.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditEmailSidebar.tsx@@ -3,10 +3,8 @@ import { useEffect } from "react";import { t } from "ttag";import _ from "underscore";-import {- type ScheduleChangeProp,- SchedulePicker,-} from "metabase/common/components/SchedulePicker";+import { Schedule, toCronString } from "metabase/common/components/Schedule";+import type { ScheduleChangeProp } from "metabase/common/components/Schedule/types";import { SendTestPulse } from "metabase/common/components/SendTestPulse";import { Sidebar } from "metabase/common/components/Sidebar";import CS from "metabase/css/core/index.css";@@ -16,7 +14,9 @@ import { PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE } from "metabimport { dashboardPulseIsValid } from "metabase/pulse";import { useSelector } from "metabase/redux";import type { DraftDashboardSubscription } from "metabase/redux/store";+import { getSetting } from "metabase/selectors/settings";import { canAccessSettings, getUser } from "metabase/selectors/user";+import { getApplicationName } from "metabase/selectors/whitelabel";import { Icon, Stack, Switch, Text, Title } from "metabase/ui";import type { UiParameter } from "metabase-lib/v1/parameters/types";import {@@ -34,7 +34,7 @@ import { CaveatMessage } from "./CaveatMessage";import DefaultParametersSection from "./DefaultParametersSection";import { DeleteSubscriptionAction } from "./DeleteSubscriptionAction";import { EmailAttachmentPicker } from "./EmailAttachmentPicker";-import { CHANNEL_NOUN_PLURAL } from "./constants";+import { getSubscriptionScheduleDescription } from "./utils";interface AddEditEmailSidebarProps {pulse: DraftDashboardSubscription;@@ -83,6 +83,20 @@ export const AddEditEmailSidebar = ({const isValid = dashboardPulseIsValid(pulse, formInput.channels);const userCanAccessSettings = useSelector(canAccessSettings);const currentUser = useSelector(getUser);+ const applicationName = useSelector(getApplicationName);+ const timezone = useSelector((state) =>+ getSetting(state, "report-timezone-short"),+ );++ const renderScheduleDescription = (schedule: ScheduleSettings) => {+ const description = getSubscriptionScheduleDescription({+ schedule,+ channelSpec,+ applicationName,+ timezone,+ });+ return description ? <Text c="text-secondary">{description}</Text> : null;+ };// Return true if the results of all cards can be downloadedconst allowDownload = pulse.cards.every(@@ -111,7 +125,7 @@ export const AddEditEmailSidebar = ({>{isEmbeddingSdk() ? null : (<div>- <div className={cx(CS.textBold, CS.mb1)}>{t`To:`}</div>+ <div className={CS.mb1}>{t`To:`}</div><RecipientPickerautoFocus={false}recipients={channel.recipients}@@ -127,22 +141,25 @@ export const AddEditEmailSidebar = ({/></div>)}- <SchedulePicker- schedule={_.pick(- channel,- "schedule_day",- "schedule_frame",- "schedule_hour",- "schedule_type",+ <Schedule+ mt="md"+ cronString={toCronString(+ _.pick(+ channel,+ "schedule_day",+ "schedule_frame",+ "schedule_hour",+ "schedule_type",+ ),)}scheduleOptions={channelSpec.schedules}- textBeforeInterval={t`Sent`}- textBeforeSendTime={t`${- (channelSpec?.type && CHANNEL_NOUN_PLURAL[channelSpec.type]) ??- t`Messages`- } will be sent at`}- onScheduleChange={(newSchedule, changedProp) =>- onChannelScheduleChange(newSchedule, changedProp)+ verb={t`Sent`}+ renderScheduleDescription={renderScheduleDescription}+ onScheduleChange={(_cronString, newSchedule) =>+ onChannelScheduleChange(newSchedule, {+ name: "schedule_type",+ value: newSchedule.schedule_type,+ })}/><div className={cx(CS.py2)}>diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditSlackSidebar.tsx b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditSlackSidebar.tsxindex 2f0030d0306..125006c67f4 100644--- a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditSlackSidebar.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/AddEditSlackSidebar.tsx@@ -2,17 +2,19 @@ import cx from "classnames";import { t } from "ttag";import _ from "underscore";-import {- type ScheduleChangeProp,- SchedulePicker,-} from "metabase/common/components/SchedulePicker";+import { Schedule } from "metabase/common/components/Schedule/Schedule";+import { toCronString } from "metabase/common/components/Schedule/cron";+import type { ScheduleChangeProp } from "metabase/common/components/Schedule/types";import { SendTestPulse } from "metabase/common/components/SendTestPulse";import { Sidebar } from "metabase/common/components/Sidebar";import CS from "metabase/css/core/index.css";import { SlackChannelField } from "metabase/notifications/channels/SlackChannelField";import { PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE } from "metabase/plugins";import { dashboardPulseIsValid } from "metabase/pulse";+import { useSelector } from "metabase/redux";import type { DraftDashboardSubscription } from "metabase/redux/store";+import { getSetting } from "metabase/selectors/settings";+import { getApplicationName } from "metabase/selectors/whitelabel";import { Icon, Stack, Switch, Text, Title } from "metabase/ui";import type { UiParameter } from "metabase-lib/v1/parameters/types";import {@@ -28,7 +30,7 @@ import S from "./AddEditSidebar.module.css";import { CaveatMessage } from "./CaveatMessage";import DefaultParametersSection from "./DefaultParametersSection";import { DeleteSubscriptionAction } from "./DeleteSubscriptionAction";-import { CHANNEL_NOUN_PLURAL } from "./constants";+import { getSubscriptionScheduleDescription } from "./utils";interface AddEditSlackSidebarProps {pulse: DraftDashboardSubscription;@@ -70,6 +72,20 @@ export const AddEditSlackSidebar = ({setPulseParameters,}: AddEditSlackSidebarProps) => {const isValid = dashboardPulseIsValid(pulse, formInput.channels);+ const applicationName = useSelector(getApplicationName);+ const timezone = useSelector((state) =>+ getSetting(state, "report-timezone-short"),+ );++ const renderScheduleDescription = (schedule: ScheduleSettings) => {+ const description = getSubscriptionScheduleDescription({+ schedule,+ channelSpec,+ applicationName,+ timezone,+ });+ return description ? <Text c="text-secondary">{description}</Text> : null;+ };// Return true if the results of all cards can be downloadedconst allowDownload = pulse.cards?.every(@@ -107,22 +123,25 @@ export const AddEditSlackSidebar = ({onChannelPropertyChange={onChannelPropertyChange}/>)}- <SchedulePicker- schedule={_.pick(- channel,- "schedule_day",- "schedule_frame",- "schedule_hour",- "schedule_type",+ <Schedule+ mt="md"+ cronString={toCronString(+ _.pick(+ channel,+ "schedule_day",+ "schedule_frame",+ "schedule_hour",+ "schedule_type",+ ),)}scheduleOptions={channelSpec.schedules}- textBeforeInterval={t`Send`}- textBeforeSendTime={t`${- (channelSpec?.type && CHANNEL_NOUN_PLURAL[channelSpec.type]) ??- t`Messages`- } will be sent at`}- onScheduleChange={(newSchedule, changedProp) =>- onChannelScheduleChange(newSchedule, changedProp)+ verb={t`Send`}+ renderScheduleDescription={renderScheduleDescription}+ onScheduleChange={(_cronString, newSchedule) =>+ onChannelScheduleChange(newSchedule, {+ name: "schedule_type",+ value: newSchedule.schedule_type,+ })}/><div className={cx(CS.pt2, CS.pb1)}>diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/utils.ts b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/utils.tsnew file mode 100644index 00000000000..57c8503b265--- /dev/null+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/AddEditSidebar/utils.ts@@ -0,0 +1,36 @@+import { c, t } from "ttag";++import { formatNotificationScheduleDescription } from "metabase/notifications/utils";+import type { ChannelSpec, ScheduleSettings } from "metabase-types/api";++import { CHANNEL_NOUN_PLURAL } from "./constants";++interface GetSubscriptionScheduleDescriptionOpts {+ schedule: ScheduleSettings;+ channelSpec: ChannelSpec;+ applicationName: string;+ timezone: string | null;+}++export const getSubscriptionScheduleDescription = ({+ schedule,+ channelSpec,+ applicationName,+ timezone,+}: GetSubscriptionScheduleDescriptionOpts): string | null => {+ const description = formatNotificationScheduleDescription(schedule);+ if (!description) {+ return null;+ }++ const channelNoun =+ (channelSpec?.type && CHANNEL_NOUN_PLURAL[channelSpec.type]) ?? t`Messages`;++ const actionText = c("{0} is a noun like 'Emails' or 'Slack messages'")+ .t`${channelNoun} will be sent`;+ const timezoneLabel = c(+ "An additional clarification for a human-readable schedule description",+ ).t`${timezone}, your ${applicationName} timezone.`;++ return `${actionText} ${description} ${timezoneLabel}`;+};diff --git a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/DashboardSubscriptionsSidebar.tsx b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/DashboardSubscriptionsSidebar.tsxindex abbdb55daf6..2c809efe9a4 100644--- a/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/DashboardSubscriptionsSidebar.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardSubscriptionsSidebar/DashboardSubscriptionsSidebar.tsx@@ -5,7 +5,7 @@ import { skipToken, useListSubscriptionsQuery, userApi } from "metabase/api";import { runRtkEndpoint } from "metabase/api/utils/run-rtk-endpoint";import { useSetArchive } from "metabase/archive/hooks";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";-import type { ScheduleChangeProp } from "metabase/common/components/SchedulePicker";+import type { ScheduleChangeProp } from "metabase/common/components/Schedule/types";import { Sidebar } from "metabase/common/components/Sidebar";import { isEmbeddingSdk } from "metabase/embedding-sdk/config";import {diff --git a/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx b/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsxindex b73744cac09..8d0c1aea0f0 100644--- a/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx+++ b/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx@@ -4,7 +4,7 @@ import { useCallback } from "react";import { match } from "ts-pattern";import { t } from "ttag";-import { SchedulePicker } from "metabase/common/components/SchedulePicker/SchedulePicker";+import { Schedule, toCronString } from "metabase/common/components/Schedule";import { FormField } from "metabase/forms";import { Box, rem } from "metabase/ui";import type {@@ -90,10 +90,13 @@ export const DatabaseCacheScheduleField = ({/>{scheduleMode === "full" && (- <SchedulePicker- schedule={value ?? DEFAULT_SCHEDULE}+ <Schedule+ mt="md"+ cronString={toCronString(value ?? DEFAULT_SCHEDULE)}scheduleOptions={SCHEDULE_OPTIONS}- onScheduleChange={handleScheduleChange}+ onScheduleChange={(_cronString, nextSchedule) =>+ handleScheduleChange(nextSchedule)+ }/>)}diff --git a/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx b/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsxindex c476d2b0cd8..e8a44dbcea9 100644--- a/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx+++ b/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx@@ -3,7 +3,7 @@ import type { ReactNode } from "react";import { useCallback } from "react";import { t } from "ttag";-import { SchedulePicker } from "metabase/common/components/SchedulePicker/SchedulePicker";+import { Schedule, toCronString } from "metabase/common/components/Schedule";import { FormField } from "metabase/forms";import type { ScheduleSettings, ScheduleType } from "metabase-types/api";@@ -38,12 +38,15 @@ const DatabaseSyncScheduleField = ({return (<FormField title={title} description={description}>- <SchedulePicker- schedule={value ?? DEFAULT_SCHEDULE}+ <Schedule+ mt="md"+ cronString={toCronString(value ?? DEFAULT_SCHEDULE)}scheduleOptions={SCHEDULE_OPTIONS}- textBeforeInterval={t`Sync`}+ verb={t`Sync`}minutesOnHourPicker- onScheduleChange={handleScheduleChange}+ onScheduleChange={(_cronString, nextSchedule) =>+ handleScheduleChange(nextSchedule)+ }/></FormField>);diff --git a/frontend/src/metabase/notifications/channels/SlackChannelField.tsx b/frontend/src/metabase/notifications/channels/SlackChannelField.tsxindex 5d67213480d..007544f5867 100644--- a/frontend/src/metabase/notifications/channels/SlackChannelField.tsx+++ b/frontend/src/metabase/notifications/channels/SlackChannelField.tsx@@ -77,9 +77,7 @@ export const SlackChannelField = ({return (<div>- <span className={cx(CS.block, CS.textBold, CS.pb2)}>- {channelField?.displayName}- </span>+ <span className={cx(CS.block, CS.pb2)}>{channelField?.displayName}</span><Autocompletedata={displayNames}value={value}