This commit is contained in:
@ -17,7 +17,9 @@ export function CheckboxInput(p: {
|
||||
<Checkbox
|
||||
disabled={!p.editable}
|
||||
checked={p.checked}
|
||||
onChange={(e) => { p.onValueChange(e.target.checked); }}
|
||||
onChange={(e) => {
|
||||
p.onValueChange(e.target.checked);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label={p.label}
|
||||
|
@ -214,6 +214,23 @@ function CloudInitUserDataAssistant(p: CloudInitProps): React.ReactElement {
|
||||
onChange={onChange}
|
||||
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
|
||||
editable={p.editable}
|
||||
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?.();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user