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
268f085b
Unverified
Commit
268f085b
authored
Jun 05, 2023
by
ZackYoung
Committed by
GitHub
Jun 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix][git] fix git front web & mp tenant get is npe (#2020)
* fix git front web & mp tenant get is npe * optimize ds config
parent
b3936f7a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
19 deletions
+64
-19
MybatisPlusConfig.java
.../src/main/java/org/dinky/configure/MybatisPlusConfig.java
+1
-1
TenantContextHolder.java
.../src/main/java/org/dinky/context/TenantContextHolder.java
+1
-1
SystemInit.java
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
+13
-0
SysConfigServiceImpl.java
...ain/java/org/dinky/service/impl/SysConfigServiceImpl.java
+15
-2
MavenStepSse.java
...y-admin/src/main/java/org/dinky/sse/git/MavenStepSse.java
+1
-1
MavenUtil.java
dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java
+3
-2
SystemConfiguration.java
...c/main/java/org/dinky/data/model/SystemConfiguration.java
+3
-2
ProjectClient.java
...c/main/java/org/dinky/scheduler/client/ProjectClient.java
+15
-4
index.tsx
...ages/RegCenter/GitProject/components/BuildSteps/index.tsx
+12
-6
No files found.
dinky-admin/src/main/java/org/dinky/configure/MybatisPlusConfig.java
View file @
268f085b
...
...
@@ -74,7 +74,7 @@ public class MybatisPlusConfig {
"dinky_savepoints"
,
"dinky_task"
,
"dinky_task_statement"
,
//
"dinky_git_project",
"dinky_git_project"
,
"dinky_task_version"
);
@Bean
...
...
dinky-admin/src/main/java/org/dinky/context/TenantContextHolder.java
View file @
268f085b
...
...
@@ -22,7 +22,7 @@ package org.dinky.context;
/** TenantContextHolder */
public
class
TenantContextHolder
{
private
static
final
ThreadLocal
<
Object
>
TENANT_CONTEXT
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Object
>
TENANT_CONTEXT
=
new
Inheritable
ThreadLocal
<>();
public
static
void
set
(
Object
value
)
{
TENANT_CONTEXT
.
set
(
value
);
...
...
dinky-admin/src/main/java/org/dinky/init/SystemInit.java
View file @
268f085b
...
...
@@ -29,6 +29,7 @@ import org.dinky.data.model.Tenant;
import
org.dinky.function.constant.PathConstant
;
import
org.dinky.function.pool.UdfCodePool
;
import
org.dinky.job.FlinkJobTask
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.scheduler.client.ProjectClient
;
import
org.dinky.scheduler.exception.SchedulerException
;
import
org.dinky.scheduler.model.Project
;
...
...
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.RequiredArgsConstructor
;
/**
...
...
@@ -106,6 +108,16 @@ public class SystemInit implements ApplicationRunner {
c
->
{
if
(
c
==
systemConfiguration
.
getDolphinschedulerEnable
())
{
if
(
systemConfiguration
.
getDolphinschedulerEnable
().
getValue
())
{
if
(
StrUtil
.
hasBlank
(
systemConfiguration
.
getDolphinschedulerUrl
().
getValue
(),
systemConfiguration
.
getDolphinschedulerProjectName
().
getValue
(),
systemConfiguration
.
getDolphinschedulerToken
().
getValue
()))
{
sysConfigService
.
updateSysConfigByKv
(
systemConfiguration
.
getDolphinschedulerEnable
().
getKey
(),
"false"
);
throw
new
DinkyException
(
"Before starting dolphinscheduler docking, please fill in the relevant configuration"
);
}
try
{
project
=
projectClient
.
getDinkyProject
();
if
(
Asserts
.
isNull
(
project
))
{
...
...
@@ -113,6 +125,7 @@ public class SystemInit implements ApplicationRunner {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Error in DolphinScheduler: "
,
e
);
throw
new
DinkyException
(
e
);
}
}
}
...
...
dinky-admin/src/main/java/org/dinky/service/impl/SysConfigServiceImpl.java
View file @
268f085b
...
...
@@ -24,6 +24,7 @@ import org.dinky.data.model.SysConfig;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.mapper.SysConfigMapper
;
import
org.dinky.mybatis.service.impl.SuperServiceImpl
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.service.SysConfigService
;
import
java.util.HashMap
;
...
...
@@ -39,6 +40,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.StrUtil
;
/**
* SysConfigServiceImpl
...
...
@@ -85,8 +87,19 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC
public
void
updateSysConfigByKv
(
String
key
,
String
value
)
{
SysConfig
config
=
getOne
(
new
QueryWrapper
<
SysConfig
>().
eq
(
"name"
,
key
));
config
.
setValue
(
value
);
config
.
updateById
();
SystemConfiguration
systemConfiguration
=
SystemConfiguration
.
getInstances
();
SystemConfiguration
.
getInstances
().
setConfiguration
(
MapUtil
.
of
(
key
,
value
));
if
(
key
.
equals
(
systemConfiguration
.
getDolphinschedulerEnable
().
getKey
())
&&
Convert
.
toBool
(
value
))
{
if
(
StrUtil
.
hasBlank
(
systemConfiguration
.
getDolphinschedulerUrl
().
getValue
(),
systemConfiguration
.
getDolphinschedulerProjectName
().
getValue
(),
systemConfiguration
.
getDolphinschedulerToken
().
getValue
()))
{
throw
new
DinkyException
(
"Before starting dolphinscheduler docking, please fill in the relevant configuration"
);
}
}
systemConfiguration
.
setConfiguration
(
MapUtil
.
of
(
key
,
value
));
config
.
updateById
();
}
}
dinky-admin/src/main/java/org/dinky/sse/git/MavenStepSse.java
View file @
268f085b
...
...
@@ -88,7 +88,7 @@ public class MavenStepSse extends StepSse {
getLogFile
().
getAbsolutePath
(),
CollUtil
.
newArrayList
(
"clean"
,
"package"
),
StrUtil
.
split
(
gitProject
.
getBuildArgs
(),
" "
),
this
::
add
Ms
g
);
this
::
add
FileMsgLo
g
);
params
.
put
(
"pom"
,
pom
);
Assert
.
isTrue
(
state
,
"maven build failed"
);
}
...
...
dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java
View file @
268f085b
...
...
@@ -99,14 +99,15 @@ public class MavenUtil {
}
String
mavenCommandLine
=
getMavenCommandLine
(
pom
,
mavenHome
,
localRepositoryDirectory
,
setting
,
goals
,
args
);
Opt
.
ofNullable
(
consumer
)
.
ifPresent
(
c
->
c
.
accept
(
"Executing command: "
+
mavenCommandLine
+
"\n"
));
int
waitValue
=
RuntimeUtils
.
run
(
mavenCommandLine
,
s
->
{
s
=
DateUtil
.
date
().
toMsStr
()
+
" - "
+
s
;
s
=
DateUtil
.
date
().
toMsStr
()
+
" - "
+
s
+
"\n"
;
consumer
.
accept
(
s
);
FileUtil
.
writeUtf8String
(
s
,
logFile
);
},
log:
:
error
);
return
waitValue
==
0
;
...
...
dinky-common/src/main/java/org/dinky/data/model/SystemConfiguration.java
View file @
268f085b
...
...
@@ -156,8 +156,9 @@ public class SystemConfiguration {
item
.
setValue
(
value
);
});
// initRun
CONFIGURATION_LIST
.
forEach
(
c
->
Opt
.
ofNullable
(
this
.
initMethod
).
ifPresent
(
x
->
x
.
accept
(
c
)));
for
(
Configuration
<?>
configuration
:
CONFIGURATION_LIST
)
{
Opt
.
ofNullable
(
this
.
initMethod
).
ifPresent
(
x
->
x
.
accept
(
configuration
));
}
}
public
Map
<
String
,
List
<
Configuration
<?>>>
getAllConfiguration
()
{
...
...
dinky-scheduler/src/main/java/org/dinky/scheduler/client/ProjectClient.java
View file @
268f085b
...
...
@@ -100,9 +100,20 @@ public class ProjectClient {
.
execute
()
.
body
();
return
MyJSONUtil
.
toPageBeanAndFindByName
(
content
,
SystemConfiguration
.
getInstances
().
getDolphinschedulerProjectName
().
getValue
(),
Project
.
class
);
Project
pageBeanAndFindByName
=
null
;
try
{
pageBeanAndFindByName
=
MyJSONUtil
.
toPageBeanAndFindByName
(
content
,
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerProjectName
()
.
getValue
(),
Project
.
class
);
}
catch
(
Exception
e
)
{
SystemConfiguration
.
getInstances
().
getDolphinschedulerEnable
().
setValue
(
false
);
throw
new
RuntimeException
(
content
);
}
return
pageBeanAndFindByName
;
}
}
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx
View file @
268f085b
...
...
@@ -83,6 +83,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
let
stepNum
:
number
=
1
;
let
showDataStep
=
-
1
;
let
showData
=
""
;
let
finish
=
false
;
//sse listen event message
eventSource
.
onmessage
=
e
=>
{
...
...
@@ -108,9 +109,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
title
:
renderTitle
(
item
.
step
),
status
:
renderStatus
(
item
.
status
),
description
:
item
.
startTime
,
disabled
:
item
.
status
===
-
1
||
status
===
1
,
disabled
:
true
,
onClick
:
()
=>
{
if
(
item
.
status
!==
-
1
&&
status
!==
1
)
{
if
(
finish
)
{
if
(
item
.
step
===
showDataStep
)
{
setShowList
(
true
)
setLog
(
showData
)
...
...
@@ -138,9 +139,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
}
else
if
(
type
===
2
)
{
showDataStep
=
currentStep
;
showData
=
JSON
.
parse
(
data
);
}
else
if
(
type
===
3
){
stepArray
[
currentStep
].
description
=
data
;
return
}
else
if
(
type
===
3
)
{
stepArray
[
currentStep
].
description
=
data
;
}
if
(
currentStep
>=
globalCurrentStep
)
{
...
...
@@ -148,11 +148,17 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
stepArray
[
currentStep
-
1
].
status
=
renderStatus
(
status
)
}
if
((
status
===
2
||
status
===
0
)
&&
history
===
false
)
{
if
((
status
===
2
||
status
===
0
)
&&
currentStep
===
stepNum
)
{
if
(
currentStep
===
stepNum
)
{
stepArray
.
forEach
(
d
=>
d
.
disabled
=
false
)
}
finish
=
true
;
eventSource
.
close
();
return
;
}
}
}
catch
(
e
)
{
finish
=
true
;
eventSource
.
close
();
}
};
...
...
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