@electerm/electerm-react 2.3.176 → 2.3.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/client/components/bookmark-form/common/fields.jsx +1 -1
  2. package/client/components/bookmark-form/common/ssh-auth-selector.jsx +36 -32
  3. package/client/components/bookmark-form/common/ssh-auth-type-selector.jsx +4 -1
  4. package/client/components/bookmark-form/config/common-fields.js +29 -24
  5. package/client/components/bookmark-form/config/ftp.js +5 -5
  6. package/client/components/bookmark-form/config/local.js +9 -9
  7. package/client/components/bookmark-form/config/rdp.js +3 -3
  8. package/client/components/bookmark-form/config/serial.js +4 -4
  9. package/client/components/bookmark-form/config/ssh.js +3 -2
  10. package/client/components/bookmark-form/config/telnet.js +2 -2
  11. package/client/components/bookmark-form/config/vnc.js +5 -5
  12. package/client/components/bookmark-form/config/web.js +3 -3
  13. package/client/components/bookmark-form/tree-delete.jsx +100 -42
  14. package/client/components/quick-commands/quick-commands-form-elem.jsx +9 -39
  15. package/client/components/setting-panel/hotkey.jsx +132 -0
  16. package/client/components/setting-panel/setting-common.jsx +8 -62
  17. package/client/components/shortcuts/get-key-char.js +1 -1
  18. package/client/components/shortcuts/shortcut-control.jsx +5 -0
  19. package/client/components/shortcuts/shortcut-editor.jsx +3 -0
  20. package/client/components/shortcuts/shortcut-handler.js +8 -0
  21. package/client/components/shortcuts/shortcut-utils.js +49 -0
  22. package/client/components/shortcuts/shortcuts-defaults.js +5 -0
  23. package/client/components/shortcuts/shortcuts.jsx +4 -40
  24. package/client/components/sidebar/index.jsx +3 -0
  25. package/client/components/tabs/tab.jsx +11 -0
  26. package/client/components/widgets/widget-form.jsx +7 -1
  27. package/client/store/tab.js +11 -0
  28. package/package.json +1 -1
@@ -101,7 +101,7 @@ export function renderFormItem (item, formItemLayout, form, ctxProps, index) {
101
101
  const formItemProps = {
102
102
  ...formItemLayout,
103
103
  className: cls,
104
- label,
104
+ label: typeof label === 'string' ? label : label(),
105
105
  name,
106
106
  rules,
107
107
  valuePropName,
@@ -26,14 +26,44 @@ export default function renderAuth (props) {
26
26
  formItemName = 'password',
27
27
  profileFilter = (d) => d
28
28
  } = props
29
- const beforeUpload = async (file) => {
29
+ const commonBeforeUpload = (fieldName) => async (file) => {
30
30
  const filePath = getFilePath(file)
31
- const privateKey = await window.fs.readFile(filePath)
31
+ const content = await window.fs.readFile(filePath)
32
32
  form.setFieldsValue({
33
- privateKey
33
+ [fieldName]: content
34
34
  })
35
35
  return false
36
36
  }
37
+ const renderKeyField = (key, label, desc) => (
38
+ <FormItem
39
+ {...formItemLayout}
40
+ label={e(label)}
41
+ hasFeedback
42
+ key={key}
43
+ className='mg1b'
44
+ rules={[{
45
+ max: 13000, message: '13000 chars max'
46
+ }]}
47
+ >
48
+ <FormItem noStyle name={key}>
49
+ <TextArea
50
+ placeholder={e(desc)}
51
+ autoSize={{ minRows: 1 }}
52
+ />
53
+ </FormItem>
54
+ <Upload
55
+ beforeUpload={commonBeforeUpload(key)}
56
+ fileList={[]}
57
+ >
58
+ <Button
59
+ type='dashed'
60
+ className='mg2b mg1t'
61
+ >
62
+ {e('importFromFile')}
63
+ </Button>
64
+ </Upload>
65
+ </FormItem>
66
+ )
37
67
  if (authType === 'password') {
38
68
  const opts = {
39
69
  options: uniqBy(
@@ -95,34 +125,7 @@ export default function renderAuth (props) {
95
125
  )
96
126
  }
97
127
  return [
98
- <FormItem
99
- {...formItemLayout}
100
- label={e('privateKey')}
101
- hasFeedback
102
- key='privateKey'
103
- className='mg1b'
104
- rules={[{
105
- max: 13000, message: '13000 chars max'
106
- }]}
107
- >
108
- <FormItem noStyle name='privateKey'>
109
- <TextArea
110
- placeholder={e('privateKeyDesc')}
111
- autoSize={{ minRows: 1 }}
112
- />
113
- </FormItem>
114
- <Upload
115
- beforeUpload={beforeUpload}
116
- fileList={[]}
117
- >
118
- <Button
119
- type='dashed'
120
- className='mg2b mg1t'
121
- >
122
- {e('importFromFile')}
123
- </Button>
124
- </Upload>
125
- </FormItem>,
128
+ renderKeyField('privateKey', 'privateKey', 'privateKeyDesc'),
126
129
  <FormItem
127
130
  key='passphrase'
128
131
  {...formItemLayout}
@@ -136,6 +139,7 @@ export default function renderAuth (props) {
136
139
  <Password
137
140
  placeholder={e('passphraseDesc')}
138
141
  />
139
- </FormItem>
142
+ </FormItem>,
143
+ renderKeyField('certificate', 'certificate', 'certificate')
140
144
  ]
141
145
  }
@@ -25,9 +25,12 @@ export default function SshAuthTypeSelector ({ handleChangeAuthType, filterAuthT
25
25
  >
26
26
  {
27
27
  authTypesFiltered.map(t => {
28
+ const str = t === 'privateKey'
29
+ ? e(t) + '/' + e('certificate')
30
+ : e(t)
28
31
  return (
29
32
  <RadioButton value={t} key={t}>
30
- {e(t)}
33
+ {str}
31
34
  </RadioButton>
32
35
  )
33
36
  })
@@ -15,65 +15,65 @@ export const commonFields = {
15
15
  host: {
16
16
  type: 'colorTitle',
17
17
  name: 'host',
18
- label: e('host'),
18
+ label: () => e('host'),
19
19
  rules: [{ required: true, message: e('host') + ' required' }]
20
20
  },
21
21
 
22
22
  colorTitle: {
23
23
  type: 'colorTitle',
24
24
  name: 'title',
25
- label: e('title')
25
+ label: () => e('title')
26
26
  },
27
27
 
28
28
  title: {
29
29
  type: 'input',
30
30
  name: 'title',
31
- label: e('title')
31
+ label: () => e('title')
32
32
  },
33
33
 
34
34
  username: {
35
35
  type: 'input',
36
36
  name: 'username',
37
- label: e('username')
37
+ label: () => e('username')
38
38
  },
39
39
 
40
40
  password: {
41
41
  type: 'password',
42
42
  name: 'password',
43
- label: e('password')
43
+ label: () => e('password')
44
44
  },
45
45
 
46
46
  loginPrompt: {
47
47
  type: 'input',
48
48
  name: 'loginPrompt',
49
- label: e('loginPrompt'),
49
+ label: () => e('loginPrompt'),
50
50
  props: { placeholder: '/login[: ]*$/i' }
51
51
  },
52
52
 
53
53
  passwordPrompt: {
54
54
  type: 'input',
55
55
  name: 'passwordPrompt',
56
- label: e('passwordPrompt'),
56
+ label: () => e('passwordPrompt'),
57
57
  props: { placeholder: '/password[: ]*$/i' }
58
58
  },
59
59
 
60
60
  port: {
61
61
  type: 'number',
62
62
  name: 'port',
63
- label: e('port'),
63
+ label: () => e('port'),
64
64
  rules: [{ required: true, message: 'port required' }]
65
65
  },
66
66
 
67
67
  description: {
68
68
  type: 'textarea',
69
69
  name: 'description',
70
- label: e('description')
70
+ label: () => e('description')
71
71
  },
72
72
 
73
73
  category: {
74
74
  type: 'categorySelect',
75
75
  name: 'category',
76
- label: e('category')
76
+ label: () => e('category')
77
77
  },
78
78
 
79
79
  type: {
@@ -106,13 +106,13 @@ export const commonFields = {
106
106
  interactiveValues: {
107
107
  type: 'textarea',
108
108
  name: 'interactiveValues',
109
- label: e('interactiveValues')
109
+ label: () => e('interactiveValues')
110
110
  },
111
111
 
112
112
  encode: {
113
113
  type: 'select',
114
114
  name: 'encode',
115
- label: e('encode'),
115
+ label: () => e('encode'),
116
116
  options: encodes.map(k => ({ label: k.toUpperCase(), value: k }))
117
117
  },
118
118
 
@@ -128,7 +128,7 @@ export const commonFields = {
128
128
  terminalType: {
129
129
  type: 'autocomplete',
130
130
  name: 'term',
131
- label: e('terminalType'),
131
+ label: () => e('terminalType'),
132
132
  rules: [{ required: true, message: 'terminal type required' }],
133
133
  options: terminalTypes.map(t => ({ label: t, value: t }))
134
134
  },
@@ -136,14 +136,14 @@ export const commonFields = {
136
136
  displayRaw: {
137
137
  type: 'switch',
138
138
  name: 'displayRaw',
139
- label: e('displayRaw'),
139
+ label: () => e('displayRaw'),
140
140
  valuePropName: 'checked'
141
141
  },
142
142
 
143
143
  fontFamily: {
144
144
  type: 'input',
145
145
  name: 'fontFamily',
146
- label: e('fontFamily'),
146
+ label: () => e('fontFamily'),
147
147
  rules: [{ max: 130, message: '130 chars max' }],
148
148
  props: { placeholder: defaultSettings.fontFamily }
149
149
  },
@@ -151,7 +151,7 @@ export const commonFields = {
151
151
  fontSize: {
152
152
  type: 'number',
153
153
  name: 'fontSize',
154
- label: e('fontSize'),
154
+ label: () => e('fontSize'),
155
155
  props: {
156
156
  min: 9,
157
157
  max: 65535,
@@ -163,7 +163,7 @@ export const commonFields = {
163
163
  keepaliveInterval: {
164
164
  type: 'number',
165
165
  name: 'keepaliveInterval',
166
- label: e('keepaliveIntervalDesc'),
166
+ label: () => e('keepaliveIntervalDesc'),
167
167
  props: {
168
168
  min: 0,
169
169
  max: 20000000,
@@ -174,13 +174,13 @@ export const commonFields = {
174
174
  terminalBackground: {
175
175
  type: 'terminalBackground',
176
176
  name: 'terminalBackground',
177
- label: e('terminalBackgroundImage')
177
+ label: () => e('terminalBackgroundImage')
178
178
  },
179
179
 
180
180
  proxy: {
181
181
  type: 'proxy',
182
182
  name: '__proxy__',
183
- label: e('proxy')
183
+ label: () => e('proxy')
184
184
  },
185
185
 
186
186
  x11: {
@@ -243,11 +243,10 @@ export const sshSettings = [
243
243
  {
244
244
  type: 'switch',
245
245
  name: 'ignoreKeyboardInteractive',
246
- label: e('ignoreKeyboardInteractive'),
246
+ label: () => e('ignoreKeyboardInteractive'),
247
247
  valuePropName: 'checked'
248
248
  },
249
249
  ...terminalSettings.slice(0, -1), // All except terminalBackground
250
- commonFields.proxy,
251
250
  commonFields.x11,
252
251
  commonFields.terminalBackground
253
252
  ]
@@ -272,6 +271,12 @@ export const sshAuthFields = [
272
271
  { type: 'sshAuthTypeSelector', name: 'authType', label: '' },
273
272
  { type: 'sshAuthSelector', name: '__auth__', label: '', formItemName: 'password' },
274
273
  commonFields.port,
274
+ {
275
+ type: 'switch',
276
+ name: 'useSshAgent',
277
+ label: () => e('useSshAgent'),
278
+ valuePropName: 'checked'
279
+ },
275
280
  commonFields.runScripts,
276
281
  commonFields.description,
277
282
  commonFields.setEnv,
@@ -306,18 +311,18 @@ export const telnetAuthFields = [
306
311
  // Common tab configurations - functions to ensure translation happens at render time
307
312
  export const quickCommandsTab = () => ({
308
313
  key: 'quickCommands',
309
- label: e('quickCommands'),
314
+ label: () => e('quickCommands'),
310
315
  fields: [commonFields.quickCommands]
311
316
  })
312
317
 
313
318
  export const sshTunnelTab = () => ({
314
319
  key: 'tunnel',
315
- label: e('sshTunnel'),
320
+ label: () => e('sshTunnel'),
316
321
  fields: [commonFields.sshTunnels]
317
322
  })
318
323
 
319
324
  export const connectionHoppingTab = () => ({
320
325
  key: 'connectionHopping',
321
- label: e('connectionHopping'),
326
+ label: () => e('connectionHopping'),
322
327
  fields: [commonFields.connectionHopping]
323
328
  })
@@ -22,16 +22,16 @@ const ftpConfig = {
22
22
  tabs: () => [
23
23
  {
24
24
  key: 'auth',
25
- label: e('auth'),
25
+ label: () => e('auth'),
26
26
  fields: [
27
27
  commonFields.category,
28
28
  commonFields.colorTitle,
29
- { type: 'input', name: 'host', label: e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
29
+ { type: 'input', name: 'host', label: () => e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
30
30
  commonFields.port,
31
31
  { type: 'profileItem', name: '__profile__', label: '', profileFilter: d => !isEmpty(d.ftp) },
32
- { type: 'input', name: 'user', label: e('username') },
33
- { type: 'password', name: 'password', label: e('password') },
34
- { type: 'switch', name: 'secure', label: e('secure'), valuePropName: 'checked' },
32
+ { type: 'input', name: 'user', label: () => e('username') },
33
+ { type: 'password', name: 'password', label: () => e('password') },
34
+ { type: 'switch', name: 'secure', label: () => e('secure'), valuePropName: 'checked' },
35
35
  commonFields.type
36
36
  ]
37
37
  }
@@ -26,7 +26,7 @@ const localConfig = {
26
26
  tabs: () => [
27
27
  {
28
28
  key: 'auth',
29
- label: e('auth'),
29
+ label: () => e('auth'),
30
30
  fields: [
31
31
  commonFields.category,
32
32
  commonFields.colorTitle,
@@ -37,7 +37,7 @@ const localConfig = {
37
37
  },
38
38
  {
39
39
  key: 'settings',
40
- label: e('settings'),
40
+ label: () => e('settings'),
41
41
  fields: [
42
42
  {
43
43
  type: 'input',
@@ -48,27 +48,27 @@ const localConfig = {
48
48
  {
49
49
  type: 'autocomplete',
50
50
  name: 'term',
51
- label: e('terminalType'),
51
+ label: () => e('terminalType'),
52
52
  rules: [{ required: true, message: 'terminal type required' }],
53
53
  options: terminalTypes.map(t => ({ label: t, value: t }))
54
54
  },
55
55
  {
56
56
  type: 'switch',
57
57
  name: 'displayRaw',
58
- label: e('displayRaw'),
58
+ label: () => e('displayRaw'),
59
59
  valuePropName: 'checked'
60
60
  },
61
61
  {
62
62
  type: 'input',
63
63
  name: 'fontFamily',
64
- label: e('fontFamily'),
64
+ label: () => e('fontFamily'),
65
65
  rules: [{ max: 130, message: '130 chars max' }],
66
66
  props: { placeholder: defaultSettings.fontFamily }
67
67
  },
68
68
  {
69
69
  type: 'number',
70
70
  name: 'fontSize',
71
- label: e('fontSize'),
71
+ label: () => e('fontSize'),
72
72
  props: {
73
73
  min: 9,
74
74
  max: 65535,
@@ -79,19 +79,19 @@ const localConfig = {
79
79
  {
80
80
  type: 'number',
81
81
  name: 'keepaliveInterval',
82
- label: e('keepaliveIntervalDesc'),
82
+ label: () => e('keepaliveIntervalDesc'),
83
83
  props: {
84
84
  min: 0,
85
85
  max: 20000000,
86
86
  step: 1000
87
87
  }
88
88
  },
89
- { type: 'terminalBackground', name: 'terminalBackground', label: e('terminalBackgroundImage') }
89
+ { type: 'terminalBackground', name: 'terminalBackground', label: () => e('terminalBackgroundImage') }
90
90
  ]
91
91
  },
92
92
  {
93
93
  key: 'quickCommands',
94
- label: e('quickCommands'),
94
+ label: () => e('quickCommands'),
95
95
  fields: [
96
96
  { type: 'quickCommands', name: '__quick__', label: '' }
97
97
  ]
@@ -19,18 +19,18 @@ const rdpConfig = {
19
19
  tabs: () => [
20
20
  {
21
21
  key: 'auth',
22
- label: e('auth'),
22
+ label: () => e('auth'),
23
23
  fields: [
24
24
  { type: 'rdpWarning', name: 'rdpWarning' },
25
25
  commonFields.category,
26
26
  commonFields.colorTitle,
27
- { type: 'input', name: 'host', label: e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
27
+ { type: 'input', name: 'host', label: () => e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
28
28
  commonFields.port,
29
29
  { type: 'profileItem', name: '__profile__', label: '', profileFilter: d => !isEmpty(d.rdp) },
30
30
  { ...commonFields.username, rules: [{ required: true, message: e('username') + ' required' }] },
31
31
  { ...commonFields.password, rules: [{ required: true, message: e('password') + ' required' }] },
32
32
  commonFields.description,
33
- { type: 'input', name: 'domain', label: e('domain') },
33
+ { type: 'input', name: 'domain', label: () => e('domain') },
34
34
  commonFields.type
35
35
  ]
36
36
  }
@@ -31,7 +31,7 @@ const serialConfig = {
31
31
  tabs: () => [
32
32
  {
33
33
  key: 'auth',
34
- label: e('auth'),
34
+ label: () => e('auth'),
35
35
  fields: [
36
36
  commonFields.category,
37
37
  commonFields.colorTitle,
@@ -64,14 +64,14 @@ const serialConfig = {
64
64
  },
65
65
  {
66
66
  key: 'settings',
67
- label: e('settings'),
67
+ label: () => e('settings'),
68
68
  fields: [
69
- { type: 'terminalBackground', name: 'terminalBackground', label: e('terminalBackgroundImage') }
69
+ { type: 'terminalBackground', name: 'terminalBackground', label: () => e('terminalBackgroundImage') }
70
70
  ]
71
71
  },
72
72
  {
73
73
  key: 'quickCommands',
74
- label: e('quickCommands'),
74
+ label: () => e('quickCommands'),
75
75
  fields: [
76
76
  { type: 'quickCommands', name: '__quick__', label: '' }
77
77
  ]
@@ -20,6 +20,7 @@ const sshConfig = {
20
20
  enableSftp: true,
21
21
  sshTunnels: [],
22
22
  connectionHoppings: [],
23
+ useSshAgent: true,
23
24
  serverHostKey: [],
24
25
  cipher: [],
25
26
  ...getTerminalDefaults(store),
@@ -32,12 +33,12 @@ const sshConfig = {
32
33
  tabs: () => [
33
34
  {
34
35
  key: 'auth',
35
- label: e('auth'),
36
+ label: () => e('auth'),
36
37
  fields: sshAuthFields
37
38
  },
38
39
  {
39
40
  key: 'settings',
40
- label: e('settings'),
41
+ label: () => e('settings'),
41
42
  fields: sshSettings
42
43
  },
43
44
  quickCommandsTab(),
@@ -31,12 +31,12 @@ const telnetConfig = {
31
31
  tabs: () => [
32
32
  {
33
33
  key: 'auth',
34
- label: e('auth'),
34
+ label: () => e('auth'),
35
35
  fields: telnetAuthFields
36
36
  },
37
37
  {
38
38
  key: 'settings',
39
- label: e('settings'),
39
+ label: () => e('settings'),
40
40
  fields: terminalSettings
41
41
  },
42
42
  quickCommandsTab()
@@ -23,16 +23,16 @@ const vncConfig = {
23
23
  tabs: () => [
24
24
  {
25
25
  key: 'auth',
26
- label: e('auth'),
26
+ label: () => e('auth'),
27
27
  fields: [
28
28
  { type: 'vncWarning', name: 'vncWarning' },
29
29
  commonFields.category,
30
30
  commonFields.colorTitle,
31
- { type: 'input', name: 'host', label: e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
31
+ { type: 'input', name: 'host', label: () => e('host'), rules: [{ required: true, message: e('host') + ' required' }] },
32
32
  commonFields.port,
33
- { type: 'switch', name: 'viewOnly', label: e('viewOnly'), valuePropName: 'checked' },
34
- { type: 'switch', name: 'clipViewport', label: e('clipViewport'), valuePropName: 'checked' },
35
- { type: 'switch', name: 'scaleViewport', label: e('scaleViewport'), valuePropName: 'checked' },
33
+ { type: 'switch', name: 'viewOnly', label: () => e('viewOnly'), valuePropName: 'checked' },
34
+ { type: 'switch', name: 'clipViewport', label: () => e('clipViewport'), valuePropName: 'checked' },
35
+ { type: 'switch', name: 'scaleViewport', label: () => e('scaleViewport'), valuePropName: 'checked' },
36
36
  { type: 'profileItem', name: '__profile__', label: '', profileFilter: d => !isEmpty(d.vnc) },
37
37
  commonFields.username,
38
38
  commonFields.password,
@@ -15,14 +15,14 @@ const webConfig = {
15
15
  tabs: () => [
16
16
  {
17
17
  key: 'main',
18
- label: e('auth'),
18
+ label: () => e('auth'),
19
19
  fields: [
20
20
  commonFields.category,
21
21
  commonFields.colorTitle,
22
22
  {
23
23
  type: 'input',
24
24
  name: 'url',
25
- label: e('URL'),
25
+ label: () => e('URL'),
26
26
  rules: [
27
27
  { required: true, message: e('Please input URL') },
28
28
  {
@@ -34,7 +34,7 @@ const webConfig = {
34
34
  ]
35
35
  },
36
36
  commonFields.description,
37
- { type: 'input', name: 'useragent', label: e('useragent') },
37
+ { type: 'input', name: 'useragent', label: () => e('useragent') },
38
38
  { type: 'switch', name: 'hideAddressBar', label: 'hideAddressBar', valuePropName: 'checked' },
39
39
  commonFields.type
40
40
  ]