Add new options
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-06-16 19:42:57 +02:00
parent 92f187bf91
commit b28ca5f27d
2 changed files with 42 additions and 1 deletions

View File

@ -17,7 +17,9 @@ export function CheckboxInput(p: {
<Checkbox <Checkbox
disabled={!p.editable} disabled={!p.editable}
checked={p.checked} checked={p.checked}
onChange={(e) => { p.onValueChange(e.target.checked); }} onChange={(e) => {
p.onValueChange(e.target.checked);
}}
/> />
} }
label={p.label} label={p.label}

View File

@ -214,6 +214,23 @@ function CloudInitUserDataAssistant(p: CloudInitProps): React.ReactElement {
onChange={onChange} onChange={onChange}
yaml={user_data} yaml={user_data}
/> />
<CloudInitBooleanInput
editable={p.editable}
name="Expire password to require new password on next login"
yaml={user_data}
attrPath={["chpasswd", "expire"]}
onChange={onChange}
refUrl="https://cloudinit.readthedocs.io/en/latest/reference/modules.html#set-passwords"
/>
<br />
<CloudInitBooleanInput
editable={p.editable}
name="Enable SSH password auth"
yaml={user_data}
attrPath={["ssh_pwauth"]}
onChange={onChange}
refUrl="https://cloudinit.readthedocs.io/en/latest/reference/modules.html#set-passwords"
/>
<CloudInitTextInput <CloudInitTextInput
editable={p.editable} editable={p.editable}
name="Keyboard layout" name="Keyboard layout"
@ -262,3 +279,25 @@ function CloudInitTextInput(p: {
/> />
); );
} }
function CloudInitBooleanInput(p: {
editable: boolean;
name: string;
refUrl: string;
attrPath: Iterable<unknown>;
yaml: YAML.Document;
onChange: () => void;
}): React.ReactElement {
return (
<CheckboxInput
editable={p.editable}
label={p.name}
checked={p.yaml.getIn(p.attrPath) === true}
onValueChange={(v) => {
if (v !== undefined) p.yaml.setIn(p.attrPath, v);
else p.yaml.deleteIn(p.attrPath);
p.onChange?.();
}}
/>
);
}