@electerm/electerm-react 1.51.3 → 1.51.18

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 (86) hide show
  1. package/client/common/constants.js +15 -1
  2. package/client/common/db.js +10 -9
  3. package/client/common/default-setting.js +0 -1
  4. package/client/common/is-color-dark.js +15 -11
  5. package/client/common/new-terminal.js +2 -5
  6. package/client/common/reverse-color.js +12 -0
  7. package/client/common/ws.js +4 -1
  8. package/client/components/batch-op/batch-op.jsx +16 -5
  9. package/client/components/bookmark-form/index.jsx +1 -1
  10. package/client/components/bookmark-form/render-connection-hopping.jsx +25 -2
  11. package/client/components/bookmark-form/ssh-form.jsx +4 -25
  12. package/client/components/bookmark-form/tree-delete.jsx +5 -10
  13. package/client/components/bookmark-form/use-submit.jsx +6 -15
  14. package/client/components/bookmark-form/use-ui.jsx +1 -2
  15. package/client/components/common/connection-hopping-warning-text.jsx +36 -0
  16. package/client/components/common/drag-handle.jsx +60 -0
  17. package/client/components/common/drag-handle.styl +12 -0
  18. package/client/components/context-menu/context-menu.styl +5 -5
  19. package/client/components/context-menu/history.jsx +2 -11
  20. package/client/components/context-menu/sub-tab-menu.jsx +1 -1
  21. package/client/components/footer/footer-entry.jsx +1 -6
  22. package/client/components/layout/layout-item.jsx +2 -2
  23. package/client/components/layout/layout.jsx +3 -2
  24. package/client/components/main/connection-hopping-warnning.jsx +45 -0
  25. package/client/components/main/error-wrapper.jsx +120 -5
  26. package/client/components/main/main.jsx +32 -8
  27. package/client/components/main/upgrade.jsx +4 -9
  28. package/client/components/main/wrapper.styl +2 -1
  29. package/client/components/profile/profile-form-ssh.jsx +1 -1
  30. package/client/components/rdp/resolution-edit.jsx +3 -5
  31. package/client/components/session/session.jsx +22 -3
  32. package/client/components/session/session.styl +3 -2
  33. package/client/components/setting-panel/list.styl +0 -1
  34. package/client/components/setting-panel/on-tree-drop.js +5 -5
  35. package/client/components/setting-panel/setting-common.jsx +28 -7
  36. package/client/components/setting-panel/setting-modal.jsx +0 -12
  37. package/client/components/setting-panel/setting-terminal.jsx +7 -4
  38. package/client/components/sftp/confirm-modal-store.jsx +3 -11
  39. package/client/components/sftp/file-mode-modal.jsx +2 -2
  40. package/client/components/sftp/sftp-entry.jsx +4 -7
  41. package/client/components/sftp/transfer-conflict-store.jsx +70 -69
  42. package/client/components/sftp/transport-action-store.jsx +42 -49
  43. package/client/components/sftp/transports-action-store.jsx +15 -15
  44. package/client/components/sftp/transports-ui-store.jsx +9 -5
  45. package/client/components/side-panel-r/side-panel-r.jsx +13 -40
  46. package/client/components/sidebar/bookmark-select.jsx +1 -4
  47. package/client/components/sidebar/bookmark.jsx +4 -63
  48. package/client/components/sidebar/history-item.jsx +34 -0
  49. package/client/components/sidebar/history.jsx +17 -52
  50. package/client/components/sidebar/index.jsx +5 -40
  51. package/client/components/sidebar/side-panel.jsx +27 -51
  52. package/client/components/sidebar/sidebar-panel.jsx +107 -0
  53. package/client/components/sidebar/sidebar.styl +14 -9
  54. package/client/components/sidebar/transfer-list-control.jsx +1 -0
  55. package/client/components/sidebar/transfer.styl +1 -1
  56. package/client/components/sidebar/transport-ui.jsx +179 -37
  57. package/client/components/ssh-config/load-ssh-configs.jsx +106 -0
  58. package/client/components/ssh-config/ssh-config-item.jsx +26 -0
  59. package/client/components/ssh-config/ssh-config-load-notify.jsx +60 -0
  60. package/client/components/tabs/index.jsx +4 -4
  61. package/client/components/tabs/tab.jsx +28 -20
  62. package/client/components/tabs/tabs.styl +6 -1
  63. package/client/components/terminal/index.jsx +4 -18
  64. package/client/components/tree-list/bookmark-toolbar.jsx +203 -0
  65. package/client/components/tree-list/bookmark-transport.jsx +2 -0
  66. package/client/components/tree-list/tree-list.jsx +33 -42
  67. package/client/entry/worker.js +5 -3
  68. package/client/store/bookmark-group.js +5 -18
  69. package/client/store/bookmark.js +43 -1
  70. package/client/store/common.js +13 -9
  71. package/client/store/db-upgrade.js +0 -2
  72. package/client/store/index.js +45 -53
  73. package/client/store/init-state.js +20 -23
  74. package/client/store/item.js +0 -19
  75. package/client/store/load-data.js +7 -10
  76. package/client/store/setting.js +10 -66
  77. package/client/store/sidebar.js +7 -8
  78. package/client/store/sync.js +7 -8
  79. package/client/store/tab.js +93 -14
  80. package/client/store/terminal-theme.js +1 -1
  81. package/client/store/transfer-history.js +3 -9
  82. package/client/store/transfer-list.js +67 -75
  83. package/client/store/ui-theme.js +0 -9
  84. package/client/store/watch.js +17 -9
  85. package/package.json +1 -1
  86. package/client/components/setting-panel/tab-history.jsx +0 -43
@@ -0,0 +1,45 @@
1
+ import { useEffect } from 'react'
2
+ import ConnectionHoppingWarningText from '../common/connection-hopping-warning-text'
3
+ import {
4
+ notification
5
+ } from 'antd'
6
+ import * as ls from '../../common/safe-local-storage'
7
+ import {
8
+ connectionHoppingWarnKey
9
+ } from '../../common/constants'
10
+
11
+ const e = window.translate
12
+
13
+ export default function ConnectionHoppingWarning (props) {
14
+ const {
15
+ hasOldConnectionHoppingBookmark,
16
+ configLoaded
17
+ } = props
18
+ function closeWarn () {
19
+ notification.destroy(connectionHoppingWarnKey)
20
+ }
21
+ function showWarning () {
22
+ if (
23
+ !hasOldConnectionHoppingBookmark ||
24
+ !configLoaded ||
25
+ ls.getItem(connectionHoppingWarnKey) === 'yes'
26
+ ) {
27
+ return
28
+ }
29
+ notification.info({
30
+ message: e('connectionHopping'),
31
+ duration: 0,
32
+ placement: 'bottom',
33
+ key: connectionHoppingWarnKey,
34
+ description: (
35
+ <ConnectionHoppingWarningText
36
+ closeWarn={closeWarn}
37
+ />
38
+ )
39
+ })
40
+ }
41
+ useEffect(() => {
42
+ showWarning()
43
+ }, [configLoaded, hasOldConnectionHoppingBookmark])
44
+ return null
45
+ }
@@ -1,11 +1,35 @@
1
1
  import React from 'react'
2
2
  import { FrownOutlined, ReloadOutlined } from '@ant-design/icons'
3
- import { Button } from 'antd'
3
+ import { Button, message } from 'antd'
4
4
  import {
5
- logoPath1
5
+ logoPath1,
6
+ packInfo,
7
+ isMac,
8
+ isWin
6
9
  } from '../../common/constants'
10
+ import Link from '../common/external-link'
11
+ import fs from '../../common/fs'
12
+ import { copy } from '../../common/clipboard'
7
13
 
8
14
  const e = window.translate
15
+ const os = isMac ? 'mac' : isWin ? 'windows' : 'linux'
16
+ const troubleshootContent = {
17
+ runInCommandLine: {
18
+ mac: '/Applications/electerm.app/Contents/MacOS/electerm',
19
+ linux: 'path/to/electerm',
20
+ windows: 'path\\to\\electerm.exe'
21
+ },
22
+ clearConfig: {
23
+ mac: 'rm -rf ~/Library/Application\\ Support/electerm/users/default_user/electerm.data.nedb',
24
+ linux: 'rm -rf ~/.config/electerm/users/default_user/electerm.data.nedb',
25
+ windows: 'Delete C:\\Users\\your-user-name\\AppData\\Roaming\\electerm\\users\\default_user\\electerm.data.nedb'
26
+ },
27
+ clearData: {
28
+ mac: 'rm -rf ~/Library/Application\\ Support/electerm*',
29
+ linux: 'rm -rf ~/.config/electerm',
30
+ windows: 'Delete C:\\Users\\your-user-name\\AppData\\Roaming\\electerm'
31
+ }
32
+ }
9
33
 
10
34
  export default class ErrorBoundary extends React.PureComponent {
11
35
  constructor (props) {
@@ -28,12 +52,101 @@ export default class ErrorBoundary extends React.PureComponent {
28
52
  window.location.reload()
29
53
  }
30
54
 
55
+ handleClearData = async () => {
56
+ await fs.rmrf(troubleshootContent.clearData[os])
57
+ .then(
58
+ () => {
59
+ message.success('Data cleared')
60
+ }
61
+ )
62
+ }
63
+
64
+ handleClearConfig = async () => {
65
+ await fs.rmrf(troubleshootContent.clearConfig[os])
66
+ .then(
67
+ () => {
68
+ message.success('Config cleared')
69
+ }
70
+ )
71
+ }
72
+
73
+ handleCopy = () => {
74
+ copy(troubleshootContent.runInCommandLine[os])
75
+ }
76
+
77
+ renderButton = type => {
78
+ if (type === 'clearData') {
79
+ return (
80
+ <Button
81
+ className='mg1l'
82
+ onClick={this.handleClearData}
83
+ >
84
+ {e('clearData')}
85
+ </Button>
86
+ )
87
+ }
88
+ if (type === 'runInCommandLine') {
89
+ return (
90
+ <Button
91
+ className='mg1l'
92
+ onClick={this.handleCopy}
93
+ >
94
+ {e('copy')}
95
+ </Button>
96
+ )
97
+ }
98
+ return (
99
+ <Button
100
+ className='mg1l'
101
+ onClick={this.handleClearConfig}
102
+ >
103
+ {e('clearConfig')}
104
+ </Button>
105
+ )
106
+ }
107
+
108
+ renderTroubleShoot = () => {
109
+ const {
110
+ bugs: {
111
+ url: bugReportLink
112
+ }
113
+ } = packInfo
114
+ const bugUrl = `${bugReportLink}/new/choose`
115
+ return (
116
+ <div className='pd1y wordbreak'>
117
+ <h2>{e('troubleShoot')}</h2>
118
+ <p>Electerm Version: {packInfo.version}, OS: {os}</p>
119
+ {
120
+ Object.keys(troubleshootContent).map((k, i) => {
121
+ const v = troubleshootContent[k]
122
+ const cmd = v[os]
123
+ return (
124
+ <div className='pd1b' key={k}>
125
+ <h3>{e(k)} {this.renderButton(k)}</h3>
126
+ <p><code>{cmd}</code></p>
127
+ </div>
128
+ )
129
+ })
130
+ }
131
+ <div className='pd1b'>
132
+ <Link to={bugUrl}>{e('bugReport')}</Link>
133
+ </div>
134
+ <div className='pd3y'>
135
+ <img
136
+ src='https://electerm.html5beta.com/electerm-wechat-group-qr.jpg'
137
+ className='mwm-100'
138
+ />
139
+ </div>
140
+ </div>
141
+ )
142
+ }
143
+
31
144
  render () {
32
145
  if (this.state.hasError) {
33
146
  const { stack, message } = this.state.error
34
147
  return (
35
- <div className='pd3 aligncenter error-wrapper'>
36
- <div className='pd2y aligncenter'>
148
+ <div className='pd3 error-wrapper'>
149
+ <div className='pd2y'>
37
150
  <img src={logoPath1} className='iblock mwm-100' />
38
151
  </div>
39
152
  <h1>
@@ -41,7 +154,6 @@ export default class ErrorBoundary extends React.PureComponent {
41
154
  <span className='iblock mg1r'>{e('error')}</span>
42
155
  <Button
43
156
  onClick={this.handleReload}
44
- className='iblock'
45
157
  icon={<ReloadOutlined />}
46
158
  >
47
159
  {e('reload')}
@@ -49,6 +161,9 @@ export default class ErrorBoundary extends React.PureComponent {
49
161
  </h1>
50
162
  <div className='pd1y'>{message}</div>
51
163
  <div className='pd1y'>{stack}</div>
164
+ {
165
+ this.renderTroubleShoot()
166
+ }
52
167
  </div>
53
168
  )
54
169
  }
@@ -26,7 +26,11 @@ import { LoadingUI } from './loading'
26
26
  import { ConfigProvider, notification, message } from 'antd'
27
27
  import InfoModal from '../sidebar/info-modal.jsx'
28
28
  import RightSidePanel from '../side-panel-r/side-panel-r'
29
+ import ConnectionHoppingWarning from './connection-hopping-warnning'
30
+ import SshConfigLoadNotify from '../ssh-config/ssh-config-load-notify'
31
+ import LoadSshConfigs from '../ssh-config/load-ssh-configs'
29
32
  import { pick } from 'lodash-es'
33
+ import deepCopy from 'json-deep-copy'
30
34
  import './wrapper.styl'
31
35
 
32
36
  function setupGlobalMessageDismiss () {
@@ -89,7 +93,6 @@ export default auto(function Index (props) {
89
93
  isSecondInstance,
90
94
  pinnedQuickCommandBar,
91
95
  wsInited,
92
- upgradeInfo,
93
96
  installSrc,
94
97
  fileTransfers,
95
98
  uiThemeConfig,
@@ -97,6 +100,7 @@ export default auto(function Index (props) {
97
100
  transferToConfirm,
98
101
  openResolutionEdit
99
102
  } = store
103
+ const upgradeInfo = deepCopy(store.upgradeInfo)
100
104
  const cls = classnames({
101
105
  loaded: configLoaded,
102
106
  'not-webapp': !window.et.isWebApp,
@@ -131,6 +135,8 @@ export default auto(function Index (props) {
131
135
  opacity: config.opacity
132
136
  }
133
137
  }
138
+ const copiedTransfer = deepCopy(fileTransfers)
139
+ const copiedHistory = deepCopy(transferHistory)
134
140
  const sidebarProps = {
135
141
  ...pick(store, [
136
142
  'activeItemId',
@@ -143,10 +149,11 @@ export default auto(function Index (props) {
143
149
  'settingItem',
144
150
  'isSyncingSetting',
145
151
  'leftSidebarWidth',
146
- 'transferTab'
152
+ 'transferTab',
153
+ 'sidebarPanelTab'
147
154
  ]),
148
- fileTransfers,
149
- transferHistory,
155
+ fileTransfers: copiedTransfer,
156
+ transferHistory: copiedHistory,
150
157
  upgradeInfo,
151
158
  pinned
152
159
  }
@@ -161,8 +168,8 @@ export default auto(function Index (props) {
161
168
  upgradeInfo
162
169
  }
163
170
  const conflictStoreProps = {
164
- fileTransfers,
165
- _fileTransfers: store._fileTransfers
171
+ fileTransferChanged: JSON.stringify(copiedTransfer),
172
+ fileTransfers: copiedTransfer
166
173
  }
167
174
  const batchOpProps = {
168
175
  transferHistory,
@@ -170,7 +177,7 @@ export default auto(function Index (props) {
170
177
  innerWidth: store.innerWidth
171
178
  }
172
179
  const resProps = {
173
- resolutions: store.resolutions,
180
+ resolutions: deepCopy(store.resolutions),
174
181
  openResolutionEdit
175
182
  }
176
183
  const contextMenuProps = {
@@ -186,7 +193,7 @@ export default auto(function Index (props) {
186
193
  rightPanelWidth: store.rightPanelWidth
187
194
  }
188
195
  const terminalInfoProps = {
189
- ...store.terminalInfoProps,
196
+ ...deepCopy(store.terminalInfoProps),
190
197
  ...pick(
191
198
  config,
192
199
  ['host', 'port', 'saveTerminalLogToFile', 'terminalInfos']
@@ -195,6 +202,17 @@ export default auto(function Index (props) {
195
202
  'appPath'
196
203
  ])
197
204
  }
205
+ const sshConfigProps = {
206
+ ...pick(store, [
207
+ 'settingTab',
208
+ 'showModal',
209
+ 'sshConfigs'
210
+ ])
211
+ }
212
+ const warningProps = {
213
+ hasOldConnectionHoppingBookmark: store.hasOldConnectionHoppingBookmark,
214
+ configLoaded
215
+ }
198
216
  return (
199
217
  <ConfigProvider
200
218
  theme={uiThemeConfig}
@@ -253,6 +271,12 @@ export default auto(function Index (props) {
253
271
  <RightSidePanel {...rightPanelProps}>
254
272
  <TerminalInfo {...terminalInfoProps} />
255
273
  </RightSidePanel>
274
+ <SshConfigLoadNotify {...sshConfigProps} />
275
+ <LoadSshConfigs
276
+ showSshConfigModal={store.showSshConfigModal}
277
+ sshConfigs={store.sshConfigs}
278
+ />
279
+ <ConnectionHoppingWarning {...warningProps} />
256
280
  </div>
257
281
  </ConfigProvider>
258
282
  )
@@ -63,12 +63,9 @@ export default class Upgrade extends PureComponent {
63
63
  }
64
64
 
65
65
  changeProps = (update) => {
66
- window.store.storeAssign({
67
- _upgradeInfo: JSON.stringify({
68
- ...this.props.upgradeInfo,
69
- ...update
70
- })
71
- })
66
+ Object.assign(
67
+ window.store.upgradeInfo, update
68
+ )
72
69
  }
73
70
 
74
71
  handleMinimize = () => {
@@ -79,9 +76,7 @@ export default class Upgrade extends PureComponent {
79
76
  }
80
77
 
81
78
  handleClose = () => {
82
- window.store.storeAssign({
83
- _upgradeInfo: '{}'
84
- })
79
+ window.store.upgradeInfo = {}
85
80
  }
86
81
 
87
82
  onData = (upgradePercent) => {
@@ -9,10 +9,11 @@
9
9
  // .pinned .sessions
10
10
  // margin-left 343px
11
11
  .error-wrapper
12
- background main-light
12
+ background main
13
13
  height 100%
14
14
  position fixed
15
15
  color text
16
+ overflow-y scroll
16
17
  .init-wrap
17
18
  .loading-data
18
19
  position fixed
@@ -9,7 +9,7 @@ const FormItem = Form.Item
9
9
  const e = window.translate
10
10
 
11
11
  export default function ProfileFormSsh (props) {
12
- const { form } = props.store
12
+ const { form } = props
13
13
  return (
14
14
  <>
15
15
  <FormItem
@@ -7,22 +7,20 @@ import uid from '../../common/uid'
7
7
 
8
8
  export default function Resolutions (props) {
9
9
  function remove (id) {
10
- const { resolutions } = props
10
+ const { resolutions } = window.store
11
11
  const index = resolutions.findIndex(d => d.id === id)
12
12
  if (index < 0) {
13
13
  return
14
14
  }
15
15
  resolutions.splice(index, 1)
16
- window.store.setState('resolutions', resolutions)
17
16
  }
18
17
 
19
18
  function submit (data) {
20
- const { resolutions } = props
19
+ const { resolutions } = window.store
21
20
  resolutions.push({
22
21
  ...data,
23
22
  id: uid()
24
23
  })
25
- window.store.setState('resolutions', resolutions)
26
24
  }
27
25
 
28
26
  const {
@@ -37,7 +35,7 @@ export default function Resolutions (props) {
37
35
  }
38
36
  const modalProps = {
39
37
  footer: null,
40
- visible: true,
38
+ open: true,
41
39
  onCancel: () => toggleResolutionEdit()
42
40
  }
43
41
  const resList = {
@@ -14,7 +14,8 @@ import {
14
14
  CloseOutlined
15
15
  } from '@ant-design/icons'
16
16
  import {
17
- Tooltip
17
+ Tooltip,
18
+ message
18
19
  } from 'antd'
19
20
  import { pick } from 'lodash-es'
20
21
  import generate from '../../common/uid'
@@ -71,7 +72,12 @@ export default class SessionWrapper extends Component {
71
72
  if (!target) {
72
73
  return
73
74
  }
74
- const fromTab = JSON.parse(e.dataTransfer.getData('fromFile'))
75
+ let fromTab
76
+ try {
77
+ fromTab = JSON.parse(e.dataTransfer.getData('fromFile'))
78
+ } catch (e) {
79
+ return
80
+ }
75
81
  const onDropElem = this.getDom()
76
82
  const { batch } = this.props.tab
77
83
  if (!onDropElem || !fromTab || fromTab.batch === batch) {
@@ -83,6 +89,15 @@ export default class SessionWrapper extends Component {
83
89
  if (!t) {
84
90
  return
85
91
  }
92
+ // Handle currentTab change if needed
93
+ const fromBatch = fromTab.batch
94
+ if (window.store[`activeTabId${fromBatch}`] === fromTab.id && fromBatch !== batch) {
95
+ // Find next tab in the same batch
96
+ const nextTab = tabs.find((t, i) =>
97
+ t.id !== fromTab.id && t.batch === fromBatch
98
+ )
99
+ window.store[`activeTabId${fromBatch}`] = nextTab ? nextTab.id : ''
100
+ }
86
101
  t.batch = batch
87
102
  this.clearCls()
88
103
  }
@@ -136,8 +151,12 @@ export default class SessionWrapper extends Component {
136
151
  }
137
152
 
138
153
  toggleCheckSftpPathFollowSsh = () => {
154
+ const nv = !this.state.sftpPathFollowSsh
155
+ if (nv) {
156
+ message.warning(e('sftpPathFollowSshTip'), 8)
157
+ }
139
158
  this.setState({
140
- sftpPathFollowSsh: !this.state.sftpPathFollowSsh
159
+ sftpPathFollowSsh: nv
141
160
  })
142
161
  }
143
162
 
@@ -57,8 +57,9 @@
57
57
  overflow hidden
58
58
  z-index 3
59
59
  padding-top 36px
60
- .session-batch-active
61
- display block
60
+ box-shadow 0px 0px 1px 1px alpha(main, .3)
61
+ &.session-batch-active
62
+ display block
62
63
 
63
64
  .web-session-wrap
64
65
  height 100vh
@@ -21,7 +21,6 @@
21
21
  margin-bottom 1px
22
22
  cursor pointer
23
23
  line-height 1.8
24
- cu
25
24
  &.active
26
25
  background primary
27
26
  color contrastColor(primary)
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  defaultBookmarkGroupId
7
7
  } from '../../common/constants'
8
- import { isEqual, find, findIndex, last, remove } from 'lodash-es'
8
+ import { isEqual, find, last, remove } from 'lodash-es'
9
9
  import copy from 'json-deep-copy'
10
10
 
11
11
  export default (info, props) => {
@@ -129,7 +129,7 @@ export default (info, props) => {
129
129
  ? toGroup.bookmarkIds || []
130
130
  : toGroup.bookmarkGroupIds || []
131
131
  nodeIndex = dropToGap
132
- ? findIndex(pool, d => d === toId)
132
+ ? pool.findIndex(d => d === toId)
133
133
  : pool.length
134
134
  if (dropToGap) {
135
135
  if (fromLeaf) {
@@ -143,7 +143,7 @@ export default (info, props) => {
143
143
  }
144
144
  }
145
145
  } else {
146
- nodeIndex = findIndex(bookmarkGroups, d => {
146
+ nodeIndex = bookmarkGroups.findIndex(d => {
147
147
  return d.id === toId
148
148
  })
149
149
  if (fromLeaf) {
@@ -165,7 +165,7 @@ export default (info, props) => {
165
165
  }
166
166
  const updates = []
167
167
  if (toFirstLevel) {
168
- fromIndex = findIndex(bookmarkGroups, d => d.id === fromId)
168
+ fromIndex = bookmarkGroups.findIndex(d => d.id === fromId)
169
169
  from = copy(from)
170
170
  bookmarkGroups.splice(fromIndex, 1, 'tobedel')
171
171
  bookmarkGroups.splice(nodeIndex, 0, from)
@@ -177,7 +177,7 @@ export default (info, props) => {
177
177
  const arr = fromLeaf
178
178
  ? fromGroup.bookmarkIds
179
179
  : fromGroup.bookmarkGroupIds
180
- fromIndex = findIndex(arr, d => d === fromId)
180
+ fromIndex = arr.findIndex(d => d === fromId)
181
181
  isSameCat
182
182
  ? arr.splice(fromIndex, 1, 'tobedel')
183
183
  : remove(arr, d => d === fromId)
@@ -1,7 +1,9 @@
1
1
  import React, { Component } from 'react'
2
2
  import {
3
3
  ArrowRightOutlined,
4
- LoadingOutlined
4
+ LoadingOutlined,
5
+ SunOutlined,
6
+ MoonOutlined
5
7
  } from '@ant-design/icons'
6
8
  import {
7
9
  message,
@@ -12,7 +14,8 @@ import {
12
14
  Alert,
13
15
  Button,
14
16
  Table,
15
- Space
17
+ Space,
18
+ Tag
16
19
  } from 'antd'
17
20
  import deepCopy from 'json-deep-copy'
18
21
  import {
@@ -26,6 +29,7 @@ import createEditLangLink from '../../common/create-lang-edit-link'
26
29
  import StartSession from './start-session-select'
27
30
  import HelpIcon from '../common/help-icon'
28
31
  import delay from '../../common/wait.js'
32
+ import isColorDark from '../../common/is-color-dark'
29
33
  import './setting.styl'
30
34
 
31
35
  const { Option } = Select
@@ -501,8 +505,8 @@ export default class SettingCommon extends Component {
501
505
  customCss
502
506
  } = props.config
503
507
  const {
504
- langs
505
- } = this.props.store
508
+ langs = []
509
+ } = window.et
506
510
  const terminalThemes = props.store.getSidebarList(settingMap.terminalThemes)
507
511
  const [modifier, key] = hotkey.split('+')
508
512
  const pops = {
@@ -581,9 +585,27 @@ export default class SettingCommon extends Component {
581
585
  >
582
586
  {
583
587
  terminalThemes.map(l => {
584
- const { id, name } = l
588
+ const { id, name, uiThemeConfig } = l
589
+ const { main, text } = uiThemeConfig
590
+ const isDark = isColorDark(main)
591
+ const txt = isDark ? <MoonOutlined /> : <SunOutlined />
592
+ const tag = (
593
+ <Tag
594
+ color={main}
595
+ className='mg1l'
596
+ style={
597
+ {
598
+ color: text
599
+ }
600
+ }
601
+ >
602
+ {txt}
603
+ </Tag>
604
+ )
585
605
  return (
586
- <Option key={id} value={id}>{name}</Option>
606
+ <Option key={id} value={id}>
607
+ {tag} {name}
608
+ </Option>
587
609
  )
588
610
  })
589
611
  }
@@ -633,7 +655,6 @@ export default class SettingCommon extends Component {
633
655
  {
634
656
  [
635
657
  'autoRefreshWhenSwitchToSftp',
636
- 'hideSshConfig',
637
658
  'showHiddenFilesOnSftpStart',
638
659
  'screenReaderMode',
639
660
  'initDefaultTabOnStart',
@@ -11,7 +11,6 @@ import {
11
11
  modals
12
12
  } from '../../common/constants'
13
13
  import TabBookmarks from './tab-bookmarks'
14
- import TabHistory from './tab-history'
15
14
  import TabQuickCommands from './tab-quick-commands'
16
15
  import TabSettings from './tab-settings'
17
16
  import TabThemes from './tab-themes'
@@ -68,11 +67,6 @@ export default auto(function SettingModalWrap (props) {
68
67
  ])
69
68
  }
70
69
  const items = [
71
- {
72
- key: settingMap.history,
73
- label: e(settingMap.history),
74
- children: null
75
- },
76
70
  {
77
71
  key: settingMap.bookmarks,
78
72
  label: e(settingMap.bookmarks),
@@ -113,12 +107,6 @@ export default auto(function SettingModalWrap (props) {
113
107
  <Tabs
114
108
  {...tabsProps}
115
109
  />
116
- <TabHistory
117
- listProps={props0}
118
- settingItem={settingItem}
119
- formProps={formProps}
120
- settingTab={settingTab}
121
- />
122
110
  <TabQuickCommands
123
111
  listProps={props0}
124
112
  settingItem={settingItem}
@@ -18,7 +18,8 @@ import deepCopy from 'json-deep-copy'
18
18
  import {
19
19
  noTerminalBgValue,
20
20
  rendererTypes,
21
- regexHelpLink
21
+ regexHelpLink,
22
+ terminalTypes
22
23
  } from '../../common/constants'
23
24
  import defaultSettings from '../../common/default-setting'
24
25
  import ShowItem from '../common/show-item'
@@ -66,7 +67,9 @@ export default class SettingTerminal extends Component {
66
67
 
67
68
  onChangeValue = (value, name) => {
68
69
  if (name === 'useSystemTitleBar') {
69
- message.info(e('useSystemTitleBarTip'), 5)
70
+ message.info(e('useSystemTitleBarTip'), 8)
71
+ } else if (name === 'sftpPathFollowSsh' && value) {
72
+ message.warn(e('sftpPathFollowSshTip'), 8)
70
73
  }
71
74
  this.saveConfig({
72
75
  [name]: value
@@ -304,7 +307,7 @@ export default class SettingTerminal extends Component {
304
307
  }
305
308
 
306
309
  renderDefaultTerminalType = () => {
307
- const opts = this.props.config.terminalTypes.map(mapper)
310
+ const opts = terminalTypes.map(mapper)
308
311
  return (
309
312
  <AutoComplete
310
313
  options={opts}
@@ -364,7 +367,7 @@ export default class SettingTerminal extends Component {
364
367
  }
365
368
 
366
369
  renderFontFamily = () => {
367
- const { fonts } = this.props.store
370
+ const { fonts = [] } = window.et
368
371
  const { fontFamily } = this.props.config
369
372
  const props = {
370
373
  mode: 'multiple',