@electerm/electerm-react 1.91.8 → 1.100.6
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.
- package/client/common/default-setting.js +2 -1
- package/client/common/sftp.js +7 -5
- package/client/common/transfer.js +3 -2
- package/client/common/ws.js +12 -8
- package/client/components/ai/ai-chat-history-item.jsx +17 -3
- package/client/components/ai/ai-config.jsx +3 -3
- package/client/components/ai/ai-output.jsx +2 -31
- package/client/components/bookmark-form/proxy.jsx +1 -1
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +4 -4
- package/client/components/rdp/rdp-session.jsx +6 -4
- package/client/components/setting-panel/setting-common.jsx +2 -1
- package/client/components/setting-panel/terminal-bg-config.jsx +1 -1
- package/client/components/sftp/sftp-entry.jsx +32 -4
- package/client/components/sys-menu/sys-menu.jsx +4 -1
- package/client/components/sys-menu/sys-menu.styl +5 -0
- package/client/components/tabs/tab.jsx +2 -2
- package/client/components/terminal/term-search.jsx +2 -2
- package/client/components/terminal/terminal.jsx +7 -7
- package/client/components/tree-list/tree-list.jsx +3 -2
- package/client/components/vnc/vnc-session.jsx +5 -4
- package/package.json +1 -1
package/client/common/sftp.js
CHANGED
|
@@ -10,12 +10,13 @@ import initWs from './ws'
|
|
|
10
10
|
const transferKeys = Object.keys(transferTypeMap)
|
|
11
11
|
|
|
12
12
|
class Sftp {
|
|
13
|
-
async init (terminalId) {
|
|
13
|
+
async init (terminalId, port) {
|
|
14
14
|
const id = generate()
|
|
15
|
-
const ws = await initWs('sftp', id, terminalId)
|
|
15
|
+
const ws = await initWs('sftp', id, terminalId, undefined, port)
|
|
16
16
|
this.ws = ws
|
|
17
17
|
this.id = id
|
|
18
18
|
this.terminalId = terminalId
|
|
19
|
+
this.port = port
|
|
19
20
|
ws.s({
|
|
20
21
|
action: 'sftp-new',
|
|
21
22
|
id,
|
|
@@ -32,7 +33,8 @@ class Sftp {
|
|
|
32
33
|
isFtp: this.type === 'ftp',
|
|
33
34
|
...args[0],
|
|
34
35
|
terminalId,
|
|
35
|
-
type: func
|
|
36
|
+
type: func,
|
|
37
|
+
port
|
|
36
38
|
})
|
|
37
39
|
}
|
|
38
40
|
const fid = generate()
|
|
@@ -71,9 +73,9 @@ class Sftp {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
export default async (terminalId, type = 'sftp') => {
|
|
76
|
+
export default async (terminalId, type = 'sftp', port) => {
|
|
75
77
|
const sftp = new Sftp()
|
|
76
78
|
sftp.type = type
|
|
77
|
-
await sftp.init(terminalId)
|
|
79
|
+
await sftp.init(terminalId, port)
|
|
78
80
|
return sftp
|
|
79
81
|
}
|
|
@@ -19,9 +19,10 @@ class Transfer {
|
|
|
19
19
|
const th = this
|
|
20
20
|
const {
|
|
21
21
|
sftpId,
|
|
22
|
-
isFtp
|
|
22
|
+
isFtp,
|
|
23
|
+
port
|
|
23
24
|
} = rest
|
|
24
|
-
const ws = await initWs('transfer', id, sftpId)
|
|
25
|
+
const ws = await initWs('transfer', id, sftpId, undefined, port)
|
|
25
26
|
ws.s({
|
|
26
27
|
action: 'transfer-new',
|
|
27
28
|
...rest,
|
package/client/common/ws.js
CHANGED
|
@@ -140,7 +140,17 @@ function onEvent (e) {
|
|
|
140
140
|
|
|
141
141
|
window.worker.addEventListener('message', onEvent)
|
|
142
142
|
|
|
143
|
-
export default (type, id, sftpId = '', persist) => {
|
|
143
|
+
export default (type, id, sftpId = '', persist, port) => {
|
|
144
|
+
const opts = pick(window.store.config, [
|
|
145
|
+
'host',
|
|
146
|
+
'port',
|
|
147
|
+
'tokenElecterm',
|
|
148
|
+
'server',
|
|
149
|
+
'urlPath'
|
|
150
|
+
])
|
|
151
|
+
if (port) {
|
|
152
|
+
opts.port = port
|
|
153
|
+
}
|
|
144
154
|
return new Promise((resolve) => {
|
|
145
155
|
send({
|
|
146
156
|
id,
|
|
@@ -151,13 +161,7 @@ export default (type, id, sftpId = '', persist) => {
|
|
|
151
161
|
type,
|
|
152
162
|
id,
|
|
153
163
|
sftpId,
|
|
154
|
-
|
|
155
|
-
'host',
|
|
156
|
-
'port',
|
|
157
|
-
'tokenElecterm',
|
|
158
|
-
'server',
|
|
159
|
-
'urlPath'
|
|
160
|
-
])
|
|
164
|
+
opts
|
|
161
165
|
]
|
|
162
166
|
})
|
|
163
167
|
onces[id] = {
|
|
@@ -7,17 +7,31 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
UserOutlined,
|
|
9
9
|
CopyOutlined,
|
|
10
|
-
CloseOutlined
|
|
10
|
+
CloseOutlined,
|
|
11
|
+
CaretDownOutlined,
|
|
12
|
+
CaretRightOutlined
|
|
11
13
|
} from '@ant-design/icons'
|
|
12
14
|
import { copy } from '../../common/clipboard'
|
|
15
|
+
import { useState } from 'react'
|
|
13
16
|
|
|
14
17
|
export default function AIChatHistoryItem ({ item }) {
|
|
18
|
+
const [showOutput, setShowOutput] = useState(true)
|
|
15
19
|
const {
|
|
16
20
|
prompt
|
|
17
21
|
} = item
|
|
22
|
+
|
|
23
|
+
function toggleOutput () {
|
|
24
|
+
setShowOutput(!showOutput)
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
const alertProps = {
|
|
19
28
|
message: (
|
|
20
|
-
|
|
29
|
+
<>
|
|
30
|
+
<span className='pointer mg1r' onClick={toggleOutput}>
|
|
31
|
+
{showOutput ? <CaretDownOutlined /> : <CaretRightOutlined />}
|
|
32
|
+
</span>
|
|
33
|
+
<UserOutlined />: {prompt}
|
|
34
|
+
</>
|
|
21
35
|
),
|
|
22
36
|
type: 'info'
|
|
23
37
|
}
|
|
@@ -63,7 +77,7 @@ export default function AIChatHistoryItem ({ item }) {
|
|
|
63
77
|
<Alert {...alertProps} />
|
|
64
78
|
</Tooltip>
|
|
65
79
|
</div>
|
|
66
|
-
<AIOutput item={item} />
|
|
80
|
+
{showOutput && <AIOutput item={item} />}
|
|
67
81
|
</div>
|
|
68
82
|
)
|
|
69
83
|
}
|
|
@@ -27,8 +27,8 @@ const defaultRoles = [
|
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
const proxyOptions = [
|
|
30
|
-
{ value: 'socks5://
|
|
31
|
-
{ value: 'http://
|
|
30
|
+
{ value: 'socks5://localhost:1080' },
|
|
31
|
+
{ value: 'http://localhost:8080' },
|
|
32
32
|
{ value: 'https://proxy.example.com:3128' }
|
|
33
33
|
]
|
|
34
34
|
|
|
@@ -180,7 +180,7 @@ export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig })
|
|
|
180
180
|
<Form.Item
|
|
181
181
|
label={e('proxy')}
|
|
182
182
|
name='proxyAI'
|
|
183
|
-
tooltip='Proxy for AI API requests (e.g., socks5://
|
|
183
|
+
tooltip='Proxy for AI API requests (e.g., socks5://localhost:1080)'
|
|
184
184
|
>
|
|
185
185
|
<AutoComplete
|
|
186
186
|
options={proxyOptions}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { useState, useMemo } from 'react'
|
|
2
1
|
import ReactMarkdown from 'react-markdown'
|
|
3
2
|
import { copy } from '../../common/clipboard'
|
|
4
3
|
import Link from '../common/external-link'
|
|
5
4
|
import { Tag } from 'antd'
|
|
6
|
-
import { CopyOutlined, PlayCircleOutlined
|
|
5
|
+
import { CopyOutlined, PlayCircleOutlined } from '@ant-design/icons'
|
|
7
6
|
import getBrand from './get-brand'
|
|
8
7
|
|
|
9
8
|
const e = window.translate
|
|
10
9
|
|
|
11
10
|
export default function AIOutput ({ item }) {
|
|
12
|
-
const [showFull, setShowFull] = useState(false)
|
|
13
11
|
const {
|
|
14
12
|
response,
|
|
15
13
|
baseURLAI
|
|
@@ -20,18 +18,6 @@ export default function AIOutput ({ item }) {
|
|
|
20
18
|
|
|
21
19
|
const { brand, brandUrl } = getBrand(baseURLAI)
|
|
22
20
|
|
|
23
|
-
const truncatedResponse = useMemo(() => {
|
|
24
|
-
if (!response) return ''
|
|
25
|
-
const codeBlockRegex = /```[\s\S]*?```/
|
|
26
|
-
const match = response.match(codeBlockRegex)
|
|
27
|
-
if (match) {
|
|
28
|
-
const index = match.index + match[0].length
|
|
29
|
-
return response.slice(0, index) + '\n\n... ...'
|
|
30
|
-
}
|
|
31
|
-
// If no code block found, show first 5 lines
|
|
32
|
-
return response.split('\n').slice(0, 5).join('\n') + '\n\n... ...'
|
|
33
|
-
}, [response])
|
|
34
|
-
|
|
35
21
|
const renderCode = (props) => {
|
|
36
22
|
const { node, className = '', children, ...rest } = props
|
|
37
23
|
const code = String(children).replace(/\n$/, '')
|
|
@@ -87,22 +73,8 @@ export default function AIOutput ({ item }) {
|
|
|
87
73
|
)
|
|
88
74
|
}
|
|
89
75
|
|
|
90
|
-
function renderShowMore () {
|
|
91
|
-
if (showFull) {
|
|
92
|
-
return null
|
|
93
|
-
}
|
|
94
|
-
return (
|
|
95
|
-
<span
|
|
96
|
-
onClick={() => setShowFull(true)}
|
|
97
|
-
className='mg1t pointer'
|
|
98
|
-
>
|
|
99
|
-
<DownCircleOutlined /> {e('fullContent')}
|
|
100
|
-
</span>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
76
|
const mdProps = {
|
|
105
|
-
children:
|
|
77
|
+
children: response,
|
|
106
78
|
components: {
|
|
107
79
|
code: renderCode
|
|
108
80
|
}
|
|
@@ -112,7 +84,6 @@ export default function AIOutput ({ item }) {
|
|
|
112
84
|
<div className='pd1'>
|
|
113
85
|
{renderBrand()}
|
|
114
86
|
<ReactMarkdown {...mdProps} />
|
|
115
|
-
{renderShowMore()}
|
|
116
87
|
</div>
|
|
117
88
|
)
|
|
118
89
|
}
|
|
@@ -29,9 +29,9 @@ export default function renderSshTunnels (props) {
|
|
|
29
29
|
const [initialValues] = useState({
|
|
30
30
|
sshTunnel: 'forwardRemoteToLocal',
|
|
31
31
|
sshTunnelLocalPort: 12200,
|
|
32
|
-
sshTunnelLocalHost: '
|
|
32
|
+
sshTunnelLocalHost: 'localhost',
|
|
33
33
|
sshTunnelRemotePort: 12300,
|
|
34
|
-
sshTunnelRemoteHost: '
|
|
34
|
+
sshTunnelRemoteHost: 'localhost'
|
|
35
35
|
})
|
|
36
36
|
const [isDynamic, setter] = useState(formData.sshTunnel === 'dynamicForward')
|
|
37
37
|
const [list, setList] = useState(formData.sshTunnels || [])
|
|
@@ -85,9 +85,9 @@ export default function renderSshTunnels (props) {
|
|
|
85
85
|
// sshTunnel is forwardRemoteToLocal or forwardLocalToRemote or dynamicForward
|
|
86
86
|
const {
|
|
87
87
|
sshTunnel,
|
|
88
|
-
sshTunnelRemoteHost = '
|
|
88
|
+
sshTunnelRemoteHost = 'localhost',
|
|
89
89
|
sshTunnelRemotePort = '',
|
|
90
|
-
sshTunnelLocalHost = '
|
|
90
|
+
sshTunnelLocalHost = 'localhost',
|
|
91
91
|
sshTunnelLocalPort = '',
|
|
92
92
|
name
|
|
93
93
|
} = item
|
|
@@ -63,7 +63,6 @@ export default class RdpSession extends PureComponent {
|
|
|
63
63
|
const { config } = this.props
|
|
64
64
|
const {
|
|
65
65
|
host,
|
|
66
|
-
port,
|
|
67
66
|
tokenElecterm,
|
|
68
67
|
server = ''
|
|
69
68
|
} = config
|
|
@@ -76,24 +75,27 @@ export default class RdpSession extends PureComponent {
|
|
|
76
75
|
const opts = clone({
|
|
77
76
|
term: terminalType || config.terminalType,
|
|
78
77
|
tabId: id,
|
|
78
|
+
uid: tab.id,
|
|
79
79
|
srcTabId: tab.id,
|
|
80
80
|
termType: type,
|
|
81
81
|
...tab
|
|
82
82
|
})
|
|
83
|
-
|
|
83
|
+
const r = await createTerm(opts)
|
|
84
84
|
.catch(err => {
|
|
85
85
|
const text = err.message
|
|
86
86
|
handleErr({ message: text })
|
|
87
87
|
})
|
|
88
|
-
pid = pid || ''
|
|
89
88
|
this.setState({
|
|
90
89
|
loading: false
|
|
91
90
|
})
|
|
92
|
-
if (!
|
|
91
|
+
if (!r) {
|
|
93
92
|
this.setStatus(statusMap.error)
|
|
94
93
|
return
|
|
95
94
|
}
|
|
96
95
|
this.setStatus(statusMap.success)
|
|
96
|
+
const {
|
|
97
|
+
pid, port
|
|
98
|
+
} = r
|
|
97
99
|
this.pid = pid
|
|
98
100
|
const hs = server
|
|
99
101
|
? server.replace(/https?:\/\//, '')
|
|
@@ -434,7 +434,7 @@ export default class SettingCommon extends Component {
|
|
|
434
434
|
/>
|
|
435
435
|
</div>
|
|
436
436
|
{
|
|
437
|
-
this.renderText('proxy', 'socks5://
|
|
437
|
+
this.renderText('proxy', 'socks5://localhost:1080')
|
|
438
438
|
}
|
|
439
439
|
</div>
|
|
440
440
|
)
|
|
@@ -669,6 +669,7 @@ export default class SettingCommon extends Component {
|
|
|
669
669
|
'useSystemTitleBar',
|
|
670
670
|
'confirmBeforeExit',
|
|
671
671
|
'hideIP',
|
|
672
|
+
'allowMultiInstance',
|
|
672
673
|
'debug'
|
|
673
674
|
].map(this.renderToggle)
|
|
674
675
|
}
|
|
@@ -3,6 +3,7 @@ import { refs } from '../common/ref'
|
|
|
3
3
|
import generate from '../../common/uid'
|
|
4
4
|
import runIdle from '../../common/run-idle'
|
|
5
5
|
import { Spin, Modal, notification } from 'antd'
|
|
6
|
+
import clone from '../../common/to-simple-obj'
|
|
6
7
|
import { isEqual, last, isNumber, some, isArray, pick, uniq, debounce } from 'lodash-es'
|
|
7
8
|
import FileSection from './file-item'
|
|
8
9
|
import resolve from '../../common/resolve'
|
|
@@ -10,6 +11,7 @@ import wait from '../../common/wait'
|
|
|
10
11
|
import isAbsPath from '../../common/is-absolute-path'
|
|
11
12
|
import classnames from 'classnames'
|
|
12
13
|
import sorterIndex from '../../common/index-sorter'
|
|
14
|
+
import { handleErr } from '../../common/fetch'
|
|
13
15
|
import { getLocalFileInfo, getRemoteFileInfo, getFolderFromFilePath } from './file-read'
|
|
14
16
|
import {
|
|
15
17
|
typeMap, maxSftpHistory, paneMap,
|
|
@@ -29,6 +31,7 @@ import memoizeOne from 'memoize-one'
|
|
|
29
31
|
import * as owner from './owner-list'
|
|
30
32
|
import AddressBar from './address-bar'
|
|
31
33
|
import getProxy from '../../common/get-proxy'
|
|
34
|
+
import { createTerm } from '../terminal/terminal-apis'
|
|
32
35
|
import './sftp.styl'
|
|
33
36
|
|
|
34
37
|
const e = window.translate
|
|
@@ -52,8 +55,7 @@ export default class Sftp extends Component {
|
|
|
52
55
|
this.id = 'sftp-' + this.props.tab.id
|
|
53
56
|
refs.add(this.id, this)
|
|
54
57
|
if (this.props.isFtp) {
|
|
55
|
-
this.
|
|
56
|
-
this.initData()
|
|
58
|
+
this.initFtpData()
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -100,6 +102,31 @@ export default class Sftp extends Component {
|
|
|
100
102
|
this.timer5 = null
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
initFtpData = async () => {
|
|
106
|
+
this.type = 'ftp'
|
|
107
|
+
const { tab } = this.props
|
|
108
|
+
const { id } = tab
|
|
109
|
+
const opts = clone({
|
|
110
|
+
tabId: id,
|
|
111
|
+
uid: tab.id,
|
|
112
|
+
srcTabId: tab.id,
|
|
113
|
+
termType: 'ftp',
|
|
114
|
+
...tab
|
|
115
|
+
})
|
|
116
|
+
const r = await createTerm(opts)
|
|
117
|
+
.catch(err => {
|
|
118
|
+
const text = err.message
|
|
119
|
+
handleErr({ message: text })
|
|
120
|
+
})
|
|
121
|
+
if (!r) {
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
const {
|
|
125
|
+
port
|
|
126
|
+
} = r
|
|
127
|
+
this.initData(undefined, port)
|
|
128
|
+
}
|
|
129
|
+
|
|
103
130
|
directions = [
|
|
104
131
|
'desc',
|
|
105
132
|
'asc'
|
|
@@ -427,8 +454,9 @@ export default class Sftp extends Component {
|
|
|
427
454
|
this[type + 'Dom'].onPaste()
|
|
428
455
|
}
|
|
429
456
|
|
|
430
|
-
initData = (terminalId) => {
|
|
457
|
+
initData = (terminalId, port) => {
|
|
431
458
|
this.terminalId = terminalId
|
|
459
|
+
this.port = port
|
|
432
460
|
if (this.shouldRenderRemote()) {
|
|
433
461
|
this.initRemoteAll()
|
|
434
462
|
}
|
|
@@ -592,7 +620,7 @@ export default class Sftp extends Component {
|
|
|
592
620
|
let sftp = this.sftp
|
|
593
621
|
try {
|
|
594
622
|
if (!this.sftp) {
|
|
595
|
-
sftp = await Client(this.terminalId, this.type)
|
|
623
|
+
sftp = await Client(this.terminalId, this.type, this.port)
|
|
596
624
|
if (!sftp) {
|
|
597
625
|
return
|
|
598
626
|
}
|
|
@@ -77,9 +77,12 @@ export default class ContextMenu extends PureComponent {
|
|
|
77
77
|
if (type === 'hr') {
|
|
78
78
|
return <hr />
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
let baseCls = 'context-item'
|
|
81
81
|
if (module && this.modules[module]) {
|
|
82
82
|
const Mod = this.modules[module]
|
|
83
|
+
if (module === 'Zoom') {
|
|
84
|
+
baseCls = 'context-item zoom-item'
|
|
85
|
+
}
|
|
83
86
|
return (
|
|
84
87
|
<div className={baseCls}>
|
|
85
88
|
<Mod {...this.props} />
|
|
@@ -350,10 +350,10 @@ class Tab extends Component {
|
|
|
350
350
|
const list = sshTunnelResults.map(({ sshTunnel: obj, error }, i) => {
|
|
351
351
|
const {
|
|
352
352
|
sshTunnelLocalPort,
|
|
353
|
-
sshTunnelRemoteHost = '
|
|
353
|
+
sshTunnelRemoteHost = 'localhost',
|
|
354
354
|
sshTunnelRemotePort,
|
|
355
355
|
sshTunnel,
|
|
356
|
-
sshTunnelLocalHost = '
|
|
356
|
+
sshTunnelLocalHost = 'localhost',
|
|
357
357
|
name
|
|
358
358
|
} = obj
|
|
359
359
|
let tunnel
|
|
@@ -63,14 +63,14 @@ export default class TermSearch extends PureComponent {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
prev = (
|
|
66
|
+
prev = () => {
|
|
67
67
|
const {
|
|
68
68
|
activeTabId,
|
|
69
69
|
termSearchOptions
|
|
70
70
|
} = this.props
|
|
71
71
|
refs.get('term-' + activeTabId)
|
|
72
72
|
?.searchPrev(
|
|
73
|
-
|
|
73
|
+
this.props.termSearch,
|
|
74
74
|
copy(termSearchOptions)
|
|
75
75
|
)
|
|
76
76
|
}
|
|
@@ -1105,8 +1105,8 @@ clear\r`
|
|
|
1105
1105
|
this.bufferMode = buf.type
|
|
1106
1106
|
}
|
|
1107
1107
|
|
|
1108
|
-
buildWsUrl = () => {
|
|
1109
|
-
const { host,
|
|
1108
|
+
buildWsUrl = (port) => {
|
|
1109
|
+
const { host, tokenElecterm } = this.props.config
|
|
1110
1110
|
const { id } = this.props.tab
|
|
1111
1111
|
if (window.et.buildWsUrl) {
|
|
1112
1112
|
return window.et.buildWsUrl(
|
|
@@ -1172,13 +1172,12 @@ clear\r`
|
|
|
1172
1172
|
? typeMap.remote
|
|
1173
1173
|
: typeMap.local
|
|
1174
1174
|
})
|
|
1175
|
-
|
|
1175
|
+
const r = await createTerm(opts)
|
|
1176
1176
|
.catch(err => {
|
|
1177
1177
|
const text = err.message
|
|
1178
1178
|
handleErr({ message: text })
|
|
1179
1179
|
})
|
|
1180
|
-
|
|
1181
|
-
if (r.includes('fail')) {
|
|
1180
|
+
if (typeof r === 'string' && r.includes('fail')) {
|
|
1182
1181
|
return this.promote()
|
|
1183
1182
|
}
|
|
1184
1183
|
if (savePassword) {
|
|
@@ -1191,11 +1190,12 @@ clear\r`
|
|
|
1191
1190
|
this.setStatus(statusMap.error)
|
|
1192
1191
|
return
|
|
1193
1192
|
}
|
|
1193
|
+
this.port = r.port
|
|
1194
1194
|
this.setStatus(statusMap.success)
|
|
1195
|
-
refs.get('sftp-' + id)?.initData(id)
|
|
1195
|
+
refs.get('sftp-' + id)?.initData(id, r.port)
|
|
1196
1196
|
term.pid = id
|
|
1197
1197
|
this.pid = id
|
|
1198
|
-
const wsUrl = this.buildWsUrl()
|
|
1198
|
+
const wsUrl = this.buildWsUrl(r.port)
|
|
1199
1199
|
const socket = new WebSocket(wsUrl)
|
|
1200
1200
|
socket.onclose = this.oncloseSocket
|
|
1201
1201
|
socket.onerror = this.onerrorSocket
|
|
@@ -385,6 +385,7 @@ export default class ItemListTree extends Component {
|
|
|
385
385
|
if (tar) {
|
|
386
386
|
target = tar
|
|
387
387
|
}
|
|
388
|
+
console.log('tar', target, tar)
|
|
388
389
|
const dataDragged = e.dataTransfer.getData('idDragged')
|
|
389
390
|
const [idDragged, pidDrags, isGroupDragged] = dataDragged.split('@')
|
|
390
391
|
const isGroupDrag = isGroupDragged === 'true'
|
|
@@ -395,7 +396,6 @@ export default class ItemListTree extends Component {
|
|
|
395
396
|
const pidDrops = target.getAttribute('data-parent-id') || ''
|
|
396
397
|
const pidDropsArr = pidDrops.split('#')
|
|
397
398
|
const pidDrop = pidDropsArr[pidDropsArr.length - 1]
|
|
398
|
-
|
|
399
399
|
// can not drag item to its own children
|
|
400
400
|
if (
|
|
401
401
|
(idDragged === 'default' &&
|
|
@@ -404,7 +404,8 @@ export default class ItemListTree extends Component {
|
|
|
404
404
|
pidDrop &&
|
|
405
405
|
pidDrags !== pidDrops &&
|
|
406
406
|
pidDrops.includes(idDragged)
|
|
407
|
-
)
|
|
407
|
+
) ||
|
|
408
|
+
idDragged === idDrop
|
|
408
409
|
) {
|
|
409
410
|
return
|
|
410
411
|
}
|
|
@@ -69,7 +69,6 @@ export default class VncSession extends RdpSession {
|
|
|
69
69
|
const { config } = this.props
|
|
70
70
|
const {
|
|
71
71
|
host,
|
|
72
|
-
port,
|
|
73
72
|
tokenElecterm,
|
|
74
73
|
server = ''
|
|
75
74
|
} = config
|
|
@@ -86,25 +85,27 @@ export default class VncSession extends RdpSession {
|
|
|
86
85
|
const opts = clone({
|
|
87
86
|
term: terminalType || config.terminalType,
|
|
88
87
|
tabId: id,
|
|
88
|
+
uid: tab.id,
|
|
89
89
|
srcTabId: tab.id,
|
|
90
90
|
termType: type,
|
|
91
91
|
...tab
|
|
92
92
|
})
|
|
93
|
-
|
|
93
|
+
const r = await createTerm(opts)
|
|
94
94
|
.catch(err => {
|
|
95
95
|
const text = err.message
|
|
96
96
|
handleErr({ message: text })
|
|
97
97
|
})
|
|
98
|
-
pid = pid || ''
|
|
99
98
|
this.setState({
|
|
100
99
|
loading: false
|
|
101
100
|
})
|
|
102
|
-
if (!
|
|
101
|
+
if (!r) {
|
|
103
102
|
this.setStatus(statusMap.error)
|
|
104
103
|
return
|
|
105
104
|
}
|
|
106
105
|
this.setStatus(statusMap.success)
|
|
106
|
+
const { pid, port } = r
|
|
107
107
|
this.pid = pid
|
|
108
|
+
this.port = port
|
|
108
109
|
const hs = server
|
|
109
110
|
? server.replace(/https?:\/\//, '')
|
|
110
111
|
: `${host}:${port}`
|