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
346d051e
Unverified
Commit
346d051e
authored
Jan 14, 2024
by
gaoyan
Committed by
GitHub
Jan 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-2793] Fix Catalog NPE (#3004)
Co-authored-by:
gaoyan1998
<
gaoyan1998@users.noreply.github.com
>
parent
cf37b0bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
169 deletions
+140
-169
AbstractStatementDTO.java
...rc/main/java/org/dinky/data/dto/AbstractStatementDTO.java
+3
-2
index.tsx
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
+1
-2
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
+128
-154
index.tsx
...b/src/pages/DataStudio/LeftContainer/DataSource/index.tsx
+2
-2
index.tsx
...rceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx
+1
-1
index.tsx
...nts/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
+5
-8
No files found.
dinky-admin/src/main/java/org/dinky/data/dto/AbstractStatementDTO.java
View file @
346d051e
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
data
.
dto
;
package
org
.
dinky
.
data
.
dto
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -41,12 +42,12 @@ public class AbstractStatementDTO {
...
@@ -41,12 +42,12 @@ public class AbstractStatementDTO {
private
Integer
envId
;
private
Integer
envId
;
@ApiModelProperty
(
value
=
"Fragment Flag"
,
dataType
=
"boolean"
,
example
=
"false"
,
notes
=
"是否为片段"
)
@ApiModelProperty
(
value
=
"Fragment Flag"
,
dataType
=
"boolean"
,
example
=
"false"
,
notes
=
"是否为片段"
)
private
Boolean
fragment
;
private
Boolean
fragment
=
false
;
@ApiModelProperty
(
@ApiModelProperty
(
value
=
"Variables"
,
value
=
"Variables"
,
dataType
=
"Map<String, String>"
,
dataType
=
"Map<String, String>"
,
example
=
"{\"key\": \"value\"}"
,
example
=
"{\"key\": \"value\"}"
,
notes
=
"变量集合"
)
notes
=
"变量集合"
)
private
Map
<
String
,
String
>
variables
;
private
Map
<
String
,
String
>
variables
=
new
HashMap
<>()
;
}
}
dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx
View file @
346d051e
...
@@ -366,8 +366,7 @@ const HeaderContainer = (props: connect) => {
...
@@ -366,8 +366,7 @@ const HeaderContainer = (props: connect) => {
// 发布按钮
// 发布按钮
icon
:
isOnline
(
currentData
)
?
<
MergeCellsOutlined
/>
:
<
FundOutlined
/>,
icon
:
isOnline
(
currentData
)
?
<
MergeCellsOutlined
/>
:
<
FundOutlined
/>,
title
:
isOnline
(
currentData
)
?
l
(
'button.offline'
)
:
l
(
'button.publish'
),
title
:
isOnline
(
currentData
)
?
l
(
'button.offline'
)
:
l
(
'button.publish'
),
isShow
:
isShow
:
currentTab
?.
type
==
TabsPageType
.
project
,
(
currentTab
?.
type
==
TabsPageType
.
project
),
click
:
()
=>
handleChangeJobLife
()
click
:
()
=>
handleChangeJobLife
()
},
},
{
{
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
View file @
346d051e
...
@@ -22,20 +22,18 @@ import { isSql } from '@/pages/DataStudio/HeaderContainer/function';
...
@@ -22,20 +22,18 @@ import { isSql } from '@/pages/DataStudio/HeaderContainer/function';
import
{
BtnRoute
,
useTasksDispatch
}
from
'@/pages/DataStudio/LeftContainer/BtnContext'
;
import
{
BtnRoute
,
useTasksDispatch
}
from
'@/pages/DataStudio/LeftContainer/BtnContext'
;
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
SchemaDesc
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
DIALECT
}
from
'@/services/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
import
{
AppstoreOutlined
,
AppstoreOutlined
,
BlockOutlined
,
BlockOutlined
,
CodepenOutlined
,
DownOutlined
,
DownOutlined
,
FunctionOutlined
,
FunctionOutlined
,
TableOutlined
TableOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Button
,
Col
,
Empty
,
Modal
,
Row
,
Select
,
Spin
,
Tabs
}
from
'antd'
;
import
{
Button
,
Col
,
Empty
,
Modal
,
Row
,
Select
,
Spin
}
from
'antd'
;
import
{
DataNode
}
from
'antd/es/tree'
;
import
{
DataNode
}
from
'antd/es/tree'
;
import
DirectoryTree
from
'antd/es/tree/DirectoryTree'
;
import
DirectoryTree
from
'antd/es/tree/DirectoryTree'
;
import
{
DefaultOptionType
}
from
'rc-select/lib/Select'
;
import
{
DefaultOptionType
}
from
'rc-select/lib/Select'
;
...
@@ -103,10 +101,12 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -103,10 +101,12 @@ const Catalog: React.FC = (props: connect) => {
table
,
table
,
dialect
,
dialect
,
databaseId
databaseId
}).
then
((
res
)
=>
{
})
setLoading
(
false
);
.
then
((
res
)
=>
{
setColumnData
(
res
);
setLoading
(
false
);
});
setColumnData
(
res
);
})
.
catch
(()
=>
{});
}
}
},
[
table
]);
},
[
table
]);
...
@@ -133,111 +133,113 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -133,111 +133,113 @@ const Catalog: React.FC = (props: connect) => {
databaseId
databaseId
};
};
const
result
=
getMSSchemaInfo
(
param
);
const
result
=
getMSSchemaInfo
(
param
);
result
.
then
((
res
)
=>
{
result
setLoading
(
false
);
.
then
((
res
)
=>
{
const
tables
:
any
[]
=
[];
setLoading
(
false
);
if
(
res
.
tables
)
{
const
tables
:
any
[]
=
[];
for
(
let
i
=
0
;
i
<
res
.
tables
.
length
;
i
++
)
{
if
(
res
.
tables
)
{
tables
.
push
(
res
.
tables
[
i
]);
for
(
let
i
=
0
;
i
<
res
.
tables
.
length
;
i
++
)
{
tables
.
push
(
res
.
tables
[
i
]);
}
}
const
treeDataTmp
:
DataNode
[]
=
[];
const
tablesData
:
TableDataNode
[]
=
[];
for
(
const
t
of
tables
)
{
tablesData
.
push
({
title
:
t
.
name
,
key
:
t
.
name
,
icon
:
<
TableOutlined
/>,
isLeaf
:
true
,
isTable
:
true
,
name
:
t
.
name
,
schema
:
databaseTmp
,
catalog
:
catalog
,
comment
:
t
.
comment
,
type
:
t
.
type
,
engine
:
engine
??
t
.
engine
,
options
:
t
.
options
,
rows
:
t
.
rows
,
createTime
:
t
.
createTime
,
updateTime
:
t
.
updateTime
});
}
}
}
treeDataTmp
.
push
({
const
treeDataTmp
:
DataNode
[]
=
[];
title
:
'tables'
,
const
tablesData
:
TableDataNode
[]
=
[];
key
:
'tables'
,
for
(
const
t
of
tables
)
{
children
:
tablesData
tablesData
.
push
({
title
:
t
.
name
,
key
:
t
.
name
,
icon
:
<
TableOutlined
/>,
isLeaf
:
true
,
isTable
:
true
,
name
:
t
.
name
,
schema
:
databaseTmp
,
catalog
:
catalog
,
comment
:
t
.
comment
,
type
:
t
.
type
,
engine
:
engine
??
t
.
engine
,
options
:
t
.
options
,
rows
:
t
.
rows
,
createTime
:
t
.
createTime
,
updateTime
:
t
.
updateTime
});
});
}
treeDataTmp
.
push
({
title
:
'tables'
,
key
:
'tables'
,
children
:
tablesData
});
const
viewsData
:
DataNode
[]
=
[];
const
viewsData
:
DataNode
[]
=
[];
if
(
res
.
views
)
{
if
(
res
.
views
)
{
for
(
let
i
=
0
;
i
<
res
.
views
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
views
.
length
;
i
++
)
{
viewsData
.
push
({
viewsData
.
push
({
title
:
res
.
views
[
i
],
title
:
res
.
views
[
i
],
key
:
res
.
views
[
i
],
key
:
res
.
views
[
i
],
icon
:
<
BlockOutlined
/>,
icon
:
<
BlockOutlined
/>,
isLeaf
:
true
isLeaf
:
true
});
});
}
}
}
}
treeDataTmp
.
push
({
treeDataTmp
.
push
({
title
:
'views'
,
title
:
'views'
,
key
:
'views'
,
key
:
'views'
,
children
:
viewsData
children
:
viewsData
});
});
const
functionsData
:
DataNode
[]
=
[];
const
functionsData
:
DataNode
[]
=
[];
if
(
res
.
functions
)
{
if
(
res
.
functions
)
{
for
(
let
i
=
0
;
i
<
res
.
functions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
functions
.
length
;
i
++
)
{
functionsData
.
push
({
functionsData
.
push
({
title
:
res
.
functions
[
i
],
title
:
res
.
functions
[
i
],
key
:
res
.
functions
[
i
],
key
:
res
.
functions
[
i
],
icon
:
<
FunctionOutlined
/>,
icon
:
<
FunctionOutlined
/>,
isLeaf
:
true
isLeaf
:
true
});
});
}
}
}
}
treeDataTmp
.
push
({
treeDataTmp
.
push
({
title
:
'functions'
,
title
:
'functions'
,
key
:
'functions'
,
key
:
'functions'
,
children
:
functionsData
children
:
functionsData
});
});
const
userFunctionsData
:
DataNode
[]
=
[];
const
userFunctionsData
:
DataNode
[]
=
[];
if
(
res
.
userFunctions
)
{
if
(
res
.
userFunctions
)
{
for
(
let
i
=
0
;
i
<
res
.
userFunctions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
userFunctions
.
length
;
i
++
)
{
userFunctionsData
.
push
({
userFunctionsData
.
push
({
title
:
res
.
userFunctions
[
i
],
title
:
res
.
userFunctions
[
i
],
key
:
res
.
userFunctions
[
i
],
key
:
res
.
userFunctions
[
i
],
icon
:
<
FunctionOutlined
/>,
icon
:
<
FunctionOutlined
/>,
isLeaf
:
true
isLeaf
:
true
});
});
}
}
}
}
treeDataTmp
.
push
({
treeDataTmp
.
push
({
title
:
'user functions'
,
title
:
'user functions'
,
key
:
'userFunctions'
,
key
:
'userFunctions'
,
children
:
userFunctionsData
children
:
userFunctionsData
});
});
const
modulesData
:
DataNode
[]
=
[];
const
modulesData
:
DataNode
[]
=
[];
if
(
res
.
modules
)
{
if
(
res
.
modules
)
{
for
(
let
i
=
0
;
i
<
res
.
modules
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
modules
.
length
;
i
++
)
{
modulesData
.
push
({
modulesData
.
push
({
title
:
res
.
modules
[
i
],
title
:
res
.
modules
[
i
],
key
:
res
.
modules
[
i
],
key
:
res
.
modules
[
i
],
icon
:
<
AppstoreOutlined
/>,
icon
:
<
AppstoreOutlined
/>,
isLeaf
:
true
isLeaf
:
true
});
});
}
}
}
}
treeDataTmp
.
push
({
treeDataTmp
.
push
({
title
:
'modules'
,
title
:
'modules'
,
key
:
'modules'
,
key
:
'modules'
,
children
:
modulesData
children
:
modulesData
});
});
setTreeData
(
treeDataTmp
);
setTreeData
(
treeDataTmp
);
});
})
.
catch
(()
=>
{});
};
};
const
getCatalogs
=
()
=>
{
const
getCatalogs
=
()
=>
{
...
@@ -252,22 +254,24 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -252,22 +254,24 @@ const Catalog: React.FC = (props: connect) => {
dialect
:
dialect
,
dialect
:
dialect
,
databaseId
databaseId
};
};
getMSCatalogs
(
param
).
then
((
d
)
=>
{
getMSCatalogs
(
param
)
setCatalogSelect
(
.
then
((
d
)
=>
{
(
d
as
any
[]).
map
((
item
)
=>
{
setCatalogSelect
(
setLoading
(
false
);
(
d
as
any
[]).
map
((
item
)
=>
{
return
{
setLoading
(
false
);
label
:
item
.
name
,
return
{
options
:
(
item
.
schemas
as
any
[]).
map
((
schema
)
=>
{
label
:
item
.
name
,
return
{
options
:
(
item
.
schemas
as
any
[]).
map
((
schema
)
=>
{
label
:
schema
.
name
,
return
{
value
:
item
.
name
+
'.'
+
schema
.
name
label
:
schema
.
name
,
};
value
:
item
.
name
+
'.'
+
schema
.
name
})
};
};
})
})
};
);
})
});
);
})
.
catch
(()
=>
{});
}
}
};
};
...
@@ -283,8 +287,8 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -283,8 +287,8 @@ const Catalog: React.FC = (props: connect) => {
onRefreshTreeData
(
value
);
onRefreshTreeData
(
value
);
};
};
const
openColumnInfo
=
(
_e
:
React
.
MouseEvent
,
node
:
TableDataNode
)
=>
{
const
openColumnInfo
=
(
node
:
TableDataNode
)
=>
{
if
(
node
.
isLeaf
&&
node
.
isTable
)
{
if
(
node
&&
node
.
isLeaf
&&
node
.
isTable
)
{
setTable
(
node
.
name
);
setTable
(
node
.
name
);
setRow
(
node
);
setRow
(
node
);
setModalVisit
(
true
);
setModalVisit
(
true
);
...
@@ -317,9 +321,8 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -317,9 +321,8 @@ const Catalog: React.FC = (props: connect) => {
showIcon
showIcon
switcherIcon=
{
<
DownOutlined
/>
}
switcherIcon=
{
<
DownOutlined
/>
}
treeData=
{
treeData
}
treeData=
{
treeData
}
onRightClick=
{
({
event
,
node
}:
any
)
=>
{
onRightClick=
{
({
node
}:
any
)
=>
openColumnInfo
(
node
)
}
openColumnInfo
(
event
,
node
);
onSelect=
{
(
_
,
info
:
any
)
=>
openColumnInfo
(
info
.
node
)
}
}
}
/>
/>
)
:
(
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
...
@@ -328,7 +331,7 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -328,7 +331,7 @@ const Catalog: React.FC = (props: connect) => {
<
Modal
<
Modal
title=
{
<>
{
row
?.
key
}
</>
??
<></>
}
title=
{
<>
{
row
?.
key
}
</>
??
<></>
}
open=
{
modalVisit
}
open=
{
modalVisit
}
width=
{
10000
}
width=
{
'85%'
}
onCancel=
{
()
=>
{
onCancel=
{
()
=>
{
cancelHandle
();
cancelHandle
();
}
}
}
}
...
@@ -343,36 +346,7 @@ const Catalog: React.FC = (props: connect) => {
...
@@ -343,36 +346,7 @@ const Catalog: React.FC = (props: connect) => {
</
Button
>
</
Button
>
]
}
]
}
>
>
<
Tabs
<
SchemaDesc
tableInfo=
{
row
}
tableColumns=
{
columnData
}
/>
defaultActiveKey=
'tableInfo'
size=
'small'
items=
{
[
{
key
:
'tableInfo'
,
label
:
(
<
span
>
<
TableOutlined
/>
{
l
(
'pages.datastudio.catalog.tableInfo'
)
}
</
span
>
),
children
:
row
?
(
<
TableInfo
tableInfo=
{
row
}
/>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
},
{
key
:
'columnsInfo'
,
label
:
(
<
span
>
<
CodepenOutlined
/>
{
l
(
'pages.datastudio.catalog.fieldInformation'
)
}
</
span
>
),
children
:
<
Spin
spinning=
{
loading
}
>
{
<
ColumnInfo
columnInfo=
{
columnData
}
/>
}
</
Spin
>
}
]
}
/>
</
Modal
>
</
Modal
>
</
Spin
>
</
Spin
>
);
);
...
...
dinky-web/src/pages/DataStudio/LeftContainer/DataSource/index.tsx
View file @
346d051e
...
@@ -29,7 +29,7 @@ import { Key, ProForm, ProFormSelect } from '@ant-design/pro-components';
...
@@ -29,7 +29,7 @@ import { Key, ProForm, ProFormSelect } from '@ant-design/pro-components';
import
{
connect
}
from
'@umijs/max'
;
import
{
connect
}
from
'@umijs/max'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
{
Spin
,
Tag
}
from
'antd'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
StateType
,
STUDIO_MODEL
}
from
'../../model'
;
import
{
StateType
,
STUDIO_MODEL
,
TabsPageType
}
from
'../../model'
;
import
{
clearDataSourceTable
,
getDataSourceList
,
showDataSourceTable
}
from
'./service'
;
import
{
clearDataSourceTable
,
getDataSourceList
,
showDataSourceTable
}
from
'./service'
;
const
DataSource
=
(
props
:
any
)
=>
{
const
DataSource
=
(
props
:
any
)
=>
{
...
@@ -161,7 +161,7 @@ const DataSource = (props: any) => {
...
@@ -161,7 +161,7 @@ const DataSource = (props: any) => {
breadcrumbLabel
:
[
selectDb
.
type
,
selectDb
.
name
].
join
(
'/'
),
breadcrumbLabel
:
[
selectDb
.
type
,
selectDb
.
name
].
join
(
'/'
),
label
:
schemaName
+
'.'
+
tableName
,
label
:
schemaName
+
'.'
+
tableName
,
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
params
:
{
queryParams
:
queryParams
,
tableInfo
:
fullInfo
},
type
:
'metadata'
type
:
TabsPageType
.
metadata
}
}
});
});
};
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx
View file @
346d051e
...
@@ -84,7 +84,7 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -84,7 +84,7 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
{
{
title
:
l
(
'rc.ds.length'
),
title
:
l
(
'rc.ds.length'
),
dataIndex
:
'length'
,
dataIndex
:
'length'
,
width
:
'
4
%'
width
:
'
6
%'
},
},
{
{
title
:
l
(
'rc.ds.precision'
),
title
:
l
(
'rc.ds.precision'
),
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
View file @
346d051e
...
@@ -25,8 +25,8 @@ import { Empty } from 'antd';
...
@@ -25,8 +25,8 @@ import { Empty } from 'antd';
import
React
from
'react'
;
import
React
from
'react'
;
type
SchemaDescProps
=
{
type
SchemaDescProps
=
{
tableInfo
:
Partial
<
DataSources
.
Table
>
;
tableInfo
?
:
Partial
<
DataSources
.
Table
>
;
tableColumns
:
Partial
<
DataSources
.
Column
[]
>
;
tableColumns
?
:
Partial
<
DataSources
.
Column
[]
>
;
};
};
const
SchemaDesc
:
React
.
FC
<
SchemaDescProps
>
=
(
props
)
=>
{
const
SchemaDesc
:
React
.
FC
<
SchemaDescProps
>
=
(
props
)
=>
{
...
@@ -34,12 +34,9 @@ const SchemaDesc: React.FC<SchemaDescProps> = (props) => {
...
@@ -34,12 +34,9 @@ const SchemaDesc: React.FC<SchemaDescProps> = (props) => {
return
(
return
(
<>
<>
{
!
(
Object
.
keys
(
tableInfo
).
length
===
0
&&
tableColumns
.
length
===
0
)
?
(
{
tableInfo
&&
<
TableInfo
tableInfo=
{
tableInfo
}
/>
}
<>
{
tableColumns
&&
<
ColumnInfo
columnInfo=
{
tableColumns
}
/>
}
<
TableInfo
tableInfo=
{
tableInfo
}
/>
{
!
tableInfo
&&
!
tableColumns
&&
(
<
ColumnInfo
columnInfo=
{
tableColumns
}
/>
</>
)
:
(
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
)
}
)
}
</>
</>
...
...
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