Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
831c025f
Commit
831c025f
authored
Dec 13, 2021
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据源语句查询与结果展示
parent
0f7563ce
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
140 additions
and
37 deletions
+140
-37
pom.xml
dlink-admin/pom.xml
+2
-6
StudioServiceImpl.java
...c/main/java/com/dlink/service/impl/StudioServiceImpl.java
+46
-1
AbstractResult.java
...common/src/main/java/com/dlink/result/AbstractResult.java
+0
-0
IResult.java
dlink-common/src/main/java/com/dlink/result/IResult.java
+0
-0
JobResult.java
dlink-core/src/main/java/com/dlink/job/JobResult.java
+4
-1
AbstractJdbcDriver.java
...in/java/com/dlink/metadata/driver/AbstractJdbcDriver.java
+14
-3
Driver.java
...-base/src/main/java/com/dlink/metadata/driver/Driver.java
+1
-1
SelectResult.java
...src/main/java/com/dlink/metadata/result/SelectResult.java
+9
-2
MysqlTest.java
...ata-mysql/src/test/java/com/dlink/metadata/MysqlTest.java
+7
-5
index.tsx
...b/src/components/Studio/StudioConsole/StudioMsg/index.tsx
+40
-14
index.tsx
...src/components/Studio/StudioConsole/StudioTable/index.tsx
+7
-4
index.tsx
dlink-web/src/components/Studio/StudioMenu/index.tsx
+7
-0
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+3
-0
No files found.
dlink-admin/pom.xml
View file @
831c025f
...
@@ -76,11 +76,11 @@
...
@@ -76,11 +76,11 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<
!--<
dependency>
<groupId>org.slf4j</groupId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<version>1.7.30</version>
</dependency>
</dependency>
-->
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
...
@@ -97,10 +97,6 @@
...
@@ -97,10 +97,6 @@
<groupId>
org.hibernate
</groupId>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-validator
</artifactId>
<artifactId>
hibernate-validator
</artifactId>
</dependency>
</dependency>
<!--<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>-->
<dependency>
<dependency>
<groupId>
junit
</groupId>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<artifactId>
junit
</artifactId>
...
...
dlink-admin/src/main/java/com/dlink/service/impl/StudioServiceImpl.java
View file @
831c025f
...
@@ -69,6 +69,14 @@ public class StudioServiceImpl implements StudioService {
...
@@ -69,6 +69,14 @@ public class StudioServiceImpl implements StudioService {
@Override
@Override
public
JobResult
executeSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
public
JobResult
executeSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
if
(
Dialect
.
SQL
.
equalsVal
(
studioExecuteDTO
.
getDialect
())){
return
executeCommonSql
(
studioExecuteDTO
);
}
else
{
return
executeFlinkSql
(
studioExecuteDTO
);
}
}
private
JobResult
executeFlinkSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
JobConfig
config
=
studioExecuteDTO
.
getJobConfig
();
JobConfig
config
=
studioExecuteDTO
.
getJobConfig
();
// If you are using a shared session, configure the current jobmanager address
// If you are using a shared session, configure the current jobmanager address
if
(!
config
.
isUseSession
())
{
if
(!
config
.
isUseSession
())
{
...
@@ -80,6 +88,36 @@ public class StudioServiceImpl implements StudioService {
...
@@ -80,6 +88,36 @@ public class StudioServiceImpl implements StudioService {
return
jobResult
;
return
jobResult
;
}
}
private
JobResult
executeCommonSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
JobResult
result
=
new
JobResult
();
result
.
setStatement
(
studioExecuteDTO
.
getStatement
());
result
.
setStartTime
(
LocalDateTime
.
now
());
if
(
Asserts
.
isNull
(
studioExecuteDTO
.
getDatabaseId
())){
result
.
setSuccess
(
false
);
result
.
setError
(
"请指定数据源"
);
result
.
setEndTime
(
LocalDateTime
.
now
());
return
result
;
}
else
{
DataBase
dataBase
=
dataBaseService
.
getById
(
studioExecuteDTO
.
getDatabaseId
());
if
(
Asserts
.
isNull
(
dataBase
)){
result
.
setSuccess
(
false
);
result
.
setError
(
"数据源不存在"
);
result
.
setEndTime
(
LocalDateTime
.
now
());
return
result
;
}
try
{
com
.
dlink
.
metadata
.
result
.
SelectResult
selectResult
=
Driver
.
build
(
dataBase
.
getDriverConfig
()).
connect
().
query
(
studioExecuteDTO
.
getStatement
(),
studioExecuteDTO
.
getMaxRowNum
());
result
.
setResult
(
selectResult
);
result
.
setSuccess
(
true
);
}
catch
(
Exception
e
){
result
.
setSuccess
(
false
);
result
.
setError
(
e
.
getMessage
());
}
result
.
setEndTime
(
LocalDateTime
.
now
());
return
result
;
}
}
@Override
@Override
public
IResult
executeDDL
(
StudioDDLDTO
studioDDLDTO
)
{
public
IResult
executeDDL
(
StudioDDLDTO
studioDDLDTO
)
{
JobConfig
config
=
studioDDLDTO
.
getJobConfig
();
JobConfig
config
=
studioDDLDTO
.
getJobConfig
();
...
@@ -110,9 +148,16 @@ public class StudioServiceImpl implements StudioService {
...
@@ -110,9 +148,16 @@ public class StudioServiceImpl implements StudioService {
private
List
<
SqlExplainResult
>
explainCommonSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
private
List
<
SqlExplainResult
>
explainCommonSql
(
StudioExecuteDTO
studioExecuteDTO
)
{
if
(
Asserts
.
isNull
(
studioExecuteDTO
.
getDatabaseId
())){
if
(
Asserts
.
isNull
(
studioExecuteDTO
.
getDatabaseId
())){
return
new
ArrayList
<>();
return
new
ArrayList
<
SqlExplainResult
>(){{
add
(
SqlExplainResult
.
fail
(
studioExecuteDTO
.
getStatement
(),
"请指定数据源"
));
}};
}
else
{
}
else
{
DataBase
dataBase
=
dataBaseService
.
getById
(
studioExecuteDTO
.
getDatabaseId
());
DataBase
dataBase
=
dataBaseService
.
getById
(
studioExecuteDTO
.
getDatabaseId
());
if
(
Asserts
.
isNull
(
dataBase
)){
return
new
ArrayList
<
SqlExplainResult
>(){{
add
(
SqlExplainResult
.
fail
(
studioExecuteDTO
.
getStatement
(),
"数据源不存在"
));
}};
}
SqlExplainResult
explainResult
=
Driver
.
build
(
dataBase
.
getDriverConfig
()).
connect
().
explain
(
studioExecuteDTO
.
getStatement
());
SqlExplainResult
explainResult
=
Driver
.
build
(
dataBase
.
getDriverConfig
()).
connect
().
explain
(
studioExecuteDTO
.
getStatement
());
return
new
ArrayList
<
SqlExplainResult
>(){{
return
new
ArrayList
<
SqlExplainResult
>(){{
add
(
explainResult
);
add
(
explainResult
);
...
...
dlink-co
re
/src/main/java/com/dlink/result/AbstractResult.java
→
dlink-co
mmon
/src/main/java/com/dlink/result/AbstractResult.java
View file @
831c025f
File moved
dlink-co
re
/src/main/java/com/dlink/result/IResult.java
→
dlink-co
mmon
/src/main/java/com/dlink/result/IResult.java
View file @
831c025f
File moved
dlink-core/src/main/java/com/dlink/job/JobResult.java
View file @
831c025f
...
@@ -29,7 +29,10 @@ public class JobResult {
...
@@ -29,7 +29,10 @@ public class JobResult {
private
LocalDateTime
startTime
;
private
LocalDateTime
startTime
;
private
LocalDateTime
endTime
;
private
LocalDateTime
endTime
;
public
JobResult
(
Integer
id
,
JobConfig
jobConfig
,
String
jobManagerAddress
,
Job
.
JobStatus
status
,
String
statement
,
String
jobId
,
String
error
,
IResult
result
,
LocalDateTime
startTime
,
LocalDateTime
endTime
)
{
public
JobResult
()
{
}
public
JobResult
(
Integer
id
,
JobConfig
jobConfig
,
String
jobManagerAddress
,
Job
.
JobStatus
status
,
String
statement
,
String
jobId
,
String
error
,
IResult
result
,
LocalDateTime
startTime
,
LocalDateTime
endTime
)
{
this
.
id
=
id
;
this
.
id
=
id
;
this
.
jobConfig
=
jobConfig
;
this
.
jobConfig
=
jobConfig
;
this
.
jobManagerAddress
=
jobManagerAddress
;
this
.
jobManagerAddress
=
jobManagerAddress
;
...
...
dlink-metadata/dlink-metadata-base/src/main/java/com/dlink/metadata/driver/AbstractJdbcDriver.java
View file @
831c025f
...
@@ -2,6 +2,7 @@ package com.dlink.metadata.driver;
...
@@ -2,6 +2,7 @@ package com.dlink.metadata.driver;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.constant.CommonConstant
;
import
com.dlink.constant.CommonConstant
;
import
com.dlink.metadata.result.SelectResult
;
import
com.dlink.model.Column
;
import
com.dlink.model.Column
;
import
com.dlink.model.Schema
;
import
com.dlink.model.Schema
;
import
com.dlink.model.Table
;
import
com.dlink.model.Table
;
...
@@ -241,35 +242,45 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
...
@@ -241,35 +242,45 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
}
}
@Override
@Override
public
List
<
HashMap
<
String
,
Object
>>
query
(
String
sql
)
{
public
SelectResult
query
(
String
sql
,
Integer
limit
)
{
SelectResult
result
=
new
SelectResult
();
List
<
HashMap
<
String
,
Object
>>
datas
=
new
ArrayList
<>();
List
<
HashMap
<
String
,
Object
>>
datas
=
new
ArrayList
<>();
List
<
Column
>
columns
=
new
ArrayList
<>();
List
<
Column
>
columns
=
new
ArrayList
<>();
List
<
String
>
columnNameList
=
new
ArrayList
<>();
PreparedStatement
preparedStatement
=
null
;
PreparedStatement
preparedStatement
=
null
;
ResultSet
results
=
null
;
ResultSet
results
=
null
;
int
count
=
0
;
try
{
try
{
preparedStatement
=
conn
.
prepareStatement
(
sql
);
preparedStatement
=
conn
.
prepareStatement
(
sql
);
results
=
preparedStatement
.
executeQuery
();
results
=
preparedStatement
.
executeQuery
();
ResultSetMetaData
metaData
=
results
.
getMetaData
();
ResultSetMetaData
metaData
=
results
.
getMetaData
();
for
(
int
i
=
1
;
i
<=
metaData
.
getColumnCount
();
i
++)
{
for
(
int
i
=
1
;
i
<=
metaData
.
getColumnCount
();
i
++)
{
columnNameList
.
add
(
metaData
.
getColumnLabel
(
i
));
Column
column
=
new
Column
();
Column
column
=
new
Column
();
column
.
setName
(
metaData
.
getColumn
Name
(
i
));
column
.
setName
(
metaData
.
getColumn
Label
(
i
));
column
.
setType
(
metaData
.
getColumnTypeName
(
i
));
column
.
setType
(
metaData
.
getColumnTypeName
(
i
));
column
.
setJavaType
(
getTypeConvert
().
convert
(
metaData
.
getColumnTypeName
(
i
)).
getType
());
column
.
setJavaType
(
getTypeConvert
().
convert
(
metaData
.
getColumnTypeName
(
i
)).
getType
());
columns
.
add
(
column
);
columns
.
add
(
column
);
}
}
result
.
setColumns
(
columnNameList
);
while
(
results
.
next
())
{
while
(
results
.
next
())
{
HashMap
<
String
,
Object
>
data
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
data
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
columns
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
columns
.
size
();
i
++)
{
data
.
put
(
columns
.
get
(
i
).
getName
(),
getTypeConvert
().
convertValue
(
results
,
columns
.
get
(
i
).
getName
(),
columns
.
get
(
i
).
getType
()));
data
.
put
(
columns
.
get
(
i
).
getName
(),
getTypeConvert
().
convertValue
(
results
,
columns
.
get
(
i
).
getName
(),
columns
.
get
(
i
).
getType
()));
}
}
datas
.
add
(
data
);
datas
.
add
(
data
);
count
++;
if
(
count
>=
limit
){
break
;
}
}
}
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
close
(
preparedStatement
,
results
);
close
(
preparedStatement
,
results
);
}
}
return
datas
;
result
.
setRowData
(
datas
);
return
result
;
}
}
@Override
@Override
...
...
dlink-metadata/dlink-metadata-base/src/main/java/com/dlink/metadata/driver/Driver.java
View file @
831c025f
...
@@ -90,7 +90,7 @@ public interface Driver {
...
@@ -90,7 +90,7 @@ public interface Driver {
boolean
execute
(
String
sql
);
boolean
execute
(
String
sql
);
List
query
(
String
sql
);
SelectResult
query
(
String
sql
,
Integer
limit
);
SqlExplainResult
explain
(
String
sql
);
SqlExplainResult
explain
(
String
sql
);
...
...
dlink-metadata/dlink-metadata-base/src/main/java/com/dlink/metadata/result/SelectResult.java
View file @
831c025f
package
com
.
dlink
.
metadata
.
result
;
package
com
.
dlink
.
metadata
.
result
;
import
com.dlink.result.AbstractResult
;
import
com.dlink.result.IResult
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -14,10 +16,15 @@ import java.util.List;
...
@@ -14,10 +16,15 @@ import java.util.List;
*/
*/
@Setter
@Setter
@Getter
@Getter
public
class
SelectResult
{
public
class
SelectResult
extends
AbstractResult
implements
IResult
{
private
List
<
String
>
columns
;
private
List
<
String
>
columns
;
private
List
<
HashMap
<
String
,
Object
>>
datas
;
private
List
<
HashMap
<
String
,
Object
>>
rowData
;
private
Integer
total
;
private
Integer
total
;
private
Integer
page
;
private
Integer
page
;
private
Integer
limit
;
private
Integer
limit
;
@Override
public
String
getJobId
()
{
return
null
;
}
}
}
dlink-metadata/dlink-metadata-mysql/src/test/java/com/dlink/metadata/MysqlTest.java
View file @
831c025f
...
@@ -2,6 +2,7 @@ package com.dlink.metadata;
...
@@ -2,6 +2,7 @@ package com.dlink.metadata;
import
com.dlink.metadata.driver.Driver
;
import
com.dlink.metadata.driver.Driver
;
import
com.dlink.metadata.driver.DriverConfig
;
import
com.dlink.metadata.driver.DriverConfig
;
import
com.dlink.metadata.result.SelectResult
;
import
com.dlink.model.Column
;
import
com.dlink.model.Column
;
import
com.dlink.model.Schema
;
import
com.dlink.model.Schema
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -16,14 +17,15 @@ import java.util.List;
...
@@ -16,14 +17,15 @@ import java.util.List;
**/
**/
public
class
MysqlTest
{
public
class
MysqlTest
{
private
static
final
String
IP
=
"127.0.0.1"
;
public
Driver
getDriver
(){
public
Driver
getDriver
(){
DriverConfig
config
=
new
DriverConfig
();
DriverConfig
config
=
new
DriverConfig
();
config
.
setType
(
"Mysql"
);
config
.
setType
(
"Mysql"
);
config
.
setIp
(
"10.1.51.25"
);
config
.
setIp
(
IP
);
config
.
setPort
(
3306
);
config
.
setPort
(
3306
);
config
.
setUsername
(
"dca"
);
config
.
setUsername
(
"dca"
);
config
.
setPassword
(
"dca"
);
config
.
setPassword
(
"dca"
);
config
.
setUrl
(
"jdbc:mysql://
10.1.51.25
:3306/dca?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true"
);
config
.
setUrl
(
"jdbc:mysql://
"
+
IP
+
"
:3306/dca?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true"
);
return
Driver
.
build
(
config
).
connect
();
return
Driver
.
build
(
config
).
connect
();
}
}
...
@@ -31,11 +33,11 @@ public class MysqlTest {
...
@@ -31,11 +33,11 @@ public class MysqlTest {
public
void
connectTest
(){
public
void
connectTest
(){
DriverConfig
config
=
new
DriverConfig
();
DriverConfig
config
=
new
DriverConfig
();
config
.
setType
(
"Mysql"
);
config
.
setType
(
"Mysql"
);
config
.
setIp
(
"10.1.51.25"
);
config
.
setIp
(
IP
);
config
.
setPort
(
3306
);
config
.
setPort
(
3306
);
config
.
setUsername
(
"dca"
);
config
.
setUsername
(
"dca"
);
config
.
setPassword
(
"dca"
);
config
.
setPassword
(
"dca"
);
config
.
setUrl
(
"jdbc:mysql://
10.1.51.25
:3306/dca?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true"
);
config
.
setUrl
(
"jdbc:mysql://
"
+
IP
+
"
:3306/dca?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true"
);
String
test
=
Driver
.
build
(
config
).
test
();
String
test
=
Driver
.
build
(
config
).
test
();
System
.
out
.
println
(
test
);
System
.
out
.
println
(
test
);
System
.
out
.
println
(
"end..."
);
System
.
out
.
println
(
"end..."
);
...
@@ -58,7 +60,7 @@ public class MysqlTest {
...
@@ -58,7 +60,7 @@ public class MysqlTest {
@Test
@Test
public
void
queryTest
(){
public
void
queryTest
(){
Driver
driver
=
getDriver
();
Driver
driver
=
getDriver
();
List
query
=
driver
.
query
(
"select * from MENU"
);
SelectResult
query
=
driver
.
query
(
"select * from MENU"
,
10
);
System
.
out
.
println
(
"end..."
);
System
.
out
.
println
(
"end..."
);
}
}
}
}
dlink-web/src/components/Studio/StudioConsole/StudioMsg/index.tsx
View file @
831c025f
import
{
Typography
,
Divider
,
Badge
,
Empty
,
Tag
}
from
"antd"
;
import
{
Typography
,
Divider
,
Badge
,
Empty
,
Tag
}
from
"antd"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
StateType
}
from
"@/pages/FlinkSqlStudio/model"
;
import
{
connect
}
from
"umi"
;
import
{
connect
}
from
"umi"
;
import
{
FireOutlined
}
from
'@ant-design/icons'
;
import
{
FireOutlined
,
ScheduleOutlined
}
from
'@ant-design/icons'
;
import
StudioSqlConfig
from
"@/components/Studio/StudioRightTool/StudioSqlConfig"
;
import
{
DIALECT
}
from
"@/components/Studio/conf"
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
...
@@ -9,29 +11,53 @@ const StudioMsg = (props:any) => {
...
@@ -9,29 +11,53 @@ const StudioMsg = (props:any) => {
const
{
current
}
=
props
;
const
{
current
}
=
props
;
return
(
const
renderCommonSqlContent
=
()
=>
{
<
Typography
>
return
(<>
{
current
.
console
.
result
.
jobConfig
?(<
Paragraph
>
<
Paragraph
>
<
blockquote
><
Link
href=
{
`http://${current.console.result.jobConfig.address}`
}
target=
"_blank"
>
<
blockquote
>
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
startTime
}
[
{
current
.
console
.
result
.
jobConfig
.
session
}
:
{
current
.
console
.
result
.
jobConfig
.
address
}
]
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
endTime
}
<
Divider
type=
"vertical"
/>
{
!
(
current
.
console
.
result
.
success
)
?
<><
Badge
status=
"error"
/><
Text
type=
"danger"
>
Error
</
Text
></>
:
<><
Badge
status=
"success"
/><
Text
type=
"success"
>
Success
</
Text
></>
}
<
Divider
type=
"vertical"
/>
</
blockquote
>
{
current
.
console
.
result
.
statement
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
statement
}
</
pre
>)
}
{
current
.
console
.
result
.
error
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
error
}
</
pre
>)
}
</
Paragraph
>
</>)
};
const
renderFlinkSqlContent
=
()
=>
{
return
(<>
<
Paragraph
>
<
blockquote
><
Link
href=
{
`http://${current.console.result.jobConfig?.address}`
}
target=
"_blank"
>
[
{
current
.
console
.
result
.
jobConfig
?.
session
}
:
{
current
.
console
.
result
.
jobConfig
?.
address
}
]
</
Link
>
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
startTime
}
</
Link
>
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
startTime
}
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
endTime
}
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
endTime
}
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
{
!
(
current
.
console
.
result
.
status
==
'SUCCESS'
)
?
<><
Badge
status=
"error"
/><
Text
type=
"danger"
>
Error
</
Text
></>
:
{
!
(
current
.
console
.
result
.
status
==
=
'SUCCESS'
)
?
<><
Badge
status=
"error"
/><
Text
type=
"danger"
>
Error
</
Text
></>
:
<><
Badge
status=
"success"
/><
Text
type=
"success"
>
Success
</
Text
></>
}
<><
Badge
status=
"success"
/><
Text
type=
"success"
>
Success
</
Text
></>
}
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
{
current
.
console
.
result
.
jobConfig
.
jobName
&&
<
Text
code
>
{
current
.
console
.
result
.
jobConfig
.
jobName
}
</
Text
>
}
{
current
.
console
.
result
.
jobConfig
?.
jobName
&&
<
Text
code
>
{
current
.
console
.
result
.
jobConfig
?
.
jobName
}
</
Text
>
}
{
current
.
console
.
result
.
jobId
&&
{
current
.
console
.
result
.
jobId
&&
(<>
(<>
<
Divider
type=
"vertical"
/>
<
Divider
type=
"vertical"
/>
<
Tag
color=
"blue"
key=
{
current
.
console
.
result
.
jobId
}
>
<
Tag
color=
"blue"
key=
{
current
.
console
.
result
.
jobId
}
>
<
FireOutlined
/>
{
current
.
console
.
result
.
jobId
}
<
FireOutlined
/>
{
current
.
console
.
result
.
jobId
}
</
Tag
>
</
Tag
>
</>)
}
</>)
}
</
blockquote
>
</
blockquote
>
{
current
.
console
.
result
.
statement
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
statement
}
</
pre
>)
}
{
current
.
console
.
result
.
statement
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
statement
}
</
pre
>)
}
{
current
.
console
.
result
.
error
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
error
}
</
pre
>)
}
{
current
.
console
.
result
.
error
&&
(<
pre
style=
{
{
height
:
'100px'
}
}
>
{
current
.
console
.
result
.
error
}
</
pre
>)
}
</
Paragraph
>):<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
</
Paragraph
>
</>)
};
return
(
<
Typography
>
{
current
.
console
.
result
.
success
?(
current
.
task
.
dialect
===
DIALECT
.
SQL
?
renderCommonSqlContent
():
renderFlinkSqlContent
()
):<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
}
}
</
Typography
>
</
Typography
>
);
);
...
...
dlink-web/src/components/Studio/StudioConsole/StudioTable/index.tsx
View file @
831c025f
...
@@ -6,6 +6,7 @@ import {useState} from "react";
...
@@ -6,6 +6,7 @@ import {useState} from "react";
import
{
SearchOutlined
}
from
'@ant-design/icons'
;
import
{
SearchOutlined
}
from
'@ant-design/icons'
;
import
{
showJobData
}
from
"@/components/Studio/StudioEvent/DQL"
;
import
{
showJobData
}
from
"@/components/Studio/StudioEvent/DQL"
;
import
ProTable
from
'@ant-design/pro-table'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
{
DIALECT
}
from
"@/components/Studio/conf"
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
...
@@ -101,11 +102,13 @@ const StudioTable = (props:any) => {
...
@@ -101,11 +102,13 @@ const StudioTable = (props:any) => {
};
};
return
(
return
(
<
div
style=
{
{
width
:
'100%'
}
}
>
<
div
style=
{
{
width
:
'100%'
}
}
>
{
current
.
console
&&
current
.
console
.
result
.
jobId
?
{
current
.
console
&&
current
.
console
.
result
.
success
?
(<>
(<>
<
Button
type=
"primary"
onClick=
{
showDetail
}
icon=
{
<
SearchOutlined
/>
}
>
{
current
.
task
.
dialect
===
DIALECT
.
FLINKSQL
?
获取最新数据
(<
Button
type=
"primary"
onClick=
{
showDetail
}
icon=
{
<
SearchOutlined
/>
}
>
</
Button
>
获取最新数据
</
Button
>):
undefined
}
{
result
.
rowData
&&
result
.
columns
?
{
result
.
rowData
&&
result
.
columns
?
<
ProTable
dataSource=
{
result
.
rowData
}
columns=
{
getColumns
(
result
.
columns
)
}
search=
{
false
}
<
ProTable
dataSource=
{
result
.
rowData
}
columns=
{
getColumns
(
result
.
columns
)
}
search=
{
false
}
options=
{
{
options=
{
{
...
...
dlink-web/src/components/Studio/StudioMenu/index.tsx
View file @
831c025f
...
@@ -18,6 +18,7 @@ import StudioGraph from "./StudioGraph";
...
@@ -18,6 +18,7 @@ import StudioGraph from "./StudioGraph";
import
{
showCluster
,
showTables
,
saveTask
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
showCluster
,
showTables
,
saveTask
}
from
"@/components/Studio/StudioEvent/DDL"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
StudioExplain
from
"../StudioConsole/StudioExplain"
;
import
StudioExplain
from
"../StudioConsole/StudioExplain"
;
import
{
DIALECT
}
from
"@/components/Studio/conf"
;
const
menu
=
(
const
menu
=
(
<
Menu
>
<
Menu
>
...
@@ -82,6 +83,12 @@ const StudioMenu = (props: any) => {
...
@@ -82,6 +83,12 @@ const StudioMenu = (props: any) => {
type
:
"Studio/saveTabs"
,
type
:
"Studio/saveTabs"
,
payload
:
newTabs
,
payload
:
newTabs
,
});
});
if
(
current
.
task
.
dialect
===
DIALECT
.
SQL
){
dispatch
&&
dispatch
({
type
:
"Studio/saveResult"
,
payload
:
res
.
datas
.
result
,
});
}
useSession
&&
showTables
(
currentSession
.
session
,
dispatch
);
useSession
&&
showTables
(
currentSession
.
session
,
dispatch
);
})
})
};
};
...
...
dlink-web/src/pages/Welcome.tsx
View file @
831c025f
...
@@ -481,6 +481,9 @@ export default (): React.ReactNode => {
...
@@ -481,6 +481,9 @@ export default (): React.ReactNode => {
<
li
>
<
li
>
<
Link
>
新增数据源的 Sql 作业语法校验
</
Link
>
<
Link
>
新增数据源的 Sql 作业语法校验
</
Link
>
</
li
>
</
li
>
<
li
>
<
Link
>
新增数据源的 Sql 作业语句执行
</
Link
>
</
li
>
</
ul
>
</
ul
>
</
Paragraph
>
</
Paragraph
>
</
Timeline
.
Item
>
</
Timeline
.
Item
>
...
...
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