@@ -2,19 +2,24 @@ import React, { useEffect, useState } from 'react';
22
33import { Form , FormGroup , FormSelect , FormSelectOption } from '@patternfly/react-core' ;
44import cockpit from 'cockpit' ;
5- import { fsinfo } from 'cockpit/fsinfo' ;
5+ // import { fsinfo } from 'cockpit/fsinfo';
66
77const _ = cockpit . gettext ;
88
9- export const BootOptions = ( ) => {
9+ export const BootOptions = ( { setBootEntry } : { setBootEntry : ( entry : string ) => void } ) => {
1010 const [ bootEntries , setBootEntries ] = useState < string [ ] > ( [ ] ) ;
11- const [ hasGrubBoot , setHasGrubBoot ] = useState < boolean | undefined > ( undefined ) ;
12- const [ selectedBoot , setSelectedBoot ] = useState < string > ( "defult?" ) ;
11+ // const [hasGrubBoot, setHasGrubBoot] = useState<boolean | undefined>(undefined);
12+ const [ selectedBoot , setSelectedBoot ] = useState < string > ( "" ) ;
13+
14+ const setEntry = ( entry : string ) => {
15+ setBootEntry ( entry ) ;
16+ setSelectedBoot ( entry ) ;
17+ } ;
1318
1419 useEffect ( ( ) => {
15- fsinfo ( '/boot/grub2/grub.cfg' , [ ] )
16- . then ( ( ) => setHasGrubBoot ( true ) )
17- . catch ( ( ) => setHasGrubBoot ( false ) ) ;
20+ // fsinfo('/boot/grub2/grub.cfg', [])
21+ // .then(() => setHasGrubBoot(true))
22+ // .catch(() => setHasGrubBoot(false));
1823
1924 const bootConfig = cockpit . file ( '/boot/grub2/grub.cfg' , { superuser : 'require' } ) ;
2025 bootConfig . watch ( content => {
@@ -32,7 +37,7 @@ export const BootOptions = () => {
3237 return (
3338 < Form >
3439 < FormGroup label = { _ ( "Console resolution" ) } fieldId = "graphical-console-resolution" >
35- < FormSelect value = { selectedBoot } onChange = { ( _event , value ) => setSelectedBoot ( value ) } >
40+ < FormSelect value = { selectedBoot } onChange = { ( _event , value ) => setEntry ( value ) } >
3641 { bootEntries . map ( ( value , idx ) =>
3742 < FormSelectOption key = { idx } label = { value } value = { value } />
3843 ) }
0 commit comments