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
1c5b198d
Unverified
Commit
1c5b198d
authored
Jun 01, 2023
by
zhu-mingye
Committed by
GitHub
Jun 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature][admin,web] support drag sort of gitproject #2004
parent
a4737678
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
365 additions
and
205 deletions
+365
-205
GitController.java
...min/src/main/java/org/dinky/controller/GitController.java
+39
-0
GitProject.java
dinky-admin/src/main/java/org/dinky/model/GitProject.java
+4
-0
GitProjectSortJarParams.java
...c/main/java/org/dinky/params/GitProjectSortJarParams.java
+33
-0
GitProjectService.java
...in/src/main/java/org/dinky/service/GitProjectService.java
+16
-0
GitProjectServiceImpl.java
...in/java/org/dinky/service/impl/GitProjectServiceImpl.java
+25
-0
global.less
dinky-web/src/global.less
+1
-1
pages.ts
dinky-web/src/locales/en-US/pages.ts
+7
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+7
-0
index.tsx
...nter/GitProject/components/BuildSteps/AutoSteps/index.tsx
+23
-35
index.tsx
...Project/components/BuildSteps/JarShow/ClassList/index.tsx
+0
-99
index.tsx
...itProject/components/BuildSteps/JarShow/JarList/index.tsx
+110
-17
index.tsx
...Center/GitProject/components/BuildSteps/JarShow/index.tsx
+19
-19
index.tsx
...ages/RegCenter/GitProject/components/BuildSteps/index.tsx
+8
-7
index.tsx
...RegCenter/GitProject/components/ProjectProTable/index.tsx
+56
-21
index.tsx
...er/Process/components/ProcessList/SubStepsTable/index.tsx
+3
-3
constants.tsx
dinky-web/src/services/constants.tsx
+4
-0
data.d.ts
dinky-web/src/types/RegCenter/data.d.ts
+7
-0
dinky_dml.sql
script/sql/upgrade/0.8.0_schema/mysql/dinky_dml.sql
+3
-3
No files found.
dinky-admin/src/main/java/org/dinky/controller/GitController.java
View file @
1c5b198d
...
...
@@ -24,6 +24,7 @@ import org.dinky.common.result.Result;
import
org.dinky.dto.GitProjectDTO
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.model.GitProject
;
import
org.dinky.params.GitProjectSortJarParams
;
import
org.dinky.service.GitProjectService
;
import
org.dinky.sse.SseEmitterUTF8
;
import
org.dinky.utils.GitProjectStepSseFactory
;
...
...
@@ -32,6 +33,7 @@ import org.dinky.utils.MessageResolverUtils;
import
java.io.File
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.http.MediaType
;
...
...
@@ -79,6 +81,43 @@ public class GitController {
return
Result
.
succeed
();
}
/**
* drag sort project level
*
* @param sortList after sorter data
* @return {@link Result}<{@link Void}>
*/
@PostMapping
(
"/dragendSortProject"
)
public
Result
<
Void
>
dragendSortProject
(
@RequestBody
Map
sortList
)
{
if
(
sortList
==
null
)
{
return
Result
.
failed
(
"获取不到项目信息"
);
}
gitProjectService
.
dragendSortProject
(
sortList
);
return
Result
.
succeed
();
}
/**
* drag sort jar level
*
* @param gitProjectSortJarParams
* @return {@link Result}<{@link Void}>
*/
@PostMapping
(
"/dragendSortJar"
)
public
Result
<
Void
>
dragendSortJar
(
@RequestBody
GitProjectSortJarParams
gitProjectSortJarParams
)
{
GitProject
gitProjectServiceById
=
gitProjectService
.
getById
(
gitProjectSortJarParams
.
getProjectId
());
if
(
gitProjectServiceById
==
null
)
{
return
Result
.
failed
(
"获取不到项目信息"
);
}
else
{
if
(
gitProjectService
.
dragendSortJar
(
gitProjectSortJarParams
))
{
return
Result
.
succeed
();
}
else
{
return
Result
.
failed
(
"排序失败"
);
}
}
}
/**
* get branch list
*
...
...
dinky-admin/src/main/java/org/dinky/model/GitProject.java
View file @
1c5b198d
...
...
@@ -23,8 +23,11 @@ import org.dinky.db.model.SuperEntity;
import
java.util.Date
;
import
org.springframework.boot.jackson.JsonObjectDeserializer
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
lombok.Data
;
...
...
@@ -90,6 +93,7 @@ public class GitProject extends SuperEntity<GitProject> {
/** scan udf class */
@TableField
(
value
=
"udf_class_map_list"
)
@JsonDeserialize
(
using
=
JsonObjectDeserializer
.
class
)
private
String
udfClassMapList
;
@TableField
(
value
=
"order_line"
)
...
...
dinky-admin/src/main/java/org/dinky/params/GitProjectSortJarParams.java
0 → 100644
View file @
1c5b198d
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
params
;
import
org.dinky.dto.GitAnalysisJarDTO
;
import
java.io.Serializable
;
import
java.util.List
;
import
lombok.Data
;
@Data
public
class
GitProjectSortJarParams
implements
Serializable
{
Integer
projectId
;
List
<
GitAnalysisJarDTO
>
jars
;
}
dinky-admin/src/main/java/org/dinky/service/GitProjectService.java
View file @
1c5b198d
...
...
@@ -23,6 +23,7 @@ import org.dinky.db.service.ISuperService;
import
org.dinky.dto.GitProjectDTO
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.model.GitProject
;
import
org.dinky.params.GitProjectSortJarParams
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -39,6 +40,21 @@ public interface GitProjectService extends ISuperService<GitProject> {
*/
void
saveOrUpdate
(
GitProjectDTO
gitProjectDTO
);
/**
* drag sort project level
*
* @param gitProjectDTOList
*/
void
dragendSortProject
(
Map
gitProjectDTOList
);
/**
* drag sort jar level
*
* @param gitProjectSortJarParams
* @return
*/
Boolean
dragendSortJar
(
GitProjectSortJarParams
gitProjectSortJarParams
);
Map
<
String
,
String
>
getGitPool
();
/**
...
...
dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java
View file @
1c5b198d
...
...
@@ -27,6 +27,7 @@ import org.dinky.dto.TreeNodeDTO;
import
org.dinky.function.pool.UdfCodePool
;
import
org.dinky.mapper.GitProjectMapper
;
import
org.dinky.model.GitProject
;
import
org.dinky.params.GitProjectSortJarParams
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.service.GitProjectService
;
import
org.dinky.utils.GitProjectStepSseFactory
;
...
...
@@ -91,6 +92,30 @@ public class GitProjectServiceImpl extends SuperServiceImpl<GitProjectMapper, Gi
ThreadUtil
.
execAsync
(()
->
UdfCodePool
.
updateGitPool
(
getGitPool
()));
}
/** @param gitProjectDTOList */
@Override
public
void
dragendSortProject
(
Map
gitProjectDTOList
)
{
List
<
GitProject
>
gitProjectList
=
BeanUtil
.
copyToList
(
((
List
<?>)
gitProjectDTOList
.
get
(
"sortList"
)),
GitProject
.
class
);
for
(
GitProject
gitProject
:
gitProjectList
)
{
updateById
(
gitProject
);
}
}
/** @param gitProjectSortJarParams */
@Override
public
Boolean
dragendSortJar
(
GitProjectSortJarParams
gitProjectSortJarParams
)
{
GitProject
gitProject
=
getById
(
gitProjectSortJarParams
.
getProjectId
());
if
(
gitProject
==
null
)
{
return
false
;
}
else
{
String
jarClasses
=
JSONUtil
.
toJsonStr
(
gitProjectSortJarParams
.
getJars
());
gitProject
.
setUdfClassMapList
(
jarClasses
);
return
updateById
(
gitProject
);
}
}
@Override
public
Map
<
String
,
String
>
getGitPool
()
{
List
<
GitProject
>
list
=
list
();
...
...
dinky-web/src/global.less
View file @
1c5b198d
...
...
@@ -206,7 +206,7 @@ ol {
}
.child-list {
margin-left:
50px
;
margin-left:
4vw
;
padding: 0;
border-bottom-color: red;
}
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
1c5b198d
...
...
@@ -393,6 +393,8 @@ export default {
'rc.gp.management'
:
'GitProject Management(Beta)'
,
'rc.gp.id'
:
'ID'
,
'rc.gp.name'
:
'Name'
,
'rc.gp.level'
:
'Level'
,
'rc.gp.level.tooltip'
:
'The smaller the number, the higher the priority, and the scanned UDF classes are repeatedly linked to the priority'
,
'rc.gp.url'
:
'Project URL'
,
'rc.gp.branch'
:
'Branch'
,
'rc.gp.username'
:
'Username'
,
...
...
@@ -406,6 +408,11 @@ export default {
'rc.gp.buildState'
:
'Build State'
,
'rc.gp.buildStep'
:
'Build Step'
,
'rc.gp.udfClassList'
:
'UDF Class List'
,
'rc.gp.ucl.jarPath'
:
'Jar Path'
,
'rc.gp.ucl.orderLine'
:
'Jar Priority'
,
'rc.gp.ucl.jarOrder'
:
' Jar Level Ordering'
,
'rc.gp.ucl.projectOrder'
:
'Project Level Ordering'
,
'rc.gp.ucl.orderLine.tooltip'
:
'The smaller the number, the higher the priority of loading UDF in Jar'
,
'rc.gp.create'
:
'Create Project'
,
'rc.gp.modify'
:
'Modify Project'
,
'rc.gp.delete'
:
'Delete Project'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
1c5b198d
...
...
@@ -394,6 +394,8 @@ export default {
// git project
'rc.gp.management'
:
'Git 项目管理(Beta)'
,
'rc.gp.id'
:
'项目 ID'
,
'rc.gp.level'
:
'优先级'
,
'rc.gp.level.tooltip'
:
'数字越小,优先级越高,扫描的udf类重复与优先级挂钩'
,
'rc.gp.name'
:
'项目名称'
,
'rc.gp.url'
:
'项目地址'
,
'rc.gp.branch'
:
'分支'
,
...
...
@@ -409,6 +411,11 @@ export default {
'rc.gp.buildState'
:
'构建状态'
,
'rc.gp.buildStep'
:
'构建步骤'
,
'rc.gp.udfClassList'
:
'UDF类列表'
,
'rc.gp.ucl.jarPath'
:
'Jar 路径'
,
'rc.gp.ucl.orderLine'
:
'Jar 优先级'
,
'rc.gp.ucl.jarOrder'
:
' Jar 级别排序'
,
'rc.gp.ucl.projectOrder'
:
'项目级别排序'
,
'rc.gp.ucl.orderLine.tooltip'
:
'数字越小,加载 Jar 中的 UDF 优先级越高'
,
'rc.gp.create'
:
'创建项目'
,
'rc.gp.modify'
:
'修改项目'
,
'rc.gp.delete'
:
'删除项目'
,
...
...
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/AutoSteps/index.tsx
View file @
1c5b198d
...
...
@@ -18,17 +18,12 @@
*/
import
{
Button
,
Progress
,
Steps
,
theme
}
from
"antd"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Progress
,
Steps
,
theme
}
from
"antd"
;
import
React
,
{
useEffect
}
from
"react"
;
import
CodeShow
from
"@/components/CustomEditor/CodeShow"
;
import
{
ErrorNotification
,
SuccessMessageAsync
}
from
"@/utils/messages"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
GitProject
}
from
"@/types/RegCenter/data"
;
import
{
processColor
}
from
"@/pages/RegCenter/GitProject/constans"
;
import
JarShow
from
"@/pages/RegCenter/GitProject/components/BuildSteps/JarShow"
;
import
{
BuildStepsState
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps"
;
import
{
JsonArray
}
from
"type-fest"
;
export
type
BuildMsgData
=
{
...
...
@@ -44,20 +39,26 @@ export type BuildMsgData = {
type
BuildStepsProps
=
{
values
:
Partial
<
GitProject
>
;
values
:
GitProject
;
steps
:
any
[];
currentDataMsg
:
any
;
percent
:
number
;
currentStep
:
number
;
log
:
string
;
showList
:
boolean
;
}
const
CodeShowProps
=
{
height
:
"50vh"
,
language
:
"java"
,
lineNumbers
:
"on"
,
showFloatButton
:
true
,
};
export
const
AutoSteps
:
React
.
FC
<
BuildStepsProps
>
=
(
props
)
=>
{
const
{
values
,
steps
,
currentDataMsg
,
percent
,
currentStep
,
log
,
showList
values
,
steps
,
percent
,
currentStep
,
log
,
showList
}
=
props
;
/**
...
...
@@ -65,9 +66,6 @@ export const AutoSteps: React.FC<BuildStepsProps> = (props) => {
*/
const
{
token
}
=
theme
.
useToken
();
useEffect
(()
=>
{
},
[]);
const
contentStyle
:
React
.
CSSProperties
=
{
lineHeight
:
"300px"
,
...
...
@@ -80,33 +78,23 @@ export const AutoSteps: React.FC<BuildStepsProps> = (props) => {
};
return
<>
<
Steps
status=
{
"wait"
}
size=
{
"small"
}
onChange=
{
(
current
)
=>
current
}
type=
{
"navigation"
}
responsive=
{
true
}
current=
{
currentStep
-
1
}
items=
{
steps
}
percent=
{
percent
}
initial=
{
0
}
/>
<
Steps
initial=
{
0
}
type=
{
'navigation'
}
status=
{
'wait'
}
size=
{
'small'
}
onChange=
{
(
current
)
=>
current
}
current=
{
currentStep
-
1
}
items=
{
steps
}
percent=
{
percent
}
/>
<
Progress
percent=
{
percent
}
strokeColor=
{
processColor
}
/>
<
div
style=
{
contentStyle
}
>
{
// if resultType is 1, data is log, else data is jar list or class list
!
showList
?
<
CodeShow
height=
{
"50vh"
}
code=
{
log
||
""
}
language=
{
"java"
}
options=
{
{
scrollBeyondLastLine
:
true
}
}
showFloatButton=
{
true
}
/>
:
<
JarShow
step=
{
currentStep
}
data=
{
log
}
/>
<
CodeShow
code=
{
log
||
""
}
options=
{
{
scrollBeyondLastLine
:
true
}
}
{
...
CodeShowProps
}
/>
:
<
JarShow
value=
{
values
}
data=
{
log
}
/>
}
</
div
>
{
/*<div style={{marginTop: 24}}>*/
}
{
/* {currentStepStatus < steps.length - 1 && (*/
}
{
/* <Button type="primary" onClick={() => nextStep()}>*/
}
{
/* {l("button.next")}*/
}
{
/* </Button>*/
}
{
/* )}*/
}
{
/* {currentStepStatus > 0 && (*/
}
{
/* <Button style={{margin: "0 8px"}} onClick={() => prevStep()}>*/
}
{
/* {l("button.prev")}*/
}
{
/* </Button>*/
}
{
/* )}*/
}
{
/*</div>*/
}
</>;
};
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/JarShow/ClassList/index.tsx
deleted
100644 → 0
View file @
a4737678
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
ProColumns
,
ProTable
}
from
"@ant-design/pro-table"
;
import
{
Empty
,
List
}
from
"antd"
;
import
React
from
"react"
;
import
{
CopyTwoTone
}
from
"@ant-design/icons"
;
import
{
BuildJarList
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps/JarShow"
;
type
ClassListProps
=
{
jarAndClassesList
:
Partial
<
BuildJarList
[]
>
;
}
const
ClassList
:
React
.
FC
<
ClassListProps
>
=
(
props
)
=>
{
const
{
jarAndClassesList
}
=
props
;
const
columns
:
ProColumns
<
BuildJarList
>
[]
=
[
{
title
:
"Jar Name"
,
dataIndex
:
"jarPath"
,
copyable
:
true
,
}
];
const
handleCopyClick
=
(
item
:
string
)
=>
{
// 创建一个临时的 textarea 元素,并将要复制的文本放到它里面
const
textarea
=
document
.
createElement
(
"textarea"
);
textarea
.
value
=
item
;
// 将 textarea 元素添加到文档中
document
.
body
.
appendChild
(
textarea
);
// 选中 textarea 中的文本
textarea
.
select
();
// 执行复制操作
document
.
execCommand
(
"copy"
);
// 删除临时的 textarea 元素
document
.
body
.
removeChild
(
textarea
);
};
const
buildExpandableList
=
(
classList
:
string
[])
=>
{
return
(
// if enable show classes then show classes, else show empty
classList
?
<>
{
classList
.
map
((
item
,
index
)
=>
{
return
<><
List
.
Item
key=
{
index
}
>
{
item
}
<
CopyTwoTone
onClick=
{
()
=>
handleCopyClick
(
item
)
}
/>
</
List
.
Item
></>;
})
}
</>
:
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_DEFAULT
}
/>
);
};
return
<>
<
ProTable
<
BuildJarList
>
style=
{
{
height
:
"50vh"
,
overflowY
:
"auto"
,
msOverflowY
:
"hidden"
}
}
columns=
{
columns
}
toolBarRender=
{
false
}
showHeader=
{
false
}
dataSource=
{
jarAndClassesList
as
BuildJarList
[]
}
search=
{
false
}
rowKey="jarPath"
pagination=
{
false
}
expandable=
{
{
expandRowByClick
:
true
,
expandedRowRender
:
record
=>
{
return
<
List
split
className=
{
"child-list"
}
>
{
buildExpandableList
(
record
.
classList
)
}
</
List
>;
}
}
}
/
>
</>
;
};
export default ClassList;
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/JarShow/JarList/index.tsx
View file @
1c5b198d
...
...
@@ -17,34 +17,127 @@
*
*/
import
{
ActionType
,
DragSortTable
,
ProColumns
}
from
"@ant-design/pro-table"
;
import
{
List
,
Tag
}
from
"antd"
;
import
React
,
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
BuildJarList
}
from
"@/types/RegCenter/data"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
ProList
}
from
"@ant-design/pro-components"
;
import
{
handleOption
}
from
"@/services/BusinessCrud"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
React
from
"react"
;
import
{
Empty
,
List
}
from
"antd"
;
/**
* props
*/
type
JarListProps
=
{
jarList
:
string
[];
projectId
:
number
;
jarAndClassesList
:
Partial
<
BuildJarList
[]
>
;
}
const
JarList
:
React
.
FC
<
JarListProps
>
=
(
props
)
=>
{
const
{
jarList
}
=
props
;
/**
* state
*/
const
{
jarAndClassesList
,
projectId
}
=
props
;
const
actionRef
=
useRef
<
ActionType
>
();
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
classes
,
setClasses
]
=
useState
<
Partial
<
BuildJarList
[]
>>
()
/**
* init
*/
useEffect
(()
=>
{
setClasses
(
jarAndClassesList
)
},[
jarAndClassesList
])
/**
* columns
* @type {({copyable: boolean, dataIndex: string, tooltip: any, title: any, render: (dom: any, record: BuildJarList) => JSX.Element} | {dataIndex: string, valueType: string} | {copyable: boolean, dataIndex: string, title: any})[]}
*/
const
columns
:
ProColumns
<
BuildJarList
>
[]
=
[
{
title
:
l
(
"rc.gp.level"
),
dataIndex
:
"orderLine"
,
tooltip
:
l
(
"rc.gp.ucl.orderLine.tooltip"
),
copyable
:
true
,
render
:
(
dom
:
any
,
record
:
BuildJarList
)
=>
{
return
<
Tag
color=
{
record
.
orderLine
>
3
?
'default'
:
'success'
}
>
{
`No.${record.orderLine}`
}
</
Tag
>
}
},
{
dataIndex
:
"index"
,
valueType
:
"indexBorder"
,
},
{
title
:
l
(
"rc.gp.ucl.jarPath"
),
dataIndex
:
"jarPath"
,
copyable
:
true
,
}
];
/**
* render sublist of udf
* @param {BuildJarList} record
* @returns {JSX.Element}
*/
const
renderUdf
=
(
record
:
BuildJarList
)
=>
{
return
<>
<
ProList
dataSource=
{
record
.
classList
as
any
[]
}
rowKey=
"index"
size=
{
"small"
}
pagination=
{
{
pageSize
:
5
,
hideOnSinglePage
:
true
,
showSizeChanger
:
false
,
}
}
renderItem=
{
(
item
,
index
)
=>
{
return
<
List
.
Item
className=
{
'child-list'
}
key=
{
index
}
>
{
item
}
</
List
.
Item
>;
}
}
/>
</>;
}
const
buildExpandableList
=
()
=>
{
return
(
// if enable show classes then show classes, else show empty
jarList
.
length
>
0
?
<>
{
jarList
.
map
((
item
,
index
)
=>
{
return
<><
List
.
Item
key=
{
index
}
>
{
item
}
</
List
.
Item
></>;
})
}
</>
:
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_DEFAULT
}
/>
);
/**
* drag sort call
* @param {BuildJarList[]} newDataSource
* @returns {Promise<void>}
*/
const
handleDragSortEnd
=
async
(
newDataSource
:
BuildJarList
[])
=>
{
setLoading
(
true
)
const
updatedItems
=
newDataSource
.
map
((
item
:
BuildJarList
,
index
:
number
)
=>
({...
item
,
orderLine
:
index
+
1
,}));
await
handleOption
(
API_CONSTANTS
.
GIT_DRAGEND_SORT_JAR
,
l
(
'rc.gp.ucl.jarOrder'
),{
projectId
,
jars
:
updatedItems
})
setClasses
(
updatedItems
)
setLoading
(
false
)
actionRef
.
current
?.
reload
();
};
/**
* render
*/
return
<>
<
List
split
className=
{
"child-list"
}
>
{
buildExpandableList
()
}
</
List
>
;
<
DragSortTable
<
BuildJarList
>
style=
{
{
overflowY
:
"auto"
,
msOverflowY
:
"hidden"
,
marginLeft
:
"0.5vw"
}
}
columns=
{
columns
}
toolBarRender=
{
false
}
sortDirections=
{
[
'ascend'
]
}
showHeader=
{
false
}
actionRef=
{
actionRef
}
loading=
{
loading
}
dataSource=
{
classes
as
BuildJarList
[]
}
search=
{
false
}
rowKey="orderLine"
revalidateOnFocus
pagination=
{
{
defaultPageSize
:
5
,
hideOnSinglePage
:
true
,
}
}
expandable=
{
{
expandRowByClick
:
false
,
expandedRowRender
:
record
=>
renderUdf
(
record
)}
}
dragSortKey=
{
"orderLine"
}
onDragSortEnd=
{
handleDragSortEnd
}
/
>
</>
;
};
...
...
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/JarShow/index.tsx
View file @
1c5b198d
...
...
@@ -17,41 +17,41 @@
*
*/
import
{
Empty
}
from
"antd"
;
import
React
,
{
useEffect
}
from
"react"
;
import
{
GitProject
}
from
"@/types/RegCenter/data"
;
import
JarList
from
"@/pages/RegCenter/GitProject/components/BuildSteps/JarShow/JarList"
;
import
ClassList
from
"@/pages/RegCenter/GitProject/components/BuildSteps/JarShow/ClassList"
;
export
type
BuildJarList
=
{
jarPath
:
string
;
classList
:
string
[];
}
/** props
*/
type
JarShowProps
=
{
step
:
number
value
:
GitProject
data
:
any
}
const
JarShow
:
React
.
FC
<
JarShowProps
>
=
(
props
)
=>
{
const
{
step
,
data
}
=
props
;
const
{
data
,
value
}
=
props
;
/**
* state
*/
const
[
resultData
,
setResultData
]
=
React
.
useState
<
any
[]
>
([]);
/**
* Effect
*/
useEffect
(
()
=>
{
setResultData
(
data
);
},
[
data
]);
return
<>
{
<
ClassList
jarAndClassesList=
{
resultData
}
/>
// step === 4 ?
// <JarList jarList=
{
resultData
}
/>
:
// step === 5 ? <ClassList jarAndClassesList=
{
resultData
}
/> : <Empty image={Empty.PRESENTED_IMAGE_DEFAULT}/
>
}
</>;
},
[
data
,
value
]);
/**
* render
*/
return
<
div
style=
{
{
height
:
'50vh'
,
overflowY
:
'auto'
}
}
>
<
JarList
projectId=
{
value
.
id
}
jarAndClassesList=
{
resultData
}
/>
</
div
>;
};
export
default
JarShow
;
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx
View file @
1c5b198d
...
...
@@ -35,7 +35,7 @@ import {BuildStepsState} from '@/pages/RegCenter/GitProject/data.d';
type
BuildStepsProps
=
{
onCancel
:
(
flag
?:
boolean
)
=>
void
title
:
string
;
values
:
Partial
<
GitProject
>
;
values
:
GitProject
;
};
export
const
BuildSteps
:
React
.
FC
<
BuildStepsProps
>
=
(
props
)
=>
{
...
...
@@ -53,7 +53,6 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
const
[
currentStep
,
setCurrentStep
]
=
useState
<
number
>
(
0
);
const
[
showList
,
setShowList
]
=
useState
<
boolean
>
(
false
);
const
[
percent
,
setPercent
]
=
useState
<
number
>
(
0
);
const
[
currentDataMsg
,
setCurrentDataMsg
]
=
useState
<
BuildMsgData
>
();
const
[
steps
,
handleSteps
]
=
useState
<
BuildStepsState
[]
>
([]);
...
...
@@ -146,15 +145,11 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
stepArray
[
currentStep
-
1
].
status
=
renderStatus
(
status
)
}
setCurrentDataMsg
(
result
);
if
((
status
===
2
||
status
===
0
)
&&
history
===
false
)
{
eventSource
.
close
();
}
}
}
catch
(
e
)
{
console
.
error
(
e
)
eventSource
.
close
();
}
};
...
...
@@ -166,11 +161,17 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
},
[])
/**
* cancel
*/
const
handleCancel
=
()
=>
{
handleModalVisible
();
}
/**
* render
*/
return
<>
<
Modal
title=
{
title
}
...
...
@@ -180,7 +181,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
onCancel=
{
()
=>
handleCancel
()
}
okButtonProps=
{
{
style
:
{
display
:
"none"
}}
}
>
<
AutoSteps
steps=
{
steps
}
currentDataMsg=
{
currentDataMsg
}
percent=
{
percent
}
currentStep=
{
currentStep
}
<
AutoSteps
steps=
{
steps
}
percent=
{
percent
}
currentStep=
{
currentStep
}
values=
{
values
}
log=
{
log
}
showList=
{
showList
}
/>
</
Modal
>
</>;
...
...
dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx
View file @
1c5b198d
...
...
@@ -18,11 +18,10 @@
*/
import
React
,
{
useRef
,
useState
}
from
"react"
;
import
ProTable
,
{
ActionTyp
e
,
ProColumns
}
from
"@ant-design/pro-table"
;
import
{
ActionType
,
DragSortTabl
e
,
ProColumns
}
from
"@ant-design/pro-table"
;
import
{
GitProject
}
from
"@/types/RegCenter/data"
;
import
{
handleAddOrUpdate
,
handlePutDataByParams
,
handleRemoveById
,
handleAddOrUpdate
,
handleOption
,
handlePutDataByParams
,
handleRemoveById
,
updateEnabled
}
from
"@/services/BusinessCrud"
;
import
{
...
...
@@ -32,7 +31,7 @@ import {
STATUS_MAPPING
,
}
from
"@/services/constants"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
Button
,
Popconfirm
,
Tag
}
from
"antd"
;
import
{
Button
,
Empty
,
Popconfirm
,
Tag
}
from
"antd"
;
import
{
BranchesOutlined
,
BuildTwoTone
}
from
"@ant-design/icons"
;
import
{
GIT_PROJECT_BUILD_STEP
,
...
...
@@ -42,7 +41,7 @@ import {
renderBranchesTagColor
}
from
"@/pages/RegCenter/GitProject/constans"
;
import
{
ShowCodeTreeIcon
}
from
"@/components/Icons/CustomIcons"
;
import
{
queryList
}
from
"@/services/api"
;
import
{
addOrUpdateData
,
queryList
}
from
"@/services/api"
;
import
{
BuildSteps
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps"
;
import
{
CodeTree
}
from
"@/pages/RegCenter/GitProject/components/CodeTree"
;
import
{
CreateBtn
}
from
"@/components/CallBackButton/CreateBtn"
;
...
...
@@ -51,6 +50,7 @@ import {EditBtn} from "@/components/CallBackButton/EditBtn";
import
{
PopconfirmDeleteBtn
}
from
"@/components/CallBackButton/PopconfirmDeleteBtn"
;
import
{
EnableSwitchBtn
}
from
"@/components/CallBackButton/EnableSwitchBtn"
;
import
{
ShowLogBtn
}
from
"@/components/CallBackButton/ShowLogBtn"
;
import
ClassList
from
"@/pages/RegCenter/GitProject/components/BuildSteps/JarShow/JarList"
;
const
ProjectProTable
:
React
.
FC
=
()
=>
{
...
...
@@ -73,7 +73,7 @@ const ProjectProTable: React.FC = () => {
setLoading
(
true
);
await
callback
();
setLoading
(
false
);
actionRef
.
current
?.
reload
?.();
actionRef
.
current
?.
reload
()
};
/**
...
...
@@ -148,6 +148,15 @@ const ProjectProTable: React.FC = () => {
* @type {({dataIndex: string, title: any} | {dataIndex: string, title: any, renderText: (text, record) => JSX.Element} | {copyable: boolean, dataIndex: string, title: any} | {hideInSearch: boolean, dataIndex: string, valueEnum: {"1": {text: string}, "2": {text: string}}, filters: ({text: string, value: number} | {text: string, value: number})[], title: any, filterMultiple: boolean} | {hideInSearch: boolean, dataIndex: string, valueEnum: {"1": {text: string}, "2": {text: string}}, filters: ({text: string, value: number} | {text: string, value: number})[], title: any, filterMultiple: boolean} | {hideInSearch: boolean, dataIndex: string, valueEnum: {"0": {text: any, title: any, status: string}, "1": {text: any, title: any, status: string}, "2": {text: any, title: any, status: string}, "3": {text: any, title: any, status: string}, "4": {text: any, title: any, status: string}, "5": {text: any, title: any, status: string}, "6": {text: any, title: any, status: string}}, filters: ({text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string})[], title: any} | {hideInSearch: boolean, dataIndex: string, valueEnum: {"0": {text: any, title: any, status: string}, "1": {text: any, title: any, status: string}, "2": {text: any, title: any, status: string}, "3": {text: any, title: any, status: string}}, filters: ({text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string} | {text: any, value: number, status: string})[], title: any, filterMultiple: boolean} | {hideInSearch: boolean, dataIndex: string, valueType: string, title: any} | {dataIndex: string, title: any} | {hideInSearch: boolean, dataIndex: string, valueEnum: {true: {text: any, status: string}, false: {text: any, status: string}}, filters: [{text: any, value: number}, {text: any, value: number}], title: any, filterMultiple: boolean, render: (_, record) => JSX.Element} | {valueType: string, width: string, title: any, render: (text, record) => JSX.Element[]})[]}
*/
const
columns
:
ProColumns
<
GitProject
>
[]
=
[
{
title
:
l
(
"rc.gp.level"
),
hideInSearch
:
true
,
dataIndex
:
'id'
,
tooltip
:
l
(
"rc.gp.level.tooltip"
),
render
:
(
dom
:
any
,
record
:
GitProject
)
=>
{
return
<
Tag
color=
{
record
.
orderLine
>
3
?
'default'
:
'success'
}
>
{
`No.${record.orderLine}`
}
</
Tag
>
},
},
{
title
:
l
(
"rc.gp.name"
),
dataIndex
:
"name"
,
...
...
@@ -155,7 +164,7 @@ const ProjectProTable: React.FC = () => {
{
title
:
l
(
"rc.gp.branch"
),
dataIndex
:
"branch"
,
renderText
:
(
text
,
record
)
=>
{
renderText
:
(
text
:
string
,
record
:
GitProject
)
=>
{
return
<
Tag
icon=
{
<
BranchesOutlined
/>
}
color=
{
renderBranchesTagColor
(
record
.
branch
)
}
>
{
record
.
branch
}
</
Tag
>;
}
...
...
@@ -214,7 +223,7 @@ const ProjectProTable: React.FC = () => {
filters
:
STATUS_MAPPING
(),
filterMultiple
:
false
,
valueEnum
:
STATUS_ENUM
(),
render
:
(
_
,
record
)
=>
{
render
:
(
_
:
string
,
record
:
GitProject
)
=>
{
return
<
EnableSwitchBtn
key=
{
`${record.id}_enable`
}
record=
{
record
}
onChange=
{
()
=>
handleChangeEnable
(
record
)
}
/>;
},
...
...
@@ -223,7 +232,7 @@ const ProjectProTable: React.FC = () => {
title
:
l
(
"global.table.operate"
),
valueType
:
"option"
,
width
:
"10vw"
,
render
:
(
text
,
record
)
=>
[
render
:
(
text
:
string
,
record
:
GitProject
)
=>
[
<
ShowLogBtn
disabled=
{
record
.
buildStep
===
0
}
key=
{
`${record.id}_showLog`
}
onClick=
{
()
=>
handleShowLog
(
record
)
}
/>,
<
Button
key=
{
`${record.id}_code`
}
...
...
@@ -261,7 +270,7 @@ const ProjectProTable: React.FC = () => {
handleBuildVisible
(
false
);
handleLogVisible
(
false
);
handleCodeTreeVisible
(
false
);
actionRef
.
current
?.
reload
?.
();
actionRef
.
current
?.
reload
();
};
...
...
@@ -273,22 +282,48 @@ const ProjectProTable: React.FC = () => {
const
handleAddOrUpdateSubmit
=
async
(
value
:
Partial
<
GitProject
>
)
=>
{
await
handleAddOrUpdate
(
API_CONSTANTS
.
GIT_SAVE_UPDATE
,
value
);
handleCancel
();
actionRef
.
current
?.
reload
?.();
};
/**
* drag sort call
* @param {GitProject[]} newDataSource
* @returns {Promise<void>}
*/
const
handleDragSortEnd
=
async
(
newDataSource
:
GitProject
[])
=>
{
const
updatedItems
=
newDataSource
.
map
((
item
:
GitProject
,
index
:
number
)
=>
({...
item
,
orderLine
:
index
+
1
,}));
await
executeAndCallback
(
async
()
=>
await
handleOption
(
API_CONSTANTS
.
GIT_DRAGEND_SORT_PROJECT
,
l
(
'rc.gp.ucl.projectOrder'
),{
sortList
:
updatedItems
}));
};
/**
* render jar
* @param {GitProject} record
* @returns {JSX.Element}
*/
const
renderClassList
=
(
record
:
GitProject
)
=>
{
const
{
udfClassMapList
,
id
}
=
record
if
(
udfClassMapList
)
{
return
<
ClassList
projectId=
{
id
}
jarAndClassesList=
{
JSON
.
parse
(
udfClassMapList
)
}
/>
}
return
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_DEFAULT
}
/>
}
/**
* render
*/
return
<>
<
ProTable
<
GitProject
>
{
...
PROTABLE_OPTIONS_PUBLIC
}
loading=
{
loading
}
actionRef=
{
actionRef
}
headerTitle=
{
l
(
"rc.gp.management"
)
}
toolBarRender=
{
()
=>
[<
CreateBtn
key=
{
"gitcreate"
}
onClick=
{
()
=>
handleModalVisible
(
true
)
}
/>]
}
request=
{
(
params
,
sorter
,
filter
:
any
)
=>
queryList
(
API_CONSTANTS
.
GIT_PROJECT
,
{...
params
,
sorter
,
filter
})
}
columns=
{
columns
}
<
DragSortTable
<
GitProject
>
{
...
PROTABLE_OPTIONS_PUBLIC
}
headerTitle=
{
l
(
"rc.gp.management"
)
}
columns=
{
columns
}
loading=
{
loading
}
actionRef=
{
actionRef
}
dragSortKey=
{
"id"
}
toolBarRender=
{
()
=>
[<
CreateBtn
key=
{
"gittable"
}
onClick=
{
()
=>
handleModalVisible
(
true
)
}
/>,]
}
pagination=
{
{
pageSize
:
5
,
hideOnSinglePage
:
true
}
}
expandable=
{
{
expandRowByClick
:
false
,
expandedRowRender
:
(
record
:
GitProject
)
=>
renderClassList
(
record
)}
}
request=
{
(
params
,
sorter
,
filter
:
any
)
=>
queryList
(
API_CONSTANTS
.
GIT_PROJECT
,
{...
params
,
sorter
,
filter
})
}
onDragSortEnd=
{
handleDragSortEnd
}
/
>
{
/* added modal form */
}
<
ProjectModal
onCancel=
{
handleCancel
}
onSubmit=
{
(
value
)
=>
handleAddOrUpdateSubmit
(
value
)
}
...
...
@@ -298,10 +333,10 @@ const ProjectProTable: React.FC = () => {
modalVisible=
{
updateModalVisible
}
values=
{
formValues
}
/>
{
/* build steps modal */
}
{
buildModalVisible
&&
<
BuildSteps
title=
{
l
(
'rc.gp.build'
)
}
onCancel=
{
handleCancel
}
values=
{
formValues
}
/>
}
{
buildModalVisible
&&
<
BuildSteps
title=
{
l
(
'rc.gp.build'
)
}
onCancel=
{
handleCancel
}
values=
{
formValues
as
any
}
/>
}
{
/* show build log modal */
}
{
/*{logModalVisible && <ShowLog modalVisible={logModalVisible} onCancel={handleCancel} values={formValues}/>}*/
}
{
logModalVisible
&&
<
BuildSteps
title=
{
l
(
'rc.gp.log'
)
}
onCancel=
{
handleCancel
}
values=
{
formValues
}
/>
}
{
logModalVisible
&&
<
BuildSteps
title=
{
l
(
'rc.gp.log'
)
}
onCancel=
{
handleCancel
}
values=
{
formValues
as
any
}
/>
}
{
/* show code tree modal */
}
<
CodeTree
modalVisible=
{
codeTreeModalVisible
}
onCancel=
{
handleCancel
}
values=
{
formValues
}
/>
</>
;
...
...
dinky-web/src/pages/SettingCenter/Process/components/ProcessList/SubStepsTable/index.tsx
View file @
1c5b198d
...
...
@@ -67,7 +67,7 @@ const SubStepsTable: React.FC<SubStepsTableProps> = (props) => {
{
title
:
l
(
'sys.process.subStep.status'
),
dataIndex
:
"stepStatus"
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
:
any
,
record
:
ProcessSteps
)
=>
{
return
MatchProcessStatus
(
record
.
stepStatus
);
}
},
...
...
@@ -75,7 +75,7 @@ const SubStepsTable: React.FC<SubStepsTableProps> = (props) => {
title
:
l
(
'sys.process.subStep.info'
),
dataIndex
:
"info"
,
align
:
"center"
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
:
any
,
record
:
ProcessSteps
)
=>
{
return
<
ShowLogBtn
onClick=
{
()
=>
handleViewLog
(
l
(
"sys.process.viewInfoLog"
),
record
.
info
)
}
/>;
}
},
...
...
@@ -83,7 +83,7 @@ const SubStepsTable: React.FC<SubStepsTableProps> = (props) => {
title
:
l
(
'sys.process.subStep.error'
),
dataIndex
:
"error"
,
align
:
"center"
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
:
any
,
record
:
ProcessSteps
)
=>
{
return
<
ShowLogBtn
onClick=
{
()
=>
handleViewLog
(
l
(
"sys.process.viewErrorLog"
),
record
.
error
)
}
/>;
}
},
...
...
dinky-web/src/services/constants.tsx
View file @
1c5b198d
...
...
@@ -136,6 +136,10 @@ export const API_CONSTANTS = {
GIT_PROJECT
:
"/api/git/getProjectList"
,
// ---- saveOrUpdate ----
GIT_SAVE_UPDATE
:
"/api/git/saveOrUpdate"
,
// dragendSortProject
GIT_DRAGEND_SORT_PROJECT
:
"/api/git/dragendSortProject"
,
// dragendSort jar
GIT_DRAGEND_SORT_JAR
:
"/api/git/dragendSortJar"
,
// ---- get git branch ----
GIT_BRANCH
:
"/api/git/getBranchList"
,
// ---- DELETE project ----
...
...
dinky-web/src/types/RegCenter/data.d.ts
View file @
1c5b198d
...
...
@@ -192,6 +192,12 @@ export type GlobalVar = BaseBeanColumns & {
note
:
string
,
};
export
type
BuildJarList
=
{
jarPath
:
string
;
orderLine
:
number
;
classList
:
string
[];
}
/**
* git project
*/
...
...
@@ -210,6 +216,7 @@ export type GitProject = BaseBeanColumns & {
buildState
:
number
,
buildStep
:
number
,
udfClassMapList
:
string
,
orderLine
:
number
,
}
...
...
script/sql/upgrade/0.8.0_schema/mysql/dinky_dml.sql
View file @
1c5b198d
...
...
@@ -46,9 +46,9 @@ alter table dinky_udf alter column `enable` set default 1;
alter
table
dinky_udf
modify
column
`source_code`
longtext
;
-- change data source of type
update
dinky_data
_sourc
e
set
`type`
=
'MySQL'
where
`type`
=
'Mysql'
;
update
dinky_data
_sourc
e
set
`type`
=
'PostgreSQL'
where
`type`
=
'PostgreSql'
;
update
dinky_data
_sourc
e
set
`type`
=
'SQLServer'
where
`type`
=
'SqlServer'
;
update
dinky_data
bas
e
set
`type`
=
'MySQL'
where
`type`
=
'Mysql'
;
update
dinky_data
bas
e
set
`type`
=
'PostgreSQL'
where
`type`
=
'PostgreSql'
;
update
dinky_data
bas
e
set
`type`
=
'SQLServer'
where
`type`
=
'SqlServer'
;
INSERT
INTO
`dinky_git_project`
(
`id`
,
`tenant_id`
,
`name`
,
`url`
,
`branch`
,
`username`
,
`password`
,
`private_key`
,
`pom`
,
`build_args`
,
`code_type`
,
`type`
,
`last_build`
,
`description`
,
`build_state`
,
`build_step`
,
`enabled`
,
`udf_class_map_list`
,
`order_line`
)
VALUES
(
1
,
1
,
'java-udf'
,
'https://github.com/zackyoungh/dinky-quickstart-java.git'
,
'master'
,
NULL
,
NULL
,
NULL
,
NULL
,
'-P flink-1.14'
,
1
,
1
,
NULL
,
NULL
,
0
,
0
,
1
,
'[]'
,
1
);
INSERT
INTO
`dinky_git_project`
(
`id`
,
`tenant_id`
,
`name`
,
`url`
,
`branch`
,
`username`
,
`password`
,
`private_key`
,
`pom`
,
`build_args`
,
`code_type`
,
`type`
,
`last_build`
,
`description`
,
`build_state`
,
`build_step`
,
`enabled`
,
`udf_class_map_list`
,
`order_line`
)
VALUES
(
2
,
1
,
'python-udf'
,
'https://github.com/zackyoungh/dinky-quickstart-python.git'
,
'master'
,
NULL
,
NULL
,
NULL
,
NULL
,
''
,
2
,
1
,
NULL
,
NULL
,
0
,
0
,
1
,
'[]'
,
2
);
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