-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Start UX for adding and editing a deployment schedule
- Loading branch information
1 parent
2df84e4
commit bb4d0a0
Showing
9 changed files
with
193 additions
and
10 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
70 changes: 70 additions & 0 deletions
70
...eployments/deployment-schedules/deployment-schedule-dialog/deployment-schedule-dialog.tsx
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,70 @@ | ||
import type { DeploymentSchedule } from "@/components/deployments/deployment-schedules/types"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogHeader, | ||
DialogTitle, | ||
} from "@/components/ui/dialog"; | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; | ||
|
||
import { useState } from "react"; | ||
import { RRuleScheduleForm } from "./rrule-schedule-form"; | ||
|
||
type ScheduleTypes = "interval" | "cron" | "rrule"; | ||
|
||
type DeploymentScheduleDialogProps = { | ||
onOpenChange: (open: boolean) => void; | ||
open: boolean; | ||
scheduleToEdit?: DeploymentSchedule; | ||
}; | ||
|
||
export const DeploymentScheduleDialog = ({ | ||
onOpenChange, | ||
open, | ||
scheduleToEdit, | ||
}: DeploymentScheduleDialogProps) => { | ||
const [scheduleTab, setScheduleTab] = useState<ScheduleTypes>("interval"); | ||
|
||
const SCHEDULE_TAB_OPTIONS = [ | ||
{ | ||
value: "interval", | ||
label: "Interval", | ||
Component: () => <div>TODO: Interval form</div>, | ||
}, | ||
{ | ||
value: "cron", | ||
label: "Cron", | ||
Component: () => <div>TODO: Cron Form</div>, | ||
}, | ||
{ value: "rrule", label: "RRule", Component: () => <RRuleScheduleForm /> }, | ||
] as const; | ||
|
||
return ( | ||
<Dialog open={open} onOpenChange={onOpenChange}> | ||
<DialogContent aria-describedby={undefined}> | ||
<DialogHeader> | ||
<DialogTitle>{scheduleToEdit ? "Edit" : "Add"} Schedule</DialogTitle> | ||
</DialogHeader> | ||
|
||
<Tabs defaultValue={SCHEDULE_TAB_OPTIONS[0].value} value={scheduleTab}> | ||
<TabsList> | ||
{SCHEDULE_TAB_OPTIONS.map(({ value, label }) => ( | ||
<TabsTrigger | ||
key={value} | ||
value={value} | ||
onClick={() => setScheduleTab(value)} | ||
> | ||
{label} | ||
</TabsTrigger> | ||
))} | ||
</TabsList> | ||
{SCHEDULE_TAB_OPTIONS.map(({ value, Component }) => ( | ||
<TabsContent key={value} value={value}> | ||
<Component /> | ||
</TabsContent> | ||
))} | ||
</Tabs> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
ui-v2/src/components/deployments/deployment-schedules/deployment-schedule-dialog/index.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 @@ | ||
export { DeploymentScheduleDialog } from "./deployment-schedule-dialog"; |
22 changes: 22 additions & 0 deletions
22
...nents/deployments/deployment-schedules/deployment-schedule-dialog/rrule-schedule-form.tsx
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,22 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { DialogFooter } from "@/components/ui/dialog"; | ||
import { Typography } from "@/components/ui/typography"; | ||
import { DialogTrigger } from "@radix-ui/react-dialog"; | ||
|
||
export const RRuleScheduleForm = () => { | ||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<Typography> | ||
Sorry, modifying RRule schedules via the UI is currently unsupported; | ||
select a different schedule type above or modify your schedule in code. | ||
</Typography> | ||
|
||
<DialogFooter> | ||
<DialogTrigger asChild> | ||
<Button variant="outline">Close</Button> | ||
</DialogTrigger> | ||
<Button disabled>Save</Button> | ||
</DialogFooter> | ||
</div> | ||
); | ||
}; |
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
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