Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
81eee7c5
Unverified
Commit
81eee7c5
authored
Jul 26, 2024
by
luoshangjie
Committed by
GitHub
Jul 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix] Fix the issue of 'Write end dead' (#3671)
Co-authored-by:
luoshangjie
<
luoshangjie@yfpharmacy.com
>
Co-authored-by:
18216499322
<
18216499322@users.noreply.github.com
>
parent
1fa08d68
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
15 deletions
+32
-15
SqlGatewayWsContext.java
.../src/main/java/org/dinky/context/SqlGatewayWsContext.java
+21
-11
index.tsx
.../pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
+4
-0
TerminalContent.tsx
...s/DataStudio/MiddleContainer/Terminal/TerminalContent.tsx
+2
-2
index.tsx
dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx
+5
-2
No files found.
dinky-admin/src/main/java/org/dinky/context/SqlGatewayWsContext.java
View file @
81eee7c5
...
...
@@ -29,6 +29,7 @@ import org.dinky.utils.CloseUtil;
import
org.dinky.utils.FragmentVariableUtils
;
import
org.dinky.utils.JsonUtils
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.SqlUtil
;
import
java.io.IOException
;
import
java.io.PipedInputStream
;
...
...
@@ -70,7 +71,7 @@ public class SqlGatewayWsContext {
private
PipedInputStream
in2web
;
private
long
lastHeartTime
=
System
.
currentTimeMillis
();
private
boolean
isRunning
=
true
;
private
volatile
boolean
isRunning
=
true
;
private
static
String
url
;
private
static
String
username
;
...
...
@@ -103,15 +104,23 @@ public class SqlGatewayWsContext {
}
});
executor
.
execute
(()
->
{
try
{
int
data
;
byte
[]
bytes
=
new
byte
[
1024
];
while
((
data
=
in2web
.
read
(
bytes
))
!=
-
1
)
{
session
.
getBasicRemote
().
sendBinary
(
ByteBuffer
.
wrap
(
bytes
,
0
,
data
));
while
(
isRunning
)
{
try
{
int
data
;
byte
[]
bytes
=
new
byte
[
1024
];
while
((
data
=
in2web
.
read
(
bytes
))
!=
-
1
)
{
session
.
getBasicRemote
().
sendBinary
(
ByteBuffer
.
wrap
(
bytes
,
0
,
data
));
}
log
.
info
(
"Sql Client Read Terminal Thread Closed :"
+
options
.
getConnectAddress
());
onClose
();
}
catch
(
IOException
e
)
{
log
.
error
(
"sql client receive error"
,
e
);
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
interruptedException
)
{
log
.
error
(
"Sql Client Thread Interrupted Error: "
,
e
);
}
}
log
.
info
(
"Sql Client Read Terminal Thread Closed :"
+
options
.
getConnectAddress
());
}
catch
(
IOException
e
)
{
log
.
error
(
"sql client receive error"
,
e
);
}
});
}
catch
(
Exception
e
)
{
...
...
@@ -157,13 +166,14 @@ public class SqlGatewayWsContext {
VariableManager
variableManager
=
new
VariableManager
();
variableManager
.
registerVariable
(
variableMap
);
String
initSql
=
URLDecoder
.
decode
(
getParameter
(
"initSql"
),
"UTF-8"
);
String
parsedSql
=
variableManager
.
parseVariable
(
initSql
);
initSql
=
SqlUtil
.
removeNote
(
initSql
);
initSql
=
variableManager
.
parseVariable
(
initSql
);
SqlClientOptions
options
=
SqlClientOptions
.
builder
()
.
mode
(
SqlCliMode
.
fromString
(
getParameter
(
"mode"
,
true
)))
.
sessionId
(
getParameter
(
"sessionId"
))
.
connectAddress
(
getParameter
(
"connectAddress"
,
true
))
.
initSql
(
parsed
Sql
)
.
initSql
(
init
Sql
)
.
historyFilePath
(
"./tmp/flink-sql-history/history"
)
.
terminalSize
(
size
)
.
build
();
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx
View file @
81eee7c5
...
...
@@ -199,6 +199,10 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
type
:
TabsPageType
.
terminal
}
});
dispatch
({
type
:
STUDIO_MODEL
.
updateSelectRightKey
,
payload
:
''
});
};
const
currentTabName
=
LeftMenuKey
.
PROJECT_KEY
;
const
btnEvent
=
[...
BtnRoute
[
currentTabName
]];
...
...
dinky-web/src/pages/DataStudio/MiddleContainer/Terminal/TerminalContent.tsx
View file @
81eee7c5
...
...
@@ -69,7 +69,7 @@ const TerminalContent: React.FC<TermProps> = (props) => {
const
termCols
=
term
.
cols
;
const
termRows
=
term
.
rows
;
const
params
=
`mode=
${
mode
}
&cols=
${
termCols
}
&rows=
${
termRows
}
&sessionId=
${
sessionId
}
&initSql=
${
encodeURIComponent
(
initSql
?
initSql
:
''
)}
&connectAddress=
${
connectAddress
}
`
;
const
params
=
`mode=
${
mode
}
&cols=
${
termCols
}
&rows=
${
termRows
}
&sessionId=
${
sessionId
}
&initSql=
${
encodeURIComponent
(
initSql
?
?
''
)}
&
connectAddress
=
$
{
connectAddress
}
`;
ws = new WebSocket(`
$
{
wsUrl
}
/
?
${params}`
)
;
...
...
@@ -122,7 +122,7 @@ const TerminalContent: React.FC<TermProps> = (props) => {
// rendererType: "canvas", //渲染类型
// cols: this.cols,// 设置之后会输入多行之后覆盖现象
// convertEol: true, //启用时,光标将设置为下一行的开头
scrollback
:
10
,
//终端中的回滚量
scrollback
:
10
00
,
//终端中的回滚量
fontSize
:
fontSize
,
//字体大小
// disableStdin: false, //是否应禁用输入。
// cursorStyle: "block", //光标样式
...
...
dinky-web/src/pages/DataStudio/MiddleContainer/index.tsx
View file @
81eee7c5
...
...
@@ -116,7 +116,7 @@ const MiddleContainer = (props: any) => {
};
const
updateActiveKey
=
(
item
:
TabsItemType
)
=>
{
const
{
key
,
label
,
subType
}
=
item
;
const
{
key
,
label
,
subType
,
type
}
=
item
;
if
(
key
===
activeKey
)
{
return
;
}
...
...
@@ -133,7 +133,10 @@ const MiddleContainer = (props: any) => {
// 根据 作业类型渲染 右侧选中菜单 key
dispatch
({
type
:
STUDIO_MODEL
.
updateSelectRightKey
,
payload
:
getRightSelectKeyFromNodeClickJobType
(
subType
??
''
)
payload
:
type
?.
toLowerCase
()
===
TabsPageType
.
terminal
?
''
:
getRightSelectKeyFromNodeClickJobType
(
subType
??
''
)
});
// 这里如果加此项功能和定位功能重复 , 暂时注释
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment