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
c3c35e84
Unverified
Commit
c3c35e84
authored
Aug 11, 2023
by
ZackYoung
Committed by
GitHub
Aug 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove_task_config_field (#2194)
parent
a497d7e5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
160 additions
and
225 deletions
+160
-225
AppConfig.java
dinky-admin/src/main/java/org/dinky/configure/AppConfig.java
+1
-14
GitController.java
...min/src/main/java/org/dinky/controller/GitController.java
+0
-4
MonitorController.java
...src/main/java/org/dinky/controller/MonitorController.java
+0
-2
SseController.java
...min/src/main/java/org/dinky/controller/SseController.java
+0
-6
PublicInterface.java
.../main/java/org/dinky/data/annotation/PublicInterface.java
+0
-31
TenantInterceptor.java
...rc/main/java/org/dinky/interceptor/TenantInterceptor.java
+0
-11
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+159
-157
No files found.
dinky-admin/src/main/java/org/dinky/configure/AppConfig.java
View file @
c3c35e84
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
package
org
.
dinky
.
configure
;
package
org
.
dinky
.
configure
;
import
org.dinky.data.annotation.PublicInterface
;
import
org.dinky.data.constant.BaseConstant
;
import
org.dinky.data.constant.BaseConstant
;
import
org.dinky.interceptor.LocaleChangeInterceptor
;
import
org.dinky.interceptor.LocaleChangeInterceptor
;
import
org.dinky.interceptor.TenantInterceptor
;
import
org.dinky.interceptor.TenantInterceptor
;
...
@@ -28,7 +27,6 @@ import java.util.Locale;
...
@@ -28,7 +27,6 @@ import java.util.Locale;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.LocaleResolver
;
import
org.springframework.web.servlet.LocaleResolver
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
...
@@ -105,18 +103,7 @@ public class AppConfig implements WebMvcConfigurer {
...
@@ -105,18 +103,7 @@ public class AppConfig implements WebMvcConfigurer {
// .excludePathPatterns("/druid/**")
// .excludePathPatterns("/druid/**")
// .excludePathPatterns("/openapi/**");
// .excludePathPatterns("/openapi/**");
registry
.
addInterceptor
(
registry
.
addInterceptor
(
new
SaInterceptor
(
handler
->
StpUtil
.
checkLogin
()))
new
SaInterceptor
(
handler
->
{
if
(
handler
instanceof
HandlerMethod
)
{
if
(((
HandlerMethod
)
handler
)
.
getMethodAnnotation
(
PublicInterface
.
class
)
!=
null
)
{
return
;
}
StpUtil
.
checkLogin
();
}
}))
.
addPathPatterns
(
"/api/**"
)
.
addPathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
.
excludePathPatterns
(
"/api/login"
,
"/api/ldap/ldapEnableStatus"
,
"/api/login"
,
"/api/ldap/ldapEnableStatus"
,
...
...
dinky-admin/src/main/java/org/dinky/controller/GitController.java
View file @
c3c35e84
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
package
org
.
dinky
.
controller
;
package
org
.
dinky
.
controller
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.PublicInterface
;
import
org.dinky.data.dto.GitProjectDTO
;
import
org.dinky.data.dto.GitProjectDTO
;
import
org.dinky.data.dto.TreeNodeDTO
;
import
org.dinky.data.dto.TreeNodeDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
...
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
...
@@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -227,8 +225,6 @@ public class GitController {
...
@@ -227,8 +225,6 @@ public class GitController {
* @return {@link Result} of {@link Void}
* @return {@link Result} of {@link Void}
*/
*/
@GetMapping
(
path
=
"/build-step-logs"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@GetMapping
(
path
=
"/build-step-logs"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@CrossOrigin
(
"*"
)
@PublicInterface
@Log
(
title
=
"GitProject Build Step Logs"
,
businessType
=
BusinessType
.
QUERY
)
@Log
(
title
=
"GitProject Build Step Logs"
,
businessType
=
BusinessType
.
QUERY
)
@ApiOperation
(
"GitProject Build Step Logs"
)
@ApiOperation
(
"GitProject Build Step Logs"
)
public
SseEmitter
buildStepLogs
(
@RequestParam
(
"id"
)
Integer
id
)
{
public
SseEmitter
buildStepLogs
(
@RequestParam
(
"id"
)
Integer
id
)
{
...
...
dinky-admin/src/main/java/org/dinky/controller/MonitorController.java
View file @
c3c35e84
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
package
org
.
dinky
.
controller
;
package
org
.
dinky
.
controller
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.Log
;
import
org.dinky.data.annotation.PublicInterface
;
import
org.dinky.data.dto.MetricsLayoutDTO
;
import
org.dinky.data.dto.MetricsLayoutDTO
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.enums.BusinessType
;
import
org.dinky.data.model.Metrics
;
import
org.dinky.data.model.Metrics
;
...
@@ -65,7 +64,6 @@ public class MonitorController {
...
@@ -65,7 +64,6 @@ public class MonitorController {
}
}
@GetMapping
(
value
=
"/getLastUpdateData"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@GetMapping
(
value
=
"/getLastUpdateData"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@PublicInterface
@ApiOperation
(
"Get Last Update Data"
)
@ApiOperation
(
"Get Last Update Data"
)
public
SseEmitter
getLastUpdateData
(
Long
lastTime
)
{
public
SseEmitter
getLastUpdateData
(
Long
lastTime
)
{
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
...
...
dinky-admin/src/main/java/org/dinky/controller/SseController.java
View file @
c3c35e84
...
@@ -19,14 +19,12 @@
...
@@ -19,14 +19,12 @@
package
org
.
dinky
.
controller
;
package
org
.
dinky
.
controller
;
import
org.dinky.data.annotation.PublicInterface
;
import
org.dinky.service.MonitorService
;
import
org.dinky.service.MonitorService
;
import
org.dinky.sse.SseEmitterUTF8
;
import
org.dinky.sse.SseEmitterUTF8
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -44,8 +42,6 @@ public class SseController {
...
@@ -44,8 +42,6 @@ public class SseController {
private
final
MonitorService
monitorService
;
private
final
MonitorService
monitorService
;
@GetMapping
(
value
=
"/getLastUpdateData"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@GetMapping
(
value
=
"/getLastUpdateData"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@CrossOrigin
(
"*"
)
@PublicInterface
@ApiOperation
(
"Get Last Update Data"
)
@ApiOperation
(
"Get Last Update Data"
)
public
SseEmitter
getLastUpdateData
(
Long
lastTime
)
{
public
SseEmitter
getLastUpdateData
(
Long
lastTime
)
{
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
...
@@ -54,8 +50,6 @@ public class SseController {
...
@@ -54,8 +50,6 @@ public class SseController {
}
}
@GetMapping
(
value
=
"/getJvmInfo"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@GetMapping
(
value
=
"/getJvmInfo"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@CrossOrigin
(
"*"
)
@PublicInterface
@ApiOperation
(
"Get JVM Info"
)
@ApiOperation
(
"Get JVM Info"
)
public
SseEmitter
getJvmInfo
(
Long
lastTime
)
{
public
SseEmitter
getJvmInfo
(
Long
lastTime
)
{
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
SseEmitter
emitter
=
new
SseEmitterUTF8
(
TimeUnit
.
MINUTES
.
toMillis
(
30
));
...
...
dinky-admin/src/main/java/org/dinky/data/annotation/PublicInterface.java
deleted
100644 → 0
View file @
a497d7e5
/*
*
* 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
.
data
.
annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
TYPE
,
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
PublicInterface
{}
dinky-admin/src/main/java/org/dinky/interceptor/TenantInterceptor.java
View file @
c3c35e84
...
@@ -21,17 +21,14 @@ package org.dinky.interceptor;
...
@@ -21,17 +21,14 @@ package org.dinky.interceptor;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.context.TenantContextHolder
;
import
org.dinky.context.TenantContextHolder
;
import
org.dinky.data.annotation.PublicInterface
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.AsyncHandlerInterceptor
;
import
org.springframework.web.servlet.AsyncHandlerInterceptor
;
import
cn.dev33.satoken.SaManager
;
import
cn.dev33.satoken.SaManager
;
import
cn.dev33.satoken.exception.NotLoginException
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.core.lang.Opt
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -62,14 +59,6 @@ public class TenantInterceptor implements AsyncHandlerInterceptor {
...
@@ -62,14 +59,6 @@ public class TenantInterceptor implements AsyncHandlerInterceptor {
}
}
}
}
}
}
if
(!
isPass
)
{
if
(
handler
instanceof
HandlerMethod
)
{
if
(((
HandlerMethod
)
handler
).
getMethodAnnotation
(
PublicInterface
.
class
)
!=
null
)
{
return
true
;
}
}
throw
new
NotLoginException
(
"请先登录"
,
"login"
,
"login"
);
}
return
AsyncHandlerInterceptor
.
super
.
preHandle
(
request
,
response
,
handler
);
return
AsyncHandlerInterceptor
.
super
.
preHandle
(
request
,
response
,
handler
);
}
}
}
}
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
c3c35e84
...
@@ -20,14 +20,14 @@ import {FlexCenterDiv} from "@/components/StyledComponents";
...
@@ -20,14 +20,14 @@ import {FlexCenterDiv} from "@/components/StyledComponents";
import
{
DataStudioParams
,
StateType
,
TabsPageType
,
VIEW
}
from
"@/pages/DataStudio/model"
;
import
{
DataStudioParams
,
StateType
,
TabsPageType
,
VIEW
}
from
"@/pages/DataStudio/model"
;
import
{
Breadcrumb
,
Button
,
Descriptions
,
message
,
Modal
,
notification
,
Space
}
from
"antd"
;
import
{
Breadcrumb
,
Button
,
Descriptions
,
message
,
Modal
,
notification
,
Space
}
from
"antd"
;
import
{
import
{
EnvironmentOutlined
,
EnvironmentOutlined
,
FlagTwoTone
,
FlagTwoTone
,
MoreOutlined
,
MoreOutlined
,
PauseCircleTwoTone
,
PauseCircleTwoTone
,
PlayCircleTwoTone
,
PlayCircleTwoTone
,
SafetyCertificateTwoTone
,
SafetyCertificateTwoTone
,
SaveTwoTone
,
SaveTwoTone
,
SmileOutlined
SmileOutlined
}
from
"@ant-design/icons"
;
}
from
"@ant-design/icons"
;
import
React
from
"react"
;
import
React
from
"react"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
...
@@ -42,103 +42,105 @@ import {buildGraphData} from "@/pages/DataStudio/HeaderContainer/FlinkGraph/func
...
@@ -42,103 +42,105 @@ import {buildGraphData} from "@/pages/DataStudio/HeaderContainer/FlinkGraph/func
import
{
ErrorNotification
}
from
"@/utils/messages"
;
import
{
ErrorNotification
}
from
"@/utils/messages"
;
const
headerStyle
:
React
.
CSSProperties
=
{
const
headerStyle
:
React
.
CSSProperties
=
{
display
:
"inline-flex"
,
display
:
"inline-flex"
,
lineHeight
:
VIEW
.
headerHeight
+
'px'
,
lineHeight
:
VIEW
.
headerHeight
+
'px'
,
height
:
VIEW
.
headerHeight
,
height
:
VIEW
.
headerHeight
,
fontStyle
:
"normal"
,
fontStyle
:
"normal"
,
fontWeight
:
"bold"
,
fontWeight
:
"bold"
,
fontSize
:
"16px"
,
fontSize
:
"16px"
,
padding
:
"4px 10px"
,
padding
:
"4px 10px"
,
};
};
type
ButtonRoute
=
{
type
ButtonRoute
=
{
icon
:
React
.
ReactNode
,
icon
:
React
.
ReactNode
,
title
:
string
,
title
:
string
,
click
:
()
=>
void
,
click
:
()
=>
void
,
hotKey
?:
(
e
:
KeyboardEvent
)
=>
boolean
,
hotKey
?:
(
e
:
KeyboardEvent
)
=>
boolean
,
hotKeyDesc
?:
string
,
hotKeyDesc
?:
string
,
isShow
?:
(
type
?:
TabsPageType
,
subType
?:
string
,
data
?:
any
)
=>
boolean
;
isShow
?:
(
type
?:
TabsPageType
,
subType
?:
string
,
data
?:
any
)
=>
boolean
;
}
}
const
HeaderContainer
=
(
props
:
any
)
=>
{
const
HeaderContainer
=
(
props
:
any
)
=>
{
const
{
const
{
size
,
activeBreadcrumbTitle
,
size
,
activeBreadcrumbTitle
,
tabs
:
{
panes
,
activeKey
},
tabs
:
{
panes
,
activeKey
},
saveTabs
,
saveTabs
,
updateJobRunningMsg
,
updateJobRunningMsg
,
}
=
props
;
}
=
props
;
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
notificationApi
,
notificationContextHolder
]
=
notification
.
useNotification
();
const
[
notificationApi
,
notificationContextHolder
]
=
notification
.
useNotification
();
const
[
messageApi
,
messageContextHolder
]
=
message
.
useMessage
();
const
[
messageApi
,
messageContextHolder
]
=
message
.
useMessage
();
const
handlerStop
=
()
=>
{
const
handlerStop
=
()
=>
{
const
current
=
getCurrentData
(
panes
,
activeKey
);
const
current
=
getCurrentData
(
panes
,
activeKey
);
modal
.
confirm
({
modal
.
confirm
({
title
:
l
(
'pages.datastudio.editor.stop.job'
),
title
:
l
(
'pages.datastudio.editor.stop.job'
),
content
:
l
(
'pages.datastudio.editor.stop.jobConfirm'
,
''
,
{
jobName
:
current
.
name
}),
content
:
l
(
'pages.datastudio.editor.stop.jobConfirm'
,
''
,
{
jobName
:
current
.
name
}),
okText
:
l
(
'button.confirm'
),
okText
:
l
(
'button.confirm'
),
cancelText
:
l
(
'button.cancel'
),
cancelText
:
l
(
'button.cancel'
),
onOk
:
async
()
=>
{
onOk
:
async
()
=>
{
offLineTask
(
l
(
'pages.datastudio.editor.stop.job'
),
current
.
id
,
"canceljob"
)
offLineTask
(
l
(
'pages.datastudio.editor.stop.job'
),
current
.
id
,
"canceljob"
)
.
then
((
result
)
=>
{
.
then
((
result
)
=>
{
(
getCurrentTab
(
panes
,
activeKey
)?.
params
as
DataStudioParams
).
taskData
.
jobInstanceId
=
0
;
(
getCurrentTab
(
panes
,
activeKey
)?.
params
as
DataStudioParams
).
taskData
.
jobInstanceId
=
0
;
saveTabs
({...
props
.
tabs
})
saveTabs
({...
props
.
tabs
})
});
});
}
}
});
});
}
const
handlerExec
=
()
=>
{
const
current
=
getCurrentData
(
panes
,
activeKey
);
if
(
!
isSql
(
current
.
dialect
)
&&
!
isOnline
(
current
.
type
))
{
messageApi
.
warning
(
l
(
'pages.datastudio.editor.execute.warn'
,
''
,
{
type
:
current
.
type
}));
return
;
}
}
const
handlerExec
=
()
=>
{
const
current
=
getCurrentData
(
panes
,
activeKey
);
if
(
!
isSql
(
current
.
dialect
)
&&
!
isOnline
(
current
.
type
))
{
messageApi
.
warning
(
l
(
'pages.datastudio.editor.execute.warn'
,
''
,
{
type
:
current
.
type
}));
return
;
}
const
param
:
any
=
{
const
param
:
any
=
{
...
current
,
...
current
,
jobName
:
current
.
name
,
jobName
:
current
.
name
,
taskId
:
current
.
id
,
taskId
:
current
.
id
,
};
};
const
key
=
current
.
key
;
const
key
=
current
.
key
;
const
taskKey
=
(
Math
.
random
()
*
1000
)
+
''
;
const
taskKey
=
(
Math
.
random
()
*
1000
)
+
''
;
notificationApi
.
success
({
notificationApi
.
success
({
message
:
l
(
'pages.datastudio.editor.submiting'
,
''
,
{
jobName
:
param
.
name
}),
message
:
l
(
'pages.datastudio.editor.submiting'
,
''
,
{
jobName
:
param
.
name
}),
description
:
param
.
statement
.
substring
(
0
,
40
)
+
'...'
,
description
:
param
.
statement
.
substring
(
0
,
40
)
+
'...'
,
duration
:
null
,
duration
:
null
,
key
:
taskKey
,
key
:
taskKey
,
icon
:
<
SmileOutlined
style=
{
{
color
:
'#108ee9'
}
}
/>,
icon
:
<
SmileOutlined
style=
{
{
color
:
'#108ee9'
}
}
/>,
});
});
executeSql
(
l
(
'pages.datastudio.editor.submiting'
,
''
,
{
jobName
:
param
.
name
}),
param
).
then
(
res
=>
{
executeSql
(
l
(
'pages.datastudio.editor.submiting'
,
''
,
{
jobName
:
param
.
name
}),
param
).
then
(
res
=>
{
console
.
log
(
res
)
notificationApi
.
destroy
(
taskKey
)
updateJobRunningMsg
({
if
(
!
res
)
{
taskId
:
current
.
id
,
return
jobName
:
current
.
name
,
}
jobState
:
res
.
datas
.
status
,
updateJobRunningMsg
({
runningLog
:
res
.
msg
,
taskId
:
current
.
id
,
})
jobName
:
current
.
name
,
notificationApi
.
destroy
(
taskKey
)
jobState
:
res
.
datas
.
status
,
if
(
res
.
datas
.
success
)
{
runningLog
:
res
.
msg
,
messageApi
.
success
(
l
(
'pages.datastudio.editor.exec.success'
));
})
(
getCurrentTab
(
panes
,
activeKey
)?.
params
as
DataStudioParams
).
taskData
.
jobInstanceId
=
res
.
datas
.
jobInstanceId
;
if
(
res
.
datas
.
success
)
{
saveTabs
({...
props
.
tabs
})
messageApi
.
success
(
l
(
'pages.datastudio.editor.exec.success'
));
}
else
{
(
getCurrentTab
(
panes
,
activeKey
)?.
params
as
DataStudioParams
).
taskData
.
jobInstanceId
=
res
.
datas
.
jobInstanceId
;
ErrorNotification
(
res
.
datas
.
error
,
l
(
"pages.datastudio.editor.exec.error"
,
''
,
{
jobName
:
param
.
name
}),
null
)
saveTabs
({...
props
.
tabs
})
}
else
{
ErrorNotification
(
res
.
datas
.
error
,
l
(
"pages.datastudio.editor.exec.error"
,
''
,
{
jobName
:
param
.
name
}),
null
)
}
}
// let newTabs = tabs;
// let newTabs = tabs;
// for (const element of newTabs.panes) {
// for (const element of newTabs.panes) {
// if (element.key == key) {
// if (element.key == key) {
// element.console.result = res.datas;
// element.console.result = res.datas;
// break;
// break;
// }
// }
// }
// }
// props.saveTabs(newTabs);
// props.saveTabs(newTabs);
// useSession && showTables(currentSession.session, dispatch);
// useSession && showTables(currentSession.session, dispatch);
})
})
}
}
const
routes
:
ButtonRoute
[]
=
[
const
routes
:
ButtonRoute
[]
=
[
// 保存按钮 icon
// 保存按钮 icon
...
@@ -147,7 +149,7 @@ const HeaderContainer = (props: any) => {
...
@@ -147,7 +149,7 @@ const HeaderContainer = (props: any) => {
title
:
l
(
'button.save'
),
title
:
l
(
'button.save'
),
click
:
()
=>
{
click
:
()
=>
{
const
current
=
getCurrentData
(
panes
,
activeKey
);
const
current
=
getCurrentData
(
panes
,
activeKey
);
handlePutDataJson
(
"/api/task"
,
current
).
then
(()
=>
saveTabs
({...
props
.
tabs
}))
handlePutDataJson
(
"/api/task"
,
current
).
then
(()
=>
saveTabs
({...
props
.
tabs
}))
},
},
hotKey
:
(
e
:
KeyboardEvent
)
=>
e
.
ctrlKey
&&
e
.
key
===
's'
,
hotKey
:
(
e
:
KeyboardEvent
)
=>
e
.
ctrlKey
&&
e
.
key
===
's'
,
hotKeyDesc
:
"Ctrl+S"
,
hotKeyDesc
:
"Ctrl+S"
,
...
@@ -165,7 +167,7 @@ const HeaderContainer = (props: any) => {
...
@@ -165,7 +167,7 @@ const HeaderContainer = (props: any) => {
cancelButtonProps
:
{
style
:
{
display
:
'none'
}},
cancelButtonProps
:
{
style
:
{
display
:
'none'
}},
});
});
},
},
isShow
:
projectCommonShow
isShow
:
projectCommonShow
// hotKey: (e: KeyboardEvent) => e.ctrlKey && e.key === 's'
// hotKey: (e: KeyboardEvent) => e.ctrlKey && e.key === 's'
},
},
{
{
...
@@ -246,81 +248,81 @@ const HeaderContainer = (props: any) => {
...
@@ -246,81 +248,81 @@ const HeaderContainer = (props: any) => {
title
:
"More"
,
title
:
"More"
,
click
:
()
=>
{
click
:
()
=>
{
},
},
isShow
:
()
=>
true
isShow
:
()
=>
true
// hotKey: (e: KeyboardEvent) => e.ctrlKey && e.key === 's'
// hotKey: (e: KeyboardEvent) => e.ctrlKey && e.key === 's'
},
},
]
]
/**
/**
* @description: 生成面包屑
* @description: 生成面包屑
* @type {({title: JSX.Element} | {title: string})[]}
* @type {({title: JSX.Element} | {title: string})[]}
*/
*/
const
renderBreadcrumbItems
=
()
=>
{
const
renderBreadcrumbItems
=
()
=>
{
if
(
!
activeBreadcrumbTitle
)
{
if
(
!
activeBreadcrumbTitle
)
{
return
<
Space
><
EnvironmentOutlined
/><
span
>
Guide Page
</
span
></
Space
>
return
<
Space
><
EnvironmentOutlined
/><
span
>
Guide Page
</
span
></
Space
>
}
}
return
<>
return
<>
<
FlexCenterDiv
style=
{
{
width
:
(
size
.
width
-
2
*
VIEW
.
paddingInline
)
/
2
}
}
>
<
FlexCenterDiv
style=
{
{
width
:
(
size
.
width
-
2
*
VIEW
.
paddingInline
)
/
2
}
}
>
<
Breadcrumb
separator=
{
">"
}
items=
{
buildBreadcrumbItems
(
activeBreadcrumbTitle
)
}
/>
<
Breadcrumb
separator=
{
">"
}
items=
{
buildBreadcrumbItems
(
activeBreadcrumbTitle
)
}
/>
</
FlexCenterDiv
>
</
FlexCenterDiv
>
</>
</>
};
};
const
renderHotkey
=
()
=>
{
const
renderHotkey
=
()
=>
{
document
.
onkeydown
=
e
=>
{
document
.
onkeydown
=
e
=>
{
routes
.
forEach
(
r
=>
{
routes
.
forEach
(
r
=>
{
if
(
r
.
hotKey
&&
r
.
hotKey
(
e
))
{
if
(
r
.
hotKey
&&
r
.
hotKey
(
e
))
{
r
.
click
()
r
.
click
()
e
.
preventDefault
()
e
.
preventDefault
()
}
})
}
}
})
}
}
renderHotkey
()
}
renderHotkey
()
/**
/**
* @description: 渲染右侧按钮
* @description: 渲染右侧按钮
* @returns {JSX.Element}
* @returns {JSX.Element}
*/
*/
const
renderRightButtons
=
()
=>
{
const
renderRightButtons
=
()
=>
{
return
<>
<
Space
size=
{
'middle'
}
align=
{
"center"
}
direction=
{
"horizontal"
}
wrap
>
{
routes
.
filter
(
x
=>
{
if
(
x
.
isShow
)
{
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
);
if
(
currentTab
)
{
return
x
.
isShow
(
currentTab
?.
type
,
currentTab
?.
subType
,
(
currentTab
?.
params
as
DataStudioParams
).
taskData
)
}
}
return
false
}).
map
((
route
)
=>
{
const
{
icon
,
title
,
click
,
hotKeyDesc
}
=
route
;
return
<
Button
key=
{
title
}
size=
{
"small"
}
type=
{
"text"
}
icon=
{
icon
}
title=
{
title
+
(
hotKeyDesc
?
" "
+
hotKeyDesc
:
""
)
}
onClick=
{
click
}
/>
})
}
</
Space
>
{
contextHolder
}
{
notificationContextHolder
}
{
messageContextHolder
}
</>
};
/**
* render
*/
return
<>
return
<>
<
Descriptions
column=
{
2
}
size=
{
'middle'
}
layout=
{
'horizontal'
}
key=
{
"h"
}
style=
{
headerStyle
}
>
<
Space
size=
{
'middle'
}
align=
{
"center"
}
direction=
{
"horizontal"
}
wrap
>
<
Descriptions
.
Item
>
{
routes
.
filter
(
x
=>
{
{
renderBreadcrumbItems
()
}
if
(
x
.
isShow
)
{
</
Descriptions
.
Item
>
const
currentTab
=
getCurrentTab
(
panes
,
activeKey
);
<
Descriptions
.
Item
contentStyle=
{
{
display
:
"flex"
,
flexDirection
:
"row-reverse"
}
}
>
if
(
currentTab
)
{
{
renderRightButtons
()
}
return
x
.
isShow
(
currentTab
?.
type
,
currentTab
?.
subType
,
(
currentTab
?.
params
as
DataStudioParams
).
taskData
)
</
Descriptions
.
Item
>
}
</
Descriptions
>
}
return
false
}).
map
((
route
)
=>
{
const
{
icon
,
title
,
click
,
hotKeyDesc
}
=
route
;
return
<
Button
key=
{
title
}
size=
{
"small"
}
type=
{
"text"
}
icon=
{
icon
}
title=
{
title
+
(
hotKeyDesc
?
" "
+
hotKeyDesc
:
""
)
}
onClick=
{
click
}
/>
})
}
</
Space
>
{
contextHolder
}
{
notificationContextHolder
}
{
messageContextHolder
}
</>
</>
};
/**
* render
*/
return
<>
<
Descriptions
column=
{
2
}
size=
{
'middle'
}
layout=
{
'horizontal'
}
key=
{
"h"
}
style=
{
headerStyle
}
>
<
Descriptions
.
Item
>
{
renderBreadcrumbItems
()
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
{
display
:
"flex"
,
flexDirection
:
"row-reverse"
}
}
>
{
renderRightButtons
()
}
</
Descriptions
.
Item
>
</
Descriptions
>
</>
}
}
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
tabs
:
Studio
.
tabs
,
tabs
:
Studio
.
tabs
,
}),
mapDispatchToProps
)(
HeaderContainer
);
}),
mapDispatchToProps
)(
HeaderContainer
);
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