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
cd7470a3
Unverified
Commit
cd7470a3
authored
Oct 17, 2023
by
ZackYoung
Committed by
GitHub
Oct 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize-same-web-code (#2393)
parent
dc81815b
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
211 additions
and
172 deletions
+211
-172
JobDataDto.java
dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java
+5
-2
index.tsx
...web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
+45
-23
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+63
-51
index.tsx
...Center/Cluster/Instance/components/InstanceList/index.tsx
+2
-3
contants.tsx
.../pages/RegCenter/Cluster/Instance/components/contants.tsx
+10
-0
function.tsx
.../pages/RegCenter/Cluster/Instance/components/function.tsx
+12
-15
constants.ts
dinky-web/src/pages/RegCenter/Cluster/constants.ts
+3
-1
index.tsx
.../RegCenter/DataSource/components/DataSourceList/index.tsx
+17
-40
index.tsx
...ce/components/DataSourceModal/DataSourceProForm/index.tsx
+28
-36
index.tsx
...RegCenter/DataSource/components/DataSourceModal/index.tsx
+5
-1
service.tsx
dinky-web/src/pages/RegCenter/DataSource/service.tsx
+21
-0
No files found.
dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java
View file @
cd7470a3
...
@@ -33,6 +33,7 @@ import java.time.LocalDateTime;
...
@@ -33,6 +33,7 @@ import java.time.LocalDateTime;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -115,7 +116,8 @@ public class JobDataDto {
...
@@ -115,7 +116,8 @@ public class JobDataDto {
}
}
public
static
JobDataDto
fromJobHistory
(
JobHistory
jobHistory
)
{
public
static
JobDataDto
fromJobHistory
(
JobHistory
jobHistory
)
{
return
JobDataDto
.
builder
()
return
Opt
.
ofNullable
(
jobHistory
)
.
map
(
x
->
JobDataDto
.
builder
()
.
id
(
jobHistory
.
getId
())
.
id
(
jobHistory
.
getId
())
.
tenantId
(
jobHistory
.
getTenantId
())
.
tenantId
(
jobHistory
.
getTenantId
())
.
job
(
jobHistory
.
getJobJson
())
.
job
(
jobHistory
.
getJobJson
())
...
@@ -126,6 +128,7 @@ public class JobDataDto {
...
@@ -126,6 +128,7 @@ public class JobDataDto {
.
jar
(
JsonUtils
.
parseToJsonNode
(
jobHistory
.
getJarJson
()))
.
jar
(
JsonUtils
.
parseToJsonNode
(
jobHistory
.
getJarJson
()))
.
cluster
(
jobHistory
.
getClusterJson
())
.
cluster
(
jobHistory
.
getClusterJson
())
.
clusterConfiguration
(
jobHistory
.
getClusterConfigurationJson
())
.
clusterConfiguration
(
jobHistory
.
getClusterConfigurationJson
())
.
build
();
.
build
())
.
orElse
(
null
);
}
}
}
}
dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
View file @
cd7470a3
import
{
TagAlignLeft
}
from
'@/components/StyledComponents'
;
import
{
TagAlignLeft
}
from
'@/components/StyledComponents'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
SchemaTree
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'
;
import
SchemaTree
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DatabaseOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
DatabaseOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
Key
,
ProForm
,
ProFormSelect
}
from
'@ant-design/pro-components'
;
import
{
Key
,
ProForm
,
ProFormSelect
}
from
'@ant-design/pro-components'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
clearMetaDataTable
,
showMetaDataTable
}
from
'./service'
;
import
{
clearMetaDataTable
,
getDataBase
,
showMetaDataTable
}
from
'./service'
;
import
DataSourceModal
from
"@/pages/RegCenter/DataSource/components/DataSourceModal"
;
import
{
handleTest
,
saveOrUpdateHandle
}
from
"@/pages/RegCenter/DataSource/service"
;
const
MetaData
=
(
props
:
any
)
=>
{
const
MetaData
=
(
props
:
any
)
=>
{
const
{
const
{
dispatch
,
dispatch
,
toolContentHeight
,
toolContentHeight
,
database
:
{
dbData
,
selectDatabaseId
,
expandKeys
,
selectKeys
}
database
:
{
dbData
,
selectDatabaseId
,
expandKeys
,
selectKeys
}
}
=
props
;
}
=
props
;
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
isLoadingDatabase
,
setIsLoadingDatabase
]
=
useState
(
false
);
const
[
isLoadingDatabase
,
setIsLoadingDatabase
]
=
useState
(
false
);
const
[
showCreate
,
setShowCreate
]
=
useState
(
false
);
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
((
x
)
=>
x
.
id
===
selectDatabaseId
)[
0
];
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
((
x
)
=>
x
.
id
===
selectDatabaseId
)[
0
];
/**
/**
...
@@ -38,12 +41,12 @@ const MetaData = (props: any) => {
...
@@ -38,12 +41,12 @@ const MetaData = (props: any) => {
for
(
let
table
of
tables
)
{
for
(
let
table
of
tables
)
{
table
.
title
=
table
.
name
;
table
.
title
=
table
.
name
;
table
.
key
=
table
.
name
;
table
.
key
=
table
.
name
;
table
.
icon
=
<
DatabaseOutlined
/>;
table
.
icon
=
<
DatabaseOutlined
/>;
table
.
children
=
table
.
tables
;
table
.
children
=
table
.
tables
;
for
(
let
child
of
table
.
children
)
{
for
(
let
child
of
table
.
children
)
{
child
.
title
=
child
.
name
;
child
.
title
=
child
.
name
;
child
.
key
=
table
.
name
+
'.'
+
child
.
name
;
child
.
key
=
table
.
name
+
'.'
+
child
.
name
;
child
.
icon
=
<
TableOutlined
/>;
child
.
icon
=
<
TableOutlined
/>;
child
.
isLeaf
=
true
;
child
.
isLeaf
=
true
;
child
.
schema
=
table
.
name
;
child
.
schema
=
table
.
name
;
child
.
table
=
child
.
name
;
child
.
table
=
child
.
name
;
...
@@ -67,6 +70,9 @@ const MetaData = (props: any) => {
...
@@ -67,6 +70,9 @@ const MetaData = (props: any) => {
};
};
BtnRoute
[
'menu.datastudio.metadata'
][
0
].
onClick
=
()
=>
{
BtnRoute
[
'menu.datastudio.metadata'
][
0
].
onClick
=
()
=>
{
setShowCreate
(
true
)
};
BtnRoute
[
'menu.datastudio.metadata'
][
1
].
onClick
=
()
=>
{
if
(
!
selectDatabaseId
)
return
;
if
(
!
selectDatabaseId
)
return
;
setIsLoadingDatabase
(
true
);
setIsLoadingDatabase
(
true
);
clearMetaDataTable
(
selectDatabaseId
).
then
(()
=>
{
clearMetaDataTable
(
selectDatabaseId
).
then
(()
=>
{
...
@@ -78,7 +84,7 @@ const MetaData = (props: any) => {
...
@@ -78,7 +84,7 @@ const MetaData = (props: any) => {
* 构建数据库列表 下拉框
* 构建数据库列表 下拉框
*/
*/
const
getDataBaseOptions
=
()
=>
{
const
getDataBaseOptions
=
()
=>
{
return
dbData
.
map
(({
id
,
name
,
type
,
enabled
,
status
}:
DataSources
.
DataSource
)
=>
({
return
dbData
.
map
(({
id
,
name
,
type
,
enabled
,
status
}:
DataSources
.
DataSource
)
=>
({
key
:
id
,
key
:
id
,
value
:
id
,
value
:
id
,
label
:
(
label
:
(
...
@@ -106,14 +112,14 @@ const MetaData = (props: any) => {
...
@@ -106,14 +112,14 @@ const MetaData = (props: any) => {
});
});
const
{
const
{
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableName
,
fullInfo
}
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableName
,
fullInfo
}
}
=
info
;
}
=
info
;
if
(
!
isLeaf
)
{
if
(
!
isLeaf
)
{
return
;
return
;
}
}
const
queryParams
=
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
const
queryParams
=
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
dispatch
({
dispatch
({
type
:
STUDIO_MODEL
.
addTab
,
type
:
STUDIO_MODEL
.
addTab
,
payload
:
{
payload
:
{
...
@@ -121,7 +127,7 @@ const MetaData = (props: any) => {
...
@@ -121,7 +127,7 @@ const MetaData = (props: any) => {
id
:
selectDatabaseId
+
schemaName
+
tableName
,
id
:
selectDatabaseId
+
schemaName
+
tableName
,
breadcrumbLabel
:
[
selectDb
.
type
,
selectDb
.
name
].
join
(
'/'
),
breadcrumbLabel
:
[
selectDb
.
type
,
selectDb
.
name
].
join
(
'/'
),
label
:
schemaName
+
'.'
+
tableName
,
label
:
schemaName
+
'.'
+
tableName
,
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
type
:
'metadata'
type
:
'metadata'
}
}
});
});
...
@@ -152,13 +158,27 @@ const MetaData = (props: any) => {
...
@@ -152,13 +158,27 @@ const MetaData = (props: any) => {
return
(
return
(
<
Spin
spinning=
{
isLoadingDatabase
}
delay=
{
500
}
>
<
Spin
spinning=
{
isLoadingDatabase
}
delay=
{
500
}
>
<
DataSourceModal
values=
{
{}
}
visible=
{
showCreate
}
onCancel=
{
()
=>
setShowCreate
(
false
)
}
onTest=
{
(
value
)
=>
handleTest
(
value
)
}
onSubmit=
{
async
(
value
)
=>
{
await
saveOrUpdateHandle
(
value
);
const
data
=
await
getDataBase
();
dispatch
({
type
:
STUDIO_MODEL
.
saveDataBase
,
payload
:
data
});
}
}
/>
<
ProForm
<
ProForm
style=
{
{
height
:
40
}
}
style=
{
{
height
:
40
}
}
initialValues=
{
{
selectDb
:
selectDatabaseId
}
}
initialValues=
{
{
selectDb
:
selectDatabaseId
}
}
submitter=
{
false
}
submitter=
{
false
}
>
>
<
ProFormSelect
<
ProFormSelect
style=
{
{
paddingInline
:
6
}
}
style=
{
{
paddingInline
:
6
}
}
// width={leftContainer.width }
// width={leftContainer.width }
width=
{
'xl'
}
width=
{
'xl'
}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
...
@@ -174,7 +194,7 @@ const MetaData = (props: any) => {
...
@@ -174,7 +194,7 @@ const MetaData = (props: any) => {
<
SchemaTree
<
SchemaTree
selectKeys=
{
selectKeys
}
selectKeys=
{
selectKeys
}
expandKeys=
{
expandKeys
}
expandKeys=
{
expandKeys
}
style=
{
{
height
:
toolContentHeight
-
64
-
20
}
}
style=
{
{
height
:
toolContentHeight
-
64
-
20
}
}
onNodeClick=
{
handleTreeNodeClick
}
onNodeClick=
{
handleTreeNodeClick
}
treeData=
{
treeData
}
treeData=
{
treeData
}
onExpand=
{
handleTreeExpand
}
onExpand=
{
handleTreeExpand
}
...
@@ -183,7 +203,9 @@ const MetaData = (props: any) => {
...
@@ -183,7 +203,9 @@ const MetaData = (props: any) => {
);
);
};
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
toolContentHeight
:
Studio
.
toolContentHeight
,
toolContentHeight
:
Studio
.
toolContentHeight
,
leftContainer
:
Studio
.
leftContainer
,
leftContainer
:
Studio
.
leftContainer
,
database
:
Studio
.
database
database
:
Studio
.
database
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
cd7470a3
...
@@ -17,21 +17,21 @@
...
@@ -17,21 +17,21 @@
*
*
*/
*/
import
{
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
{
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
Lineage
from
'@/pages/DataStudio/BottomContainer/Lineage'
;
import
Lineage
from
'@/pages/DataStudio/BottomContainer/Lineage'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
TableData
from
'@/pages/DataStudio/BottomContainer/TableData'
;
import
TableData
from
'@/pages/DataStudio/BottomContainer/TableData'
;
import
{
Catalog
}
from
'@/pages/DataStudio/LeftContainer/Catalog'
;
import
{
Catalog
}
from
'@/pages/DataStudio/LeftContainer/Catalog'
;
import
MetaData
from
'@/pages/DataStudio/LeftContainer/MetaData'
;
import
MetaData
from
'@/pages/DataStudio/LeftContainer/MetaData'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
import
ExecuteConfig
from
'@/pages/DataStudio/RightContainer/ExecuteConfig'
;
import
ExecuteConfig
from
'@/pages/DataStudio/RightContainer/ExecuteConfig'
;
import
HistoryVersion
from
'@/pages/DataStudio/RightContainer/HistoryVersion'
;
import
HistoryVersion
from
'@/pages/DataStudio/RightContainer/HistoryVersion'
;
import
JobConfig
from
'@/pages/DataStudio/RightContainer/JobConfig'
;
import
JobConfig
from
'@/pages/DataStudio/RightContainer/JobConfig'
;
import
JobInfo
from
'@/pages/DataStudio/RightContainer/JobInfo'
;
import
JobInfo
from
'@/pages/DataStudio/RightContainer/JobInfo'
;
import
SavePoints
from
'@/pages/DataStudio/RightContainer/SavePoints'
;
import
SavePoints
from
'@/pages/DataStudio/RightContainer/SavePoints'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
import
{
ApartmentOutlined
,
ApartmentOutlined
,
ArrowsAltOutlined
,
ArrowsAltOutlined
,
...
@@ -46,7 +46,7 @@ import {
...
@@ -46,7 +46,7 @@ import {
InfoCircleOutlined
,
InfoCircleOutlined
,
MonitorOutlined
,
MonitorOutlined
,
PlayCircleOutlined
,
PlayCircleOutlined
,
PlusCircle
Outlined
,
PlusCircleOutlined
,
Plus
Outlined
,
ReloadOutlined
,
ReloadOutlined
,
RightSquareOutlined
,
RightSquareOutlined
,
SettingOutlined
,
SettingOutlined
,
...
@@ -54,30 +54,30 @@ import {
...
@@ -54,30 +54,30 @@ import {
TableOutlined
,
TableOutlined
,
ToolOutlined
ToolOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
ReactNode
}
from
'react'
;
import
{
ReactNode
}
from
'react'
;
export
const
LeftSide
=
[
export
const
LeftSide
=
[
{
{
auth
:
'/datastudio/left/project'
,
auth
:
'/datastudio/left/project'
,
key
:
'menu.datastudio.project'
,
key
:
'menu.datastudio.project'
,
icon
:
<
ConsoleSqlOutlined
/>,
icon
:
<
ConsoleSqlOutlined
/>,
label
:
l
(
'menu.datastudio.project'
),
label
:
l
(
'menu.datastudio.project'
),
children
:
<
Project
/>
children
:
<
Project
/>
},
},
{
{
auth
:
'/datastudio/left/catalog'
,
auth
:
'/datastudio/left/catalog'
,
key
:
'menu.datastudio.catalog'
,
key
:
'menu.datastudio.catalog'
,
icon
:
<
TableOutlined
/>,
icon
:
<
TableOutlined
/>,
label
:
l
(
'menu.datastudio.catalog'
),
label
:
l
(
'menu.datastudio.catalog'
),
children
:
<
Catalog
/>
children
:
<
Catalog
/>
},
},
{
{
auth
:
'/datastudio/left/metadata'
,
auth
:
'/datastudio/left/metadata'
,
key
:
'menu.datastudio.metadata'
,
key
:
'menu.datastudio.metadata'
,
icon
:
<
DatabaseOutlined
/>,
icon
:
<
DatabaseOutlined
/>,
label
:
l
(
'menu.datastudio.metadata'
),
label
:
l
(
'menu.datastudio.metadata'
),
children
:
<
MetaData
/>
children
:
<
MetaData
/>
}
}
];
];
...
@@ -85,41 +85,41 @@ export const RightSide: TabProp[] = [
...
@@ -85,41 +85,41 @@ export const RightSide: TabProp[] = [
{
{
auth
:
'/datastudio/right/jobConfig'
,
auth
:
'/datastudio/right/jobConfig'
,
key
:
'menu.datastudio.jobConfig'
,
key
:
'menu.datastudio.jobConfig'
,
icon
:
<
SettingOutlined
/>,
icon
:
<
SettingOutlined
/>,
label
:
l
(
'menu.datastudio.jobConfig'
),
label
:
l
(
'menu.datastudio.jobConfig'
),
children
:
<
JobConfig
/>,
children
:
<
JobConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
},
{
{
auth
:
'/datastudio/right/executeConfig'
,
auth
:
'/datastudio/right/executeConfig'
,
key
:
'menu.datastudio.executeConfig'
,
key
:
'menu.datastudio.executeConfig'
,
icon
:
<
PlayCircleOutlined
/>,
icon
:
<
PlayCircleOutlined
/>,
label
:
l
(
'menu.datastudio.executeConfig'
),
label
:
l
(
'menu.datastudio.executeConfig'
),
children
:
<
ExecuteConfig
/>,
children
:
<
ExecuteConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
},
{
{
auth
:
'/datastudio/right/savePoint'
,
auth
:
'/datastudio/right/savePoint'
,
key
:
'menu.datastudio.savePoint'
,
key
:
'menu.datastudio.savePoint'
,
icon
:
<
FolderOutlined
/>,
icon
:
<
FolderOutlined
/>,
label
:
l
(
'menu.datastudio.savePoint'
),
label
:
l
(
'menu.datastudio.savePoint'
),
children
:
<
SavePoints
/>,
children
:
<
SavePoints
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
},
{
{
auth
:
'/datastudio/right/historyVision'
,
auth
:
'/datastudio/right/historyVision'
,
key
:
'menu.datastudio.historyVision'
,
key
:
'menu.datastudio.historyVision'
,
icon
:
<
HistoryOutlined
/>,
icon
:
<
HistoryOutlined
/>,
label
:
l
(
'menu.datastudio.historyVision'
),
label
:
l
(
'menu.datastudio.historyVision'
),
children
:
<
HistoryVersion
/>,
children
:
<
HistoryVersion
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
},
{
{
auth
:
'/datastudio/right/jobInfo'
,
auth
:
'/datastudio/right/jobInfo'
,
key
:
'menu.datastudio.jobInfo'
,
key
:
'menu.datastudio.jobInfo'
,
icon
:
<
InfoCircleOutlined
/>,
icon
:
<
InfoCircleOutlined
/>,
label
:
l
(
'menu.datastudio.jobInfo'
),
label
:
l
(
'menu.datastudio.jobInfo'
),
children
:
<
JobInfo
/>,
children
:
<
JobInfo
/>,
isShow
:
(
type
)
=>
type
!==
TabsPageType
.
None
isShow
:
(
type
)
=>
type
!==
TabsPageType
.
None
}
}
];
];
...
@@ -128,53 +128,53 @@ export const LeftBottomSide = [
...
@@ -128,53 +128,53 @@ export const LeftBottomSide = [
{
{
auth
:
'/datastudio/bottom/console'
,
auth
:
'/datastudio/bottom/console'
,
key
:
'menu.datastudio.console'
,
key
:
'menu.datastudio.console'
,
icon
:
<
RightSquareOutlined
/>,
icon
:
<
RightSquareOutlined
/>,
label
:
l
(
'menu.datastudio.console'
),
label
:
l
(
'menu.datastudio.console'
),
children
:
<
Console
/>
children
:
<
Console
/>
},
},
{
{
auth
:
'/datastudio/bottom/result'
,
auth
:
'/datastudio/bottom/result'
,
key
:
'menu.datastudio.result'
,
key
:
'menu.datastudio.result'
,
icon
:
<
MonitorOutlined
/>,
icon
:
<
MonitorOutlined
/>,
label
:
l
(
'menu.datastudio.result'
),
label
:
l
(
'menu.datastudio.result'
),
children
:
<
Result
/>
children
:
<
Result
/>
},
},
{
{
auth
:
'/datastudio/bottom/bi'
,
auth
:
'/datastudio/bottom/bi'
,
key
:
'menu.datastudio.bi'
,
key
:
'menu.datastudio.bi'
,
icon
:
<
BarChartOutlined
/>,
icon
:
<
BarChartOutlined
/>,
label
:
l
(
'menu.datastudio.bi'
)
label
:
l
(
'menu.datastudio.bi'
)
},
},
{
{
auth
:
'/datastudio/bottom/lineage'
,
auth
:
'/datastudio/bottom/lineage'
,
key
:
'menu.datastudio.lineage'
,
key
:
'menu.datastudio.lineage'
,
icon
:
<
ApartmentOutlined
/>,
icon
:
<
ApartmentOutlined
/>,
label
:
l
(
'menu.datastudio.lineage'
),
label
:
l
(
'menu.datastudio.lineage'
),
children
:
<
Lineage
/>
children
:
<
Lineage
/>
},
},
{
{
auth
:
'/datastudio/bottom/process'
,
auth
:
'/datastudio/bottom/process'
,
key
:
'menu.datastudio.process'
,
key
:
'menu.datastudio.process'
,
icon
:
<
DesktopOutlined
/>,
icon
:
<
DesktopOutlined
/>,
label
:
l
(
'menu.datastudio.process'
)
label
:
l
(
'menu.datastudio.process'
)
},
},
{
{
auth
:
'/datastudio/bottom/history'
,
auth
:
'/datastudio/bottom/history'
,
key
:
'menu.datastudio.history'
,
key
:
'menu.datastudio.history'
,
icon
:
<
CalendarOutlined
/>,
icon
:
<
CalendarOutlined
/>,
label
:
l
(
'menu.datastudio.history'
)
label
:
l
(
'menu.datastudio.history'
)
},
},
{
{
auth
:
'/datastudio/bottom/table-data'
,
auth
:
'/datastudio/bottom/table-data'
,
key
:
'menu.datastudio.table-data'
,
key
:
'menu.datastudio.table-data'
,
icon
:
<
TableOutlined
/>,
icon
:
<
TableOutlined
/>,
label
:
l
(
'menu.datastudio.table-data'
),
label
:
l
(
'menu.datastudio.table-data'
),
children
:
<
TableData
/>
children
:
<
TableData
/>
},
},
{
{
auth
:
'/datastudio/bottom/tool'
,
auth
:
'/datastudio/bottom/tool'
,
key
:
'menu.datastudio.tool'
,
key
:
'menu.datastudio.tool'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
l
(
'menu.datastudio.tool'
)
label
:
l
(
'menu.datastudio.tool'
)
}
}
];
];
...
@@ -183,7 +183,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -183,7 +183,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool'
:
[
'menu.datastudio.tool'
:
[
{
{
key
:
'menu.datastudio.tool.text-comparison'
,
key
:
'menu.datastudio.tool.text-comparison'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
children
:
(
children
:
(
<
DiffEditor
<
DiffEditor
...
@@ -209,7 +209,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -209,7 +209,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
},
{
{
key
:
'menu.datastudio.tool.datax2'
,
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.datax2'
,
label
:
'menu.datastudio.tool.datax2'
,
children
:
<
div
>
datax2
</
div
>
children
:
<
div
>
datax2
</
div
>
}
}
...
@@ -217,7 +217,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -217,7 +217,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool2'
:
[
'menu.datastudio.tool2'
:
[
{
{
key
:
'menu.datastudio.tool.text-comparison'
,
key
:
'menu.datastudio.tool.text-comparison'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.text-comparison'
,
label
:
'menu.datastudio.tool.text-comparison'
,
children
:
(
children
:
(
<
DiffEditor
<
DiffEditor
...
@@ -237,7 +237,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -237,7 +237,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
},
{
{
key
:
'menu.datastudio.tool.datax2'
,
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.datax2'
,
label
:
'menu.datastudio.tool.datax2'
,
children
:
<
div
>
datax2
</
div
>
children
:
<
div
>
datax2
</
div
>
}
}
...
@@ -248,42 +248,54 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
...
@@ -248,42 +248,54 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.metadata'
:
[
'menu.datastudio.metadata'
:
[
{
{
icon
:
<
ReloadOutlined
/>,
icon
:
<
PlusOutlined
/>,
title
:
l
(
'button.create'
),
onClick
:
()
=>
{
}
},
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
}
}
],
],
'menu.datastudio.catalog'
:
[
'menu.datastudio.catalog'
:
[
{
{
icon
:
<
ReloadOutlined
/>,
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
}
}
],
],
'menu.datastudio.project'
:
[
'menu.datastudio.project'
:
[
{
{
icon
:
<
PlusCircleOutlined
/>,
icon
:
<
PlusCircleOutlined
/>,
title
:
l
(
'right.menu.createRoot'
),
title
:
l
(
'right.menu.createRoot'
),
key
:
'right.menu.createRoot'
,
key
:
'right.menu.createRoot'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
},
{
{
icon
:
<
ArrowsAltOutlined
/>,
icon
:
<
ArrowsAltOutlined
/>,
title
:
l
(
'button.expand-all'
),
title
:
l
(
'button.expand-all'
),
key
:
'button.expand-all'
,
key
:
'button.expand-all'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
},
{
{
icon
:
<
ShrinkOutlined
/>,
icon
:
<
ShrinkOutlined
/>,
title
:
l
(
'button.collapse-all'
),
title
:
l
(
'button.collapse-all'
),
key
:
'button.collapse-all'
,
key
:
'button.collapse-all'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
},
{
{
icon
:
<
EnvironmentOutlined
/>,
icon
:
<
EnvironmentOutlined
/>,
title
:
l
(
'button.position'
),
title
:
l
(
'button.position'
),
key
:
'button.position'
,
key
:
'button.position'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
}
}
]
]
};
};
...
...
dinky-web/src/pages/RegCenter/Cluster/Instance/components/InstanceList/index.tsx
View file @
cd7470a3
...
@@ -186,7 +186,6 @@ export default () => {
...
@@ -186,7 +186,6 @@ export default () => {
description=
{
l
(
'rc.ci.deleteConfirm'
)
}
description=
{
l
(
'rc.ci.deleteConfirm'
)
}
/>
/>
</
Authorized
>
</
Authorized
>
{
renderWebUiRedirect
(
record
)
}
</
Space
>
</
Space
>
);
);
...
@@ -201,7 +200,7 @@ export default () => {
...
@@ -201,7 +200,7 @@ export default () => {
<
Col
flex=
'85%'
>
<
Col
flex=
'85%'
>
<
Paragraph
>
<
Paragraph
>
<
blockquote
>
<
blockquote
>
{
l
(
'rc.ci.jma'
)
}
:
<
Link
>
{
item
.
jobManagerHost
}
</
Link
>
{
l
(
'rc.ci.jma'
)
}
:
{
renderWebUiRedirect
(
item
)
}
</
blockquote
>
</
blockquote
>
<
blockquote
>
<
blockquote
>
{
l
(
'rc.ci.version'
)
}
:
<
Link
>
{
item
.
version
}
</
Link
>
{
l
(
'rc.ci.version'
)
}
:
<
Link
>
{
item
.
version
}
</
Link
>
...
@@ -306,7 +305,7 @@ export default () => {
...
@@ -306,7 +305,7 @@ export default () => {
<
Badge
.
Ribbon
<
Badge
.
Ribbon
className=
{
'card-list-item-wrapper'
}
className=
{
'card-list-item-wrapper'
}
color=
{
item
.
autoRegisters
?
'green'
:
'yellow'
}
color=
{
item
.
autoRegisters
?
'green'
:
'yellow'
}
text=
{
item
.
autoRegisters
?
l
(
'rc.ci.ar'
)
:
l
(
'rc.ci.mr'
)
}
text=
{
item
.
autoRegisters
?
l
(
'rc.ci.ar'
)
:
<
span
style=
{
{
color
:
"crimson"
}
}
>
{
l
(
'rc.ci.mr'
)
}
</
span
>
}
>
>
<
Card
<
Card
headStyle=
{
{
minHeight
:
'10px'
}
}
headStyle=
{
{
minHeight
:
'10px'
}
}
...
...
dinky-web/src/pages/RegCenter/Cluster/Instance/components/contants.tsx
View file @
cd7470a3
...
@@ -38,6 +38,16 @@ export const CLUSTER_INSTANCE_TYPE: DefaultOptionType[] = [
...
@@ -38,6 +38,16 @@ export const CLUSTER_INSTANCE_TYPE: DefaultOptionType[] = [
value
:
ClusterType
.
KUBERNETES_SESSION
,
value
:
ClusterType
.
KUBERNETES_SESSION
,
label
:
'Kubernetes Session'
,
label
:
'Kubernetes Session'
,
key
:
ClusterType
.
KUBERNETES_SESSION
key
:
ClusterType
.
KUBERNETES_SESSION
},
{
value
:
ClusterType
.
YARN_APPLICATION
,
label
:
'Yarn Application'
,
key
:
ClusterType
.
YARN_APPLICATION
},
{
value
:
ClusterType
.
LOACL
,
label
:
'Local'
,
key
:
ClusterType
.
LOACL
}
}
];
];
...
...
dinky-web/src/pages/RegCenter/Cluster/Instance/components/function.tsx
View file @
cd7470a3
...
@@ -17,12 +17,14 @@
...
@@ -17,12 +17,14 @@
*
*
*/
*/
import
{
WebIcon
}
from
'@/components/Icons/CustomIcons'
;
import
{
WebIcon
}
from
'@/components/Icons/CustomIcons'
;
import
{
RUN_MODE
}
from
'@/services/constants'
;
import
{
RUN_MODE
}
from
'@/services/constants'
;
import
{
Cluster
}
from
'@/types/RegCenter/data'
;
import
{
Cluster
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Button
}
from
'antd'
;
import
{
Button
,
Typography
}
from
'antd'
;
import
{
RuleObject
}
from
'rc-field-form/es/interface'
;
import
{
RuleObject
}
from
'rc-field-form/es/interface'
;
const
{
Text
,
Paragraph
,
Link
}
=
Typography
;
/**
/**
* validatorJMHAAdderess
* validatorJMHAAdderess
...
@@ -60,17 +62,12 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => {
...
@@ -60,17 +62,12 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => {
record
.
type
===
RUN_MODE
.
YARN_PER_JOB
)
record
.
type
===
RUN_MODE
.
YARN_PER_JOB
)
)
{
)
{
return
(
return
(
<>
<
Link
<
Button
href=
{
`/api/flink/${record.jobManagerHost}/#/overview`
}
icon=
{
<
WebIcon
/>
}
key=
{
`${record.id}_webui`
}
key=
{
`${record.id}_webui`
}
type=
'link'
title=
{
`http://${record.jobManagerHost}/#/overview`
}
href=
{
`http://${record.jobManagerHost}/#/overview`
}
target=
'_blank'
target=
'_blank'
/>
>
{
record
.
jobManagerHost
}
</
Link
>
</>
);
);
}
}
return
undefined
;
return
<
Link
>
{
record
.
hosts
}
</
Link
>
;
};
};
dinky-web/src/pages/RegCenter/Cluster/constants.ts
View file @
cd7470a3
...
@@ -23,5 +23,7 @@ export const enum ClusterType {
...
@@ -23,5 +23,7 @@ export const enum ClusterType {
YARN_SESSION
=
'yarn-session'
,
YARN_SESSION
=
'yarn-session'
,
KUBERNETES_SESSION
=
'kubernetes-session'
,
KUBERNETES_SESSION
=
'kubernetes-session'
,
KUBERNETES_NATIVE
=
'kubernetes-application'
,
KUBERNETES_NATIVE
=
'kubernetes-application'
,
KUBERNETES_OPERATOR
=
'kubernetes-application-operator'
KUBERNETES_OPERATOR
=
'kubernetes-application-operator'
,
YARN_APPLICATION
=
'yarn-application'
,
LOACL
=
'local'
,
}
}
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceList/index.tsx
View file @
cd7470a3
...
@@ -37,7 +37,7 @@ import { API_CONSTANTS } from '@/services/endpoints';
...
@@ -37,7 +37,7 @@ import { API_CONSTANTS } from '@/services/endpoints';
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
WarningMessage
}
from
'@/utils/messages'
;
import
{
WarningMessage
}
from
'@/utils/messages'
;
import
{
useNavigate
}
from
'@@/exports'
;
import
{
useNavigate
}
from
'@@/exports'
;
import
{
import
{
CheckCircleOutlined
,
CheckCircleOutlined
,
CopyTwoTone
,
CopyTwoTone
,
...
@@ -50,22 +50,28 @@ import DescriptionsItem from 'antd/es/descriptions/Item';
...
@@ -50,22 +50,28 @@ import DescriptionsItem from 'antd/es/descriptions/Item';
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'umi'
;
import
{
connect
}
from
'umi'
;
import
DataSourceModal
from
'../DataSourceModal'
;
import
DataSourceModal
from
'../DataSourceModal'
;
import
{
handleTest
,
saveOrUpdateHandle
}
from
"@/pages/RegCenter/DataSource/service"
;
const
DataSourceTable
:
React
.
FC
<
connect
&
StateType
>
=
(
props
)
=>
{
const
DataSourceTable
:
React
.
FC
<
connect
&
StateType
>
=
(
props
)
=>
{
const
navigate
=
useNavigate
();
const
{
dispatch
}
=
props
;
const
{
dispatch
}
=
props
;
const
navigate
=
useNavigate
();
/**
/**
* state
* state
*/
*/
const
actionRef
=
React
.
useRef
<
ActionType
>
();
const
[
loading
,
setLoading
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
modalVisible
,
setModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
modalVisible
,
setModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
detailPage
,
setDetailPage
]
=
useState
<
boolean
>
(
false
);
const
[
detailPage
,
setDetailPage
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
setUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
dataSource
,
setDataSource
]
=
useState
<
DataSources
.
DataSource
[]
>
([]);
const
[
dataSource
,
setDataSource
]
=
useState
<
DataSources
.
DataSource
[]
>
([]);
const
[
formValues
,
setFormValues
]
=
useState
<
Partial
<
DataSources
.
DataSource
>>
({});
const
[
formValues
,
setFormValues
]
=
useState
<
Partial
<
DataSources
.
DataSource
>>
({});
const
actionRef
=
React
.
useRef
<
ActionType
>
();
/**
* query list
*/
useEffect
(()
=>
{
queryDataSourceList
();
},
[]);
/**
/**
* execute query list
* execute query list
...
@@ -80,21 +86,13 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -80,21 +86,13 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
* extra callback
* extra callback
* @param callback
* @param callback
*/
*/
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
any
>
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
await
callback
();
await
callback
();
await
queryDataSourceList
();
await
queryDataSourceList
();
setLoading
(
false
);
setLoading
(
false
);
};
};
/**
* handle add or update
* @param item
*/
const
saveOrUpdateHandle
=
async
(
item
:
Partial
<
DataSources
.
DataSource
>
)
=>
{
await
executeAndCallbackRefresh
(
async
()
=>
handleAddOrUpdate
(
API_CONSTANTS
.
DATASOURCE
,
item
));
};
/**
/**
* handle delete
* handle delete
* @param id
* @param id
...
@@ -120,13 +118,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -120,13 +118,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
);
);
};
};
/**
* handle test
* @param item
*/
const
handleTest
=
async
(
item
:
Partial
<
DataSources
.
DataSource
>
)
=>
{
await
handleOption
(
API_CONSTANTS
.
DATASOURCE_TEST
,
l
(
'button.test'
),
item
);
};
/**
/**
* handle check heart
* handle check heart
...
@@ -146,12 +138,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -146,12 +138,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
);
);
};
};
/**
* query list
*/
useEffect
(()
=>
{
queryDataSourceList
();
},
[]);
/**
/**
* render sub title
* render sub title
...
@@ -175,7 +162,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -175,7 +162,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
*/
*/
const
editClick
=
(
item
:
DataSources
.
DataSource
)
=>
{
const
editClick
=
(
item
:
DataSources
.
DataSource
)
=>
{
setFormValues
(
item
);
setFormValues
(
item
);
set
Update
ModalVisible
(
!
modalVisible
);
setModalVisible
(
!
modalVisible
);
};
};
/**
/**
...
@@ -272,7 +259,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -272,7 +259,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
*/
*/
const
cancelAll
=
()
=>
{
const
cancelAll
=
()
=>
{
setModalVisible
(
false
);
setModalVisible
(
false
);
setUpdateModalVisible
(
false
);
setFormValues
({});
setFormValues
({});
};
};
...
@@ -299,21 +285,12 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
...
@@ -299,21 +285,12 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
/
>
/
>
{
/* added */
}
{
/* added */
}
<
DataSourceModal
values=
{
{}
}
visible=
{
modalVisible
}
onCancel=
{
cancelAll
}
onTest=
{
(
value
)
=>
handleTest
(
value
)
}
onSubmit=
{
(
value
)
=>
saveOrUpdateHandle
(
value
)
}
/>
{
/* modify*/
}
<
DataSourceModal
<
DataSourceModal
values=
{
formValues
}
values=
{
formValues
}
visible=
{
updateM
odalVisible
}
visible=
{
m
odalVisible
}
onCancel=
{
cancelAll
}
onCancel=
{
cancelAll
}
onTest=
{
(
value
)
=>
handleTest
(
value
)
}
onTest=
{
(
value
)
=>
handleTest
(
value
)
}
onSubmit=
{
(
value
)
=>
saveOrUpdateHandle
(
value
)
}
onSubmit=
{
(
value
)
=>
executeAndCallbackRefresh
(
async
()
=>
saveOrUpdateHandle
(
value
)
)
}
/>
/>
</>
</>
) : (
) : (
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceModal/DataSourceProForm/index.tsx
View file @
cd7470a3
...
@@ -21,19 +21,19 @@ import {
...
@@ -21,19 +21,19 @@ import {
DATA_SOURCE_TYPE_OPTIONS
,
DATA_SOURCE_TYPE_OPTIONS
,
GROUP_TYPE
GROUP_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
import
{
ProForm
,
ProForm
,
ProFormGroup
,
ProFormGroup
,
ProFormSelect
,
ProFormSelect
,
ProFormText
,
ProFormText
ProFormTextArea
}
from
'@ant-design/pro-components'
;
}
from
'@ant-design/pro-components'
;
import
{
AutoComplete
}
from
'antd'
;
import
{
AutoComplete
,
Form
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
import
{
Values
}
from
'async-validator'
;
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
TextArea
from
"antd/es/input/TextArea"
;
type
DataSourceProFormProps
=
{
type
DataSourceProFormProps
=
{
values
:
Partial
<
DataSources
.
DataSource
>
;
values
:
Partial
<
DataSources
.
DataSource
>
;
...
@@ -50,7 +50,7 @@ const CodeEditProps = {
...
@@ -50,7 +50,7 @@ const CodeEditProps = {
};
};
const
DataSourceProForm
:
React
.
FC
<
DataSourceProFormProps
>
=
(
props
)
=>
{
const
DataSourceProForm
:
React
.
FC
<
DataSourceProFormProps
>
=
(
props
)
=>
{
const
{
values
,
form
,
flinkTemplateChange
,
flinkConfigChange
}
=
props
;
const
{
values
,
form
,
flinkTemplateChange
,
flinkConfigChange
}
=
props
;
const
[
excludeFormItem
,
setExcludeFormItem
]
=
useState
<
boolean
>
(
false
);
const
[
excludeFormItem
,
setExcludeFormItem
]
=
useState
<
boolean
>
(
false
);
const
[
dbType
,
setDbType
]
=
useState
<
string
>
(
values
.
type
??
'MySQL'
);
const
[
dbType
,
setDbType
]
=
useState
<
string
>
(
values
.
type
??
'MySQL'
);
...
@@ -72,7 +72,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -72,7 +72,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name=
'name'
name=
'name'
width=
{
'md'
}
width=
{
'md'
}
label=
{
l
(
'rc.ds.name'
)
}
label=
{
l
(
'rc.ds.name'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.namePlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.namePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.namePlaceholder'
)
}
placeholder=
{
l
(
'rc.ds.namePlaceholder'
)
}
/>
/>
<
ProFormSelect
<
ProFormSelect
...
@@ -89,7 +89,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -89,7 +89,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
showSearch
showSearch
initialValue=
{
dbType
}
initialValue=
{
dbType
}
options=
{
DATA_SOURCE_TYPE_OPTIONS
}
options=
{
DATA_SOURCE_TYPE_OPTIONS
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.typePlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.typePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.typePlaceholder'
)
}
placeholder=
{
l
(
'rc.ds.typePlaceholder'
)
}
/>
/>
...
@@ -97,7 +97,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -97,7 +97,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name=
'username'
name=
'username'
width=
{
'sm'
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.username'
)
}
label=
{
l
(
'rc.ds.username'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.usernamePlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.usernamePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.usernamePlaceholder'
)
}
placeholder=
{
l
(
'rc.ds.usernamePlaceholder'
)
}
/>
/>
<
ProFormText
.
Password
<
ProFormText
.
Password
...
@@ -121,28 +121,31 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -121,28 +121,31 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
</
ProForm
.
Group
>
</
ProForm
.
Group
>
<
ProForm
.
Group
>
<
ProForm
.
Group
>
<
Form
.
Item
name=
"url"
label=
{
l
(
'rc.ds.url'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)}]
}
>
<
AutoComplete
<
AutoComplete
virtual
virtual
size=
{
'small'
}
placement=
{
'topLeft'
}
placement=
{
'topLeft'
}
autoClearSearchValue
autoClearSearchValue
options=
{
AUTO_COMPLETE_TYPE
}
options=
{
AUTO_COMPLETE_TYPE
}
style=
{
{
style=
{
{
width
:
parent
.
innerWidth
/
2
-
80
,
width
:
parent
.
innerWidth
/
2
-
80
minHeight
:
parent
.
innerHeight
/
4
-
110
,
marginBottom
:
0
}
}
}
}
filterOption
filterOption
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
>
>
<
ProFormTextArea
<
TextArea
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
/>
name=
'url'
{
/*<ProFormTextArea*/
}
width=
{
parent
.
innerWidth
/
2
-
80
}
{
/* name='url'*/
}
label=
{
l
(
'rc.ds.url'
)
}
{
/* width={parent.innerWidth / 2 - 80}*/
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)
}]
}
{
/* label={l('rc.ds.url')}*/
}
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
{
/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/
}
/>
{
/* placeholder={l('rc.ds.urlPlaceholder')}*/
}
{
/*/>*/
}
</
AutoComplete
>
</
AutoComplete
>
</
Form
.
Item
>
</
ProForm
.
Group
>
</
ProForm
.
Group
>
{
!
excludeFormItem
&&
(
{
!
excludeFormItem
&&
(
...
@@ -176,17 +179,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -176,17 +179,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
);
);
};
};
return
(
return
renderDataSourceForm
();
<>
<
ProForm
initialValues=
{
values
}
form=
{
form
}
onValuesChange=
{
(
changedValues
,
values
)
=>
handleTypeChange
(
values
)
}
submitter=
{
false
}
>
{
renderDataSourceForm
()
}
</
ProForm
>
</>
);
};
};
export
default
DataSourceProForm
;
export
default
DataSourceProForm
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceModal/index.tsx
View file @
cd7470a3
...
@@ -57,8 +57,12 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
...
@@ -57,8 +57,12 @@ const DataSourceModal: React.FC<DataSourceModalProps> = (props) => {
* when modalVisible or values changed, set form values
* when modalVisible or values changed, set form values
*/
*/
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
visible
)
{
form
.
resetFields
();
}
else
{
form
.
setFieldsValue
(
values
);
form
.
setFieldsValue
(
values
);
},
[
visible
,
values
,
form
]);
}
},
[
visible
,
values
]);
/**
/**
* handle cancel
* handle cancel
...
...
dinky-web/src/pages/RegCenter/DataSource/service.tsx
0 → 100644
View file @
cd7470a3
import
{
DataSources
}
from
"@/types/RegCenter/data"
;
import
{
API_CONSTANTS
}
from
"@/services/endpoints"
;
import
{
handleAddOrUpdate
,
handleOption
}
from
"@/services/BusinessCrud"
;
import
{
l
}
from
"@/utils/intl"
;
/**
* handle test
* @param item
*/
export
const
handleTest
=
async
(
item
:
Partial
<
DataSources
.
DataSource
>
)
=>
{
await
handleOption
(
API_CONSTANTS
.
DATASOURCE_TEST
,
l
(
'button.test'
),
item
);
};
/**
* handle add or update
* @param item
*/
export
const
saveOrUpdateHandle
=
async
(
item
:
Partial
<
DataSources
.
DataSource
>
)
=>
{
await
handleAddOrUpdate
(
API_CONSTANTS
.
DATASOURCE
,
item
);
};
\ No newline at end of file
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