-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show approval step in actions list
Fixes #2380
- Loading branch information
1 parent
d599704
commit 11eb481
Showing
6 changed files
with
172 additions
and
16 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 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
33 changes: 33 additions & 0 deletions
33
src/components/Playbooks/Runs/Actions/PlaybookRunsApprovalActionItem.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,33 @@ | ||
import clsx from "clsx"; | ||
import { FaCheckCircle } from "react-icons/fa"; | ||
|
||
type PlaybookRunsActionItemProps = { | ||
onClick?: () => void; | ||
isSelected?: boolean; | ||
stepNumber: number; | ||
}; | ||
|
||
export default function PlaybookRunsApprovalActionItem({ | ||
onClick = () => {}, | ||
isSelected = false, | ||
stepNumber | ||
}: PlaybookRunsActionItemProps) { | ||
return ( | ||
<div | ||
role="button" | ||
className={clsx( | ||
`flex flex-row items-center justify-between rounded border border-gray-200 px-4 py-2 hover:bg-gray-200`, | ||
isSelected ? "bg-gray-200" : "bg-white" | ||
)} | ||
onClick={onClick} | ||
> | ||
<div className="flex flex-col"> | ||
<div className="flex flex-row items-center gap-2 text-sm text-gray-600"> | ||
<FaCheckCircle className="text-green-500" /> | ||
Approval | ||
</div> | ||
<div className={`flex flex-row items-center gap-1 text-xs`}></div> | ||
</div> | ||
</div> | ||
); | ||
} |
34 changes: 34 additions & 0 deletions
34
src/components/Playbooks/Runs/Actions/PlaybookRunsApprovalActionsResults.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,34 @@ | ||
import { | ||
PlaybookApproval, | ||
PlaybookSpec | ||
} from "@flanksource-ui/api/types/playbooks"; | ||
import { Avatar } from "@flanksource-ui/ui/Avatar"; | ||
|
||
type Props = { | ||
approval?: PlaybookApproval; | ||
className?: string; | ||
playbook: Pick<PlaybookSpec, "name">; | ||
}; | ||
|
||
export default function PlaybookRunsApprovalActionsResults({ | ||
approval, | ||
className = "whitespace-pre-wrap break-all", | ||
playbook | ||
}: Props) { | ||
if (!approval) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="relative flex h-full w-full flex-col"> | ||
<p className="space-x-2"> | ||
Approved by{" "} | ||
{approval.person_id ? ( | ||
<Avatar user={approval.person_id} inline showName /> | ||
) : ( | ||
<span className={className}>{approval.team_id?.name}</span> | ||
)} | ||
</p> | ||
</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