@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
5
5
import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/ui/card" ;
6
6
import { Input } from "@/components/ui/input" ;
7
7
import { Label } from "@/components/ui/label" ;
8
+ import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select" ;
8
9
import { Switch } from "@/components/ui/switch" ;
9
10
import { updateProjectSettingsAction } from "@/data/user/projects" ;
10
11
import { useSAToastMutation } from "@/hooks/useSAToastMutation" ;
@@ -20,6 +21,11 @@ type ProjectSettingsProps = {
20
21
21
22
type ProjectSettingsFormData = {
22
23
terraformWorkingDir : string ;
24
+ iac_type : "terraform" | "terragrunt" | "opentofu" ;
25
+ workspace : string ;
26
+ workflow_file : string ;
27
+ include_patterns : string ;
28
+ exclude_patterns : string ;
23
29
labels : string [ ] ;
24
30
managedState : boolean ;
25
31
is_drift_detection_enabled : boolean ;
@@ -32,6 +38,9 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
32
38
const { control, handleSubmit, formState : { isDirty } } = useForm < ProjectSettingsFormData > ( {
33
39
defaultValues : {
34
40
terraformWorkingDir : project . terraform_working_dir || '' ,
41
+ iac_type : project . iac_type || 'terraform' ,
42
+ workspace : project . workspace || 'default' ,
43
+ workflow_file : project . workflow_file || 'digger_workflow.yml' ,
35
44
labels : project . labels || [ ] ,
36
45
managedState : project . is_managing_state || false ,
37
46
is_drift_detection_enabled : project . is_drift_detection_enabled || false ,
@@ -44,6 +53,11 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
44
53
const result = await updateProjectSettingsAction ( {
45
54
projectId : project . id ,
46
55
terraformWorkingDir : data . terraformWorkingDir ,
56
+ iac_type : data . iac_type ,
57
+ workspace : data . workspace ,
58
+ workflow_file : data . workflow_file ,
59
+ include_patterns : data . include_patterns ,
60
+ exclude_patterns : data . exclude_patterns ,
47
61
labels : data . labels ,
48
62
managedState : data . managedState ,
49
63
is_drift_detection_enabled : data . is_drift_detection_enabled ,
@@ -118,6 +132,100 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett
118
132
/>
119
133
</ motion . div >
120
134
135
+ < motion . div
136
+ initial = { { opacity : 0 } }
137
+ animate = { { opacity : 1 } }
138
+ transition = { { duration : 0.15 , delay : 0.4 } }
139
+ >
140
+ < Label htmlFor = "iac_type" > IAC type</ Label >
141
+ < Controller
142
+ name = "iac_type"
143
+ control = { control }
144
+ render = { ( { field } ) => (
145
+ < Select onValueChange = { field . onChange } value = { field . value } >
146
+ < SelectTrigger >
147
+ < SelectValue placeholder = "Select IAC type" />
148
+ </ SelectTrigger >
149
+ < SelectContent className = "rounded-xl" >
150
+ < SelectItem value = "terraform" className = "rounded-lg" >
151
+ Terraform
152
+ </ SelectItem >
153
+ < SelectItem value = "terragrunt" className = "rounded-lg" >
154
+ Terragrunt
155
+ </ SelectItem >
156
+ < SelectItem value = "opentofu" className = "rounded-lg" >
157
+ Opentofu
158
+ </ SelectItem >
159
+ </ SelectContent >
160
+ </ Select >
161
+ ) }
162
+ />
163
+ </ motion . div >
164
+
165
+ < motion . div
166
+ initial = { { opacity : 0 } }
167
+ animate = { { opacity : 1 } }
168
+ transition = { { duration : 0.15 , delay : 0.4 } }
169
+ >
170
+ < Label htmlFor = "workspace" > Workspace</ Label >
171
+ < Controller
172
+ name = "workspace"
173
+ control = { control }
174
+ render = { ( { field } ) => (
175
+ < Input id = "workspace" { ...field } />
176
+ ) }
177
+ />
178
+ </ motion . div >
179
+
180
+ < motion . div
181
+ initial = { { opacity : 0 } }
182
+ animate = { { opacity : 1 } }
183
+ transition = { { duration : 0.15 , delay : 0.4 } }
184
+ >
185
+ < Label htmlFor = "workflow_file" > Workflow file</ Label >
186
+ < Controller
187
+ name = "workflow_file"
188
+ control = { control }
189
+ render = { ( { field } ) => (
190
+ < Input id = "workflow_file" { ...field } />
191
+ ) }
192
+ />
193
+ </ motion . div >
194
+
195
+ < div className = "grid grid-cols-2 gap-6" >
196
+
197
+ < motion . div
198
+ initial = { { opacity : 0 } }
199
+ animate = { { opacity : 1 } }
200
+ transition = { { duration : 0.15 , delay : 0.4 } }
201
+ >
202
+ < Label htmlFor = "include_patterns" > Include patterns</ Label >
203
+ < Controller
204
+ name = "include_patterns"
205
+ control = { control }
206
+ render = { ( { field } ) => (
207
+ < Input id = "include_patterns" { ...field } />
208
+ ) }
209
+ />
210
+ </ motion . div >
211
+
212
+ < motion . div
213
+ initial = { { opacity : 0 } }
214
+ animate = { { opacity : 1 } }
215
+ transition = { { duration : 0.15 , delay : 0.4 } }
216
+ >
217
+ < Label htmlFor = "Exclude patterns" > Exclude patterns</ Label >
218
+ < Controller
219
+ name = "exclude_patterns"
220
+ control = { control }
221
+ render = { ( { field } ) => (
222
+ < Input id = "exclude_patterns" { ...field } />
223
+ ) }
224
+ />
225
+ </ motion . div >
226
+
227
+ </ div >
228
+
121
229
< motion . div
122
230
initial = { { opacity : 0 } }
123
231
animate = { { opacity : 1 } }
0 commit comments