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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
112 additions
and
99 deletions
+112
-99
JobDataDto.java
dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java
+15
-12
index.tsx
...web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
+0
-0
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+0
-0
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
+38
-41
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
+0
-0
index.tsx
...RegCenter/DataSource/components/DataSourceModal/index.tsx
+6
-2
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,17 +116,19 @@ public class JobDataDto {
...
@@ -115,17 +116,19 @@ public class JobDataDto {
}
}
public
static
JobDataDto
fromJobHistory
(
JobHistory
jobHistory
)
{
public
static
JobDataDto
fromJobHistory
(
JobHistory
jobHistory
)
{
return
JobDataDto
.
builder
()
return
Opt
.
ofNullable
(
jobHistory
)
.
id
(
jobHistory
.
getId
())
.
map
(
x
->
JobDataDto
.
builder
()
.
tenantId
(
jobHistory
.
getTenantId
())
.
id
(
jobHistory
.
getId
())
.
job
(
jobHistory
.
getJobJson
())
.
tenantId
(
jobHistory
.
getTenantId
())
.
exceptions
(
jobHistory
.
getExceptionsJson
())
.
job
(
jobHistory
.
getJobJson
())
.
checkpoints
(
jobHistory
.
getCheckpointsJson
())
.
exceptions
(
jobHistory
.
getExceptionsJson
())
.
checkpointsConfig
(
jobHistory
.
getCheckpointsConfigJson
())
.
checkpoints
(
jobHistory
.
getCheckpointsJson
())
.
config
(
jobHistory
.
getConfigJson
())
.
checkpointsConfig
(
jobHistory
.
getCheckpointsConfigJson
())
.
jar
(
JsonUtils
.
parseToJsonNode
(
jobHistory
.
getJarJson
()))
.
config
(
jobHistory
.
getConfigJson
())
.
cluster
(
jobHistory
.
getClusterJson
())
.
jar
(
JsonUtils
.
parseToJsonNode
(
jobHistory
.
getJarJson
()))
.
clusterConfiguration
(
jobHistory
.
getClusterConfigurationJson
())
.
cluster
(
jobHistory
.
getClusterJson
())
.
build
();
.
clusterConfiguration
(
jobHistory
.
getClusterConfigurationJson
())
.
build
())
.
orElse
(
null
);
}
}
}
}
dinky-web/src/pages/DataStudio/LeftContainer/MetaData/index.tsx
View file @
cd7470a3
This diff is collapsed.
Click to expand it.
dinky-web/src/pages/DataStudio/route.tsx
View file @
cd7470a3
This diff is collapsed.
Click to expand it.
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
...
@@ -30,21 +32,21 @@ import { RuleObject } from 'rc-field-form/es/interface';
...
@@ -30,21 +32,21 @@ import { RuleObject } from 'rc-field-form/es/interface';
* @param value
* @param value
*/
*/
export
const
validatorJMHAAdderess
=
(
rule
:
RuleObject
,
value
=
''
)
=>
{
export
const
validatorJMHAAdderess
=
(
rule
:
RuleObject
,
value
=
''
)
=>
{
let
hostArray
=
[];
let
hostArray
=
[];
if
(
value
.
trim
().
length
===
0
)
{
if
(
value
.
trim
().
length
===
0
)
{
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmhaPlaceholder'
)));
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmhaPlaceholder'
)));
}
else
{
}
else
{
hostArray
=
value
.
split
(
','
);
hostArray
=
value
.
split
(
','
);
for
(
let
i
=
0
;
i
<
hostArray
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
hostArray
.
length
;
i
++
)
{
if
(
hostArray
[
i
].
includes
(
'/'
))
{
if
(
hostArray
[
i
].
includes
(
'/'
))
{
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmha.validate.slash'
)));
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmha.validate.slash'
)));
}
}
if
(
parseInt
(
hostArray
[
i
].
split
(
':'
)[
1
])
>=
65535
)
{
if
(
parseInt
(
hostArray
[
i
].
split
(
':'
)[
1
])
>=
65535
)
{
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmha.validate.port'
)));
return
Promise
.
reject
(
new
Error
(
l
(
'rc.ci.jmha.validate.port'
)));
}
}
}
return
Promise
.
resolve
();
}
}
return
Promise
.
resolve
();
}
};
};
/**
/**
...
@@ -52,25 +54,20 @@ export const validatorJMHAAdderess = (rule: RuleObject, value = '') => {
...
@@ -52,25 +54,20 @@ export const validatorJMHAAdderess = (rule: RuleObject, value = '') => {
* @param record
* @param record
*/
*/
export
const
renderWebUiRedirect
=
(
record
:
Cluster
.
Instance
)
=>
{
export
const
renderWebUiRedirect
=
(
record
:
Cluster
.
Instance
)
=>
{
if
(
if
(
record
.
status
&&
record
.
status
&&
(
record
.
type
===
RUN_MODE
.
YARN_SESSION
||
(
record
.
type
===
RUN_MODE
.
YARN_SESSION
||
record
.
type
===
RUN_MODE
.
STANDALONE
||
record
.
type
===
RUN_MODE
.
STANDALONE
||
record
.
type
===
RUN_MODE
.
YARN_APPLICATION
||
record
.
type
===
RUN_MODE
.
YARN_APPLICATION
||
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`
}
target=
'_blank'
type=
'link'
>
{
record
.
jobManagerHost
}
</
Link
>
title=
{
`http://${record.jobManagerHost}/#/overview`
}
);
href=
{
`http://${record.jobManagerHost}/#/overview`
}
}
target=
'_blank'
return
<
Link
>
{
record
.
hosts
}
</
Link
>;
/>
</>
);
}
return
undefined
;
};
};
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
This diff is collapsed.
Click to expand it.
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
(()
=>
{
form
.
setFieldsValue
(
values
);
if
(
!
visible
)
{
},
[
visible
,
values
,
form
]);
form
.
resetFields
();
}
else
{
form
.
setFieldsValue
(
values
);
}
},
[
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