-
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 Update src/components/Playbooks/Runs/Actions/PlaybookRunsApprovalActionItem.tsx Co-authored-by: Moshe Immerman <[email protected]> chore: update icon size
- Loading branch information
1 parent
6270f1b
commit 7105c2f
Showing
6 changed files
with
188 additions
and
17 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
42 changes: 42 additions & 0 deletions
42
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,42 @@ | ||
import { PlaybookApproval } from "@flanksource-ui/api/types/playbooks"; | ||
import { Avatar } from "@flanksource-ui/ui/Avatar"; | ||
import clsx from "clsx"; | ||
import { BsCheck2Circle } from "react-icons/bs"; | ||
|
||
type PlaybookRunsActionItemProps = { | ||
onClick?: () => void; | ||
isSelected?: boolean; | ||
approval: PlaybookApproval; | ||
}; | ||
|
||
export default function PlaybookRunsApprovalActionItem({ | ||
onClick = () => {}, | ||
isSelected = false, | ||
approval | ||
}: 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"> | ||
<BsCheck2Circle className="text-green-500 h-5 w-auto" /> | ||
Approved by{" "} | ||
{approval?.person_id ? ( | ||
<Avatar user={approval.person_id} inline showName size="xs" /> | ||
) : ( | ||
<span className="whitespace-pre-wrap break-all"> | ||
{approval.team_id?.name} | ||
</span> | ||
)} | ||
</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