@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'
2
2
import clsx from 'clsx'
3
3
import { Button } from '../../../../components/Button'
4
4
import { framesModel } from '../../../../models/framesModel'
5
- import { Form } from 'kea-forms'
5
+ import { Form , Group } from 'kea-forms'
6
6
import { TextInput } from '../../../../components/TextInput'
7
7
import { Select } from '../../../../components/Select'
8
8
import { frameLogic } from '../../frameLogic'
@@ -16,7 +16,7 @@ export interface FrameSettingsProps {
16
16
}
17
17
18
18
export function FrameSettings ( { className } : FrameSettingsProps ) {
19
- const { frameId, frame, frameFormTouches } = useValues ( frameLogic )
19
+ const { frameId, frame, frameForm , frameFormTouches } = useValues ( frameLogic )
20
20
const { touchFrameFormField, setFrameFormValues } = useActions ( frameLogic )
21
21
const { deleteFrame } = useActions ( framesModel )
22
22
@@ -281,16 +281,95 @@ export function FrameSettings({ className }: FrameSettingsProps) {
281
281
placeholder = "e.g. /srv/frameos/logs/frame-{date}.log"
282
282
required
283
283
/>
284
- </ Field > { ' ' }
285
- < Field name = "debug" label = "Debug logging (noisy)" >
286
- < Select
287
- name = "debug"
288
- options = { [
289
- { value : 'false' , label : 'Disabled' } ,
290
- { value : 'true' , label : 'Enabled' } ,
291
- ] }
292
- />
293
284
</ Field >
285
+ < Group name = "reboot" >
286
+ < Field name = "enabled" label = "Automatic reboot" >
287
+ < Select
288
+ name = "enabled"
289
+ options = { [
290
+ { value : 'false' , label : 'Disabled' } ,
291
+ { value : 'true' , label : 'Enabled' } ,
292
+ ] }
293
+ />
294
+ </ Field >
295
+ { String ( frameForm . reboot ?. enabled ) === 'true' && (
296
+ < div className = "pl-4 space-y-4" >
297
+ < Field name = "crontab" label = "Reboot time" >
298
+ < Select
299
+ name = "crontab"
300
+ options = { [
301
+ { value : '0 0 * * *' , label : '00:00' } ,
302
+ { value : '1 0 * * *' , label : '01:00' } ,
303
+ { value : '2 0 * * *' , label : '02:00' } ,
304
+ { value : '3 0 * * *' , label : '03:00' } ,
305
+ { value : '4 0 * * *' , label : '04:00' } ,
306
+ { value : '5 0 * * *' , label : '05:00' } ,
307
+ { value : '6 0 * * *' , label : '06:00' } ,
308
+ { value : '7 0 * * *' , label : '07:00' } ,
309
+ { value : '8 0 * * *' , label : '08:00' } ,
310
+ { value : '9 0 * * *' , label : '09:00' } ,
311
+ { value : '10 0 * * *' , label : '10:00' } ,
312
+ { value : '11 0 * * *' , label : '11:00' } ,
313
+ { value : '12 0 * * *' , label : '12:00' } ,
314
+ { value : '13 0 * * *' , label : '13:00' } ,
315
+ { value : '14 0 * * *' , label : '14:00' } ,
316
+ { value : '15 0 * * *' , label : '15:00' } ,
317
+ { value : '16 0 * * *' , label : '16:00' } ,
318
+ { value : '17 0 * * *' , label : '17:00' } ,
319
+ { value : '18 0 * * *' , label : '18:00' } ,
320
+ { value : '19 0 * * *' , label : '19:00' } ,
321
+ { value : '20 0 * * *' , label : '20:00' } ,
322
+ { value : '21 0 * * *' , label : '21:00' } ,
323
+ { value : '22 0 * * *' , label : '22:00' } ,
324
+ { value : '23 0 * * *' , label : '23:00' } ,
325
+ ] }
326
+ />
327
+ </ Field >
328
+ < Field name = "type" label = "What to reboot" >
329
+ < Select
330
+ name = "type"
331
+ options = { [
332
+ { value : 'frameos' , label : 'FrameOS' } ,
333
+ { value : 'raspberry' , label : 'System reboot' } ,
334
+ ] }
335
+ />
336
+ </ Field >
337
+ </ div >
338
+ ) }
339
+ </ Group >
340
+ { /* <Group name="control_code">
341
+ <Field name="enabled" label="QR Control Code">
342
+ <Select
343
+ name="enabled"
344
+ options={[
345
+ { value: 'false', label: 'Disabled' },
346
+ { value: 'true', label: 'Enabled' },
347
+ ]}
348
+ />
349
+ </Field>
350
+ {String(frameForm.control_code?.enabled) === 'true' && (
351
+ <div className="pl-4 space-y-4">
352
+ <Field name="position" label="Position">
353
+ <Select
354
+ name="position"
355
+ options={[
356
+ { value: 'top-left', label: 'Top Left' },
357
+ { value: 'top-right', label: 'Top Right' },
358
+ { value: 'bottom-left', label: 'Bottom Left' },
359
+ { value: 'bottom-right', label: 'Bottom Right' },
360
+ { value: 'center', label: 'Center' },
361
+ ]}
362
+ />
363
+ </Field>
364
+ <Field name="size" label="Size of each square in pixels">
365
+ <TextInput name="size" placeholder="2" />
366
+ </Field>
367
+ <Field name="padding" label="Padding in pixels">
368
+ <TextInput name="padding" placeholder="0" />
369
+ </Field>
370
+ </div>
371
+ )}
372
+ </Group> */ }
294
373
</ Form >
295
374
</ >
296
375
) }
0 commit comments