|
1 | | -import { AuthorizationAccessCheck } from "@flanksource-ui/components/Permissions/AuthorizationAccessCheck"; |
2 | 1 | import { Icon } from "@flanksource-ui/ui/Icons/Icon"; |
3 | 2 | import { |
4 | 3 | Menu, |
@@ -61,58 +60,56 @@ export default function PlaybooksDropdownMenu({ |
61 | 60 | ); |
62 | 61 |
|
63 | 62 | return ( |
64 | | - <AuthorizationAccessCheck resource={"playbook_runs"} action={"write"}> |
65 | | - <div className={containerClassName}> |
66 | | - <Menu as="div" className="relative inline-block text-left"> |
67 | | - <MenuButton className={buttonClassName}> |
68 | | - <Icon name="playbook" className="mr-2 mt-0.5 h-5 w-5" /> |
69 | | - <span>Playbooks</span> |
70 | | - <ChevronDownIcon |
71 | | - className={clsx( |
72 | | - "-mr-1 ml-2 h-5 w-5", |
73 | | - highlight ? "text-blue-500" : "text-gray-400" |
74 | | - )} |
75 | | - aria-hidden="true" |
76 | | - /> |
77 | | - </MenuButton> |
78 | | - |
79 | | - {/* @ts-ignore */} |
80 | | - <Transition |
81 | | - as={Fragment as any} |
82 | | - enter="transition ease-out duration-100" |
83 | | - enterFrom="transform opacity-0 scale-95" |
84 | | - enterTo="transform opacity-100 scale-100" |
85 | | - leave="transition ease-in duration-75" |
86 | | - leaveFrom="transform opacity-100 scale-100" |
87 | | - leaveTo="transform opacity-0 scale-95" |
88 | | - > |
89 | | - <MenuItems portal className="menu-items" anchor="bottom start"> |
90 | | - {playbooks?.map((playbook) => ( |
91 | | - <MenuItem |
92 | | - as="button" |
93 | | - className="menu-item w-full" |
94 | | - onClick={() => setSelectedPlaybookSpec(playbook)} |
95 | | - key={playbook.id} |
96 | | - > |
97 | | - <PlaybookSpecIcon playbook={playbook} showLabel showTag /> |
98 | | - </MenuItem> |
99 | | - ))} |
100 | | - </MenuItems> |
101 | | - </Transition> |
102 | | - </Menu> |
103 | | - {selectedPlaybookSpec && ( |
104 | | - <SubmitPlaybookRunForm |
105 | | - componentId={component_id} |
106 | | - checkId={check_id} |
107 | | - configId={config_id} |
108 | | - isOpen={!!selectedPlaybookSpec} |
109 | | - onClose={() => { |
110 | | - setSelectedPlaybookSpec(undefined); |
111 | | - }} |
112 | | - playbook={selectedPlaybookSpec} |
| 63 | + <div className={containerClassName}> |
| 64 | + <Menu as="div" className="relative inline-block text-left"> |
| 65 | + <MenuButton className={buttonClassName}> |
| 66 | + <Icon name="playbook" className="mr-2 mt-0.5 h-5 w-5" /> |
| 67 | + <span>Playbooks</span> |
| 68 | + <ChevronDownIcon |
| 69 | + className={clsx( |
| 70 | + "-mr-1 ml-2 h-5 w-5", |
| 71 | + highlight ? "text-blue-500" : "text-gray-400" |
| 72 | + )} |
| 73 | + aria-hidden="true" |
113 | 74 | /> |
114 | | - )} |
115 | | - </div> |
116 | | - </AuthorizationAccessCheck> |
| 75 | + </MenuButton> |
| 76 | + |
| 77 | + {/* @ts-ignore */} |
| 78 | + <Transition |
| 79 | + as={Fragment as any} |
| 80 | + enter="transition ease-out duration-100" |
| 81 | + enterFrom="transform opacity-0 scale-95" |
| 82 | + enterTo="transform opacity-100 scale-100" |
| 83 | + leave="transition ease-in duration-75" |
| 84 | + leaveFrom="transform opacity-100 scale-100" |
| 85 | + leaveTo="transform opacity-0 scale-95" |
| 86 | + > |
| 87 | + <MenuItems portal className="menu-items" anchor="bottom start"> |
| 88 | + {playbooks?.map((playbook) => ( |
| 89 | + <MenuItem |
| 90 | + as="button" |
| 91 | + className="menu-item w-full" |
| 92 | + onClick={() => setSelectedPlaybookSpec(playbook)} |
| 93 | + key={playbook.id} |
| 94 | + > |
| 95 | + <PlaybookSpecIcon playbook={playbook} showLabel showTag /> |
| 96 | + </MenuItem> |
| 97 | + ))} |
| 98 | + </MenuItems> |
| 99 | + </Transition> |
| 100 | + </Menu> |
| 101 | + {selectedPlaybookSpec && ( |
| 102 | + <SubmitPlaybookRunForm |
| 103 | + componentId={component_id} |
| 104 | + checkId={check_id} |
| 105 | + configId={config_id} |
| 106 | + isOpen={!!selectedPlaybookSpec} |
| 107 | + onClose={() => { |
| 108 | + setSelectedPlaybookSpec(undefined); |
| 109 | + }} |
| 110 | + playbook={selectedPlaybookSpec} |
| 111 | + /> |
| 112 | + )} |
| 113 | + </div> |
117 | 114 | ); |
118 | 115 | } |
0 commit comments