@ -3,6 +3,7 @@ import * as React from 'react';
import { FieldCheckbox } from '../FieldTypes/checkbox' ;
import { FieldDropdown } from '../FieldTypes/dropdown' ;
import { FieldDropdownWithInput } from '../FieldTypes/dropdownwithinput' ;
import { FieldConfigList } from '../FieldTypes/list' ;
import { FieldNumber } from '../FieldTypes/number' ;
import { FieldPath } from '../FieldTypes/path' ;
import { FieldString } from '../FieldTypes/string' ;
@ -27,14 +28,6 @@ export function name(config: FileSystemConfig, onChange: FSCChanged<'name'>): Re
return < FieldString key = "name" label = "Name" value = { config . name } onChange = { callback } validator = { invalidConfigName } description = { description } / >
}
export function merge ( config : FileSystemConfig , onChange : FSCChanged < 'merge' > ) : React . ReactElement {
const callback = ( newValue : string ) = > onChange ( 'merge' , newValue === 'Yes' || undefined ) ;
const description = 'Whether to merge this "lower" config (e.g. from workspace settings) into higher configs (e.g. from global settings)' ;
const values = [ 'Yes' , 'No' ] ;
const value = config . merge ? 'Yes' : 'No' ;
return < FieldDropdown key = "merge" label = "Merge" { ... { value , values , description }} onChange = { callback } / >
}
export function label ( config : FileSystemConfig , onChange : FSCChanged < 'label' > ) : React . ReactElement {
const callback = ( newValue? : string ) = > onChange ( 'label' , newValue ) ;
const description = 'Label to display in some UI places (e.g. popups)' ;
@ -47,6 +40,21 @@ export function group(config: FileSystemConfig, onChange: FSCChanged<'group'>):
return < FieldConfigGroup key = "group" label = "Group" value = { config . group } { ... { description }} onChange = { callback } optional / >
}
export function merge ( config : FileSystemConfig , onChange : FSCChanged < 'merge' > ) : React . ReactElement {
const callback = ( newValue : string ) = > onChange ( 'merge' , newValue === 'Yes' || undefined ) ;
const description = 'Whether to merge this "lower" config (e.g. from workspace settings) into higher configs (e.g. from global settings)' ;
const values = [ 'Yes' , 'No' ] ;
const value = config . merge ? 'Yes' : 'No' ;
return < FieldDropdown key = "merge" label = "Merge" { ... { value , values , description }} onChange = { callback } / >
}
export function extend ( config : FileSystemConfig , onChange : FSCChanged < 'extend' > ) : React . ReactElement {
const callback = ( newValue? : string | string [ ] ) = > onChange ( 'extend' , newValue ) ;
const description = 'Names of other existing configs to merge into this config. Earlier entries overridden by later entries overridden by this config itself' ;
const value = typeof config . extend === 'string' ? [ config . extend ] : config . extend ;
return < FieldConfigList key = "extend" label = "Extend" { ... { value , description }} onChange = { callback } optional freeText / >
}
export function putty ( config : FileSystemConfig , onChange : FSCChanged < 'putty' > ) : React . ReactElement {
const callback = ( newValue : string ) = > onChange ( 'putty' , newValue === '<Auto-detect>' ? true : newValue ) ;
const description = 'A name of a PuTTY session, or `true` to find the PuTTY session from the host address' ;
@ -163,7 +171,7 @@ export function taskCommand(config: FileSystemConfig, onChange: FSCChanged<'task
export type FieldFactory = ( config : FileSystemConfig , onChange : FSCChanged , onChangeMultiple : FSCChangedMultiple ) = > React . ReactElement | null ;
export const FIELDS : FieldFactory [ ] = [
name , merge, label, group , putty , host , port ,
name , label, group , merge , extend , putty , host , port ,
root , agent , username , password , privateKeyPath , passphrase ,
newFileMode , agentForward , sftpCommand , sftpSudo , terminalCommand , taskCommand ,
PROXY_FIELD ] ;