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;
import
com.fasterxml.jackson.databind.JsonNode
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.json.JSONUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
...
...
@@ -115,7 +116,8 @@ public class JobDataDto {
}
public
static
JobDataDto
fromJobHistory
(
JobHistory
jobHistory
)
{
return
JobDataDto
.
builder
()
return
Opt
.
ofNullable
(
jobHistory
)
.
map
(
x
->
JobDataDto
.
builder
()
.
id
(
jobHistory
.
getId
())
.
tenantId
(
jobHistory
.
getTenantId
())
.
job
(
jobHistory
.
getJobJson
())
...
...
@@ -126,6 +128,7 @@ public class JobDataDto {
.
jar
(
JsonUtils
.
parseToJsonNode
(
jobHistory
.
getJarJson
()))
.
cluster
(
jobHistory
.
getClusterJson
())
.
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
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
{
TagAlignLeft
}
from
'@/components/StyledComponents'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
SchemaTree
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DatabaseOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
Key
,
ProForm
,
ProFormSelect
}
from
'@ant-design/pro-components'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
clearMetaDataTable
,
showMetaDataTable
}
from
'./service'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DatabaseOutlined
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
Key
,
ProForm
,
ProFormSelect
}
from
'@ant-design/pro-components'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
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
{
dispatch
,
toolContentHeight
,
database
:
{
dbData
,
selectDatabaseId
,
expandKeys
,
selectKeys
}
database
:
{
dbData
,
selectDatabaseId
,
expandKeys
,
selectKeys
}
}
=
props
;
const
[
treeData
,
setTreeData
]
=
useState
<
[]
>
([]);
const
[
isLoadingDatabase
,
setIsLoadingDatabase
]
=
useState
(
false
);
const
[
showCreate
,
setShowCreate
]
=
useState
(
false
);
const
selectDb
=
(
dbData
as
DataSources
.
DataSource
[]).
filter
((
x
)
=>
x
.
id
===
selectDatabaseId
)[
0
];
/**
...
...
@@ -38,12 +41,12 @@ const MetaData = (props: any) => {
for
(
let
table
of
tables
)
{
table
.
title
=
table
.
name
;
table
.
key
=
table
.
name
;
table
.
icon
=
<
DatabaseOutlined
/>;
table
.
icon
=
<
DatabaseOutlined
/>;
table
.
children
=
table
.
tables
;
for
(
let
child
of
table
.
children
)
{
child
.
title
=
child
.
name
;
child
.
key
=
table
.
name
+
'.'
+
child
.
name
;
child
.
icon
=
<
TableOutlined
/>;
child
.
icon
=
<
TableOutlined
/>;
child
.
isLeaf
=
true
;
child
.
schema
=
table
.
name
;
child
.
table
=
child
.
name
;
...
...
@@ -67,6 +70,9 @@ const MetaData = (props: any) => {
};
BtnRoute
[
'menu.datastudio.metadata'
][
0
].
onClick
=
()
=>
{
setShowCreate
(
true
)
};
BtnRoute
[
'menu.datastudio.metadata'
][
1
].
onClick
=
()
=>
{
if
(
!
selectDatabaseId
)
return
;
setIsLoadingDatabase
(
true
);
clearMetaDataTable
(
selectDatabaseId
).
then
(()
=>
{
...
...
@@ -78,7 +84,7 @@ const MetaData = (props: any) => {
* 构建数据库列表 下拉框
*/
const
getDataBaseOptions
=
()
=>
{
return
dbData
.
map
(({
id
,
name
,
type
,
enabled
,
status
}:
DataSources
.
DataSource
)
=>
({
return
dbData
.
map
(({
id
,
name
,
type
,
enabled
,
status
}:
DataSources
.
DataSource
)
=>
({
key
:
id
,
value
:
id
,
label
:
(
...
...
@@ -106,14 +112,14 @@ const MetaData = (props: any) => {
});
const
{
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableName
,
fullInfo
}
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableName
,
fullInfo
}
}
=
info
;
if
(
!
isLeaf
)
{
return
;
}
const
queryParams
=
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
const
queryParams
=
{
id
:
selectDatabaseId
,
schemaName
,
tableName
};
dispatch
({
type
:
STUDIO_MODEL
.
addTab
,
payload
:
{
...
...
@@ -121,7 +127,7 @@ const MetaData = (props: any) => {
id
:
selectDatabaseId
+
schemaName
+
tableName
,
breadcrumbLabel
:
[
selectDb
.
type
,
selectDb
.
name
].
join
(
'/'
),
label
:
schemaName
+
'.'
+
tableName
,
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
type
:
'metadata'
}
});
...
...
@@ -152,13 +158,27 @@ const MetaData = (props: any) => {
return
(
<
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
style=
{
{
height
:
40
}
}
initialValues=
{
{
selectDb
:
selectDatabaseId
}
}
style=
{
{
height
:
40
}
}
initialValues=
{
{
selectDb
:
selectDatabaseId
}
}
submitter=
{
false
}
>
<
ProFormSelect
style=
{
{
paddingInline
:
6
}
}
style=
{
{
paddingInline
:
6
}
}
// width={leftContainer.width }
width=
{
'xl'
}
// addonAfter={<ReloadOutlined spin={isLoadingDatabase} title={l('button.refresh')} onClick={() => refreshDataBase()} />}
...
...
@@ -174,7 +194,7 @@ const MetaData = (props: any) => {
<
SchemaTree
selectKeys=
{
selectKeys
}
expandKeys=
{
expandKeys
}
style=
{
{
height
:
toolContentHeight
-
64
-
20
}
}
style=
{
{
height
:
toolContentHeight
-
64
-
20
}
}
onNodeClick=
{
handleTreeNodeClick
}
treeData=
{
treeData
}
onExpand=
{
handleTreeExpand
}
...
...
@@ -183,7 +203,9 @@ const MetaData = (props: any) => {
);
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
toolContentHeight
:
Studio
.
toolContentHeight
,
leftContainer
:
Studio
.
leftContainer
,
database
:
Studio
.
database
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
cd7470a3
...
...
@@ -17,21 +17,21 @@
*
*/
import
{
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
{
CircleDataStudioButtonProps
}
from
'@/components/CallBackButton/CircleBtn'
;
import
Console
from
'@/pages/DataStudio/BottomContainer/Console'
;
import
Lineage
from
'@/pages/DataStudio/BottomContainer/Lineage'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
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
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
HistoryVersion
from
'@/pages/DataStudio/RightContainer/HistoryVersion'
;
import
JobConfig
from
'@/pages/DataStudio/RightContainer/JobConfig'
;
import
JobInfo
from
'@/pages/DataStudio/RightContainer/JobInfo'
;
import
SavePoints
from
'@/pages/DataStudio/RightContainer/SavePoints'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ApartmentOutlined
,
ArrowsAltOutlined
,
...
...
@@ -46,7 +46,7 @@ import {
InfoCircleOutlined
,
MonitorOutlined
,
PlayCircleOutlined
,
PlusCircle
Outlined
,
PlusCircleOutlined
,
Plus
Outlined
,
ReloadOutlined
,
RightSquareOutlined
,
SettingOutlined
,
...
...
@@ -54,30 +54,30 @@ import {
TableOutlined
,
ToolOutlined
}
from
'@ant-design/icons'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
ReactNode
}
from
'react'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
ReactNode
}
from
'react'
;
export
const
LeftSide
=
[
{
auth
:
'/datastudio/left/project'
,
key
:
'menu.datastudio.project'
,
icon
:
<
ConsoleSqlOutlined
/>,
icon
:
<
ConsoleSqlOutlined
/>,
label
:
l
(
'menu.datastudio.project'
),
children
:
<
Project
/>
children
:
<
Project
/>
},
{
auth
:
'/datastudio/left/catalog'
,
key
:
'menu.datastudio.catalog'
,
icon
:
<
TableOutlined
/>,
icon
:
<
TableOutlined
/>,
label
:
l
(
'menu.datastudio.catalog'
),
children
:
<
Catalog
/>
children
:
<
Catalog
/>
},
{
auth
:
'/datastudio/left/metadata'
,
key
:
'menu.datastudio.metadata'
,
icon
:
<
DatabaseOutlined
/>,
icon
:
<
DatabaseOutlined
/>,
label
:
l
(
'menu.datastudio.metadata'
),
children
:
<
MetaData
/>
children
:
<
MetaData
/>
}
];
...
...
@@ -85,41 +85,41 @@ export const RightSide: TabProp[] = [
{
auth
:
'/datastudio/right/jobConfig'
,
key
:
'menu.datastudio.jobConfig'
,
icon
:
<
SettingOutlined
/>,
icon
:
<
SettingOutlined
/>,
label
:
l
(
'menu.datastudio.jobConfig'
),
children
:
<
JobConfig
/>,
children
:
<
JobConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/executeConfig'
,
key
:
'menu.datastudio.executeConfig'
,
icon
:
<
PlayCircleOutlined
/>,
icon
:
<
PlayCircleOutlined
/>,
label
:
l
(
'menu.datastudio.executeConfig'
),
children
:
<
ExecuteConfig
/>,
children
:
<
ExecuteConfig
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/savePoint'
,
key
:
'menu.datastudio.savePoint'
,
icon
:
<
FolderOutlined
/>,
icon
:
<
FolderOutlined
/>,
label
:
l
(
'menu.datastudio.savePoint'
),
children
:
<
SavePoints
/>,
children
:
<
SavePoints
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/historyVision'
,
key
:
'menu.datastudio.historyVision'
,
icon
:
<
HistoryOutlined
/>,
icon
:
<
HistoryOutlined
/>,
label
:
l
(
'menu.datastudio.historyVision'
),
children
:
<
HistoryVersion
/>,
children
:
<
HistoryVersion
/>,
isShow
:
(
type
,
subType
)
=>
type
===
TabsPageType
.
project
&&
TabsPageSubType
.
flinkSql
===
subType
},
{
auth
:
'/datastudio/right/jobInfo'
,
key
:
'menu.datastudio.jobInfo'
,
icon
:
<
InfoCircleOutlined
/>,
icon
:
<
InfoCircleOutlined
/>,
label
:
l
(
'menu.datastudio.jobInfo'
),
children
:
<
JobInfo
/>,
children
:
<
JobInfo
/>,
isShow
:
(
type
)
=>
type
!==
TabsPageType
.
None
}
];
...
...
@@ -128,53 +128,53 @@ export const LeftBottomSide = [
{
auth
:
'/datastudio/bottom/console'
,
key
:
'menu.datastudio.console'
,
icon
:
<
RightSquareOutlined
/>,
icon
:
<
RightSquareOutlined
/>,
label
:
l
(
'menu.datastudio.console'
),
children
:
<
Console
/>
children
:
<
Console
/>
},
{
auth
:
'/datastudio/bottom/result'
,
key
:
'menu.datastudio.result'
,
icon
:
<
MonitorOutlined
/>,
icon
:
<
MonitorOutlined
/>,
label
:
l
(
'menu.datastudio.result'
),
children
:
<
Result
/>
children
:
<
Result
/>
},
{
auth
:
'/datastudio/bottom/bi'
,
key
:
'menu.datastudio.bi'
,
icon
:
<
BarChartOutlined
/>,
icon
:
<
BarChartOutlined
/>,
label
:
l
(
'menu.datastudio.bi'
)
},
{
auth
:
'/datastudio/bottom/lineage'
,
key
:
'menu.datastudio.lineage'
,
icon
:
<
ApartmentOutlined
/>,
icon
:
<
ApartmentOutlined
/>,
label
:
l
(
'menu.datastudio.lineage'
),
children
:
<
Lineage
/>
children
:
<
Lineage
/>
},
{
auth
:
'/datastudio/bottom/process'
,
key
:
'menu.datastudio.process'
,
icon
:
<
DesktopOutlined
/>,
icon
:
<
DesktopOutlined
/>,
label
:
l
(
'menu.datastudio.process'
)
},
{
auth
:
'/datastudio/bottom/history'
,
key
:
'menu.datastudio.history'
,
icon
:
<
CalendarOutlined
/>,
icon
:
<
CalendarOutlined
/>,
label
:
l
(
'menu.datastudio.history'
)
},
{
auth
:
'/datastudio/bottom/table-data'
,
key
:
'menu.datastudio.table-data'
,
icon
:
<
TableOutlined
/>,
icon
:
<
TableOutlined
/>,
label
:
l
(
'menu.datastudio.table-data'
),
children
:
<
TableData
/>
children
:
<
TableData
/>
},
{
auth
:
'/datastudio/bottom/tool'
,
key
:
'menu.datastudio.tool'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
l
(
'menu.datastudio.tool'
)
}
];
...
...
@@ -183,7 +183,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool'
:
[
{
key
:
'menu.datastudio.tool.text-comparison'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
l
(
'menu.datastudio.tool.text-comparison'
),
children
:
(
<
DiffEditor
...
...
@@ -209,7 +209,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
{
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.datax2'
,
children
:
<
div
>
datax2
</
div
>
}
...
...
@@ -217,7 +217,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
'menu.datastudio.tool2'
:
[
{
key
:
'menu.datastudio.tool.text-comparison'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.text-comparison'
,
children
:
(
<
DiffEditor
...
...
@@ -237,7 +237,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
},
{
key
:
'menu.datastudio.tool.datax2'
,
icon
:
<
ToolOutlined
/>,
icon
:
<
ToolOutlined
/>,
label
:
'menu.datastudio.tool.datax2'
,
children
:
<
div
>
datax2
</
div
>
}
...
...
@@ -248,42 +248,54 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
export
const
BtnRoute
:
{
[
c
:
string
]:
CircleDataStudioButtonProps
[]
}
=
{
'menu.datastudio.metadata'
:
[
{
icon
:
<
ReloadOutlined
/>,
icon
:
<
PlusOutlined
/>,
title
:
l
(
'button.create'
),
onClick
:
()
=>
{
}
},
{
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
}
],
'menu.datastudio.catalog'
:
[
{
icon
:
<
ReloadOutlined
/>,
icon
:
<
ReloadOutlined
/>,
title
:
l
(
'button.refresh'
),
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
}
],
'menu.datastudio.project'
:
[
{
icon
:
<
PlusCircleOutlined
/>,
icon
:
<
PlusCircleOutlined
/>,
title
:
l
(
'right.menu.createRoot'
),
key
:
'right.menu.createRoot'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
{
icon
:
<
ArrowsAltOutlined
/>,
icon
:
<
ArrowsAltOutlined
/>,
title
:
l
(
'button.expand-all'
),
key
:
'button.expand-all'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
{
icon
:
<
ShrinkOutlined
/>,
icon
:
<
ShrinkOutlined
/>,
title
:
l
(
'button.collapse-all'
),
key
:
'button.collapse-all'
,
onClick
:
()
=>
{}
onClick
:
()
=>
{
}
},
{
icon
:
<
EnvironmentOutlined
/>,
icon
:
<
EnvironmentOutlined
/>,
title
:
l
(
'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 () => {
description=
{
l
(
'rc.ci.deleteConfirm'
)
}
/>
</
Authorized
>
{
renderWebUiRedirect
(
record
)
}
</
Space
>
);
...
...
@@ -201,7 +200,7 @@ export default () => {
<
Col
flex=
'85%'
>
<
Paragraph
>
<
blockquote
>
{
l
(
'rc.ci.jma'
)
}
:
<
Link
>
{
item
.
jobManagerHost
}
</
Link
>
{
l
(
'rc.ci.jma'
)
}
:
{
renderWebUiRedirect
(
item
)
}
</
blockquote
>
<
blockquote
>
{
l
(
'rc.ci.version'
)
}
:
<
Link
>
{
item
.
version
}
</
Link
>
...
...
@@ -306,7 +305,7 @@ export default () => {
<
Badge
.
Ribbon
className=
{
'card-list-item-wrapper'
}
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
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[] = [
value
:
ClusterType
.
KUBERNETES_SESSION
,
label
:
'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 @@
*
*/
import
{
WebIcon
}
from
'@/components/Icons/CustomIcons'
;
import
{
RUN_MODE
}
from
'@/services/constants'
;
import
{
Cluster
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Button
}
from
'antd'
;
import
{
RuleObject
}
from
'rc-field-form/es/interface'
;
import
{
WebIcon
}
from
'@/components/Icons/CustomIcons'
;
import
{
RUN_MODE
}
from
'@/services/constants'
;
import
{
Cluster
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Button
,
Typography
}
from
'antd'
;
import
{
RuleObject
}
from
'rc-field-form/es/interface'
;
const
{
Text
,
Paragraph
,
Link
}
=
Typography
;
/**
* validatorJMHAAdderess
...
...
@@ -60,17 +62,12 @@ export const renderWebUiRedirect = (record: Cluster.Instance) => {
record
.
type
===
RUN_MODE
.
YARN_PER_JOB
)
)
{
return
(
<>
<
Button
icon=
{
<
WebIcon
/>
}
<
Link
href=
{
`/api/flink/${record.jobManagerHost}/#/overview`
}
key=
{
`${record.id}_webui`
}
type=
'link'
title=
{
`http://${record.jobManagerHost}/#/overview`
}
href=
{
`http://${record.jobManagerHost}/#/overview`
}
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 {
YARN_SESSION
=
'yarn-session'
,
KUBERNETES_SESSION
=
'kubernetes-session'
,
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';
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
WarningMessage
}
from
'@/utils/messages'
;
import
{
useNavigate
}
from
'@@/exports'
;
import
{
useNavigate
}
from
'@@/exports'
;
import
{
CheckCircleOutlined
,
CopyTwoTone
,
...
...
@@ -50,22 +50,28 @@ import DescriptionsItem from 'antd/es/descriptions/Item';
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'umi'
;
import
DataSourceModal
from
'../DataSourceModal'
;
import
{
handleTest
,
saveOrUpdateHandle
}
from
"@/pages/RegCenter/DataSource/service"
;
const
DataSourceTable
:
React
.
FC
<
connect
&
StateType
>
=
(
props
)
=>
{
const
navigate
=
useNavigate
();
const
{
dispatch
}
=
props
;
const
navigate
=
useNavigate
();
/**
* state
*/
const
actionRef
=
React
.
useRef
<
ActionType
>
();
const
[
loading
,
setLoading
]
=
React
.
useState
<
boolean
>
(
false
);
const
[
modalVisible
,
setModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
detailPage
,
setDetailPage
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
setUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
dataSource
,
setDataSource
]
=
useState
<
DataSources
.
DataSource
[]
>
([]);
const
[
formValues
,
setFormValues
]
=
useState
<
Partial
<
DataSources
.
DataSource
>>
({});
const
actionRef
=
React
.
useRef
<
ActionType
>
();
/**
* query list
*/
useEffect
(()
=>
{
queryDataSourceList
();
},
[]);
/**
* execute query list
...
...
@@ -80,21 +86,13 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
* extra callback
* @param callback
*/
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
any
>
)
=>
{
setLoading
(
true
);
await
callback
();
await
queryDataSourceList
();
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
* @param id
...
...
@@ -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
...
...
@@ -146,12 +138,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
);
};
/**
* query list
*/
useEffect
(()
=>
{
queryDataSourceList
();
},
[]);
/**
* render sub title
...
...
@@ -175,7 +162,7 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
*/
const
editClick
=
(
item
:
DataSources
.
DataSource
)
=>
{
setFormValues
(
item
);
set
Update
ModalVisible
(
!
modalVisible
);
setModalVisible
(
!
modalVisible
);
};
/**
...
...
@@ -272,7 +259,6 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
*/
const
cancelAll
=
()
=>
{
setModalVisible
(
false
);
setUpdateModalVisible
(
false
);
setFormValues
({});
};
...
...
@@ -299,21 +285,12 @@ const DataSourceTable: React.FC<connect & StateType> = (props) => {
/
>
{
/* added */
}
<
DataSourceModal
values=
{
{}
}
visible=
{
modalVisible
}
onCancel=
{
cancelAll
}
onTest=
{
(
value
)
=>
handleTest
(
value
)
}
onSubmit=
{
(
value
)
=>
saveOrUpdateHandle
(
value
)
}
/>
{
/* modify*/
}
<
DataSourceModal
values=
{
formValues
}
visible=
{
updateM
odalVisible
}
visible=
{
m
odalVisible
}
onCancel=
{
cancelAll
}
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 {
DATA_SOURCE_TYPE_OPTIONS
,
GROUP_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ProForm
,
ProFormGroup
,
ProFormSelect
,
ProFormText
,
ProFormTextArea
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
AutoComplete
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
import
React
,
{
useState
}
from
'react'
;
import
{
AutoComplete
,
Form
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
import
React
,
{
useState
}
from
'react'
;
import
TextArea
from
"antd/es/input/TextArea"
;
type
DataSourceProFormProps
=
{
values
:
Partial
<
DataSources
.
DataSource
>
;
...
...
@@ -50,7 +50,7 @@ const CodeEditProps = {
};
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
[
dbType
,
setDbType
]
=
useState
<
string
>
(
values
.
type
??
'MySQL'
);
...
...
@@ -72,7 +72,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name=
'name'
width=
{
'md'
}
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'
)
}
/>
<
ProFormSelect
...
...
@@ -89,7 +89,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
showSearch
initialValue=
{
dbType
}
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'
)
}
/>
...
...
@@ -97,7 +97,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name=
'username'
width=
{
'sm'
}
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'
)
}
/>
<
ProFormText
.
Password
...
...
@@ -121,28 +121,31 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
</
ProForm
.
Group
>
<
ProForm
.
Group
>
<
Form
.
Item
name=
"url"
label=
{
l
(
'rc.ds.url'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)}]
}
>
<
AutoComplete
virtual
size=
{
'small'
}
placement=
{
'topLeft'
}
autoClearSearchValue
options=
{
AUTO_COMPLETE_TYPE
}
style=
{
{
width
:
parent
.
innerWidth
/
2
-
80
,
minHeight
:
parent
.
innerHeight
/
4
-
110
,
marginBottom
:
0
width
:
parent
.
innerWidth
/
2
-
80
}
}
filterOption
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
>
<
ProFormTextArea
name=
'url'
width=
{
parent
.
innerWidth
/
2
-
80
}
label=
{
l
(
'rc.ds.url'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
/>
<
TextArea
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
/>
{
/*<ProFormTextArea*/
}
{
/* name='url'*/
}
{
/* width={parent.innerWidth / 2 - 80}*/
}
{
/* label={l('rc.ds.url')}*/
}
{
/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/
}
{
/* placeholder={l('rc.ds.urlPlaceholder')}*/
}
{
/*/>*/
}
</
AutoComplete
>
</
Form
.
Item
>
</
ProForm
.
Group
>
{
!
excludeFormItem
&&
(
...
...
@@ -176,17 +179,6 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
);
};
return
(
<>
<
ProForm
initialValues=
{
values
}
form=
{
form
}
onValuesChange=
{
(
changedValues
,
values
)
=>
handleTypeChange
(
values
)
}
submitter=
{
false
}
>
{
renderDataSourceForm
()
}
</
ProForm
>
</>
);
return
renderDataSourceForm
();
};
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) => {
* when modalVisible or values changed, set form values
*/
useEffect
(()
=>
{
if
(
!
visible
)
{
form
.
resetFields
();
}
else
{
form
.
setFieldsValue
(
values
);
},
[
visible
,
values
,
form
]);
}
},
[
visible
,
values
]);
/**
* 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