Add agentForward field in UI (issue #265)

pull/285/head
Kelvin Schoofs 3 years ago
parent c74567187d
commit d167ac83a6

@ -1,4 +1,5 @@
import * as React from 'react'; import * as React from 'react';
import { FieldCheckbox } from '../FieldTypes/checkbox';
import { FieldDropdown } from '../FieldTypes/dropdown'; import { FieldDropdown } from '../FieldTypes/dropdown';
import { FieldDropdownWithInput } from '../FieldTypes/dropdownwithinput'; import { FieldDropdownWithInput } from '../FieldTypes/dropdownwithinput';
import { FieldNumber } from '../FieldTypes/number'; import { FieldNumber } from '../FieldTypes/number';
@ -110,6 +111,16 @@ export function passphrase(config: FileSystemConfig, onChange: FSCChanged<'passp
return <FieldDropdownWithInput key="passphrase" label="Passphrase" {...{ value, values, description }} onChange={callback} optional /> return <FieldDropdownWithInput key="passphrase" label="Passphrase" {...{ value, values, description }} onChange={callback} optional />
} }
export function agentForward(config: FileSystemConfig, onChange: FSCChanged<'agentForward'>): React.ReactElement {
const callback = (newValue?: boolean) => onChange('agentForward', newValue);
const description = 'Whether to enable to use OpenSSH agent forwarding (`auth-agent@openssh.com`) when authenticating using an agent';
const postface = (config.agentForward && !config.agent) && <p className="warning">
Agent forwarding will be disabled if not authenticated with an agent! E.g. password authentication will disable agent forwarding!
In case of using PuTTY with the PuTTY using an agent, this will still work without having to explicitly specify the agent.
</p>;
return <FieldCheckbox key="agentForward" label="Forward agent" value={!!config.agentForward} onChange={callback} description={description} postface={postface} />;
}
export function sftpCommand(config: FileSystemConfig, onChange: FSCChanged<'sftpCommand'>): React.ReactElement { export function sftpCommand(config: FileSystemConfig, onChange: FSCChanged<'sftpCommand'>): React.ReactElement {
const callback = (newValue?: string) => onChange('sftpCommand', newValue); const callback = (newValue?: string) => onChange('sftpCommand', newValue);
const description = 'A command to run on the remote SSH session to start a SFTP session (defaults to sftp subsystem)'; const description = 'A command to run on the remote SSH session to start a SFTP session (defaults to sftp subsystem)';
@ -146,5 +157,5 @@ export type FieldFactory = (config: FileSystemConfig, onChange: FSCChanged, onCh
export const FIELDS: FieldFactory[] = [ export const FIELDS: FieldFactory[] = [
name, merge, label, group, putty, host, port, name, merge, label, group, putty, host, port,
root, agent, username, password, privateKeyPath, passphrase, root, agent, username, password, privateKeyPath, passphrase,
sftpCommand, sftpSudo, terminalCommand, taskCommand, agentForward, sftpCommand, sftpSudo, terminalCommand, taskCommand,
PROXY_FIELD]; PROXY_FIELD];

Loading…
Cancel
Save