@electerm/electerm-react 1.50.66 → 1.51.0
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/constants.js +0 -13
- package/client/common/is-color-dark.js +33 -0
- package/client/components/footer/batch-input.jsx +3 -2
- package/client/components/layout/layout-item.jsx +1 -23
- package/client/components/layout/layout.jsx +55 -19
- package/client/components/layout/layouts.jsx +2 -10
- package/client/components/layout/pixed.js +9 -0
- package/client/components/main/css-overwrite.jsx +2 -2
- package/client/components/quick-commands/quick-commands-select.jsx +1 -1
- package/client/components/session/session.jsx +100 -22
- package/client/components/session/session.styl +9 -5
- package/client/components/session/sessions.jsx +45 -451
- package/client/components/setting-panel/setting-modal.jsx +2 -1
- package/client/components/sftp/sftp-entry.jsx +1 -1
- package/client/components/shortcuts/shortcut-control.jsx +18 -6
- package/client/components/sidebar/info-modal.jsx +8 -1
- package/client/components/sidebar/side-panel.jsx +1 -1
- package/client/components/tabs/index.jsx +70 -9
- package/client/components/tabs/on-tab-drop.js +25 -0
- package/client/components/tabs/tab.jsx +67 -119
- package/client/components/tabs/tabs.styl +12 -1
- package/client/components/terminal/index.jsx +11 -6
- package/client/components/terminal/terminal-interactive.jsx +1 -7
- package/client/components/terminal/terminal.styl +1 -2
- package/client/components/theme/theme-form.jsx +1 -1
- package/client/components/theme/theme-list-item.jsx +148 -0
- package/client/components/theme/theme-list.jsx +18 -72
- package/client/store/common.js +0 -7
- package/client/store/index.js +5 -39
- package/client/store/init-state.js +1 -1
- package/client/store/tab.js +338 -86
- package/client/store/watch.js +1 -6
- package/package.json +1 -1
|
@@ -24,8 +24,9 @@ import {
|
|
|
24
24
|
TwoRowsRightIcon,
|
|
25
25
|
TwoColumnsBottomIcon
|
|
26
26
|
} from '../icons/split-icons'
|
|
27
|
-
import { Dropdown, Popover } from 'antd'
|
|
27
|
+
import { Dropdown, Popover, Button } from 'antd'
|
|
28
28
|
import Tab from './tab'
|
|
29
|
+
import LogoElem from '../common/logo-elem.jsx'
|
|
29
30
|
import './tabs.styl'
|
|
30
31
|
import {
|
|
31
32
|
tabWidth,
|
|
@@ -71,7 +72,7 @@ export default class Tabs extends React.Component {
|
|
|
71
72
|
|
|
72
73
|
componentDidUpdate (prevProps) {
|
|
73
74
|
if (
|
|
74
|
-
prevProps.
|
|
75
|
+
prevProps.currentBatchTabId !== this.props.currentBatchTabId ||
|
|
75
76
|
prevProps.width !== this.props.width ||
|
|
76
77
|
(prevProps.tabs || []).length !== (this.props.tabs || []).length
|
|
77
78
|
) {
|
|
@@ -88,6 +89,14 @@ export default class Tabs extends React.Component {
|
|
|
88
89
|
runIdle(() => this.setState(...args))
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
handleNewTab = () => {
|
|
93
|
+
window.store.addTab(undefined, undefined, this.props.batch)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
handleNewSsh = () => {
|
|
97
|
+
window.store.onNewSsh()
|
|
98
|
+
}
|
|
99
|
+
|
|
91
100
|
onEvent = (e) => {
|
|
92
101
|
const {
|
|
93
102
|
action,
|
|
@@ -204,16 +213,22 @@ export default class Tabs extends React.Component {
|
|
|
204
213
|
if (!e.target.className.includes('tabs-wrapper')) {
|
|
205
214
|
return
|
|
206
215
|
}
|
|
207
|
-
|
|
216
|
+
window.store.addTab(
|
|
217
|
+
undefined, undefined,
|
|
218
|
+
this.props.batch
|
|
219
|
+
)
|
|
208
220
|
}
|
|
209
221
|
|
|
210
222
|
handleTabAdd = () => {
|
|
211
|
-
|
|
223
|
+
window.store.addTab(
|
|
224
|
+
undefined, undefined,
|
|
225
|
+
this.props.batch
|
|
226
|
+
)
|
|
212
227
|
}
|
|
213
228
|
|
|
214
229
|
adjustScroll = () => {
|
|
215
|
-
const { tabs,
|
|
216
|
-
const index = findIndex(tabs, t => t.id ===
|
|
230
|
+
const { tabs, currentBatchTabId, batch } = this.props
|
|
231
|
+
const index = findIndex(tabs, t => t.id === currentBatchTabId)
|
|
217
232
|
const tabsDomWith = Array.from(
|
|
218
233
|
document.querySelectorAll(`.v${batch + 1} .tab`)
|
|
219
234
|
).slice(0, index + 2).reduce((prev, c) => {
|
|
@@ -260,7 +275,7 @@ export default class Tabs extends React.Component {
|
|
|
260
275
|
|
|
261
276
|
handleClickMenu = ({ key }) => {
|
|
262
277
|
const id = key.split('##')[1]
|
|
263
|
-
this.props.
|
|
278
|
+
window.store['currentTabId' + this.props.batch] = id
|
|
264
279
|
}
|
|
265
280
|
|
|
266
281
|
handleChangeLayout = ({ key }) => {
|
|
@@ -312,6 +327,7 @@ export default class Tabs extends React.Component {
|
|
|
312
327
|
<Popover
|
|
313
328
|
content={this.renderMenus()}
|
|
314
329
|
onOpenChange={this.handleOpenChange}
|
|
330
|
+
placement='bottomRight'
|
|
315
331
|
>
|
|
316
332
|
<PlusOutlined
|
|
317
333
|
title={e('openNewTerm')}
|
|
@@ -421,7 +437,8 @@ export default class Tabs extends React.Component {
|
|
|
421
437
|
tab,
|
|
422
438
|
isLast,
|
|
423
439
|
receiveData: receiveDataTabId === tab.id,
|
|
424
|
-
openContextMenu: onContextMenuTabId === tab.id
|
|
440
|
+
openContextMenu: onContextMenuTabId === tab.id,
|
|
441
|
+
tabIndex: i
|
|
425
442
|
}
|
|
426
443
|
if (this.state.contextFuncTabId === tab.id) {
|
|
427
444
|
tabProps.contextFunc = this.state.contextFunc
|
|
@@ -522,7 +539,7 @@ export default class Tabs extends React.Component {
|
|
|
522
539
|
return null
|
|
523
540
|
}
|
|
524
541
|
|
|
525
|
-
|
|
542
|
+
renderTabs () {
|
|
526
543
|
const { overflow } = this.state
|
|
527
544
|
return (
|
|
528
545
|
<div className='tabs' ref={this.tabsRef} onContextMenu={this.handleContextMenu}>
|
|
@@ -538,4 +555,48 @@ export default class Tabs extends React.Component {
|
|
|
538
555
|
</div>
|
|
539
556
|
)
|
|
540
557
|
}
|
|
558
|
+
|
|
559
|
+
renderNoSession = () => {
|
|
560
|
+
const props = {
|
|
561
|
+
style: {
|
|
562
|
+
height: this.props.height + 'px'
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return (
|
|
566
|
+
<div className='no-sessions electerm-logo-bg' {...props}>
|
|
567
|
+
<Button
|
|
568
|
+
onClick={this.handleNewTab}
|
|
569
|
+
size='large'
|
|
570
|
+
className='mg1r mg1b add-new-tab-btn'
|
|
571
|
+
>
|
|
572
|
+
{e('newTab')}
|
|
573
|
+
</Button>
|
|
574
|
+
<Button
|
|
575
|
+
onClick={this.handleNewSsh}
|
|
576
|
+
size='large'
|
|
577
|
+
className='mg1r mg1b'
|
|
578
|
+
>
|
|
579
|
+
{e('newBookmark')}
|
|
580
|
+
</Button>
|
|
581
|
+
<div className='pd3'>
|
|
582
|
+
<LogoElem />
|
|
583
|
+
</div>
|
|
584
|
+
</div>
|
|
585
|
+
)
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
render () {
|
|
589
|
+
const {
|
|
590
|
+
tabs
|
|
591
|
+
} = this.props
|
|
592
|
+
if (!tabs || !tabs.length) {
|
|
593
|
+
return (
|
|
594
|
+
<div className='tabs-outer'>
|
|
595
|
+
{this.renderTabs()}
|
|
596
|
+
{this.renderNoSession()}
|
|
597
|
+
</div>
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
return this.renderTabs()
|
|
601
|
+
}
|
|
541
602
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default function onDrop (e, batch, onDropElem) {
|
|
2
|
+
e.preventDefault()
|
|
3
|
+
const { target } = e
|
|
4
|
+
if (!target) {
|
|
5
|
+
return
|
|
6
|
+
}
|
|
7
|
+
let currentElement = target
|
|
8
|
+
while (currentElement) {
|
|
9
|
+
if (currentElement.classList && currentElement.classList.contains('tab')) {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
currentElement = currentElement.parentElement
|
|
13
|
+
}
|
|
14
|
+
const fromTab = JSON.parse(e.dataTransfer.getData('fromFile'))
|
|
15
|
+
if (!onDropElem || !fromTab || fromTab.batch === batch) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
const { store } = window
|
|
19
|
+
const { tabs } = store
|
|
20
|
+
const t = tabs.find(t => t.id === fromTab.id)
|
|
21
|
+
if (!t) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
t.batch = batch
|
|
25
|
+
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Component } from 'react'
|
|
6
|
-
import runIdle from '../../common/run-idle'
|
|
7
6
|
import {
|
|
8
7
|
CloseOutlined,
|
|
9
8
|
Loading3QuartersOutlined,
|
|
@@ -11,8 +10,7 @@ import {
|
|
|
11
10
|
} from '@ant-design/icons'
|
|
12
11
|
import { Tooltip, message } from 'antd'
|
|
13
12
|
import classnames from 'classnames'
|
|
14
|
-
import
|
|
15
|
-
import { isEqual, findIndex, some, pick } from 'lodash-es'
|
|
13
|
+
import { findIndex, pick } from 'lodash-es'
|
|
16
14
|
import Input from '../common/input-auto-focus'
|
|
17
15
|
import createName from '../../common/create-title'
|
|
18
16
|
import { addClass, removeClass } from '../../common/class'
|
|
@@ -26,24 +24,12 @@ const onDragCls = 'ondrag-tab'
|
|
|
26
24
|
const onDragOverCls = 'dragover-tab'
|
|
27
25
|
|
|
28
26
|
class Tab extends Component {
|
|
29
|
-
constructor (props) {
|
|
30
|
-
super(props)
|
|
31
|
-
this.state = {
|
|
32
|
-
tab: copy(props.tab)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
componentDidMount () {
|
|
37
|
-
this.dom = document.getElementById('tab-' + this.
|
|
28
|
+
this.dom = document.getElementById('tab-' + this.props.tab.id)
|
|
38
29
|
window.addEventListener('message', this.onEvent)
|
|
39
30
|
}
|
|
40
31
|
|
|
41
32
|
componentDidUpdate (prevProps) {
|
|
42
|
-
if (!isEqual(prevProps.tab, this.props.tab)) {
|
|
43
|
-
this.setState({
|
|
44
|
-
tab: copy(this.props.tab)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
33
|
if (this.props.openContextMenu && !prevProps.openContextMenu) {
|
|
48
34
|
this.handleContextMenu()
|
|
49
35
|
}
|
|
@@ -56,35 +42,27 @@ class Tab extends Component {
|
|
|
56
42
|
this.dom = null
|
|
57
43
|
}
|
|
58
44
|
|
|
59
|
-
shouldComponentUpdate (nextProps
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// compare only the relevant props
|
|
82
|
-
return !isEqual(pick(prevProps, pickKeys), pick(nextProps, pickKeys))
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
modifier = (...args) => {
|
|
86
|
-
runIdle(() => this.setState(...args))
|
|
87
|
-
}
|
|
45
|
+
// shouldComponentUpdate (nextProps) {
|
|
46
|
+
// return this.shouldUpdate(this.props, nextProps)
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
// shouldUpdate = (prevProps, nextProps) => {
|
|
50
|
+
// // todo currentTabId still need improve
|
|
51
|
+
// const pickKeys = [
|
|
52
|
+
// 'currentTabId',
|
|
53
|
+
// 'height',
|
|
54
|
+
// 'isLast',
|
|
55
|
+
// 'isMaximized',
|
|
56
|
+
// 'config',
|
|
57
|
+
// 'tab',
|
|
58
|
+
// 'width',
|
|
59
|
+
// 'openContextMenu',
|
|
60
|
+
// 'contextFunc'
|
|
61
|
+
// ]
|
|
62
|
+
|
|
63
|
+
// // compare only the relevant props
|
|
64
|
+
// return !isEqual(pick(prevProps, pickKeys), pick(nextProps, pickKeys))
|
|
65
|
+
// }
|
|
88
66
|
|
|
89
67
|
clearCls = () => {
|
|
90
68
|
document.querySelectorAll('.' + onDragOverCls).forEach((d) => {
|
|
@@ -93,11 +71,7 @@ class Tab extends Component {
|
|
|
93
71
|
}
|
|
94
72
|
|
|
95
73
|
handleClick = (e) => {
|
|
96
|
-
|
|
97
|
-
onChangeTabId
|
|
98
|
-
} = this.props
|
|
99
|
-
const { id } = this.state.tab
|
|
100
|
-
onChangeTabId(id)
|
|
74
|
+
window.store.clickTab(this.props.tab.id, this.props.batch)
|
|
101
75
|
}
|
|
102
76
|
|
|
103
77
|
onDrag = () => {
|
|
@@ -131,7 +105,7 @@ class Tab extends Component {
|
|
|
131
105
|
onDragStart = e => {
|
|
132
106
|
// debug('ondragstart')
|
|
133
107
|
// debug(e.target)
|
|
134
|
-
e.dataTransfer.setData('fromFile', JSON.stringify(this.
|
|
108
|
+
e.dataTransfer.setData('fromFile', JSON.stringify(this.props.tab))
|
|
135
109
|
// e.effectAllowed = 'copyMove'
|
|
136
110
|
}
|
|
137
111
|
|
|
@@ -141,45 +115,49 @@ class Tab extends Component {
|
|
|
141
115
|
if (!target) {
|
|
142
116
|
return
|
|
143
117
|
}
|
|
144
|
-
|
|
118
|
+
|
|
145
119
|
const fromTab = JSON.parse(e.dataTransfer.getData('fromFile'))
|
|
146
120
|
const onDropTab = document.querySelector('.' + onDragOverCls)
|
|
147
121
|
if (!onDropTab || !fromTab) {
|
|
148
122
|
return
|
|
149
123
|
}
|
|
124
|
+
|
|
150
125
|
const dropId = onDropTab.getAttribute('data-id')
|
|
151
126
|
if (!dropId || dropId === fromTab.id) {
|
|
152
127
|
return
|
|
153
128
|
}
|
|
129
|
+
|
|
154
130
|
const { id } = fromTab
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (indexFrom
|
|
131
|
+
const storeTabs = window.store.tabs
|
|
132
|
+
const indexFrom = findIndex(storeTabs, t => t.id === id)
|
|
133
|
+
let indexDrop = findIndex(storeTabs, t => t.id === dropId)
|
|
134
|
+
|
|
135
|
+
if (indexFrom >= 0 && indexDrop >= 0) {
|
|
136
|
+
const targetTab = storeTabs[indexDrop]
|
|
160
137
|
const fromBatch = fromTab.batch
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
138
|
+
|
|
139
|
+
// Handle currentTab change if needed
|
|
140
|
+
if (window.store[`currentTabId${fromBatch}`] === id && fromBatch !== targetTab.batch) {
|
|
141
|
+
// Find next tab in the same batch
|
|
142
|
+
const nextTab = storeTabs.find((t, i) =>
|
|
143
|
+
i !== indexFrom && t.batch === fromBatch
|
|
144
|
+
)
|
|
145
|
+
window.store[`currentTabId${fromBatch}`] = nextTab ? nextTab.id : ''
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Reorder tabs and update batch
|
|
149
|
+
const [tab] = storeTabs.splice(indexFrom, 1)
|
|
150
|
+
tab.batch = targetTab.batch // Update the batch to match target tab's batch
|
|
151
|
+
if (indexFrom < indexDrop) {
|
|
170
152
|
indexDrop = indexDrop - 1
|
|
171
153
|
}
|
|
172
|
-
|
|
154
|
+
storeTabs.splice(indexDrop, 0, tab)
|
|
155
|
+
window.store.focus()
|
|
173
156
|
}
|
|
174
|
-
tabs.splice(indexDrop, 0, fromTab)
|
|
175
|
-
this.props.setTabs(
|
|
176
|
-
tabs
|
|
177
|
-
)
|
|
178
|
-
window.store.focus()
|
|
179
157
|
}
|
|
180
158
|
|
|
181
159
|
handleReloadTab = async () => {
|
|
182
|
-
|
|
160
|
+
window.store.reloadTab(this.props.tab.id)
|
|
183
161
|
}
|
|
184
162
|
|
|
185
163
|
onDragEnd = e => {
|
|
@@ -189,17 +167,17 @@ class Tab extends Component {
|
|
|
189
167
|
}
|
|
190
168
|
|
|
191
169
|
handleClose = () => {
|
|
192
|
-
|
|
170
|
+
window.store.delTab(this.props.tab.id)
|
|
193
171
|
}
|
|
194
172
|
|
|
195
173
|
handleDup = () => {
|
|
196
|
-
|
|
197
|
-
this.
|
|
174
|
+
window.store.duplicateTab(
|
|
175
|
+
this.props.tab.id
|
|
198
176
|
)
|
|
199
177
|
}
|
|
200
178
|
|
|
201
179
|
cloneToNextLayout = () => {
|
|
202
|
-
window.store.cloneToNextLayout()
|
|
180
|
+
window.store.cloneToNextLayout(this.props.tab)
|
|
203
181
|
}
|
|
204
182
|
|
|
205
183
|
newTab = () => {
|
|
@@ -207,67 +185,42 @@ class Tab extends Component {
|
|
|
207
185
|
}
|
|
208
186
|
|
|
209
187
|
doRename = () => {
|
|
210
|
-
const tab =
|
|
188
|
+
const { tab } = this.props
|
|
211
189
|
tab.titleTemp = tab.title || ''
|
|
212
190
|
tab.isEditting = true
|
|
213
|
-
this.setState({
|
|
214
|
-
tab
|
|
215
|
-
})
|
|
216
191
|
}
|
|
217
192
|
|
|
218
193
|
handleBlur = () => {
|
|
219
|
-
const tab =
|
|
220
|
-
const { titleTemp, title,
|
|
194
|
+
const { tab } = this.props
|
|
195
|
+
const { titleTemp, title, host } = tab
|
|
221
196
|
if (!titleTemp && !host) {
|
|
222
197
|
return message.warning(e('titleEmptyWarn'))
|
|
223
198
|
}
|
|
224
199
|
delete tab.isEditting
|
|
225
200
|
if (title === titleTemp) {
|
|
226
201
|
delete tab.titleTemp
|
|
227
|
-
return this.setState({
|
|
228
|
-
tab
|
|
229
|
-
})
|
|
230
202
|
}
|
|
231
|
-
|
|
232
|
-
tab
|
|
233
|
-
})
|
|
234
|
-
this.props.editTab(id, { title: titleTemp })
|
|
203
|
+
tab.title = titleTemp
|
|
235
204
|
}
|
|
236
205
|
|
|
237
206
|
handleChange = e => {
|
|
207
|
+
const { tab } = this.props
|
|
238
208
|
const titleTemp = e.target.value
|
|
239
|
-
const tab = copy(this.state.tab)
|
|
240
209
|
tab.titleTemp = titleTemp
|
|
241
|
-
this.setState({
|
|
242
|
-
tab
|
|
243
|
-
})
|
|
244
210
|
}
|
|
245
211
|
|
|
246
212
|
closeOther = () => {
|
|
247
|
-
|
|
248
|
-
onChangeTabId(this.props.tab.id)
|
|
249
|
-
setTabs([this.props.tab])
|
|
213
|
+
window.store.closeOtherTabs(this.props.tab.id)
|
|
250
214
|
}
|
|
251
215
|
|
|
252
216
|
closeTabsRight = () => {
|
|
253
|
-
|
|
254
|
-
tab, currentTabId,
|
|
255
|
-
onChangeTabId,
|
|
256
|
-
setTabs
|
|
257
|
-
} = this.props
|
|
258
|
-
let tabs = copy(this.props.tabs)
|
|
259
|
-
const index = findIndex(tabs, t => t.id === tab.id)
|
|
260
|
-
tabs = tabs.slice(0, index + 1)
|
|
261
|
-
if (!some(tabs, t => t.id === currentTabId)) {
|
|
262
|
-
onChangeTabId(tabs[0].id)
|
|
263
|
-
}
|
|
264
|
-
setTabs(tabs)
|
|
217
|
+
window.store.closeTabsRight(this.props.tab.id)
|
|
265
218
|
}
|
|
266
219
|
|
|
267
220
|
renderContext = () => {
|
|
268
|
-
const { tabs, tab } = this.props
|
|
221
|
+
const { tabs, tab, tabIndex } = this.props
|
|
269
222
|
const len = tabs.length
|
|
270
|
-
const index =
|
|
223
|
+
const index = tabIndex
|
|
271
224
|
const noRight = index >= len - 1
|
|
272
225
|
const isSshConfig = tab.type === terminalSshConfigType
|
|
273
226
|
const res = []
|
|
@@ -332,7 +285,7 @@ class Tab extends Component {
|
|
|
332
285
|
left: rect.left,
|
|
333
286
|
top: rect.top + 20
|
|
334
287
|
},
|
|
335
|
-
id: this.
|
|
288
|
+
id: this.props.tab.id
|
|
336
289
|
})
|
|
337
290
|
}
|
|
338
291
|
|
|
@@ -352,7 +305,6 @@ class Tab extends Component {
|
|
|
352
305
|
)
|
|
353
306
|
}
|
|
354
307
|
|
|
355
|
-
// sshTunnelResults is a array of { sshTunnel, error? }, sshTunnel is a object has props of sshTunnelLocalPort, sshTunnelRemoteHost, sshTunnelRemotePort, sshTunnel, sshTunnelLocalHost, should build sshTunnel string from sshTunnel object, when error exist, this string should start with "error:", return title and sshTunnelResults list in react element.
|
|
356
308
|
renderTitle = (sshTunnelResults, title) => {
|
|
357
309
|
const list = sshTunnelResults.map(({ sshTunnel: obj, error }, i) => {
|
|
358
310
|
const {
|
|
@@ -396,11 +348,7 @@ class Tab extends Component {
|
|
|
396
348
|
}
|
|
397
349
|
|
|
398
350
|
render () {
|
|
399
|
-
const {
|
|
400
|
-
currentTabId
|
|
401
|
-
} = this.props
|
|
402
|
-
const { isLast, terminalOnData } = this.props
|
|
403
|
-
const { tab } = this.state
|
|
351
|
+
const { isLast, terminalOnData, tab, currentBatchTabId } = this.props
|
|
404
352
|
const {
|
|
405
353
|
id,
|
|
406
354
|
isEditting,
|
|
@@ -408,7 +356,7 @@ class Tab extends Component {
|
|
|
408
356
|
isTransporting,
|
|
409
357
|
sshTunnelResults
|
|
410
358
|
} = tab
|
|
411
|
-
const active = id ===
|
|
359
|
+
const active = id === currentBatchTabId
|
|
412
360
|
const cls = classnames(
|
|
413
361
|
`tab-${id}`,
|
|
414
362
|
'tab',
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
height 36px
|
|
5
5
|
overflow hidden
|
|
6
6
|
background main-dark
|
|
7
|
+
z-index 12
|
|
7
8
|
::-webkit-scrollbar
|
|
8
9
|
width 0
|
|
9
10
|
display none
|
|
@@ -212,4 +213,14 @@
|
|
|
212
213
|
display none
|
|
213
214
|
.tab-title-tag
|
|
214
215
|
margin-right 5px
|
|
215
|
-
font-size 14px
|
|
216
|
+
font-size 14px
|
|
217
|
+
.no-sessions
|
|
218
|
+
background main-dark
|
|
219
|
+
text-align center
|
|
220
|
+
padding 50px 0
|
|
221
|
+
position absolute
|
|
222
|
+
top 36px
|
|
223
|
+
left 0
|
|
224
|
+
right 0
|
|
225
|
+
bottom 0
|
|
226
|
+
z-index 11
|
|
@@ -86,8 +86,8 @@ class Term extends Component {
|
|
|
86
86
|
|
|
87
87
|
componentDidUpdate (prevProps) {
|
|
88
88
|
const shouldChange = (
|
|
89
|
-
prevProps.
|
|
90
|
-
this.props.tab.id === this.props.
|
|
89
|
+
prevProps.currentBatchTabId !== this.props.currentBatchTabId &&
|
|
90
|
+
this.props.tab.id === this.props.currentBatchTabId &&
|
|
91
91
|
this.props.pane === paneMap.terminal
|
|
92
92
|
) || (
|
|
93
93
|
this.props.pane !== prevProps.pane &&
|
|
@@ -120,7 +120,10 @@ class Term extends Component {
|
|
|
120
120
|
prevProps.themeConfig
|
|
121
121
|
)
|
|
122
122
|
if (themeChanged) {
|
|
123
|
-
this.term.options.theme =
|
|
123
|
+
this.term.options.theme = {
|
|
124
|
+
...deepCopy(this.props.themeConfig),
|
|
125
|
+
background: 'rgba(0,0,0,0)'
|
|
126
|
+
}
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
const sftpPathFollowSshChanged = !isEqual(
|
|
@@ -268,7 +271,7 @@ clear\r`
|
|
|
268
271
|
}
|
|
269
272
|
|
|
270
273
|
isActiveTerminal = () => {
|
|
271
|
-
return this.props.tab.id === this.props.
|
|
274
|
+
return this.props.tab.id === this.props.currentBatchTabId &&
|
|
272
275
|
this.props.pane === paneMap.terminal
|
|
273
276
|
}
|
|
274
277
|
|
|
@@ -995,12 +998,14 @@ clear\r`
|
|
|
995
998
|
initTerminal = async () => {
|
|
996
999
|
// let {password, privateKey, host} = this.props.tab
|
|
997
1000
|
const { themeConfig, tab = {}, config = {} } = this.props
|
|
1001
|
+
const tc = deepCopy(themeConfig)
|
|
1002
|
+
tc.background = 'rgba(0,0,0,0)'
|
|
998
1003
|
const term = new Terminal({
|
|
999
1004
|
allowProposedApi: true,
|
|
1000
1005
|
scrollback: config.scrollback,
|
|
1001
1006
|
rightClickSelectsWord: config.rightClickSelectsWord || false,
|
|
1002
1007
|
fontFamily: tab.fontFamily || config.fontFamily,
|
|
1003
|
-
theme:
|
|
1008
|
+
theme: tc,
|
|
1004
1009
|
allowTransparency: true,
|
|
1005
1010
|
// lineHeight: 1.2,
|
|
1006
1011
|
wordSeparator: config.terminalWordSeparator,
|
|
@@ -1230,7 +1235,7 @@ clear\r`
|
|
|
1230
1235
|
}
|
|
1231
1236
|
|
|
1232
1237
|
onResize = throttle(() => {
|
|
1233
|
-
const cid = this.props.
|
|
1238
|
+
const cid = this.props.currentBatchTabId
|
|
1234
1239
|
const tid = this.props.tab?.id
|
|
1235
1240
|
if (
|
|
1236
1241
|
this.props.tab.status === statusMap.success &&
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react'
|
|
6
6
|
import { Modal, Form, Button } from 'antd'
|
|
7
7
|
import InputAutoFocus from '../common/input-auto-focus'
|
|
8
|
-
import { tabActions } from '../../common/constants'
|
|
9
8
|
import wait from '../../common/wait'
|
|
10
|
-
import postMsg from '../../common/post-msg'
|
|
11
9
|
|
|
12
10
|
const e = window.translate
|
|
13
11
|
const FormItem = Form.Item
|
|
@@ -17,11 +15,7 @@ export default function TermInteractive () {
|
|
|
17
15
|
const [opts, setter] = useState(null)
|
|
18
16
|
const [form] = Form.useForm()
|
|
19
17
|
function updateTab (data) {
|
|
20
|
-
|
|
21
|
-
action: tabActions.updateTabs,
|
|
22
|
-
id: data.tabId,
|
|
23
|
-
update: data.update
|
|
24
|
-
})
|
|
18
|
+
window.store.updateTab(data.tabId, data.update)
|
|
25
19
|
}
|
|
26
20
|
function onMsg (e) {
|
|
27
21
|
if (
|