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
bce0f34e
Unverified
Commit
bce0f34e
authored
Oct 31, 2023
by
ZackYoung
Committed by
GitHub
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimize][Web]optimize_web_catalog (#2457)
* optimize_web_catalog * optimize_web_catalog * add_json_to_sql_tool
parent
a08fb07a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
358 additions
and
325 deletions
+358
-325
StudioController.java
.../src/main/java/org/dinky/controller/StudioController.java
+3
-12
StudioService.java
...-admin/src/main/java/org/dinky/service/StudioService.java
+1
-1
StudioServiceImpl.java
...c/main/java/org/dinky/service/impl/StudioServiceImpl.java
+12
-5
pages.ts
dinky-web/src/locales/en-US/pages.ts
+6
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+2
-1
index.tsx
...-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
+328
-301
service.tsx
...eb/src/pages/DataStudio/LeftContainer/Catalog/service.tsx
+2
-2
index.tsx
...web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
+1
-1
model.ts
dinky-web/src/pages/DataStudio/model.ts
+1
-0
route.tsx
dinky-web/src/pages/DataStudio/route.tsx
+1
-1
index.tsx
dlink-web/src/pages/DataCenter/MetaData/index.tsx
+1
-1
No files found.
dinky-admin/src/main/java/org/dinky/controller/StudioController.java
View file @
bce0f34e
...
@@ -158,7 +158,7 @@ public class StudioController {
...
@@ -158,7 +158,7 @@ public class StudioController {
}
}
/** 获取 Meta Store Flink Column 信息 */
/** 获取 Meta Store Flink Column 信息 */
@
GetMapping
(
"/getMSFlink
Columns"
)
@
PostMapping
(
"/getMS
Columns"
)
@ApiOperation
(
"Get Flink Column List"
)
@ApiOperation
(
"Get Flink Column List"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"envId"
,
value
=
"envId"
,
required
=
true
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"envId"
,
value
=
"envId"
,
required
=
true
,
dataType
=
"Integer"
,
paramType
=
"query"
),
...
@@ -176,16 +176,7 @@ public class StudioController {
...
@@ -176,16 +176,7 @@ public class StudioController {
paramType
=
"query"
),
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"table"
,
value
=
"table"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"table"
,
value
=
"table"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"query"
)
})
})
public
Result
<
List
<
Column
>>
getMSFlinkColumns
(
public
Result
<
List
<
Column
>>
getMSColumns
(
@RequestBody
StudioMetaStoreDTO
studioMetaStoreDTO
)
{
@RequestParam
Integer
envId
,
return
Result
.
succeed
(
studioService
.
getMSColumns
(
studioMetaStoreDTO
));
@RequestParam
String
catalog
,
@RequestParam
String
database
,
@RequestParam
String
table
)
{
StudioMetaStoreDTO
studioMetaStoreDTO
=
new
StudioMetaStoreDTO
();
studioMetaStoreDTO
.
setEnvId
(
envId
);
studioMetaStoreDTO
.
setCatalog
(
catalog
);
studioMetaStoreDTO
.
setDatabase
(
database
);
studioMetaStoreDTO
.
setTable
(
table
);
return
Result
.
succeed
(
studioService
.
getMSFlinkColumns
(
studioMetaStoreDTO
));
}
}
}
}
dinky-admin/src/main/java/org/dinky/service/StudioService.java
View file @
bce0f34e
...
@@ -55,5 +55,5 @@ public interface StudioService {
...
@@ -55,5 +55,5 @@ public interface StudioService {
Schema
getMSSchemaInfo
(
StudioMetaStoreDTO
studioMetaStoreDTO
);
Schema
getMSSchemaInfo
(
StudioMetaStoreDTO
studioMetaStoreDTO
);
List
<
Column
>
getMS
Flink
Columns
(
StudioMetaStoreDTO
studioMetaStoreDTO
);
List
<
Column
>
getMSColumns
(
StudioMetaStoreDTO
studioMetaStoreDTO
);
}
}
dinky-admin/src/main/java/org/dinky/service/impl/StudioServiceImpl.java
View file @
bce0f34e
...
@@ -188,12 +188,19 @@ public class StudioServiceImpl implements StudioService {
...
@@ -188,12 +188,19 @@ public class StudioServiceImpl implements StudioService {
}
}
@Override
@Override
public
List
<
Column
>
getMSFlinkColumns
(
StudioMetaStoreDTO
studioMetaStoreDTO
)
{
public
List
<
Column
>
getMSColumns
(
StudioMetaStoreDTO
studioMetaStoreDTO
)
{
String
catalogName
=
studioMetaStoreDTO
.
getCatalog
();
String
database
=
studioMetaStoreDTO
.
getDatabase
();
String
tableName
=
studioMetaStoreDTO
.
getTable
();
List
<
Column
>
columns
=
new
ArrayList
<>();
List
<
Column
>
columns
=
new
ArrayList
<>();
if
(!
Dialect
.
isCommonSql
(
studioMetaStoreDTO
.
getDialect
()))
{
if
(
Dialect
.
isCommonSql
(
studioMetaStoreDTO
.
getDialect
()))
{
String
catalogName
=
studioMetaStoreDTO
.
getCatalog
();
DataBase
dataBase
=
dataBaseService
.
getById
(
studioMetaStoreDTO
.
getDatabaseId
());
String
database
=
studioMetaStoreDTO
.
getDatabase
();
if
(
Asserts
.
isNotNull
(
dataBase
))
{
String
tableName
=
studioMetaStoreDTO
.
getTable
();
Driver
driver
=
Driver
.
build
(
dataBase
.
getDriverConfig
());
columns
.
addAll
(
driver
.
listColumns
(
database
,
tableName
));
}
}
else
{
String
envSql
=
taskService
.
buildEnvSql
(
studioMetaStoreDTO
);
String
envSql
=
taskService
.
buildEnvSql
(
studioMetaStoreDTO
);
JobManager
jobManager
=
getJobManager
(
studioMetaStoreDTO
,
envSql
);
JobManager
jobManager
=
getJobManager
(
studioMetaStoreDTO
,
envSql
);
CustomTableEnvironment
customTableEnvironment
=
CustomTableEnvironment
customTableEnvironment
=
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
bce0f34e
...
@@ -415,6 +415,12 @@ export default {
...
@@ -415,6 +415,12 @@ export default {
'pages.metadata.DataSearch'
:
'Data Search'
,
'pages.metadata.DataSearch'
:
'Data Search'
,
'pages.metadata.selectDatabase'
:
'Select Database'
,
'pages.metadata.selectDatabase'
:
'Select Database'
,
'pages.task.savePointPath'
:
'SavePoint Path'
,
'pages.task.savePointPath'
:
'SavePoint Path'
,
'pages.datastudio.catalog.catalogSelect'
:
'Please select catalog & database'
,
'pages.datastudio.catalog.tableInfo'
:
'Table Info'
,
'pages.datastudio.catalog.fieldInformation'
:
'Field Information'
,
'pages.datastudio.catalog.selectDatasource'
:
'Select Datasource'
,
'pages.datastudio.catalog.openMission'
:
'Open Mission'
,
/**
/**
*
*
* rc
* rc
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
bce0f34e
...
@@ -394,10 +394,11 @@ export default {
...
@@ -394,10 +394,11 @@ export default {
'pages.datastudio.label.version.rollback.flinksqlConfirm'
:
'pages.datastudio.label.version.rollback.flinksqlConfirm'
:
'确定回滚Flink SQL版本至【{versionId}】吗?'
,
'确定回滚Flink SQL版本至【{versionId}】吗?'
,
'pages.datastudio.catalog.flinkSqlEnvSelect'
:
'请选择 FlinkSqlEnv'
,
'pages.datastudio.catalog.catalogSelect'
:
'请选择 catalog & database'
,
'pages.datastudio.catalog.catalogSelect'
:
'请选择 catalog & database'
,
'pages.datastudio.catalog.tableInfo'
:
'表信息'
,
'pages.datastudio.catalog.tableInfo'
:
'表信息'
,
'pages.datastudio.catalog.fieldInformation'
:
'字段信息'
,
'pages.datastudio.catalog.fieldInformation'
:
'字段信息'
,
'pages.datastudio.catalog.selectDatasource'
:
'请选择数据源'
,
'pages.datastudio.catalog.openMission'
:
'请打开任务'
,
'pages.datastudio.print.table.inputTableName'
:
'请选择表名'
,
'pages.datastudio.print.table.inputTableName'
:
'请选择表名'
,
'pages.devops.jobinfo.localenv'
:
'本地环境'
,
'pages.devops.jobinfo.localenv'
:
'本地环境'
,
...
...
dinky-web/src/pages/DataStudio/LeftContainer/Catalog/index.tsx
View file @
bce0f34e
...
@@ -17,332 +17,358 @@
...
@@ -17,332 +17,358 @@
*
*
*/
*/
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
TableDataNode
}
from
'@/pages/DataStudio/LeftContainer/Catalog/data'
;
import
{
MetaStoreTableType
}
from
'@/pages/DataStudio/model'
;
import
{
StateType
}
from
'@/pages/DataStudio/model'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
{
BtnRoute
}
from
'@/pages/DataStudio/route'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
useRequest
}
from
'@@/exports'
;
import
{
import
{
AppstoreOutlined
,
AppstoreOutlined
,
BlockOutlined
,
BlockOutlined
,
CodepenOutlined
,
CodepenOutlined
,
DownOutlined
,
DownOutlined
,
FunctionOutlined
,
FunctionOutlined
,
TableOutlined
TableOutlined
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
Button
,
Col
,
Empty
,
Modal
,
Row
,
Select
,
Spin
,
Tabs
}
from
'antd'
;
import
{
Button
,
Col
,
Empty
,
Modal
,
Row
,
Select
,
Spin
,
Tabs
}
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'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
getMSCatalogs
,
getMSFlinkColumns
,
getMSSchemaInfo
}
from
'./service'
;
import
{
getMSCatalogs
,
getMSColumns
,
getMSSchemaInfo
}
from
'./service'
;
import
{
getCurrentData
}
from
"@/pages/DataStudio/function"
;
import
{
DIALECT
}
from
"@/services/constants"
;
import
{
isSql
}
from
"@/pages/DataStudio/HeaderContainer/service"
;
import
{
connect
}
from
"@umijs/max"
;
export
const
Catalog
:
React
.
FC
=
(
props
:
any
)
=>
{
const
Catalog
:
React
.
FC
=
(
props
:
connect
)
=>
{
const
data
=
useRequest
({
const
{
tabs
}
=
props
;
url
:
'/api/task/listFlinkSQLEnv'
const
currentData
=
getCurrentData
(
tabs
.
panes
,
tabs
.
activeKey
);
});
if
(
!
currentData
)
{
const
[
envId
,
setEnvId
]
=
useState
<
number
>
();
return
<
Empty
description=
{
l
(
"pages.datastudio.catalog.selectDatasource"
)
}
/>
const
[
catalogSelect
,
setCatalogSelect
]
=
useState
<
DefaultOptionType
[]
>
([]);
const
[
catalog
,
setCatalog
]
=
useState
<
string
>
(
'default_catalog'
);
const
[
database
,
setDatabase
]
=
useState
<
string
>
(
''
);
const
[
table
,
setTable
]
=
useState
<
string
>
(
''
);
const
[
treeData
,
setTreeData
]
=
useState
<
DataNode
[]
>
([]);
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
row
,
setRow
]
=
useState
<
TableDataNode
>
();
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
columnData
,
setColumnData
]
=
useState
([]);
useEffect
(()
=>
{
if
(
envId
)
{
setLoading
(
true
);
setTreeData
([]);
setCatalogSelect
([]);
setDatabase
(
''
);
let
param
=
{
envId
:
envId
,
fragment
:
true
,
dialect
:
'FlinkSqlEnv'
};
getMSCatalogs
(
param
).
then
((
d
)
=>
{
setCatalogSelect
(
(
d
as
any
[]).
map
((
item
)
=>
{
setLoading
(
false
);
return
{
label
:
item
.
name
,
options
:
(
item
.
schemas
as
any
[]).
map
((
schema
)
=>
{
return
{
label
:
schema
.
name
,
value
:
item
.
name
+
'.'
+
schema
.
name
};
})
};
})
);
});
}
}
},
[
envId
]);
const
dialect
=
currentData
?.
dialect
.
toLowerCase
()
??
""
;
const
fragment
=
currentData
?.
fragment
??
true
;
useEffect
(()
=>
{
let
envId
:
number
|
undefined
;
if
(
table
)
{
let
databaseId
:
number
|
undefined
;
setLoading
(
true
);
let
engine
:
string
|
undefined
;
setColumnData
([]);
if
(
dialect
===
DIALECT
.
FLINKSQLENV
)
{
getMSFlinkColumns
({
envId
=
currentData
?.
id
;
envId
,
engine
=
"Flink"
;
catalog
,
}
else
if
(
dialect
===
DIALECT
.
FLINK_SQL
)
{
database
,
envId
=
currentData
?.
envId
;
table
engine
=
"Flink"
;
}).
then
((
res
)
=>
{
}
else
if
(
isSql
(
dialect
))
{
setLoading
(
false
);
databaseId
=
currentData
?.
databaseId
;
setColumnData
(
res
);
if
(
!
databaseId
){
});
return
<
Empty
description=
{
l
(
"pages.datastudio.catalog.openMission"
)
}
/>
}
}
}
},
[
table
]);
envId
=
envId
??
-
1
;
const
[
catalogSelect
,
setCatalogSelect
]
=
useState
<
DefaultOptionType
[]
>
([]);
const
[
catalog
,
setCatalog
]
=
useState
<
string
>
(
'default_catalog'
);
const
[
database
,
setDatabase
]
=
useState
<
string
>
(
''
);
const
[
table
,
setTable
]
=
useState
<
string
>
(
''
);
const
[
treeData
,
setTreeData
]
=
useState
<
DataNode
[]
>
([]);
const
[
modalVisit
,
setModalVisit
]
=
useState
(
false
);
const
[
row
,
setRow
]
=
useState
<
TableDataNode
>
();
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
columnData
,
setColumnData
]
=
useState
([]);
const
onRefreshTreeData
=
(
catalogAndDatabase
:
string
)
=>
{
BtnRoute
[
'menu.datastudio.catalog'
][
0
].
onClick
=
()
=>
{
setTreeData
([]);
refreshMetaStoreTables
();
setLoading
(
true
);
const
names
=
catalogAndDatabase
.
split
(
'.'
);
let
catalogTmp
=
'default_catalog'
;
let
databaseTmp
=
'default_database'
;
if
(
names
.
length
>
1
)
{
catalogTmp
=
names
[
0
];
databaseTmp
=
names
[
1
];
}
else
if
(
names
.
length
==
1
)
{
databaseTmp
=
names
[
0
];
}
setCatalog
(
catalogTmp
);
setDatabase
(
databaseTmp
);
let
param
=
{
envId
:
envId
,
fragment
:
true
,
dialect
:
'FlinkSqlEnv'
,
catalog
:
catalogTmp
,
database
:
databaseTmp
};
};
const
result
=
getMSSchemaInfo
(
param
);
result
.
then
((
res
)
=>
{
setLoading
(
false
);
const
tables
:
MetaStoreTableType
[]
=
[];
if
(
res
.
tables
)
{
for
(
let
i
=
0
;
i
<
res
.
tables
.
length
;
i
++
)
{
tables
.
push
({
name
:
res
.
tables
[
i
].
name
,
columns
:
res
.
tables
[
i
].
columns
});
}
}
const
treeDataTmp
:
DataNode
[]
=
[];
const
tablesData
:
TableDataNode
[]
=
[];
for
(
let
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
tablesData
.
push
({
title
:
tables
[
i
].
name
,
key
:
tables
[
i
].
name
,
icon
:
<
TableOutlined
/>,
isLeaf
:
true
,
isTable
:
true
,
name
:
tables
[
i
].
name
,
schema
:
databaseTmp
,
catalog
:
catalog
,
comment
:
'-'
,
type
:
''
,
engine
:
'Flink'
,
options
:
''
,
rows
:
-
1
,
createTime
:
''
,
updateTime
:
''
});
}
treeDataTmp
.
push
({
title
:
'tables'
,
key
:
'tables'
,
children
:
tablesData
});
const
viewsData
:
DataNode
[]
=
[];
useEffect
(()
=>
{
if
(
res
.
views
)
{
getCatalogs
();
for
(
let
i
=
0
;
i
<
res
.
views
.
length
;
i
++
)
{
},
[
envId
,
databaseId
]);
viewsData
.
push
({
title
:
res
.
views
[
i
],
key
:
res
.
views
[
i
],
icon
:
<
BlockOutlined
/>,
isLeaf
:
true
});
}
}
treeDataTmp
.
push
({
title
:
'views'
,
key
:
'views'
,
children
:
viewsData
});
const
functionsData
:
DataNode
[]
=
[];
useEffect
(()
=>
{
if
(
res
.
functions
)
{
if
(
table
)
{
for
(
let
i
=
0
;
i
<
res
.
functions
.
length
;
i
++
)
{
setLoading
(
true
);
functionsData
.
push
({
setColumnData
([]);
title
:
res
.
functions
[
i
],
getMSColumns
({
key
:
res
.
functions
[
i
],
envId
,
icon
:
<
FunctionOutlined
/>,
catalog
,
isLeaf
:
true
database
,
});
table
,
dialect
,
databaseId
}).
then
((
res
)
=>
{
setLoading
(
false
);
setColumnData
(
res
);
});
}
}
}
},
[
table
]);
treeDataTmp
.
push
({
title
:
'functions'
,
key
:
'functions'
,
children
:
functionsData
});
const
userFunctionsData
:
DataNode
[]
=
[];
const
onRefreshTreeData
=
(
catalogAndDatabase
:
string
)
=>
{
if
(
res
.
userFunctions
)
{
setTreeData
([]);
for
(
let
i
=
0
;
i
<
res
.
userFunctions
.
length
;
i
++
)
{
setLoading
(
true
);
userFunctionsData
.
push
({
const
names
=
catalogAndDatabase
.
split
(
'.'
);
title
:
res
.
userFunctions
[
i
],
let
catalogTmp
=
'default_catalog'
;
key
:
res
.
userFunctions
[
i
],
let
databaseTmp
=
'default_database'
;
icon
:
<
FunctionOutlined
/>,
if
(
names
.
length
>
1
)
{
isLeaf
:
true
catalogTmp
=
names
[
0
];
});
databaseTmp
=
names
[
1
];
}
else
if
(
names
.
length
==
1
)
{
databaseTmp
=
names
[
0
];
}
}
}
setCatalog
(
catalogTmp
);
treeDataTmp
.
push
({
setDatabase
(
databaseTmp
);
title
:
'user functions'
,
let
param
=
{
key
:
'userFunctions'
,
envId
:
envId
,
children
:
userFunctionsData
fragment
:
fragment
,
});
dialect
:
dialect
,
catalog
:
catalogTmp
,
database
:
databaseTmp
,
databaseId
};
const
result
=
getMSSchemaInfo
(
param
);
result
.
then
((
res
)
=>
{
setLoading
(
false
);
const
tables
:
any
[]
=
[];
if
(
res
.
tables
)
{
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
({
title
:
'tables'
,
key
:
'tables'
,
children
:
tablesData
});
const
module
sData
:
DataNode
[]
=
[];
const
view
sData
:
DataNode
[]
=
[];
if
(
res
.
module
s
)
{
if
(
res
.
view
s
)
{
for
(
let
i
=
0
;
i
<
res
.
module
s
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
view
s
.
length
;
i
++
)
{
module
sData
.
push
({
view
sData
.
push
({
title
:
res
.
module
s
[
i
],
title
:
res
.
view
s
[
i
],
key
:
res
.
module
s
[
i
],
key
:
res
.
view
s
[
i
],
icon
:
<
AppstoreOutlined
/>,
icon
:
<
BlockOutlined
/>,
isLeaf
:
true
isLeaf
:
true
});
});
}
}
}
}
treeDataTmp
.
push
({
treeDataTmp
.
push
({
title
:
'module
s'
,
title
:
'view
s'
,
key
:
'module
s'
,
key
:
'view
s'
,
children
:
module
sData
children
:
view
sData
});
});
setTreeData
(
treeDataTmp
);
const
functionsData
:
DataNode
[]
=
[];
});
if
(
res
.
functions
)
{
};
for
(
let
i
=
0
;
i
<
res
.
functions
.
length
;
i
++
)
{
functionsData
.
push
({
title
:
res
.
functions
[
i
],
key
:
res
.
functions
[
i
],
icon
:
<
FunctionOutlined
/>,
isLeaf
:
true
});
}
}
treeDataTmp
.
push
({
title
:
'functions'
,
key
:
'functions'
,
children
:
functionsData
});
const
refreshMetaStoreTables
=
()
=>
{
const
userFunctionsData
:
DataNode
[]
=
[];
onRefreshTreeData
(
catalog
+
'.'
+
database
);
if
(
res
.
userFunctions
)
{
};
for
(
let
i
=
0
;
i
<
res
.
userFunctions
.
length
;
i
++
)
{
userFunctionsData
.
push
({
title
:
res
.
userFunctions
[
i
],
key
:
res
.
userFunctions
[
i
],
icon
:
<
FunctionOutlined
/>,
isLeaf
:
true
});
}
}
treeDataTmp
.
push
({
title
:
'user functions'
,
key
:
'userFunctions'
,
children
:
userFunctionsData
});
BtnRoute
[
'menu.datastudio.catalog'
][
0
].
onClick
=
()
=>
{
const
modulesData
:
DataNode
[]
=
[];
refreshMetaStoreTables
();
if
(
res
.
modules
)
{
};
for
(
let
i
=
0
;
i
<
res
.
modules
.
length
;
i
++
)
{
modulesData
.
push
({
title
:
res
.
modules
[
i
],
key
:
res
.
modules
[
i
],
icon
:
<
AppstoreOutlined
/>,
isLeaf
:
true
});
}
}
treeDataTmp
.
push
({
title
:
'modules'
,
key
:
'modules'
,
children
:
modulesData
});
const
onChangeMetaStoreCatalogs
=
(
value
:
string
)
=>
{
setTreeData
(
treeDataTmp
);
onRefreshTreeData
(
value
);
}
);
};
};
const
openColumnInfo
=
(
e
:
React
.
MouseEvent
,
node
:
TableDataNode
)
=>
{
const
getCatalogs
=
()
=>
{
if
(
node
.
isLeaf
&&
node
.
isTable
)
{
if
(
envId
||
databaseId
)
{
setTable
(
node
.
name
);
setLoading
(
true
);
setRow
(
node
);
setTreeData
([]);
setModalVisit
(
true
);
setCatalogSelect
([]);
setDatabase
(
''
);
let
param
=
{
envId
:
envId
,
fragment
:
fragment
,
dialect
:
dialect
,
databaseId
};
getMSCatalogs
(
param
).
then
((
d
)
=>
{
setCatalogSelect
(
(
d
as
any
[]).
map
((
item
)
=>
{
setLoading
(
false
);
return
{
label
:
item
.
name
,
options
:
(
item
.
schemas
as
any
[]).
map
((
schema
)
=>
{
return
{
label
:
schema
.
name
,
value
:
item
.
name
+
'.'
+
schema
.
name
};
})
};
})
);
});
}
}
}
};
const
cancelHandle
=
()
=>
{
const
refreshMetaStoreTables
=
()
=>
{
setRow
(
undefined
);
if
(
database
)
{
setModalVisit
(
false
);
onRefreshTreeData
(
catalog
+
'.'
+
database
);
};
}
else
{
getCatalogs
();
}
};
return
(
const
onChangeMetaStoreCatalogs
=
(
value
:
string
)
=>
{
<
Spin
spinning=
{
loading
}
>
onRefreshTreeData
(
value
);
<
div
style=
{
{
paddingInline
:
10
}
}
>
};
<
Row
>
<
Col
span=
{
24
}
>
<
Select
placeholder=
{
l
(
'pages.datastudio.catalog.flinkSqlEnvSelect'
)
}
style=
{
{
width
:
'100%'
}
}
onChange=
{
setEnvId
}
options=
{
(
data
.
data
as
any
[])?.
map
((
x
)
=>
{
return
{
value
:
x
.
id
,
label
:
x
.
name
};
})
}
/>
<
Select
value=
{
database
?
database
:
null
}
style=
{
{
width
:
'100%'
}
}
placeholder=
{
l
(
'pages.datastudio.catalog.catalogSelect'
)
}
optionLabelProp=
'label'
onChange=
{
onChangeMetaStoreCatalogs
}
options=
{
catalogSelect
}
/>
</
Col
>
</
Row
>
{
treeData
.
length
>
0
?
(
const
openColumnInfo
=
(
_e
:
React
.
MouseEvent
,
node
:
TableDataNode
)
=>
{
<
DirectoryTree
if
(
node
.
isLeaf
&&
node
.
isTable
)
{
showIcon
setTable
(
node
.
name
);
switcherIcon=
{
<
DownOutlined
/>
}
setRow
(
node
);
treeData=
{
treeData
}
setModalVisit
(
true
);
onRightClick=
{
({
event
,
node
}:
any
)
=>
{
}
openColumnInfo
(
event
,
node
);
};
}
}
/>
const
cancelHandle
=
()
=>
{
)
:
(
setRow
(
undefined
);
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
setModalVisit
(
false
);
)
}
};
</
div
>
<
Modal
return
(
title=
{
<>
{
row
?.
key
}
</>
??
<></>
}
<
Spin
spinning=
{
loading
}
>
open=
{
modalVisit
}
<
div
style=
{
{
paddingInline
:
10
,
paddingBlock
:
5
}
}
>
width=
{
10000
}
<
Row
style=
{
{
paddingBlock
:
10
}
}
>
onCancel=
{
()
=>
{
<
Col
span=
{
24
}
>
cancelHandle
();
<
Select
}
}
value=
{
database
?
database
:
null
}
footer=
{
[
style=
{
{
width
:
'100%'
}
}
<
Button
placeholder=
{
l
(
'pages.datastudio.catalog.catalogSelect'
)
}
key=
'back'
optionLabelProp=
'label'
onClick=
{
()
=>
{
onChange=
{
onChangeMetaStoreCatalogs
}
cancelHandle
();
options=
{
catalogSelect
}
}
}
/>
>
</
Col
>
{
l
(
'button.close'
)
}
</
Row
>
</
Button
>
]
}
{
treeData
.
length
>
0
?
(
>
<
DirectoryTree
<
Tabs
showIcon
defaultActiveKey=
'tableInfo'
switcherIcon=
{
<
DownOutlined
/>
}
size=
'small'
treeData=
{
treeData
}
items=
{
[
onRightClick=
{
({
event
,
node
}:
any
)
=>
{
{
openColumnInfo
(
event
,
node
);
key
:
'tableInfo'
,
}
}
label
:
(
/>
<
span
>
)
:
(
<
TableOutlined
/>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
{
l
(
'pages.datastudio.catalog.tableInfo'
)
}
)
}
</
div
>
<
Modal
title=
{
<>
{
row
?.
key
}
</>
??
<></>
}
open=
{
modalVisit
}
width=
{
10000
}
onCancel=
{
()
=>
{
cancelHandle
();
}
}
footer=
{
[
<
Button
key=
'back'
onClick=
{
()
=>
{
cancelHandle
();
}
}
>
{
l
(
'button.close'
)
}
</
Button
>
]
}
>
<
Tabs
defaultActiveKey=
'tableInfo'
size=
'small'
items=
{
[
{
key
:
'tableInfo'
,
label
:
(
<
span
>
<
TableOutlined
/>
{
l
(
'pages.datastudio.catalog.tableInfo'
)
}
</
span
>
</
span
>
),
),
children
:
row
?
(
children
:
row
?
(
<
TableInfo
tableInfo=
{
row
}
/>
<
TableInfo
tableInfo=
{
row
}
/>
)
:
(
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
)
},
},
{
{
key
:
'columnsInfo'
,
key
:
'columnsInfo'
,
label
:
(
label
:
(
<
span
>
<
span
>
<
CodepenOutlined
/>
<
CodepenOutlined
/>
{
l
(
'pages.datastudio.catalog.fieldInformation'
)
}
{
l
(
'pages.datastudio.catalog.fieldInformation'
)
}
</
span
>
</
span
>
),
),
children
:
<
Spin
spinning=
{
loading
}
>
{
<
ColumnInfo
columnInfo=
{
columnData
}
/>
}
</
Spin
>
children
:
<
Spin
spinning=
{
loading
}
>
{
<
ColumnInfo
columnInfo=
{
columnData
}
/>
}
</
Spin
>
}
}
]
}
]
}
/>
/>
</
Modal
>
</
Modal
>
</
Spin
>
</
Spin
>
);
);
};
};
export
default
connect
(({
Studio
}:
{
Studio
:
StateType
})
=>
({
tabs
:
Studio
.
tabs
}))(
Catalog
);
\ No newline at end of file
dinky-web/src/pages/DataStudio/LeftContainer/Catalog/service.tsx
View file @
bce0f34e
...
@@ -27,6 +27,6 @@ export async function getMSSchemaInfo(params: StudioMetaStoreParam) {
...
@@ -27,6 +27,6 @@ export async function getMSSchemaInfo(params: StudioMetaStoreParam) {
export
async
function
getMSCatalogs
(
params
:
StudioMetaStoreParam
)
{
export
async
function
getMSCatalogs
(
params
:
StudioMetaStoreParam
)
{
return
(
await
postAll
(
'/api/studio/getMSCatalogs'
,
params
)).
data
;
return
(
await
postAll
(
'/api/studio/getMSCatalogs'
,
params
)).
data
;
}
}
export
async
function
getMS
Flink
Columns
(
params
:
StudioMetaStoreParam
)
{
export
async
function
getMSColumns
(
params
:
StudioMetaStoreParam
)
{
return
(
await
getDataByParamsReturnResult
(
'/api/studio/getMSFlink
Columns'
,
params
)).
data
;
return
(
await
postAll
(
'/api/studio/getMS
Columns'
,
params
)).
data
;
}
}
dinky-web/src/pages/DataStudio/MiddleContainer/Editor/index.tsx
View file @
bce0f34e
...
@@ -110,7 +110,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
...
@@ -110,7 +110,7 @@ const CodeEditor: React.FC<EditorProps & any> = (props) => {
language=
{
'sql'
}
language=
{
'sql'
}
options=
{
{
options=
{
{
readOnlyMessage
:
{
value
:
l
(
'pages.datastudio.editor.onlyread'
)
},
readOnlyMessage
:
{
value
:
l
(
'pages.datastudio.editor.onlyread'
)
},
readOnly
:
currentData
?.
step
==
JOB_LIFE_CYCLE
.
ONLINE
,
readOnly
:
currentData
?.
step
==
JOB_LIFE_CYCLE
.
PUBLISH
,
scrollBeyondLastLine
:
false
,
scrollBeyondLastLine
:
false
,
wordWrap
:
'on'
,
wordWrap
:
'on'
,
autoDetectHighContrast
:
true
,
autoDetectHighContrast
:
true
,
...
...
dinky-web/src/pages/DataStudio/model.ts
View file @
bce0f34e
...
@@ -125,6 +125,7 @@ export type TaskDataBaseType = {
...
@@ -125,6 +125,7 @@ export type TaskDataBaseType = {
step
:
number
;
step
:
number
;
// Only common sql has(只有普通sql才有)
// Only common sql has(只有普通sql才有)
databaseId
?:
number
;
databaseId
?:
number
;
envId
?:
number
;
};
};
export
type
TaskDataType
=
TaskDataBaseType
&
Record
<
string
,
any
>
;
export
type
TaskDataType
=
TaskDataBaseType
&
Record
<
string
,
any
>
;
...
...
dinky-web/src/pages/DataStudio/route.tsx
View file @
bce0f34e
...
@@ -23,7 +23,6 @@ import Lineage from '@/pages/DataStudio/BottomContainer/Lineage';
...
@@ -23,7 +23,6 @@ import Lineage from '@/pages/DataStudio/BottomContainer/Lineage';
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
Result
from
'@/pages/DataStudio/BottomContainer/Result'
;
import
TableData
from
'@/pages/DataStudio/BottomContainer/TableData'
;
import
TableData
from
'@/pages/DataStudio/BottomContainer/TableData'
;
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
isSql
}
from
'@/pages/DataStudio/HeaderContainer/service'
;
import
{
Catalog
}
from
'@/pages/DataStudio/LeftContainer/Catalog'
;
import
DataSource
from
'@/pages/DataStudio/LeftContainer/DataSource'
;
import
DataSource
from
'@/pages/DataStudio/LeftContainer/DataSource'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
Project
from
'@/pages/DataStudio/LeftContainer/Project'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
import
{
TabsPageSubType
,
TabsPageType
}
from
'@/pages/DataStudio/model'
;
...
@@ -59,6 +58,7 @@ import {
...
@@ -59,6 +58,7 @@ import {
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
DiffEditor
}
from
'@monaco-editor/react'
;
import
{
ReactNode
}
from
'react'
;
import
{
ReactNode
}
from
'react'
;
import
Catalog
from
"@/pages/DataStudio/LeftContainer/Catalog"
;
import
JsonToSql
from
"@/pages/DataStudio/BottomContainer/Tools/JsonToSql"
;
import
JsonToSql
from
"@/pages/DataStudio/BottomContainer/Tools/JsonToSql"
;
export
const
LeftSide
=
[
export
const
LeftSide
=
[
...
...
dlink-web/src/pages/DataCenter/MetaData/index.tsx
View file @
bce0f34e
...
@@ -122,7 +122,7 @@ const MetaDataContainer: React.FC<{}> = (props: any) => {
...
@@ -122,7 +122,7 @@ const MetaDataContainer: React.FC<{}> = (props: any) => {
const
onChangeDataBase
=
(
value
:
string
|
number
)
=>
{
const
onChangeDataBase
=
(
value
:
string
|
number
)
=>
{
onRefreshTreeData
(
Number
(
value
));
onRefreshTreeData
(
Number
(
value
));
setRow
(
null
);
setRow
(
undefined
);
};
};
const
refeshDataBase
=
(
value
:
string
|
number
)
=>
{
const
refeshDataBase
=
(
value
:
string
|
number
)
=>
{
...
...
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