-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎉 remove sub-1 hour frequency options (#15708)
* remove sub-1-hour frequency options, and add current connection frequency to dropdown * fix e2e test * add additional frequency to end of options instead of beginning * use better jest expect methods * refactor getFrequencyConfig util function to just use connection schedule values * move frequencyConfig to a TS file and remove unnecessary type field * use named export Co-authored-by: Tim Roes <tim@airbyte.io>
- Loading branch information
Showing
11 changed files
with
108 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ConnectionSchedule } from "core/request/AirbyteClient"; | ||
|
||
export const frequencyConfig: Array<ConnectionSchedule | null> = [ | ||
null, // manual | ||
{ | ||
units: 1, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 2, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 3, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 6, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 8, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 12, | ||
timeUnit: "hours", | ||
}, | ||
{ | ||
units: 24, | ||
timeUnit: "hours", | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import FrequencyConfig from "config/FrequencyConfig.json"; | ||
import { ConnectionSchedule } from "core/request/AirbyteClient"; | ||
import { equal } from "utils/objects"; | ||
|
||
export const getFrequencyConfig = (schedule?: ConnectionSchedule) => | ||
FrequencyConfig.find((item) => (!schedule && !item.config) || equal(item.config, schedule)); | ||
export const getFrequencyType = (schedule?: ConnectionSchedule) => | ||
schedule ? `${schedule.units} ${schedule.timeUnit}` : "manual"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
airbyte-webapp/src/views/Connection/ConnectionForm/formConfig.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { renderHook } from "@testing-library/react-hooks"; | ||
|
||
import { frequencyConfig } from "config/frequencyConfig"; | ||
import { ConnectionScheduleTimeUnit } from "core/request/AirbyteClient"; | ||
import { TestWrapper as wrapper } from "utils/testutils"; | ||
|
||
import { useFrequencyDropdownData } from "./formConfig"; | ||
|
||
describe("useFrequencyDropdownData", () => { | ||
it("should return only default frequencies when no additional frequency is provided", () => { | ||
const { result } = renderHook(() => useFrequencyDropdownData(undefined), { wrapper }); | ||
expect(result.current.map((item) => item.value)).toEqual(frequencyConfig); | ||
}); | ||
|
||
it("should return only default frequencies when additional frequency is already present", () => { | ||
const additionalFrequency = { | ||
units: 1, | ||
timeUnit: ConnectionScheduleTimeUnit["hours"], | ||
}; | ||
const { result } = renderHook(() => useFrequencyDropdownData(additionalFrequency), { wrapper }); | ||
expect(result.current.map((item) => item.value)).toEqual(frequencyConfig); | ||
}); | ||
|
||
it("should include additional frequency when provided and unique", () => { | ||
const additionalFrequency = { | ||
units: 7, | ||
timeUnit: ConnectionScheduleTimeUnit["minutes"], | ||
}; | ||
const { result } = renderHook(() => useFrequencyDropdownData(additionalFrequency), { wrapper }); | ||
|
||
expect(result.current.length).toEqual(frequencyConfig.length + 1); | ||
expect(result.current).toContainEqual({ label: "Every 7 minutes", value: { units: 7, timeUnit: "minutes" } }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters