@electerm/electerm-react 2.3.151 → 2.3.176
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 +4 -2
- package/client/common/db.js +2 -1
- package/client/common/download.jsx +1 -1
- package/client/common/error-handler.jsx +1 -1
- package/client/common/fetch.jsx +1 -1
- package/client/common/init-setting-item.js +7 -0
- package/client/components/common/modal.jsx +89 -0
- package/client/components/common/modal.styl +77 -0
- package/client/components/common/notification-with-details.jsx +34 -0
- package/client/components/file-transfer/conflict-resolve.jsx +2 -1
- package/client/components/file-transfer/transfer-speed-format.js +6 -0
- package/client/components/file-transfer/transfer.jsx +5 -2
- package/client/components/file-transfer/transports-action-store.jsx +14 -1
- package/client/components/main/connection-hopping-warnning.jsx +1 -1
- package/client/components/main/main.jsx +2 -0
- package/client/components/quick-commands/qm.styl +0 -10
- package/client/components/quick-commands/quick-command-item.jsx +2 -5
- package/client/components/quick-commands/quick-commands-box.jsx +12 -23
- package/client/components/setting-panel/setting-common.jsx +4 -3
- package/client/components/setting-panel/setting-modal.jsx +2 -1
- package/client/components/setting-panel/start-session-select.jsx +146 -21
- package/client/components/setting-panel/text-bg-modal.jsx +15 -4
- package/client/components/setting-sync/setting-sync-form.jsx +1 -1
- package/client/components/sftp/file-info-modal.jsx +2 -1
- package/client/components/sftp/file-item.jsx +2 -0
- package/client/components/sftp/sftp-entry.jsx +1 -1
- package/client/components/sftp/sftp.styl +1 -1
- package/client/components/sidebar/info-modal.jsx +53 -34
- package/client/components/sidebar/info.styl +0 -7
- package/client/components/ssh-config/ssh-config-load-notify.jsx +1 -1
- package/client/components/tabs/index.jsx +6 -58
- package/client/components/tabs/layout-menu.jsx +75 -0
- package/client/components/tabs/layout-select.jsx +60 -0
- package/client/components/tabs/tabs.styl +64 -0
- package/client/components/tabs/workspace-save-modal.jsx +117 -0
- package/client/components/tabs/workspace-select.jsx +79 -0
- package/client/components/terminal/attach-addon-custom.js +7 -1
- package/client/components/terminal/terminal-interactive.jsx +2 -1
- package/client/components/terminal/terminal.jsx +1 -2
- package/client/components/text-editor/text-editor.jsx +2 -1
- package/client/components/tree-list/move-item-modal.jsx +2 -1
- package/client/components/vnc/vnc-session.jsx +2 -2
- package/client/components/widgets/widget-control.jsx +12 -6
- package/client/components/widgets/widget-form.jsx +16 -18
- package/client/components/widgets/widget-instance.jsx +44 -9
- package/client/components/widgets/widget-notification-with-details.jsx +34 -0
- package/client/css/basic.styl +3 -1
- package/client/css/includes/box.styl +2 -2
- package/client/store/common.js +9 -5
- package/client/store/init-state.js +4 -0
- package/client/store/load-data.js +15 -6
- package/client/store/mcp-handler.js +640 -0
- package/client/store/store.js +4 -0
- package/client/store/widgets.js +4 -0
- package/client/store/workspace.js +108 -0
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workspace related functions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
settingMap
|
|
7
|
+
} from '../common/constants'
|
|
8
|
+
import getInitItem from '../common/init-setting-item'
|
|
9
|
+
import generate from '../common/uid'
|
|
10
|
+
|
|
11
|
+
export default Store => {
|
|
12
|
+
/**
|
|
13
|
+
* Get current workspace state (layout + tabs for each batch)
|
|
14
|
+
*/
|
|
15
|
+
Store.prototype.getCurrentWorkspaceState = function () {
|
|
16
|
+
const { store } = window
|
|
17
|
+
const { layout, tabs } = store
|
|
18
|
+
// Group tabs by batch and get bookmark srcIds
|
|
19
|
+
const tabsByBatch = {}
|
|
20
|
+
for (const tab of tabs) {
|
|
21
|
+
const batch = tab.batch || 0
|
|
22
|
+
if (!tabsByBatch[batch]) {
|
|
23
|
+
tabsByBatch[batch] = []
|
|
24
|
+
}
|
|
25
|
+
// Store srcId (bookmark id) if available, otherwise store basic connection info
|
|
26
|
+
if (tab.srcId) {
|
|
27
|
+
tabsByBatch[batch].push({
|
|
28
|
+
srcId: tab.srcId
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
layout,
|
|
34
|
+
tabsByBatch
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Save current workspace
|
|
40
|
+
*/
|
|
41
|
+
Store.prototype.saveWorkspace = function (name, id = null) {
|
|
42
|
+
const { store } = window
|
|
43
|
+
const state = store.getCurrentWorkspaceState()
|
|
44
|
+
const workspace = {
|
|
45
|
+
id: id || generate(),
|
|
46
|
+
name,
|
|
47
|
+
...state,
|
|
48
|
+
createdAt: Date.now(),
|
|
49
|
+
updatedAt: Date.now()
|
|
50
|
+
}
|
|
51
|
+
if (id) {
|
|
52
|
+
// Update existing
|
|
53
|
+
store.editItem(id, workspace, settingMap.workspaces)
|
|
54
|
+
} else {
|
|
55
|
+
// Add new
|
|
56
|
+
store.addItem(workspace, settingMap.workspaces)
|
|
57
|
+
}
|
|
58
|
+
return workspace
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Load a workspace - set layout and open tabs
|
|
63
|
+
*/
|
|
64
|
+
Store.prototype.loadWorkspace = function (workspaceId) {
|
|
65
|
+
const { store } = window
|
|
66
|
+
const workspace = store.workspaces.find(w => w.id === workspaceId)
|
|
67
|
+
if (!workspace) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
const { layout, tabsByBatch } = workspace
|
|
71
|
+
|
|
72
|
+
// Close all existing tabs first
|
|
73
|
+
store.removeTabs(() => true)
|
|
74
|
+
|
|
75
|
+
// Set layout
|
|
76
|
+
store.setLayout(layout)
|
|
77
|
+
// Open tabs for each batch
|
|
78
|
+
for (const [batchStr, tabInfos] of Object.entries(tabsByBatch)) {
|
|
79
|
+
const batch = parseInt(batchStr, 10)
|
|
80
|
+
for (const tabInfo of tabInfos) {
|
|
81
|
+
if (tabInfo.srcId) {
|
|
82
|
+
// Open from bookmark
|
|
83
|
+
window.openTabBatch = batch
|
|
84
|
+
store.onSelectBookmark(tabInfo.srcId)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Delete a workspace
|
|
92
|
+
*/
|
|
93
|
+
Store.prototype.deleteWorkspace = function (id) {
|
|
94
|
+
window.store.delItem({ id }, settingMap.workspaces)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Open workspace settings
|
|
99
|
+
*/
|
|
100
|
+
Store.prototype.openWorkspaceSettings = function () {
|
|
101
|
+
const { store } = window
|
|
102
|
+
store.storeAssign({
|
|
103
|
+
settingTab: settingMap.workspaces
|
|
104
|
+
})
|
|
105
|
+
store.setSettingItem(getInitItem([], settingMap.workspaces))
|
|
106
|
+
store.openSettingModal()
|
|
107
|
+
}
|
|
108
|
+
}
|