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
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
17 deletions
+62
-17
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
+13
-2
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 {
...
@@ -74,7 +74,7 @@ public class MybatisPlusConfig {
"dinky_savepoints"
,
"dinky_savepoints"
,
"dinky_task"
,
"dinky_task"
,
"dinky_task_statement"
,
"dinky_task_statement"
,
//
"dinky_git_project",
"dinky_git_project"
,
"dinky_task_version"
);
"dinky_task_version"
);
@Bean
@Bean
...
...
dinky-admin/src/main/java/org/dinky/context/TenantContextHolder.java
View file @
268f085b
...
@@ -22,7 +22,7 @@ package org.dinky.context;
...
@@ -22,7 +22,7 @@ package org.dinky.context;
/** TenantContextHolder */
/** TenantContextHolder */
public
class
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
)
{
public
static
void
set
(
Object
value
)
{
TENANT_CONTEXT
.
set
(
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;
...
@@ -29,6 +29,7 @@ import org.dinky.data.model.Tenant;
import
org.dinky.function.constant.PathConstant
;
import
org.dinky.function.constant.PathConstant
;
import
org.dinky.function.pool.UdfCodePool
;
import
org.dinky.function.pool.UdfCodePool
;
import
org.dinky.job.FlinkJobTask
;
import
org.dinky.job.FlinkJobTask
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.scheduler.client.ProjectClient
;
import
org.dinky.scheduler.client.ProjectClient
;
import
org.dinky.scheduler.exception.SchedulerException
;
import
org.dinky.scheduler.exception.SchedulerException
;
import
org.dinky.scheduler.model.Project
;
import
org.dinky.scheduler.model.Project
;
...
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
...
@@ -54,6 +55,7 @@ import org.springframework.stereotype.Component;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
/**
/**
...
@@ -106,6 +108,16 @@ public class SystemInit implements ApplicationRunner {
...
@@ -106,6 +108,16 @@ public class SystemInit implements ApplicationRunner {
c
->
{
c
->
{
if
(
c
==
systemConfiguration
.
getDolphinschedulerEnable
())
{
if
(
c
==
systemConfiguration
.
getDolphinschedulerEnable
())
{
if
(
systemConfiguration
.
getDolphinschedulerEnable
().
getValue
())
{
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
{
try
{
project
=
projectClient
.
getDinkyProject
();
project
=
projectClient
.
getDinkyProject
();
if
(
Asserts
.
isNull
(
project
))
{
if
(
Asserts
.
isNull
(
project
))
{
...
@@ -113,6 +125,7 @@ public class SystemInit implements ApplicationRunner {
...
@@ -113,6 +125,7 @@ public class SystemInit implements ApplicationRunner {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"Error in DolphinScheduler: "
,
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;
...
@@ -24,6 +24,7 @@ import org.dinky.data.model.SysConfig;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.mapper.SysConfigMapper
;
import
org.dinky.mapper.SysConfigMapper
;
import
org.dinky.mybatis.service.impl.SuperServiceImpl
;
import
org.dinky.mybatis.service.impl.SuperServiceImpl
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.service.SysConfigService
;
import
org.dinky.service.SysConfigService
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -39,6 +40,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
...
@@ -39,6 +40,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.StrUtil
;
/**
/**
* SysConfigServiceImpl
* SysConfigServiceImpl
...
@@ -85,8 +87,19 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC
...
@@ -85,8 +87,19 @@ public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysC
public
void
updateSysConfigByKv
(
String
key
,
String
value
)
{
public
void
updateSysConfigByKv
(
String
key
,
String
value
)
{
SysConfig
config
=
getOne
(
new
QueryWrapper
<
SysConfig
>().
eq
(
"name"
,
key
));
SysConfig
config
=
getOne
(
new
QueryWrapper
<
SysConfig
>().
eq
(
"name"
,
key
));
config
.
setValue
(
value
);
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 {
...
@@ -88,7 +88,7 @@ public class MavenStepSse extends StepSse {
getLogFile
().
getAbsolutePath
(),
getLogFile
().
getAbsolutePath
(),
CollUtil
.
newArrayList
(
"clean"
,
"package"
),
CollUtil
.
newArrayList
(
"clean"
,
"package"
),
StrUtil
.
split
(
gitProject
.
getBuildArgs
(),
" "
),
StrUtil
.
split
(
gitProject
.
getBuildArgs
(),
" "
),
this
::
add
Ms
g
);
this
::
add
FileMsgLo
g
);
params
.
put
(
"pom"
,
pom
);
params
.
put
(
"pom"
,
pom
);
Assert
.
isTrue
(
state
,
"maven build failed"
);
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 {
...
@@ -99,14 +99,15 @@ public class MavenUtil {
}
}
String
mavenCommandLine
=
String
mavenCommandLine
=
getMavenCommandLine
(
pom
,
mavenHome
,
localRepositoryDirectory
,
setting
,
goals
,
args
);
getMavenCommandLine
(
pom
,
mavenHome
,
localRepositoryDirectory
,
setting
,
goals
,
args
);
Opt
.
ofNullable
(
consumer
)
.
ifPresent
(
c
->
c
.
accept
(
"Executing command: "
+
mavenCommandLine
+
"\n"
));
int
waitValue
=
int
waitValue
=
RuntimeUtils
.
run
(
RuntimeUtils
.
run
(
mavenCommandLine
,
mavenCommandLine
,
s
->
{
s
->
{
s
=
DateUtil
.
date
().
toMsStr
()
+
" - "
+
s
;
s
=
DateUtil
.
date
().
toMsStr
()
+
" - "
+
s
+
"\n"
;
consumer
.
accept
(
s
);
consumer
.
accept
(
s
);
FileUtil
.
writeUtf8String
(
s
,
logFile
);
},
},
log:
:
error
);
log:
:
error
);
return
waitValue
==
0
;
return
waitValue
==
0
;
...
...
dinky-common/src/main/java/org/dinky/data/model/SystemConfiguration.java
View file @
268f085b
...
@@ -156,8 +156,9 @@ public class SystemConfiguration {
...
@@ -156,8 +156,9 @@ public class SystemConfiguration {
item
.
setValue
(
value
);
item
.
setValue
(
value
);
});
});
// initRun
// initRun
CONFIGURATION_LIST
.
forEach
(
for
(
Configuration
<?>
configuration
:
CONFIGURATION_LIST
)
{
c
->
Opt
.
ofNullable
(
this
.
initMethod
).
ifPresent
(
x
->
x
.
accept
(
c
)));
Opt
.
ofNullable
(
this
.
initMethod
).
ifPresent
(
x
->
x
.
accept
(
configuration
));
}
}
}
public
Map
<
String
,
List
<
Configuration
<?>>>
getAllConfiguration
()
{
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 {
...
@@ -100,9 +100,20 @@ public class ProjectClient {
.
execute
()
.
execute
()
.
body
();
.
body
();
return
MyJSONUtil
.
toPageBeanAndFindByName
(
Project
pageBeanAndFindByName
=
null
;
try
{
pageBeanAndFindByName
=
MyJSONUtil
.
toPageBeanAndFindByName
(
content
,
content
,
SystemConfiguration
.
getInstances
().
getDolphinschedulerProjectName
().
getValue
(),
SystemConfiguration
.
getInstances
()
.
getDolphinschedulerProjectName
()
.
getValue
(),
Project
.
class
);
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) => {
...
@@ -83,6 +83,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
let
stepNum
:
number
=
1
;
let
stepNum
:
number
=
1
;
let
showDataStep
=
-
1
;
let
showDataStep
=
-
1
;
let
showData
=
""
;
let
showData
=
""
;
let
finish
=
false
;
//sse listen event message
//sse listen event message
eventSource
.
onmessage
=
e
=>
{
eventSource
.
onmessage
=
e
=>
{
...
@@ -108,9 +109,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -108,9 +109,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
title
:
renderTitle
(
item
.
step
),
title
:
renderTitle
(
item
.
step
),
status
:
renderStatus
(
item
.
status
),
status
:
renderStatus
(
item
.
status
),
description
:
item
.
startTime
,
description
:
item
.
startTime
,
disabled
:
item
.
status
===
-
1
||
status
===
1
,
disabled
:
true
,
onClick
:
()
=>
{
onClick
:
()
=>
{
if
(
item
.
status
!==
-
1
&&
status
!==
1
)
{
if
(
finish
)
{
if
(
item
.
step
===
showDataStep
)
{
if
(
item
.
step
===
showDataStep
)
{
setShowList
(
true
)
setShowList
(
true
)
setLog
(
showData
)
setLog
(
showData
)
...
@@ -138,9 +139,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -138,9 +139,8 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
}
else
if
(
type
===
2
)
{
}
else
if
(
type
===
2
)
{
showDataStep
=
currentStep
;
showDataStep
=
currentStep
;
showData
=
JSON
.
parse
(
data
);
showData
=
JSON
.
parse
(
data
);
}
else
if
(
type
===
3
){
}
else
if
(
type
===
3
)
{
stepArray
[
currentStep
].
description
=
data
;
stepArray
[
currentStep
].
description
=
data
;
return
}
}
if
(
currentStep
>=
globalCurrentStep
)
{
if
(
currentStep
>=
globalCurrentStep
)
{
...
@@ -148,11 +148,17 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -148,11 +148,17 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
stepArray
[
currentStep
-
1
].
status
=
renderStatus
(
status
)
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
();
eventSource
.
close
();
return
;
}
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
finish
=
true
;
eventSource
.
close
();
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