-
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.
Merge branch 'main' into jean/oss-5963-deadlock-when-deloying-flow-wi…
…th-dependencies-that
- Loading branch information
Showing
15 changed files
with
331 additions
and
100 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
109 changes: 109 additions & 0 deletions
109
ui-v2/src/components/automations/automation-page/automation-page.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,109 @@ | ||
import { Automation, buildGetAutomationQuery } from "@/api/automations"; | ||
import { AutomationEnableToggle } from "@/components/automations/automation-enable-toggle"; | ||
import { AutomationsActionsMenu } from "@/components/automations/automations-actions-menu"; | ||
import { useDeleteAutomationConfirmationDialog } from "@/components/automations/use-delete-automation-confirmation-dialog"; | ||
import { Card } from "@/components/ui/card"; | ||
import { DeleteConfirmationDialog } from "@/components/ui/delete-confirmation-dialog"; | ||
import { Typography } from "@/components/ui/typography"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
import { NavHeader } from "./nav-header"; | ||
|
||
type AutomationPageProps = { | ||
id: string; | ||
}; | ||
|
||
export const AutomationPage = ({ id }: AutomationPageProps) => { | ||
const { data } = useSuspenseQuery(buildGetAutomationQuery(id)); | ||
const [dialogState, confirmDelete] = useDeleteAutomationConfirmationDialog(); | ||
|
||
const handleDelete = () => confirmDelete(data, { shouldNavigate: true }); | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-col gap-4"> | ||
<AutomationPageHeader data={data} onDelete={handleDelete} /> | ||
<div className="flex flex-col gap-4"> | ||
<AutomationDescription data={data} /> | ||
<AutomationTrigger data={data} /> | ||
<AutomationActions data={data} /> | ||
</div> | ||
</div> | ||
<DeleteConfirmationDialog {...dialogState} /> | ||
</> | ||
); | ||
}; | ||
|
||
type AutomationPageHeaderProps = { | ||
data: Automation; | ||
onDelete: () => void; | ||
}; | ||
|
||
const AutomationPageHeader = ({ | ||
data, | ||
onDelete, | ||
}: AutomationPageHeaderProps) => { | ||
return ( | ||
<div className="flex items-center justify-between"> | ||
<NavHeader name={data.name} /> | ||
<div className="flex items-center gap-2"> | ||
<AutomationEnableToggle data={data} /> | ||
<AutomationsActionsMenu id={data.id} onDelete={onDelete} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
type AutomationDescriptionProps = { | ||
data: Automation; | ||
}; | ||
|
||
const AutomationDescription = ({ data }: AutomationDescriptionProps) => { | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<Typography className="text-muted-foreground" variant="bodySmall"> | ||
Description | ||
</Typography> | ||
<Typography className="text-muted-foreground"> | ||
{data.description || "None"} | ||
</Typography> | ||
</div> | ||
); | ||
}; | ||
|
||
type AutomationTriggerProps = { | ||
data: Automation; | ||
}; | ||
|
||
const AutomationTrigger = ({ data }: AutomationTriggerProps) => { | ||
const { trigger } = data; | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<Typography>Trigger</Typography> | ||
<Typography variant="bodySmall"> | ||
TODO: {JSON.stringify(trigger)} | ||
</Typography> | ||
</div> | ||
); | ||
}; | ||
|
||
type AutomationActionsProps = { | ||
data: Automation; | ||
}; | ||
|
||
const AutomationActions = ({ data }: AutomationActionsProps) => { | ||
const { actions } = data; | ||
return ( | ||
<div className="flex flex-col gap-1"> | ||
<Typography>{`Action${actions.length > 1 ? "s" : ""}`}</Typography> | ||
<ul className="flex flex-col gap-2"> | ||
{actions.map((action, i) => ( | ||
<li key={i}> | ||
<Card className="p-4 border-r-8"> | ||
<div>TODO: {JSON.stringify(action)}</div> | ||
</Card> | ||
</li> | ||
))} | ||
</ul> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AutomationPage } from "./automation-page"; |
32 changes: 32 additions & 0 deletions
32
ui-v2/src/components/automations/automation-page/nav-header.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,32 @@ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
type NavHeaderProps = { | ||
name: string; | ||
}; | ||
|
||
export const NavHeader = ({ name }: NavHeaderProps) => { | ||
return ( | ||
<div className="flex items-center gap-2"> | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink to="/automations" className="text-xl font-semibold"> | ||
Automations | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem className="text-xl font-semibold"> | ||
<BreadcrumbPage>{name}</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { buildListAutomationsQuery } from "@/api/automations"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
import { AutomationsEmptyState } from "./automations-empty-state"; | ||
import { AutomationsHeader } from "./automations-header"; | ||
|
||
export const AutomationsPage = () => { | ||
const { data } = useSuspenseQuery(buildListAutomationsQuery()); | ||
|
||
return ( | ||
<div className="flex flex-col gap-4"> | ||
<AutomationsHeader /> | ||
{data.length === 0 ? ( | ||
<AutomationsEmptyState /> | ||
) : ( | ||
<div>TODO: AUTOMATIONS_LIST</div> | ||
)} | ||
</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
Oops, something went wrong.