Skip to content

Commit

Permalink
Add agentForward field in UI (issue #265)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchoofsKelvin committed Jun 28, 2021
1 parent c745671 commit d167ac8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion webview/src/ConfigEditor/fields.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { FieldCheckbox } from '../FieldTypes/checkbox';
import { FieldDropdown } from '../FieldTypes/dropdown';
import { FieldDropdownWithInput } from '../FieldTypes/dropdownwithinput';
import { FieldNumber } from '../FieldTypes/number';
Expand Down Expand Up @@ -110,6 +111,16 @@ export function passphrase(config: FileSystemConfig, onChange: FSCChanged<'passp
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 {
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)';
Expand Down Expand Up @@ -146,5 +157,5 @@ export type FieldFactory = (config: FileSystemConfig, onChange: FSCChanged, onCh
export const FIELDS: FieldFactory[] = [
name, merge, label, group, putty, host, port,
root, agent, username, password, privateKeyPath, passphrase,
sftpCommand, sftpSudo, terminalCommand, taskCommand,
agentForward, sftpCommand, sftpSudo, terminalCommand, taskCommand,
PROXY_FIELD];

0 comments on commit d167ac8

Please sign in to comment.