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
b65861d3
Unverified
Commit
b65861d3
authored
Oct 10, 2022
by
aiwenmo
Committed by
GitHub
Oct 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-1074][web] Add file upload in flinkjar task (#1077)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
ed0d0594
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
17 deletions
+96
-17
index.tsx
...ponents/Studio/StudioRightTool/StudioJarSetting/index.tsx
+86
-17
function.ts
dlink-web/src/pages/ClusterConfiguration/function.ts
+10
-0
No files found.
dlink-web/src/components/Studio/StudioRightTool/StudioJarSetting/index.tsx
View file @
b65861d3
...
@@ -20,24 +20,39 @@
...
@@ -20,24 +20,39 @@
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
StateType
}
from
"@/pages/DataStudio/model"
;
import
{
Form
,
InputNumber
,
Input
,
Select
,
Tag
,
Row
,
Col
,
Badge
,
Tooltip
,
Button
,
Space
}
from
"antd"
;
import
{
Form
,
InputNumber
,
Input
,
Select
,
Tag
,
Row
,
Col
,
Badge
,
Tooltip
,
Button
,
Space
,
Upload
,
message
}
from
"antd"
;
import
{
InfoCircleOutlined
,
PlusOutlined
,
MinusSquareOutlined
,
MinusCircleOutlined
,
PaperClipOutlined
}
from
"@ant-design/icons"
;
import
{
InfoCircleOutlined
,
PlusOutlined
,
MinusSquareOutlined
,
MinusCircleOutlined
,
PaperClipOutlined
,
UploadOutlined
}
from
"@ant-design/icons"
;
import
styles
from
"./index.less"
;
import
styles
from
"./index.less"
;
import
{
useEffect
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
JarStateType
}
from
"@/pages/Jar/model"
;
import
{
JarStateType
}
from
"@/pages/Jar/model"
;
import
{
Scrollbars
}
from
"react-custom-scrollbars"
;
import
{
Scrollbars
}
from
"react-custom-scrollbars"
;
import
{
RUN_MODE
}
from
"@/components/Studio/conf"
;
import
{
RUN_MODE
}
from
"@/components/Studio/conf"
;
import
{
CODE
}
from
"@/components/Common/crud"
;
import
{
getConfigFormValues
,
getHadoopConfigPathFromClusterConfigurationsById
}
from
"@/pages/ClusterConfiguration/function"
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
StudioJarSetting
=
(
props
:
any
)
=>
{
const
StudioJarSetting
=
(
props
:
any
)
=>
{
const
{
clusterConfiguration
,
current
,
form
,
dispatch
,
tabs
,
jars
,
env
,
toolHeight
}
=
props
;
const
{
clusterConfiguration
,
current
,
form
,
dispatch
,
tabs
,
jars
,
toolHeight
}
=
props
;
const
[
hadoopConfigPath
,
setHadoopConfigPath
]
=
useState
<
string
|
undefined
>
(
undefined
);
const
[
jarPath
,
setJarPath
]
=
useState
<
string
|
undefined
>
(
undefined
);
const
getClusterConfigurationOptions
=
()
=>
{
const
getClusterConfigurationOptions
=
()
=>
{
const
itemList
=
[];
const
itemList
=
[];
for
(
const
item
of
clusterConfiguration
)
{
for
(
const
item
of
clusterConfiguration
)
{
const
tag
=
(<><
Tag
color=
{
item
.
enabled
?
"processing"
:
"error"
}
>
{
item
.
type
}
</
Tag
>
{
item
.
alias
===
""
?
item
.
name
:
item
.
alias
}
</>);
const
tag
=
(<><
Tag
color=
{
item
.
enabled
?
"processing"
:
"error"
}
>
{
item
.
type
}
</
Tag
>
{
item
.
alias
===
""
?
item
.
name
:
item
.
alias
}
</>);
itemList
.
push
(<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
label=
{
tag
}
>
itemList
.
push
(<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
label=
{
tag
}
>
{
tag
}
{
tag
}
</
Option
>)
</
Option
>)
...
@@ -48,7 +63,8 @@ const StudioJarSetting = (props: any) => {
...
@@ -48,7 +63,8 @@ const StudioJarSetting = (props: any) => {
const
getJarOptions
=
()
=>
{
const
getJarOptions
=
()
=>
{
const
itemList
=
[];
const
itemList
=
[];
for
(
const
item
of
jars
)
{
for
(
const
item
of
jars
)
{
const
tag
=
(<><
Tag
color=
{
item
.
enabled
?
"processing"
:
"error"
}
>
{
item
.
type
}
</
Tag
>
{
item
.
alias
===
""
?
item
.
name
:
item
.
alias
}
</>);
const
tag
=
(<><
Tag
color=
{
item
.
enabled
?
"processing"
:
"error"
}
>
{
item
.
type
}
</
Tag
>
{
item
.
alias
===
""
?
item
.
name
:
item
.
alias
}
</>);
itemList
.
push
(<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
label=
{
tag
}
>
itemList
.
push
(<
Option
key=
{
item
.
id
}
value=
{
item
.
id
}
label=
{
tag
}
>
{
tag
}
{
tag
}
</
Option
>)
</
Option
>)
...
@@ -58,9 +74,15 @@ const StudioJarSetting = (props: any) => {
...
@@ -58,9 +74,15 @@ const StudioJarSetting = (props: any) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
form
.
setFieldsValue
(
current
.
task
);
form
.
setFieldsValue
(
current
.
task
);
setHadoopConfigPath
(
getHadoopConfigPathFromClusterConfigurationsById
(
current
.
task
.
clusterConfigurationId
,
clusterConfiguration
));
for
(
let
i
in
jars
)
{
if
(
jars
[
i
].
id
==
current
.
task
.
jarId
)
{
setJarPath
(
jars
[
i
].
path
);
break
;
}
}
},
[
current
.
task
]);
},
[
current
.
task
]);
const
onValuesChange
=
(
change
:
any
,
all
:
any
)
=>
{
const
onValuesChange
=
(
change
:
any
,
all
:
any
)
=>
{
const
newTabs
=
tabs
;
const
newTabs
=
tabs
;
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
newTabs
.
panes
.
length
;
i
++
)
{
...
@@ -75,6 +97,49 @@ const StudioJarSetting = (props: any) => {
...
@@ -75,6 +97,49 @@ const StudioJarSetting = (props: any) => {
type
:
"Studio/saveTabs"
,
type
:
"Studio/saveTabs"
,
payload
:
newTabs
,
payload
:
newTabs
,
});
});
let
clusterConfigurationId
=
all
[
'clusterConfigurationId'
];
let
jarId
=
all
[
'jarId'
];
setHadoopConfigPath
(
getHadoopConfigPathFromClusterConfigurationsById
(
clusterConfigurationId
,
clusterConfiguration
));
for
(
let
i
in
jars
)
{
if
(
jars
[
i
].
id
==
jarId
)
{
setJarPath
(
jars
[
i
].
path
);
break
;
}
}
};
const
getUploadHdfsProps
=
()
=>
{
let
dir
=
''
;
if
(
jarPath
)
{
if
(
jarPath
.
indexOf
(
'.jar'
)
>
-
1
)
{
dir
=
jarPath
.
substring
(
0
,
jarPath
.
lastIndexOf
(
'/'
));
}
else
{
dir
=
jarPath
;
}
}
return
{
name
:
'files'
,
action
:
'/api/fileUpload/hdfs'
,
headers
:
{
authorization
:
'authorization-text'
,
},
data
:
{
dir
,
hadoopConfigPath
},
showUploadList
:
true
,
onChange
(
info
)
{
if
(
info
.
file
.
status
===
'done'
)
{
if
(
info
.
file
.
response
.
code
==
CODE
.
SUCCESS
)
{
message
.
success
(
info
.
file
.
response
.
msg
);
}
else
{
message
.
warn
(
info
.
file
.
response
.
msg
);
}
}
else
if
(
info
.
file
.
status
===
'error'
)
{
message
.
error
(
`
${
info
.
file
.
name
}
上传失败`
);
}
},
}
};
};
return
(
return
(
...
@@ -121,18 +186,22 @@ const StudioJarSetting = (props: any) => {
...
@@ -121,18 +186,22 @@ const StudioJarSetting = (props: any) => {
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
<
Form
.
Item
label=
"可执行 Jar"
<
Form
.
Item
label=
{
<>
可执行 Jar
</>
}
tooltip=
{
`选择可执行 Jar 进行 ${current.task.type} 模式的远程提交 Jar 任务。当该参数项存在值时,将只提交可执行 Jar.`
}
tooltip=
{
`选择可执行 Jar 进行 ${current.task.type} 模式的远程提交 Jar 任务。当该参数项存在值时,将只提交可执行 Jar.`
}
name=
"jarId"
className=
{
styles
.
form_item
}
>
className=
{
styles
.
form_item
}
>
<
Select
<
Form
.
Item
name=
"jarId"
noStyle
>
style=
{
{
width
:
'100%'
}
}
<
Select
placeholder=
"选择可执行Jar,非必填"
style=
{
{
width
:
'80%'
}
}
allowClear
placeholder=
"选择可执行Jar,非必填"
optionLabelProp=
"label"
allowClear
>
optionLabelProp=
"label"
{
getJarOptions
()
}
>
</
Select
>
{
getJarOptions
()
}
</
Select
>
</
Form
.
Item
>
<
Upload
{
...
getUploadHdfsProps
()}
multiple
>
<
UploadOutlined
/>
</
Upload
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Row
>
<
Row
>
<
Col
span=
{
12
}
>
<
Col
span=
{
12
}
>
...
...
dlink-web/src/pages/ClusterConfiguration/function.ts
View file @
b65861d3
...
@@ -23,6 +23,7 @@ import {
...
@@ -23,6 +23,7 @@ import {
HADOOP_CONFIG_NAME_LIST
,
HADOOP_CONFIG_NAME_LIST
,
KUBERNETES_CONFIG_NAME_LIST
KUBERNETES_CONFIG_NAME_LIST
}
from
"@/pages/ClusterConfiguration/conf"
;
}
from
"@/pages/ClusterConfiguration/conf"
;
import
{
ClusterConfigurationTableListItem
}
from
"@/pages/ClusterConfiguration/data"
;
export
function
getConfig
(
values
:
any
)
{
export
function
getConfig
(
values
:
any
)
{
let
flinkConfig
=
addValueToMap
(
values
,
FLINK_CONFIG_NAME_LIST
());
let
flinkConfig
=
addValueToMap
(
values
,
FLINK_CONFIG_NAME_LIST
());
...
@@ -120,3 +121,12 @@ function addMapToList(map:{},keys:string[]){
...
@@ -120,3 +121,12 @@ function addMapToList(map:{},keys:string[]){
}
}
return
list
;
return
list
;
}
}
export
function
getHadoopConfigPathFromClusterConfigurationsById
(
id
:
number
,
clusterConfigurations
:
ClusterConfigurationTableListItem
[]){
for
(
let
i
in
clusterConfigurations
){
if
(
clusterConfigurations
[
i
].
id
==
id
){
return
getConfigFormValues
(
clusterConfigurations
[
i
])[
'hadoopConfigPath'
]
}
}
return
undefined
;
}
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