@@ -2,15 +2,34 @@ import FormikCanaryDropdown from "@flanksource-ui/components/Forms/Formik/Formik
2
2
import FormikConnectionField from "@flanksource-ui/components/Forms/Formik/FormikConnectionField" ;
3
3
import FormikPlaybooksDropdown from "@flanksource-ui/components/Forms/Formik/FormikPlaybooksDropdown" ;
4
4
import FormikResourceSelectorDropdown from "@flanksource-ui/components/Forms/Formik/FormikResourceSelectorDropdown" ;
5
+ import FormikSelectDropdown from "@flanksource-ui/components/Forms/Formik/FormikSelectDropdown" ;
5
6
import { Switch } from "@flanksource-ui/ui/FormControls/Switch" ;
6
7
import { useFormikContext } from "formik" ;
7
8
import { useState } from "react" ;
8
9
10
+ export const permissionObjectList = [
11
+ { label : "Canaries" , value : "canaries" } ,
12
+ { label : "Catalog" , value : "catalog" } ,
13
+ { label : "Incident" , value : "incident" } ,
14
+ { label : "People" , value : "people" } ,
15
+ { label : "Topology" , value : "topology" } ,
16
+ { label : "Playbooks" , value : "playbooks" } ,
17
+ { label : "Connection" , value : "connection" } ,
18
+ { label : "Connection Detail" , value : "connection-detail" } ,
19
+ { label : "Agent Push" , value : "agent-push" } ,
20
+ { label : "Kubernetes Proxy" , value : "kubernetes-proxy" } ,
21
+ { label : "Notification" , value : "notification" } ,
22
+ { label : "RBAC" , value : "rbac" } ,
23
+ { label : "Logs" , value : "logs" } ,
24
+ { label : "Agent" , value : "agent" } ,
25
+ { label : "Artifact" , value : "artifact" }
26
+ ] ;
27
+
9
28
export default function FormikPermissionSelectResourceFields ( ) {
10
29
const { setFieldValue } = useFormikContext < Record < string , any > > ( ) ;
11
30
12
31
const [ switchOption , setSwitchOption ] = useState <
13
- "Component" | "Catalog" | "Canary" | "Playbook" | "Connection"
32
+ "Component" | "Catalog" | "Canary" | "Playbook" | "Connection" | "Object"
14
33
> ( "Catalog" ) ;
15
34
16
35
return (
@@ -19,13 +38,20 @@ export default function FormikPermissionSelectResourceFields() {
19
38
< div >
20
39
< div className = "flex w-full flex-row" >
21
40
< Switch
22
- options = { [ "Catalog" , "Component" , "Connection" , "Playbook" ] }
41
+ options = { [
42
+ "Catalog" ,
43
+ "Component" ,
44
+ "Connection" ,
45
+ "Playbook" ,
46
+ "Object"
47
+ ] }
23
48
className = "w-auto"
24
49
itemsClassName = ""
25
50
defaultValue = "Go Template"
26
51
value = { switchOption }
27
52
onChange = { ( v ) => {
28
53
setSwitchOption ( v ) ;
54
+ setFieldValue ( "object" , undefined ) ;
29
55
setFieldValue ( "config_id" , undefined ) ;
30
56
setFieldValue ( "check_id" , undefined ) ;
31
57
setFieldValue ( "canary_id" , undefined ) ;
@@ -62,6 +88,14 @@ export default function FormikPermissionSelectResourceFields() {
62
88
{ switchOption === "Connection" && (
63
89
< FormikConnectionField required name = "connection_id" />
64
90
) }
91
+
92
+ { switchOption === "Object" && (
93
+ < FormikSelectDropdown
94
+ required
95
+ name = "object"
96
+ options = { permissionObjectList }
97
+ />
98
+ ) }
65
99
</ div >
66
100
</ div >
67
101
) ;
0 commit comments