@electerm/electerm-react 2.8.6 → 2.8.7
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/components/ai/ai-config.jsx +1 -1
- package/client/components/bookmark-form/common/run-scripts.jsx +1 -1
- package/client/components/common/upload.jsx +75 -0
- package/client/components/quick-commands/quick-commands-list-form.jsx +1 -2
- package/client/components/tabs/workspace-save-modal.jsx +1 -1
- package/client/components/terminal-info/base.jsx +1 -1
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@ export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig })
|
|
|
100
100
|
className='ai-config-form'
|
|
101
101
|
>
|
|
102
102
|
<Form.Item label='API URL' required>
|
|
103
|
-
<Space.Compact
|
|
103
|
+
<Space.Compact className='width-100'>
|
|
104
104
|
<Form.Item
|
|
105
105
|
label='API URL'
|
|
106
106
|
name='baseURLAI'
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Upload component that uses Electron's native file dialog
|
|
3
|
+
* This replaces antd Upload to get absolute file paths instead of browser-based file selection
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { PureComponent } from 'react'
|
|
7
|
+
import { getLocalFileInfo } from '../sftp/file-read'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Open a single file select dialog
|
|
11
|
+
* @returns {Promise<Object|null>} - File object with path info or null if cancelled
|
|
12
|
+
*/
|
|
13
|
+
const openFileSelect = async () => {
|
|
14
|
+
const properties = [
|
|
15
|
+
'openFile',
|
|
16
|
+
'showHiddenFiles',
|
|
17
|
+
'noResolveAliases',
|
|
18
|
+
'treatPackageAsDirectory',
|
|
19
|
+
'dontAddToRecent'
|
|
20
|
+
]
|
|
21
|
+
const files = await window.api.openDialog({
|
|
22
|
+
title: 'Choose a file',
|
|
23
|
+
message: 'Choose a file',
|
|
24
|
+
properties
|
|
25
|
+
}).catch(() => false)
|
|
26
|
+
if (!files || !files.length) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
const filePath = files[0]
|
|
30
|
+
const stat = await getLocalFileInfo(filePath)
|
|
31
|
+
return { ...stat, filePath, path: filePath }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Custom Upload component
|
|
36
|
+
* Uses Electron's native file dialog for file selection
|
|
37
|
+
* API compatible with antd Upload for the use cases in this project
|
|
38
|
+
*/
|
|
39
|
+
export default class Upload extends PureComponent {
|
|
40
|
+
handleClick = async () => {
|
|
41
|
+
const { beforeUpload, disabled } = this.props
|
|
42
|
+
if (disabled) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
const file = await openFileSelect()
|
|
46
|
+
if (!file) {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
if (beforeUpload) {
|
|
50
|
+
beforeUpload(file)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render () {
|
|
55
|
+
const {
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
style,
|
|
59
|
+
disabled
|
|
60
|
+
} = this.props
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={className}
|
|
65
|
+
style={style}
|
|
66
|
+
onClick={this.handleClick}
|
|
67
|
+
role='button'
|
|
68
|
+
tabIndex={disabled ? -1 : 0}
|
|
69
|
+
aria-disabled={disabled}
|
|
70
|
+
>
|
|
71
|
+
{children}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -69,7 +69,7 @@ export default auto(function WorkspaceSaveModal ({ store }) {
|
|
|
69
69
|
width={400}
|
|
70
70
|
>
|
|
71
71
|
<div className='pd1y'>
|
|
72
|
-
<Space direction='vertical'
|
|
72
|
+
<Space direction='vertical' className='width-100'>
|
|
73
73
|
<Radio.Group
|
|
74
74
|
value={saveMode}
|
|
75
75
|
onChange={ev => setSaveMode(ev.target.value)}
|
|
@@ -130,7 +130,7 @@ export default class TerminalInfoBase extends Component {
|
|
|
130
130
|
terminalInfos
|
|
131
131
|
} = this.props
|
|
132
132
|
return (
|
|
133
|
-
<Space.Compact
|
|
133
|
+
<Space.Compact className='width-100'>
|
|
134
134
|
{
|
|
135
135
|
defaults.terminalInfos.map(f => {
|
|
136
136
|
const type = terminalInfos.includes(f) ? 'primary' : 'default'
|