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
e119a075
Unverified
Commit
e119a075
authored
May 23, 2023
by
zhu-mingye
Committed by
GitHub
May 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor][web] added query page (#1981)
* added sql query * modify some code * modify some code
parent
94d37ddf
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
782 additions
and
170 deletions
+782
-170
QueryData.java
dinky-common/src/main/java/org/dinky/model/QueryData.java
+1
-1
config.ts
dinky-web/config/config.ts
+6
-0
CodeLanguageIcon.tsx
dinky-web/src/components/Icons/CodeLanguageIcon.tsx
+21
-4
global.less
dinky-web/src/global.less
+6
-1
index.tsx
dinky-web/src/hooks/index.tsx
+162
-0
global.ts
dinky-web/src/locales/en-US/global.ts
+1
-0
global.ts
dinky-web/src/locales/zh-CN/global.ts
+1
-0
index.tsx
...ponents/DataSourceDetail/RightTagsRouter/GenSQL/index.tsx
+49
-12
index.tsx
...SourceDetail/RightTagsRouter/SQLQuery/QueryForm/index.tsx
+127
-0
index.tsx
...nents/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
+130
-6
Index.tsx
...rceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
+22
-23
index.tsx
...nts/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
+1
-1
data.d.ts
...rce/components/DataSourceDetail/RightTagsRouter/data.d.ts
+37
-0
index.tsx
...rce/components/DataSourceDetail/RightTagsRouter/index.tsx
+15
-12
index.tsx
...taSource/components/DataSourceDetail/SchemaTree/index.tsx
+12
-35
function.tsx
...enter/DataSource/components/DataSourceDetail/function.tsx
+50
-0
index.tsx
...egCenter/DataSource/components/DataSourceDetail/index.tsx
+21
-16
constants.ts
...eb/src/pages/RegCenter/DataSource/components/constants.ts
+24
-0
function.tsx
...eb/src/pages/RegCenter/DataSource/components/function.tsx
+9
-1
index.tsx
...ages/RegCenter/GitProject/components/BuildSteps/index.tsx
+17
-51
index.tsx
...ter/GitProject/components/CodeTree/CodeTreeShow/index.tsx
+0
-1
data.d.tsx
dinky-web/src/pages/RegCenter/GitProject/data.d.tsx
+25
-0
function.tsx
dinky-web/src/pages/RegCenter/GitProject/function.tsx
+34
-0
BusinessCrud.ts
dinky-web/src/services/BusinessCrud.ts
+6
-5
constants.tsx
dinky-web/src/services/constants.tsx
+1
-0
function.tsx
dinky-web/src/utils/function.tsx
+4
-1
No files found.
dinky-common/src/main/java/org/dinky/model/QueryData.java
View file @
e119a075
...
@@ -24,7 +24,7 @@ import lombok.Data;
...
@@ -24,7 +24,7 @@ import lombok.Data;
@Data
@Data
public
class
QueryData
{
public
class
QueryData
{
private
String
id
;
private
Integer
id
;
private
String
schemaName
;
private
String
schemaName
;
...
...
dinky-web/config/config.ts
View file @
e119a075
...
@@ -134,6 +134,12 @@ export default defineConfig({
...
@@ -134,6 +134,12 @@ export default defineConfig({
baseNavigator
:
true
,
baseNavigator
:
true
,
useLocalStorage
:
true
,
useLocalStorage
:
true
,
},
},
/**
* @name styled-components 插件
*/
// styledComponents: {},
/**
/**
* @name antd 插件
* @name antd 插件
* @description 内置了 babel import 插件
* @description 内置了 babel import 插件
...
...
dinky-web/src/components/Icons/CodeLanguageIcon.tsx
View file @
e119a075
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
*/
*/
import
Icon
from
"@ant-design/icons"
;
import
Icon
from
'@ant-design/icons'
;
import
React
from
"react"
;
import
React
from
'react'
;
const
IconStyle
=
{
const
IconStyle
=
{
height
:
"16px"
,
height
:
'16px'
,
width
:
"16px"
,
width
:
'16px'
,
};
};
/**
/**
...
@@ -237,3 +237,20 @@ export const ScalaSvg = () => {
...
@@ -237,3 +237,20 @@ export const ScalaSvg = () => {
)
}
/>
)
}
/>
</>;
</>;
};
};
export
const
PythonSvg
=
()
=>
{
return
<>
<
Icon
style=
{
{...
IconStyle
}
}
component=
{
()
=>
(
<
svg
className=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
width=
"200"
height=
"200"
>
<
path
d=
"M366.635375 495.627875c8.93024999-1.488375 17.8605-2.480625 26.79075-2.48062499h-7.44187499 241.61287499c10.418625 0 20.341125-1.488375 30.26362501-3.969 44.65124999-12.403125 77.3955-52.093125 77.3955-101.20950002V185.053625c0-57.5505-49.116375-101.2095-107.65912501-110.63587501-37.209375-5.9535-91.287-8.93024999-128.00025-8.93024999-36.71325001 0-71.938125 3.472875-103.194 8.93024999C305.115875 90.29374999 288.74374999 123.534125 288.74374999 185.053625v66.48075h223.25625001V288.74374999H216.3095C133.456625 288.74374999 65.983625 387.96874999 65.4875 510.0155v1.9845c0 22.325625 1.9845 43.659 6.449625 63.504C90.29374999 667.78325001 147.84424999 735.25625001 216.3095 735.25625001h35.224875v-106.66687501c0-62.51174999 46.63574999-120.558375 115.101-132.9615z m23.814-283.7835c-22.325625 0-40.68225001-18.356625-40.18612499-40.68225 0-22.325625 17.8605-40.68225001 40.18612499-40.68225s40.68225001 18.356625 40.68225 40.68225c-0.496125 22.82175001-18.356625 40.68225001-40.68225 40.68225z"
fill=
"#0075AA"
></
path
>
<
path
d=
"M949.086125 434.108375C927.75275001 349.271 872.682875 288.74374999 807.6905 288.74374999h-35.224875v94.75987501c0 78.883875-51.597 135.93825001-115.101 145.86075-6.449625 0.99224999-12.89925001 1.488375-19.34887499 1.48837501H396.402875c-10.418625 0-20.341125 1.488375-30.26362499 3.969-44.65124999 11.907-77.3955 48.62025001-77.3955 96.74437499V834.48125001c0 57.5505 58.046625 91.783125 115.10099998 108.15524999 67.969125 19.845 142.387875 23.317875 224.24850002 0 54.077625-15.379875 107.163-46.63574999 107.16299998-108.15525001v-61.5195h-223.25624999V735.25625001h295.6905c58.54275001 0 109.643625-49.6125 134.449875-122.04675001 10.418625-30.263625 16.372125-64.49625001 16.372125-101.2095 0-27.286875-3.472875-53.5815-9.426375-77.891625z m-316.52775 372.58987501c22.325625 0 40.186125 18.356625 40.186125 40.68224999 0 22.325625-18.356625 40.68225001-40.186125 40.68225001-22.325625 0-40.68225001-18.356625-40.68225-40.68225001 0.496125-22.325625 18.356625-40.68225001 40.68225-40.68225001z"
fill=
"#FFD400"
></
path
>
</
svg
>
)
}
/>
</>;
};
dinky-web/src/global.less
View file @
e119a075
...
@@ -234,7 +234,6 @@ ol {
...
@@ -234,7 +234,6 @@ ol {
.schemaTree{
.schemaTree{
max-height: 78vh;
max-height: 78vh;
min-height: 78vh;
min-height: 78vh;
margin-top: 1.5vh;
}
}
.code-content-empty {
.code-content-empty {
...
@@ -280,3 +279,9 @@ ol {
...
@@ -280,3 +279,9 @@ ol {
.needWrap {
.needWrap {
white-space: pre-wrap;
white-space: pre-wrap;
}
}
.query-form{
width: -moz-max-content;
left: 0;
position: absolute;
}
dinky-web/src/hooks/index.tsx
0 → 100644
View file @
e119a075
/*
* 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.
*/
import
{
useCallback
}
from
'react'
;
import
{
RequestConfig
,
useRequest
}
from
'@umijs/max'
;
import
{
ErrorNotification
,
SuccessMessage
}
from
'@/utils/messages'
;
const
noop
=
()
=>
{
};
/**
* return CRUDResult type
*/
interface
CRUDResult
<
T
>
{
data
:
T
|
undefined
;
// 表示请求返回的数据。
error
:
Error
|
undefined
;
// 表示请求返回的错误。
loading
:
boolean
;
// 表示请求是否正在进行中。
params
:
any
;
// 表示请求参数。
run
:
(
config
?:
RequestConfig
)
=>
Promise
<
any
>
;
// 可以手动触发请求。
cancel
:
()
=>
void
;
// 用于取消当前请求。
refresh
:
()
=>
Promise
<
any
>
;
// 用于重新发起请求
mutate
:
(
newData
:
T
|
undefined
)
=>
void
;
// 用于手动更新数据
addData
:
(
payload
:
any
)
=>
Promise
<
any
>
;
// 用于创建新数据/更新数据。
getDataList
:
()
=>
Promise
<
any
>
;
// 用于读取数据。
updateData
:
(
id
:
number
,
payload
:
any
)
=>
Promise
<
any
>
;
// 用于更新数据。
removeDataById
:
(
id
:
number
)
=>
Promise
<
any
>
;
// 用于删除数据。
}
/**
* useCustomCRUD hook
* @param url 请求的url
* @param options 请求的配置
*/
const
useCustomCRUD
=
(
url
:
string
,
options
=
{}):
CRUDResult
<
any
>
=>
{
/**
* @name BaseOptions
* @note
* refreshDeps?: DependencyList; // 当前请求的依赖项
* manual?: boolean; // 手动刷新
* onSuccess?: (data: R, params: P) => void; // 请求成功时的回调
* onError?: (e: Error, params: P) => void; // 请求失败时的回调
* defaultLoading?: boolean; //默认加载
* loadingDelay?: number; // 加载延迟
* defaultParams?: P; // 默认参数
* pollingInterval?: number; // 轮询间隔
* pollingWhenHidden?: boolean; // 隐藏时是否轮询
* fetchKey?: (...args: P) => string; // 请求key
* paginated?: false; // 分页
* loadMore?: false; // 加载更多
* refreshOnWindowFocus?: boolean; // 窗口获取焦点时是否刷新
* focusTimespan?: number; // 焦点时间跨度
* cacheKey?: CachedKeyType; // 缓存键
* cacheTime?: number; // 缓存时间
* staleTime?: number; // 缓存时间
* debounceInterval?: number; // 防抖间隔时间
* throttleInterval?: number; //
* initialData?: R; // 初始数据
* requestMethod?: (service: any) => Promise<any>; // 请求方法
* getDataListy?: boolean; // 初始化状态
* throwOnError?: boolean; // 抛出错误
*/
const
{
data
,
error
,
loading
,
params
,
run
,
cancel
,
refresh
,
mutate
}
=
useRequest
(
url
,
{
...
options
,
manual
:
true
,
formatResult
:
(
res
:
{
data
:
any
;
})
=>
res
.
data
,
onSuccess
:
async
(
res
)
=>
{
SuccessMessage
(
res
.
msg
);
return
true
;
},
onError
:
(
e
)
=>
{
ErrorNotification
(
e
.
message
);
return
false
;
},
throwOnError
:
true
,
// 错误时抛出 || when error is thrown and throwOnError is true
refreshOnWindowFocus
:
true
,
// 窗口聚焦时 是否重新刷新 || when window focused and refreshOnWindowFocus is true
ready
:
true
,
// 初始化状态 || when ready is true and initialData is undefined
debounceInterval
:
500
,
// 防抖间隔 || debounce interval
throttleInterval
:
500
,
// 节流间隔 || throttle interval
initialData
:
{},
// 初始数据 || init data
defaultLoading
:
true
,
// 默认加载 || default loading
loadMore
:
true
,
// 加载更多 || load more
});
const
addData
=
useCallback
(
async
(
payload
:
any
)
=>
{
await
run
({
...
options
,
method
:
'POST'
,
data
:
payload
,
});
},
[
run
,
options
]
);
const
getDataList
=
useCallback
(
async
()
=>
{
await
run
({
...
options
,
method
:
'GET'
,
});
},
[
run
,
options
]
);
const
updateData
=
useCallback
(
async
(
id
:
number
,
payload
:
any
)
=>
{
await
run
({
...
options
,
method
:
'PUT'
,
url
:
`
${
url
}
/
${
id
}
`
,
data
:
payload
,
});
},
[
run
,
options
,
url
]
);
const
removeDataById
=
useCallback
(
async
(
id
:
number
)
=>
{
await
run
({
...
options
,
method
:
'DELETE'
,
url
:
`
${
url
}
/
${
id
}
`
,
});
},
[
run
,
options
,
url
]
);
return
{
data
,
error
,
loading
,
params
,
run
,
cancel
:
cancel
||
noop
,
refresh
:
refresh
||
(()
=>
Promise
.
resolve
()),
mutate
,
addData
,
getDataList
,
updateData
,
removeDataById
,
};
};
export
default
useCustomCRUD
;
dinky-web/src/locales/en-US/global.ts
View file @
e119a075
...
@@ -155,6 +155,7 @@ export default {
...
@@ -155,6 +155,7 @@ export default {
'global.error'
:
'Error'
,
'global.error'
:
'Error'
,
'global.warning'
:
'Warning'
,
'global.warning'
:
'Warning'
,
'global.success'
:
'Success'
,
'global.success'
:
'Success'
,
'global.getdata.tips'
:
'Get Data'
,
'global.notifaction.iknow'
:
'I understand'
,
'global.notifaction.iknow'
:
'I understand'
,
'global.notifaction.full-error'
:
'Complete error message'
,
'global.notifaction.full-error'
:
'Complete error message'
,
...
...
dinky-web/src/locales/zh-CN/global.ts
View file @
e119a075
...
@@ -151,6 +151,7 @@ export default {
...
@@ -151,6 +151,7 @@ export default {
'global.error'
:
'错误'
,
'global.error'
:
'错误'
,
'global.warning'
:
'警告'
,
'global.warning'
:
'警告'
,
'global.success'
:
'成功'
,
'global.success'
:
'成功'
,
'global.getdata.tips'
:
'获取数据'
,
'global.notifaction.iknow'
:
'我知道了'
,
'global.notifaction.iknow'
:
'我知道了'
,
'global.notifaction.full-error'
:
'完整错误信息'
,
'global.notifaction.full-error'
:
'完整错误信息'
,
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/GenSQL/index.tsx
View file @
e119a075
...
@@ -16,14 +16,18 @@
...
@@ -16,14 +16,18 @@
*/
*/
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
React
from
'react'
;
import
React
,
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
import
CodeShow
from
'@/components/CustomEditor/CodeShow'
;
import
CodeShow
from
'@/components/CustomEditor/CodeShow'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
Empty
}
from
'antd'
;
import
{
Empty
}
from
'antd'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
queryDataByParams
}
from
'@/services/BusinessCrud'
;
import
{
API_CONSTANTS
}
from
'@/services/constants'
;
import
{
QueryParams
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data'
;
type
GenSQLProps
=
{
type
GenSQLProps
=
{
sql
:
Partial
<
DataSources
.
SqlGeneration
>
;
queryParams
:
Partial
<
QueryParams
>
,
tagDisabled
:
boolean
}
}
/**
/**
...
@@ -39,39 +43,72 @@ const CodeShowProps = {
...
@@ -39,39 +43,72 @@ const CodeShowProps = {
const
GenSQL
:
React
.
FC
<
GenSQLProps
>
=
(
props
)
=>
{
const
GenSQL
:
React
.
FC
<
GenSQLProps
>
=
(
props
)
=>
{
const
{
sql
}
=
props
;
const
{
queryParams
,
tagDisabled
}
=
props
;
const
[
genSQL
,
setGenSQL
]
=
useState
<
Partial
<
DataSources
.
SqlGeneration
>>
({});
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
<
string
>
(
'flinkddl'
);
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
<
string
>
(
'flinkddl'
);
// tab list
const
queryDDL
=
useCallback
(
async
()
=>
{
//get gen sql
const
genSQLData
=
await
queryDataByParams
(
API_CONSTANTS
.
DATASOURCE_GET_GEN_SQL
,
{...
queryParams
});
setGenSQL
(
genSQLData
);
},
[
queryParams
]);
/**
* query
*/
useEffect
(()
=>
{
if
(
queryParams
.
id
&&
queryParams
.
tableName
&&
queryParams
.
schemaName
)
{
queryDDL
();
}
},
[
queryParams
]);
/**
* render content
* @param code
*/
const
renderContent
=
(
code
=
''
)
=>
{
return
<
CodeShow
{
...
CodeShowProps
}
code=
{
tagDisabled
?
''
:
code
}
/>;
};
/**
* tab list
*/
const
tabList
=
[
const
tabList
=
[
{
{
key
:
'flinkddl'
,
key
:
'flinkddl'
,
label
:
'Flink DDL'
,
label
:
'Flink DDL'
,
children
:
<
CodeShow
{
...
CodeShowProps
}
code=
{
sql
.
flinkSqlCreate
||
''
}
/>
disabled
:
tagDisabled
,
children
:
renderContent
(
genSQL
.
sqlCreate
)
},
},
{
{
key
:
'select'
,
key
:
'select'
,
label
:
'Select'
,
label
:
'Select'
,
children
:
<
CodeShow
{
...
CodeShowProps
}
code=
{
sql
.
sqlSelect
||
''
}
/>
disabled
:
tagDisabled
,
children
:
renderContent
(
genSQL
.
sqlSelect
)
},
},
{
{
key
:
'sqlddl'
,
key
:
'sqlddl'
,
label
:
'SQL DDL'
,
label
:
'SQL DDL'
,
children
:
<
CodeShow
{
...
CodeShowProps
}
code=
{
sql
.
sqlCreate
||
''
}
/>
disabled
:
tagDisabled
,
children
:
renderContent
(
genSQL
.
sqlCreate
)
}
}
]
]
;
// tab props
// tab props
const
restTabProps
=
{
const
restTabProps
=
{
activeKey
,
activeKey
,
onChange
:
(
key
:
string
)
=>
setActiveKey
(
key
),
onChange
:
(
key
:
string
)
=>
setActiveKey
(
key
),
tabPosition
:
'left'
,
tabPosition
:
'left'
,
size
:
'small'
,
items
:
tabList
items
:
tabList
}
};
/**
* render
*/
return
<>
return
<>
{
(
sql
.
flinkSqlCreate
||
sql
.
sqlSelect
||
sql
.
sqlCreate
)
?
{
(
genSQL
.
flinkSqlCreate
||
genSQL
.
sqlSelect
||
genSQL
.
sqlCreate
)
?
<
ProCard
tabs=
{
{...
restTabProps
}
}
/>
<
ProCard
tabs=
{
{...
restTabProps
}
}
/>
:
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
:
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
}
}
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery/QueryForm/index.tsx
0 → 100644
View file @
e119a075
/*
* 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.
*/
import
{
ProForm
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
import
{
AutoComplete
}
from
'antd'
;
import
React
from
'react'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DefaultOptionType
}
from
'rc-select/es/Select'
;
type
QueryFormProps
=
{
form
:
FormInstance
<
Values
>
;
onSubmit
:
(
values
:
any
)
=>
void
;
autoCompleteColumns
:
DefaultOptionType
[];
}
const
QueryForm
:
React
.
FC
<
QueryFormProps
>
=
(
props
)
=>
{
const
{
form
,
onSubmit
:
submitHandle
,
autoCompleteColumns
}
=
props
;
/**
* search form submit
*/
const
onSubmitHandle
=
()
=>
{
const
values
=
form
.
getFieldsValue
();
submitHandle
(
values
);
};
/**
* handle change
* @param value
* @param tag
*/
const
handleChange
=
(
value
:
string
,
tag
:
string
)
=>
{
switch
(
tag
)
{
case
'where'
:
form
.
setFieldsValue
({
where
:
`
${(
form
.
getFieldsValue
().
where
||
''
)
+
value
}
`
});
break
;
case
'order'
:
form
.
setFieldsValue
({
order
:
`
${(
form
.
getFieldsValue
().
order
||
''
)
+
value
}
`
});
break
;
}
};
const
renderForm
=
()
=>
{
return
<>
<
AutoComplete
backfill
autoFocus
options=
{
autoCompleteColumns
}
onSelect=
{
(
value
:
string
)
=>
handleChange
(
value
,
'where'
)
}
>
<
ProFormText
addonBefore=
{
'WHERE'
}
width=
{
'md'
}
key=
"where"
name=
"where"
required
/>
</
AutoComplete
>
<
AutoComplete
options=
{
autoCompleteColumns
}
onSelect=
{
(
value
:
string
)
=>
handleChange
(
value
,
'order'
)
}
>
<
ProFormText
addonBefore=
{
'ORDER BY'
}
width=
{
'md'
}
key=
"order"
name=
"order"
required
/>
</
AutoComplete
>
</>;
};
/**
* submit config
*/
const
submitConfig
=
{
onSubmit
:
onSubmitHandle
,
searchConfig
:
{
submitText
:
l
(
'button.search'
),
},
resetButtonProps
:
{
style
:
{
display
:
'none'
,
},
}
};
/**
* render
*/
return
<>
<
ProForm
layout=
{
'inline'
}
size=
{
'middle'
}
form=
{
form
}
isKeyPressSubmit
autoFocusFirstInput
className=
{
'query-form'
}
submitter=
{
{...
submitConfig
}
}
>
{
renderForm
()
}
</
ProForm
>
</>;
};
export
default
QueryForm
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
View file @
e119a075
...
@@ -15,16 +15,140 @@
...
@@ -15,16 +15,140 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
React
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
ProTable
}
from
'@ant-design/pro-table'
;
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
}
from
'@/services/constants'
;
import
{
handleOption
}
from
'@/services/BusinessCrud'
;
import
{
Alert
,
Empty
,
Form
}
from
'antd'
;
import
{
QueryParams
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DefaultOptionType
}
from
'rc-select/lib/Select'
;
import
QueryForm
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery/QueryForm'
;
import
{
buildColumnsQueryKeyWord
}
from
'@/pages/RegCenter/DataSource/components/function'
;
// props
type
SQLQueryProps
=
{
type
SQLQueryProps
=
{
query
:
string
,
query
Params
:
QueryParams
}
}
//todo: SQLQuery component
const
SQLQuery
:
React
.
FC
<
SQLQueryProps
>
=
(
props
)
=>
{
const
SQLQuery
:
React
.
FC
<
SQLQueryProps
>
=
(
props
)
=>
{
const
{
query
}
=
props
;
return
<
div
>
SQLQuery
</
div
>;
const
{
queryParams
:
{
id
:
dbId
,
schemaName
,
tableName
}}
=
props
;
// state
const
[
form
]
=
Form
.
useForm
();
const
[
tableData
,
setTableData
]
=
useState
({
columns
:
[{}],
rowData
:
[{}]});
const
[
autoCompleteColumns
,
setAutoCompleteColumns
]
=
useState
<
DefaultOptionType
[]
>
([]);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
errMsg
,
setErrMsg
]
=
useState
<
{
isErr
:
boolean
,
msg
:
string
}
>
({
isErr
:
false
,
msg
:
''
});
// query data
const
fetchData
=
async
(
values
:
any
)
=>
{
setLoading
(
true
);
const
result
=
await
handleOption
(
API_CONSTANTS
.
DATASOURCE_QUERY_DATA
,
l
(
'global.getdata.tips'
),
{
id
:
dbId
,
schemaName
,
tableName
,
option
:
{
where
:
values
.
where
,
order
:
values
.
order
,
limitStart
:
'0'
,
limitEnd
:
'500'
},
});
const
{
code
,
datas
:
{
columns
,
rowData
}}
=
result
;
// 获取到的数据
if
(
code
===
1
)
{
setErrMsg
({
isErr
:
true
,
msg
:
result
.
datas
.
error
});
}
else
{
setErrMsg
({
isErr
:
false
,
msg
:
''
});
}
// render columns list
const
tableColumns
=
columns
?.
map
((
item
:
string
|
number
)
=>
({
title
:
item
,
dataIndex
:
item
,
key
:
item
,
ellipsis
:
true
,
tooltip
:
item
,
width
:
'8%'
,
}));
setAutoCompleteColumns
(
buildColumnsQueryKeyWord
(
columns
));
setTableData
({
columns
:
tableColumns
,
rowData
:
rowData
});
setLoading
(
false
);
};
/**
* clear state
*/
const
clearState
=
()
=>
{
setTableData
({
columns
:
[],
rowData
:
[]});
setErrMsg
({
isErr
:
false
,
msg
:
''
});
setLoading
(
false
);
form
.
resetFields
();
};
useEffect
(()
=>
{
if
(
dbId
&&
tableName
&&
schemaName
)
{
const
values
=
form
.
getFieldsValue
();
fetchData
(
values
);
}
else
{
clearState
();
}
},
[
dbId
,
tableName
,
schemaName
,
form
]);
/**
* render alert msg
*/
const
renderAlert
=
()
=>
{
return
<>
{
errMsg
.
isErr
?
(
<
Alert
message=
"Error"
description=
{
errMsg
.
msg
}
type=
"error"
showIcon
/>
)
:
<></>
}
</>;
};
/**
* render toolbar
*/
const
renderToolBar
=
()
=>
[
<
QueryForm
key=
{
'queryForm'
}
autoCompleteColumns=
{
autoCompleteColumns
}
form=
{
form
}
onSubmit=
{
(
values
)
=>
fetchData
(
values
)
}
/>,
];
/**
* render
*/
return
<>
{
(
dbId
&&
tableName
&&
schemaName
)
?
(
<
ProTable
bordered
loading=
{
loading
}
{
...
PROTABLE_OPTIONS_PUBLIC
}
size=
{
'small'
}
search=
{
false
}
pagination=
{
{
defaultPageSize
:
12
,
}
}
dateFormatter=
"string"
columns=
{
tableData
.
columns
}
dataSource=
{
tableData
.
rowData
}
toolBarRender=
{
renderToolBar
}
tableAlertRender=
{
renderAlert
}
options=
{
{
density
:
false
,
reload
:
false
,
fullScreen
:
true
,
}
}
/>
)
:
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
}
</>;
};
};
export
default
SQLQuery
;
export
default
SQLQuery
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx
View file @
e119a075
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
CheckSquareOutlined
,
KeyOutlined
}
from
'@ant-design/icons'
;
import
{
CheckSquareOutlined
,
KeyOutlined
}
from
'@ant-design/icons'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProColumns
}
from
'@ant-design/pro-table/es/typing'
;
import
{
ProColumns
}
from
'@ant-design/pro-table/es/typing'
;
type
ColumnInfoProps
=
{
type
ColumnInfoProps
=
{
...
@@ -30,78 +30,78 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -30,78 +30,78 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
const
{
columnInfo
}
=
props
;
const
{
columnInfo
}
=
props
;
const
columns
:
ProColumns
<
DataSources
.
Column
>
[]
=
[
const
columns
:
ProColumns
<
DataSources
.
Column
>
[]
=
[
{
{
title
:
l
(
'rc.ds.no'
),
title
:
l
(
'rc.ds.no'
),
dataIndex
:
'position'
,
dataIndex
:
'position'
,
width
:
"4%"
,
width
:
'4%'
,
},
},
{
{
title
:
l
(
'rc.ds.columnName'
),
title
:
l
(
'rc.ds.columnName'
),
dataIndex
:
'name'
,
dataIndex
:
'name'
,
width
:
"10%"
,
width
:
'10%'
,
ellipsis
:
true
,
ellipsis
:
true
,
copyable
:
true
,
copyable
:
true
,
},
},
{
{
title
:
l
(
'rc.ds.columnType'
),
title
:
l
(
'rc.ds.columnType'
),
dataIndex
:
'type'
,
dataIndex
:
'type'
,
width
:
"6%"
,
width
:
'6%'
,
},
},
{
{
title
:
l
(
'rc.ds.primarykey'
),
title
:
l
(
'rc.ds.primarykey'
),
dataIndex
:
'keyFlag'
,
dataIndex
:
'keyFlag'
,
width
:
"4%"
,
width
:
'4%'
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
,
record
)
=>
{
return
record
.
keyFlag
?
<
KeyOutlined
style=
{
{
color
:
'#FAA100'
}
}
/>
:
undefined
return
record
.
keyFlag
?
<
KeyOutlined
style=
{
{
color
:
'#FAA100'
}
}
/>
:
undefined
;
},
},
},
{
},
{
title
:
l
(
'rc.ds.autoIncrement'
),
title
:
l
(
'rc.ds.autoIncrement'
),
dataIndex
:
'autoIncrement'
,
dataIndex
:
'autoIncrement'
,
width
:
"4%"
,
width
:
'4%'
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
,
record
)
=>
{
return
record
.
autoIncrement
?
<
CheckSquareOutlined
style=
{
{
color
:
'#1296db'
}
}
/>
:
undefined
return
record
.
autoIncrement
?
<
CheckSquareOutlined
style=
{
{
color
:
'#1296db'
}
}
/>
:
undefined
;
},
},
},
{
},
{
title
:
l
(
'rc.ds.isNull'
),
title
:
l
(
'rc.ds.isNull'
),
dataIndex
:
'nullable'
,
dataIndex
:
'nullable'
,
width
:
"4%"
,
width
:
'4%'
,
render
:
(
_
,
record
)
=>
{
render
:
(
_
,
record
)
=>
{
return
!
record
.
nullable
?
<
CheckSquareOutlined
style=
{
{
color
:
'#1296db'
}
}
/>
:
undefined
return
!
record
.
nullable
?
<
CheckSquareOutlined
style=
{
{
color
:
'#1296db'
}
}
/>
:
undefined
;
},
},
},
{
},
{
title
:
l
(
'rc.ds.default'
),
title
:
l
(
'rc.ds.default'
),
dataIndex
:
'defaultValue'
,
dataIndex
:
'defaultValue'
,
ellipsis
:
true
,
ellipsis
:
true
,
width
:
"8%"
,
width
:
'8%'
,
},
{
},
{
title
:
l
(
'rc.ds.length'
),
title
:
l
(
'rc.ds.length'
),
dataIndex
:
'length'
,
dataIndex
:
'length'
,
width
:
"4%"
,
width
:
'4%'
,
},
{
},
{
title
:
l
(
'rc.ds.precision'
),
title
:
l
(
'rc.ds.precision'
),
dataIndex
:
'precision'
,
dataIndex
:
'precision'
,
width
:
"4%"
,
width
:
'4%'
,
},
{
},
{
title
:
l
(
'rc.ds.decimalDigits'
),
title
:
l
(
'rc.ds.decimalDigits'
),
dataIndex
:
'scale'
,
dataIndex
:
'scale'
,
ellipsis
:
true
,
ellipsis
:
true
,
width
:
"6%"
,
width
:
'6%'
,
},
{
},
{
title
:
l
(
'rc.ds.character'
),
title
:
l
(
'rc.ds.character'
),
dataIndex
:
'characterSet'
,
dataIndex
:
'characterSet'
,
width
:
"6%"
,
width
:
'6%'
,
ellipsis
:
true
,
ellipsis
:
true
,
},
{
},
{
title
:
l
(
'rc.ds.collationRule'
),
title
:
l
(
'rc.ds.collationRule'
),
dataIndex
:
'collation'
,
dataIndex
:
'collation'
,
width
:
"10%"
,
width
:
'10%'
,
ellipsis
:
true
,
ellipsis
:
true
,
},
{
},
{
title
:
l
(
'rc.ds.javaType'
),
title
:
l
(
'rc.ds.javaType'
),
dataIndex
:
'javaType'
,
dataIndex
:
'javaType'
,
ellipsis
:
true
,
ellipsis
:
true
,
width
:
"8%"
,
width
:
'8%'
,
},
},
{
{
title
:
l
(
'rc.ds.comment'
),
title
:
l
(
'rc.ds.comment'
),
...
@@ -114,14 +114,13 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -114,14 +114,13 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
return
<>
return
<>
<
ProTable
<
DataSources
.
Column
>
<
ProTable
<
DataSources
.
Column
>
toolBarRender=
{
false
}
toolBarRender=
{
false
}
className=
{
'columnTable'
}
pagination=
{
{
pagination=
{
{
defaultPageSize
:
12
,
defaultPageSize
:
10
,
hideOnSinglePage
:
true
,
hideOnSinglePage
:
true
,
}
}
}
}
search=
{
false
}
search=
{
false
}
options=
{
false
}
options=
{
false
}
size=
{
"small"
}
size=
{
'small'
}
bordered
bordered
columns=
{
columns
}
columns=
{
columns
}
dataSource=
{
columnInfo
as
DataSources
.
Column
[]
}
dataSource=
{
columnInfo
as
DataSources
.
Column
[]
}
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
View file @
e119a075
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
*/
*/
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
Divider
,
Empty
}
from
'antd'
;
import
{
Empty
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
ColumnInfo
from
'./ColumnInfo/Index'
;
import
ColumnInfo
from
'./ColumnInfo/Index'
;
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data.d.ts
0 → 100644
View file @
e119a075
/*
* 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.
*/
export
type
QueryData
=
{
id
:
string
;
schemaName
:
string
;
tableName
:
string
;
sql
:
string
;
option
:
Option
;
}
export
type
Option
=
{
where
:
string
;
order
:
string
;
limitStart
:
string
;
limitEnd
:
string
;
}
export
type
QueryParams
=
{
id
:
number
;
schemaName
:
string
;
tableName
:
string
;
}
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/index.tsx
View file @
e119a075
...
@@ -20,13 +20,13 @@ import {l} from '@/utils/intl';
...
@@ -20,13 +20,13 @@ import {l} from '@/utils/intl';
import
{
import
{
BookOutlined
,
BookOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
React
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
SchemaDesc
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc'
;
import
SchemaDesc
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc'
;
import
GenSQL
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/GenSQL'
;
import
GenSQL
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/GenSQL'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
SQLQuery
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery'
;
import
SQLQuery
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery'
;
import
SQLConsole
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLConsole
'
;
import
{
QueryParams
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data
'
;
/**
/**
...
@@ -35,38 +35,43 @@ import SQLConsole from '@/pages/RegCenter/DataSource/components/DataSourceDetail
...
@@ -35,38 +35,43 @@ import SQLConsole from '@/pages/RegCenter/DataSource/components/DataSourceDetail
type
RightTagsRouterProps
=
{
type
RightTagsRouterProps
=
{
tableInfo
:
Partial
<
DataSources
.
Table
>
,
tableInfo
:
Partial
<
DataSources
.
Table
>
,
tableColumns
:
Partial
<
DataSources
.
Column
[]
>
,
tableColumns
:
Partial
<
DataSources
.
Column
[]
>
,
genSQL
:
Partial
<
DataSources
.
SqlGeneration
>
,
rightButtons
:
React
.
ReactNode
,
rightButtons
:
React
.
ReactNode
,
queryParams
:
QueryParams
tagDisabled
:
boolean
}
}
const
RightTagsRouter
:
React
.
FC
<
RightTagsRouterProps
>
=
(
props
)
=>
{
const
RightTagsRouter
:
React
.
FC
<
RightTagsRouterProps
>
=
(
props
)
=>
{
const
{
tableColumns
,
tableInfo
,
genSQL
,
rightButtons
}
=
props
;
const
{
tableColumns
,
tableInfo
,
queryParams
,
tagDisabled
,
rightButtons
}
=
props
;
// state
// state
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
(
'desc'
);
const
[
activeKey
,
setActiveKey
]
=
useState
(
'desc'
);
// tab list
// tab list
const
tabList
=
[
const
tabList
=
[
{
{
key
:
'desc'
,
key
:
'desc'
,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.desc'
)
}
</
Space
>,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.desc'
)
}
</
Space
>,
children
:
<
SchemaDesc
tableInfo=
{
tableInfo
}
tableColumns=
{
tableColumns
}
/>
children
:
<
SchemaDesc
tableInfo=
{
tableInfo
}
tableColumns=
{
tableColumns
}
/>,
disabled
:
tagDisabled
},
},
{
{
key
:
'query'
,
key
:
'query'
,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.query'
)
}
</
Space
>,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.query'
)
}
</
Space
>,
children
:
<
SQLQuery
query=
{
'111'
}
/>
children
:
<
SQLQuery
queryParams=
{
queryParams
}
/>,
disabled
:
tagDisabled
},
},
{
{
key
:
'gensql'
,
key
:
'gensql'
,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.gensql'
)
}
</
Space
>,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.gensql'
)
}
</
Space
>,
children
:
<
GenSQL
sql=
{
genSQL
}
/>
children
:
<
GenSQL
tagDisabled=
{
tagDisabled
}
queryParams=
{
queryParams
}
/>,
disabled
:
tagDisabled
},
},
{
{
key
:
'console'
,
key
:
'console'
,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.console'
)
}
</
Space
>,
label
:
<
Space
><
BookOutlined
/>
{
l
(
'rc.ds.detail.tag.console'
)
}
</
Space
>,
children
:
<
SQLConsole
querySQL=
{
''
}
/>
disabled
:
tagDisabled
,
// children: <SQLConsole dbId={dataSourceInfo.id} schema={tableInfo.schema} table={tableInfo.name} />
},
},
];
];
...
@@ -80,13 +85,11 @@ const RightTagsRouter: React.FC<RightTagsRouterProps> = (props) => {
...
@@ -80,13 +85,11 @@ const RightTagsRouter: React.FC<RightTagsRouterProps> = (props) => {
items
:
tabList
,
items
:
tabList
,
};
};
/**
/**
* render
* render
*/
*/
return
<>
return
<>
<
ProCard
size=
"small"
bordered
tabs=
{
{...
restTabProps
}
}
<
ProCard
size=
"small"
bordered
tabs=
{
{...
restTabProps
}
}
/>
/>
</>;
</>;
};
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree/index.tsx
View file @
e119a075
...
@@ -18,57 +18,34 @@
...
@@ -18,57 +18,34 @@
import
{
Empty
,
Tree
}
from
'antd'
;
import
{
Empty
,
Tree
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
DatabaseTwoTone
,
TableOutlined
,
TabletTwoTone
}
from
'@ant-design/icons'
;
import
{
buildSchemaTree
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/function'
;
import
{
folderSeparator
}
from
'@/utils/function'
;
const
{
DirectoryTree
}
=
Tree
;
const
{
DirectoryTree
}
=
Tree
;
/**
* props
*/
type
SchemaTreeProps
=
{
type
SchemaTreeProps
=
{
treeData
:
Partial
<
any
>
[];
treeData
:
Partial
<
any
>
[];
onNodeClick
:
(
info
:
any
)
=>
void
onNodeClick
:
(
info
:
any
)
=>
void
}
}
const
SchemaTree
:
React
.
FC
<
SchemaTreeProps
>
=
(
props
)
=>
{
const
SchemaTree
:
React
.
FC
<
SchemaTreeProps
>
=
(
props
)
=>
{
const
{
treeData
,
onNodeClick
}
=
props
;
const
{
treeData
,
onNodeClick
}
=
props
;
const
buildSchemaTree
=
(
data
:
any
):
any
=>
data
.
map
((
item
:
any
)
=>
{
/**
return
{
* render
isLeaf
:
false
,
*/
name
:
item
.
name
,
return
<>
parentId
:
item
.
name
,
icon
:
<
DatabaseTwoTone
/>,
content
:
item
.
name
,
path
:
item
.
name
,
title
:
item
.
name
,
fullInfo
:
item
,
key
:
item
.
name
,
children
:
item
.
tables
.
map
((
table
:
any
)
=>
{
return
{
isLeaf
:
true
,
name
:
table
.
name
,
parentId
:
item
.
name
,
icon
:
<
TableOutlined
/>,
content
:
table
.
name
,
path
:
item
.
name
+
folderSeparator
()
+
table
.
name
,
title
:
table
.
name
,
key
:
item
.
name
+
folderSeparator
()
+
table
.
name
,
fullInfo
:
table
,
};
}),
};
});
return
<>
{
{
(
treeData
.
length
>
0
)
?
(
treeData
.
length
>
0
)
?
<
DirectoryTree
<
DirectoryTree
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
treeData=
{
buildSchemaTree
(
treeData
)
}
treeData=
{
buildSchemaTree
(
treeData
)
}
/>
:
<
Empty
className=
{
"code-content-empty"
}
/>
/>
:
<
Empty
className=
{
'code-content-empty'
}
/>
}
}
</>
</>
;
}
}
;
export
default
SchemaTree
;
export
default
SchemaTree
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/function.tsx
0 → 100644
View file @
e119a075
/*
* 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.
*/
import
{
DatabaseTwoTone
,
TableOutlined
}
from
'@ant-design/icons'
;
import
{
folderSeparator
}
from
'@/utils/function'
;
/**
* build schema tree
* @param data
*/
export
const
buildSchemaTree
=
(
data
:
any
):
any
=>
data
.
map
((
item
:
any
)
=>
{
return
{
isLeaf
:
false
,
name
:
item
.
name
,
parentId
:
item
.
name
,
icon
:
<
DatabaseTwoTone
/>,
content
:
item
.
name
,
path
:
item
.
name
,
title
:
item
.
name
,
fullInfo
:
item
,
key
:
item
.
name
,
children
:
item
.
tables
.
map
((
table
:
any
)
=>
{
return
{
isLeaf
:
true
,
name
:
table
.
name
,
parentId
:
item
.
name
,
icon
:
<
TableOutlined
/>,
content
:
table
.
name
,
path
:
item
.
name
+
folderSeparator
()
+
table
.
name
,
title
:
table
.
name
,
key
:
item
.
name
+
folderSeparator
()
+
table
.
name
,
fullInfo
:
table
,
};
}),
};
});
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/index.tsx
View file @
e119a075
...
@@ -27,6 +27,7 @@ import {useNavigate} from '@umijs/max';
...
@@ -27,6 +27,7 @@ import {useNavigate} from '@umijs/max';
import
{
API_CONSTANTS
,
RESPONSE_CODE
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
,
RESPONSE_CODE
}
from
'@/services/constants'
;
import
{
getDataByIdReturnResult
,
queryDataByParams
}
from
'@/services/BusinessCrud'
;
import
{
getDataByIdReturnResult
,
queryDataByParams
}
from
'@/services/BusinessCrud'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
ProCard
}
from
'@ant-design/pro-components'
;
import
{
QueryParams
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data'
;
type
DataSourceDetailProps
=
{
type
DataSourceDetailProps
=
{
dataSource
:
Partial
<
DataSources
.
DataSource
>
;
dataSource
:
Partial
<
DataSources
.
DataSource
>
;
...
@@ -38,10 +39,11 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
...
@@ -38,10 +39,11 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
const
{
dataSource
,
backClick
}
=
props
;
const
{
dataSource
,
backClick
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
disabled
,
setDisabled
]
=
useState
<
boolean
>
(
true
);
const
[
treeData
,
setTreeData
]
=
useState
<
Partial
<
any
>
[]
>
([]);
const
[
treeData
,
setTreeData
]
=
useState
<
Partial
<
any
>
[]
>
([]);
const
[
tableColumns
,
setTableColumns
]
=
useState
<
Partial
<
DataSources
.
Column
[]
>>
([]);
const
[
tableColumns
,
setTableColumns
]
=
useState
<
Partial
<
DataSources
.
Column
[]
>>
([]);
const
[
genSQL
,
setGenSQL
]
=
useState
<
Partial
<
DataSources
.
SqlGeneration
>>
({});
const
[
tableInfo
,
setTableInfo
]
=
useState
<
Partial
<
DataSources
.
Table
>>
({});
const
[
tableInfo
,
setTableInfo
]
=
useState
<
Partial
<
DataSources
.
Table
>>
({});
const
[
params
,
setParams
]
=
useState
<
QueryParams
>
({
id
:
0
,
schemaName
:
''
,
tableName
:
''
});
const
handleBackClick
=
()
=>
{
const
handleBackClick
=
()
=>
{
// go back
// go back
...
@@ -51,9 +53,14 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
...
@@ -51,9 +53,14 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
};
};
const
clearState
=
()
=>
{
const
clearState
=
()
=>
{
setDisabled
(
true
);
setTableColumns
([]);
setTableColumns
([]);
setTableInfo
({});
setTableInfo
({});
setGenSQL
({});
setParams
({
id
:
0
,
schemaName
:
''
,
tableName
:
''
});
};
};
...
@@ -77,26 +84,23 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
...
@@ -77,26 +84,23 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
* tree node click
* tree node click
*/
*/
const
onSchemaTreeNodeClick
=
useCallback
(
async
(
info
:
any
)
=>
{
const
onSchemaTreeNodeClick
=
useCallback
(
async
(
info
:
any
)
=>
{
const
{
node
:
{
isLeaf
,
parentId
,
n
ame
,
fullInfo
}}
=
info
;
const
{
node
:
{
isLeaf
,
parentId
:
schemaName
,
name
:
tableN
ame
,
fullInfo
}}
=
info
;
if
(
isLeaf
)
{
if
(
isLeaf
)
{
setParams
({
id
:
dataSource
.
id
||
0
,
schemaName
,
tableName
});
setDisabled
(
false
);
/**
/**
* get table columns
* get table columns
*/
*/
const
columnsData
=
await
queryDataByParams
(
API_CONSTANTS
.
DATASOURCE_GET_COLUMNS_BY_TABLE
,
{
const
columnsData
=
await
queryDataByParams
(
API_CONSTANTS
.
DATASOURCE_GET_COLUMNS_BY_TABLE
,
{
id
:
dataSource
.
id
,
id
:
dataSource
.
id
,
schemaName
:
parentId
,
schemaName
,
tableName
:
name
tableName
});
/**
* get gen sql
*/
const
genSQLData
=
await
queryDataByParams
(
API_CONSTANTS
.
DATASOURCE_GET_GEN_SQL
,
{
id
:
dataSource
.
id
,
schemaName
:
parentId
,
tableName
:
name
});
});
setTableColumns
(
columnsData
);
setTableColumns
(
columnsData
);
setGenSQL
(
genSQLData
);
setTableInfo
(
fullInfo
);
setTableInfo
(
fullInfo
);
}
else
{
}
else
{
clearState
();
clearState
();
...
@@ -129,13 +133,14 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
...
@@ -129,13 +133,14 @@ const DataSourceDetail: React.FC<DataSourceDetailProps> = (props) => {
{
/* tree */
}
{
/* tree */
}
<
SchemaTree
onNodeClick=
{
(
info
:
any
)
=>
onSchemaTreeNodeClick
(
info
)
}
treeData=
{
treeData
}
/>
<
SchemaTree
onNodeClick=
{
(
info
:
any
)
=>
onSchemaTreeNodeClick
(
info
)
}
treeData=
{
treeData
}
/>
</
ProCard
>
</
ProCard
>
<
ProCard
headerBordered
>
<
ProCard
colSpan=
"80%"
loading=
{
loading
}
ghost
headerBordered
>
{
/* tags */
}
{
/* tags */
}
<
RightTagsRouter
<
RightTagsRouter
tableInfo=
{
tableInfo
}
tableInfo=
{
tableInfo
}
tableColumns=
{
tableColumns
}
tableColumns=
{
tableColumns
}
genSQL=
{
genSQL
}
queryParams=
{
params
}
rightButtons=
{
renderBackButton
()
}
rightButtons=
{
renderBackButton
()
}
tagDisabled=
{
disabled
}
/>
/>
</
ProCard
>
</
ProCard
>
</
ProCard
>
</
ProCard
>
...
...
dinky-web/src/pages/RegCenter/DataSource/components/constants.ts
View file @
e119a075
...
@@ -131,3 +131,27 @@ export const AUTO_COMPLETE_TYPE = [
...
@@ -131,3 +131,27 @@ export const AUTO_COMPLETE_TYPE = [
label
:
'jdbc:presto://localhost:8080/dinky'
,
label
:
'jdbc:presto://localhost:8080/dinky'
,
},
},
];
];
export
const
QUERY_KEYWORD
=
[
'and'
,
'or'
,
'not'
,
'in'
,
'like'
,
'between'
,
'is null'
,
'is not null'
,
'is not'
,
'='
,
'!='
,
'<'
,
'>'
,
'<='
,
'>='
,
'<>'
,
'!'
,
'desc'
,
'asc'
,
'not in ()'
,
];
dinky-web/src/pages/RegCenter/DataSource/components/function.tsx
View file @
e119a075
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
*/
*/
import
{
DATA_SOURCE_TYPE
}
from
"@/pages/RegCenter/DataSource/components/constants"
;
import
{
DATA_SOURCE_TYPE
,
QUERY_KEYWORD
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DefaultOptionType
}
from
"antd/es/select"
;
import
{
DefaultOptionType
}
from
"antd/es/select"
;
import
{
import
{
ClickHouseIcons
,
DefaultDBIcons
,
ClickHouseIcons
,
DefaultDBIcons
,
...
@@ -74,3 +74,11 @@ export const renderDataSourceType = () => {
...
@@ -74,3 +74,11 @@ export const renderDataSourceType = () => {
});
});
return
dataSourceType
;
return
dataSourceType
;
};
};
export
const
buildColumnsQueryKeyWord
=
(
data
:
string
[])
=>
{
const
result
=
data
.
concat
(
QUERY_KEYWORD
).
map
((
item
:
string
|
number
)
=>
({
value
:
item
,
label
:
item
,
}))
return
result
}
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx
View file @
e119a075
...
@@ -25,9 +25,9 @@ import {l} from "@/utils/intl";
...
@@ -25,9 +25,9 @@ import {l} from "@/utils/intl";
import
{
AutoSteps
,
BuildMsgData
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps/AutoSteps"
;
import
{
AutoSteps
,
BuildMsgData
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps/AutoSteps"
;
import
{
JavaSteps
,
PythonSteps
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps/constants"
;
import
{
JavaSteps
,
PythonSteps
}
from
"@/pages/RegCenter/GitProject/components/BuildSteps/constants"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
Exception
from
"@@/plugin-layout/Exception"
;
import
integer
from
"async-validator/dist-types/validator/integer"
;
import
proxy
from
"../../../../../../config/proxy"
;
import
proxy
from
"../../../../../../config/proxy"
;
import
{
renderStatus
}
from
'@/pages/RegCenter/GitProject/function'
;
import
{
BuildStepsState
}
from
'@/pages/RegCenter/GitProject/data.d'
;
/**
/**
...
@@ -39,16 +39,6 @@ type BuildStepsProps = {
...
@@ -39,16 +39,6 @@ type BuildStepsProps = {
values
:
Partial
<
GitProject
>
;
values
:
Partial
<
GitProject
>
;
};
};
export
type
BuildStepsState
=
{
key
:
number
;
title
:
string
;
status
:
string
;
description
:
string
;
disabled
:
boolean
;
onClick
:
()
=>
void
;
}
export
const
BuildSteps
:
React
.
FC
<
BuildStepsProps
>
=
(
props
)
=>
{
export
const
BuildSteps
:
React
.
FC
<
BuildStepsProps
>
=
(
props
)
=>
{
/**
/**
...
@@ -59,39 +49,19 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -59,39 +49,19 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
modalVisible
,
modalVisible
,
values
,
values
,
}
=
props
;
}
=
props
;
le
t
[
logList
,
setLogList
]
=
useState
<
Record
<
number
,
string
[]
>>
({});
cons
t
[
logList
,
setLogList
]
=
useState
<
Record
<
number
,
string
[]
>>
({});
const
[
log
,
setLog
]
=
useState
<
string
>
(
""
);
const
[
log
,
setLog
]
=
useState
<
string
>
(
""
);
const
[
currentStep
,
setCurrentStep
]
=
useState
<
number
>
(
0
);
const
[
currentStep
,
setCurrentStep
]
=
useState
<
number
>
(
0
);
const
[
showList
,
setShowList
]
=
useState
<
boolean
>
(
false
);
const
[
showList
,
setShowList
]
=
useState
<
boolean
>
(
false
);
const
[
percent
,
setPercent
]
=
useState
<
number
>
(
0
);
const
[
percent
,
setPercent
]
=
useState
<
number
>
(
0
);
const
[
currentDataMsg
,
setCurrentDataMsg
]
=
useState
<
BuildMsgData
>
();
const
[
currentDataMsg
,
setCurrentDataMsg
]
=
useState
<
BuildMsgData
>
();
const
[
buildSteps
,
setBuildSteps
]
=
useState
<
Partial
<
any
[]
>>
([]);
const
[
steps
,
handleSteps
]
=
useState
<
BuildStepsState
[]
>
([]);
const
[
steps
,
handleSteps
]
=
useState
<
BuildStepsState
[]
>
([]);
const
buildStepList
=
()
=>
{
if
(
values
.
codeType
===
1
)
{
// if code type is java then build java steps
setBuildSteps
(
JavaSteps
);
}
else
{
setBuildSteps
(
PythonSteps
);
}
};
const
renderStatus
=
(
status
:
number
)
=>
{
let
statusTemp
=
""
;
if
(
status
===
0
)
{
statusTemp
=
"error"
;
}
else
if
(
status
===
1
)
{
statusTemp
=
"process"
;
}
else
if
(
status
===
2
)
{
statusTemp
=
"finish"
;
}
else
{
statusTemp
=
"wait"
;
}
return
statusTemp
;
}
/**
* render step title
* @param step
*/
const
renderTitle
=
(
step
:
number
)
=>
{
const
renderTitle
=
(
step
:
number
)
=>
{
return
(
values
.
codeType
===
1
?
JavaSteps
:
PythonSteps
)[
step
-
1
].
title
;
return
(
values
.
codeType
===
1
?
JavaSteps
:
PythonSteps
)[
step
-
1
].
title
;
}
}
...
@@ -109,10 +79,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -109,10 +79,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
// const eventSource = new EventSource("http://127.0.0.1:8888" + API_CONSTANTS.GIT_PROJECT_BUILD_STEP_LOGS + "?id=" + values.id);
// const eventSource = new EventSource("http://127.0.0.1:8888" + API_CONSTANTS.GIT_PROJECT_BUILD_STEP_LOGS + "?id=" + values.id);
const
eventSource
=
new
EventSource
(
url
+
API_CONSTANTS
.
GIT_PROJECT_BUILD_STEP_LOGS
+
"?id="
+
values
.
id
);
const
eventSource
=
new
EventSource
(
url
+
API_CONSTANTS
.
GIT_PROJECT_BUILD_STEP_LOGS
+
"?id="
+
values
.
id
);
let
stepArray
:
BuildStepsState
[]
=
[];
// 步骤数组
buildStepList
();
let
stepArray
:
BuildStepsState
[]
=
[];
let
globalCurrentStep
:
number
=
0
;
let
globalCurrentStep
:
number
=
0
;
let
execNum
:
number
=
0
;
let
execNum
:
number
=
0
;
let
stepNum
:
number
=
1
;
let
stepNum
:
number
=
1
;
...
@@ -124,20 +91,20 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -124,20 +91,20 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
try
{
try
{
// type // 1是总状态 2是log 3是部分状态
// type // 1是总状态 2是log 3是部分状态
// status // 0是失败 1是进行中 2 完成
// status // 0是失败 1是进行中 2 完成
let
result
Msg
=
JSON
.
parse
(
e
.
data
);
let
result
=
JSON
.
parse
(
e
.
data
);
const
{
currentStep
,
type
,
data
,
status
,
history
}
=
result
Msg
;
const
{
currentStep
,
type
,
data
,
status
,
history
}
=
result
;
if
(
type
===
0
)
{
if
(
type
===
0
)
{
if
(
execNum
===
1
)
{
if
(
execNum
===
1
)
{
logList
=
{}
;
setLogList
({})
;
}
}
execNum
++
;
execNum
++
;
let
a1
=
JSON
.
parse
(
data
);
let
parseResultData
=
JSON
.
parse
(
data
);
// parse data
stepNum
=
a1
.
length
;
stepNum
=
parseResultData
.
length
;
// get step num
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
setPercent
(
parseInt
(
String
(
100
/
stepNum
*
currentStep
)));
// set percent
setCurrentStep
(
currentStep
);
setCurrentStep
(
currentStep
);
// set current step
stepArray
=
a1
.
map
((
item
:
any
)
=>
{
stepArray
=
parseResultData
.
map
((
item
:
any
)
=>
{
return
{
return
{
key
:
item
.
step
,
key
:
item
.
step
,
title
:
renderTitle
(
item
.
step
),
title
:
renderTitle
(
item
.
step
),
...
@@ -182,10 +149,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
...
@@ -182,10 +149,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
}
}
setCurrentDataMsg
(
result
Msg
);
setCurrentDataMsg
(
result
);
if
((
status
===
2
||
status
===
0
)
&&
history
===
false
)
{
if
((
status
===
2
||
status
===
0
)
&&
history
===
false
)
{
eventSource
.
close
();
eventSource
.
close
();
console
.
log
(
"build success --- close"
)
}
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
dinky-web/src/pages/RegCenter/GitProject/components/CodeTree/CodeTreeShow/index.tsx
View file @
e119a075
...
@@ -57,7 +57,6 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => {
...
@@ -57,7 +57,6 @@ export const CodeTreeShow: React.FC<CodeTreeShowProps> = (props) => {
setLoading
(
true
);
setLoading
(
true
);
await
handleData
(
API_CONSTANTS
.
GIT_PROJECT_CODE_TREE
,
values
.
id
).
then
((
res
)
=>
{
await
handleData
(
API_CONSTANTS
.
GIT_PROJECT_CODE_TREE
,
values
.
id
).
then
((
res
)
=>
{
setTreeData
(
res
);
setTreeData
(
res
);
console
.
log
(
res
);
});
});
setLoading
(
false
);
setLoading
(
false
);
};
};
...
...
dinky-web/src/pages/RegCenter/GitProject/data.d.tsx
0 → 100644
View file @
e119a075
/*
* 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.
*/
export
type
BuildStepsState
=
{
key
:
number
;
title
:
string
;
status
:
string
;
description
:
string
;
disabled
:
boolean
;
onClick
:
()
=>
void
;
}
dinky-web/src/pages/RegCenter/GitProject/function.tsx
0 → 100644
View file @
e119a075
/*
* 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.
*/
/**
* render status
* @param status
*/
export
const
renderStatus
=
(
status
:
number
)
=>
{
let
statusTemp
=
""
;
// temp
if
(
status
===
0
)
{
statusTemp
=
"error"
;
}
else
if
(
status
===
1
)
{
statusTemp
=
"process"
;
}
else
if
(
status
===
2
)
{
statusTemp
=
"finish"
;
}
else
{
statusTemp
=
"wait"
;
}
return
statusTemp
;
}
dinky-web/src/services/BusinessCrud.ts
View file @
e119a075
...
@@ -147,13 +147,14 @@ export const updateEnabled = async (url: string, params: any) => {
...
@@ -147,13 +147,14 @@ export const updateEnabled = async (url: string, params: any) => {
export
const
handleOption
=
async
(
url
:
string
,
title
:
string
,
param
:
any
)
=>
{
export
const
handleOption
=
async
(
url
:
string
,
title
:
string
,
param
:
any
)
=>
{
await
LoadingMessageAsync
(
l
(
'app.request.running'
)
+
title
);
await
LoadingMessageAsync
(
l
(
'app.request.running'
)
+
title
);
try
{
try
{
const
{
code
,
msg
}
=
await
postAll
(
url
,
param
);
const
result
=
await
postAll
(
url
,
param
);
if
(
code
===
RESPONSE_CODE
.
SUCCESS
)
{
if
(
result
.
code
===
RESPONSE_CODE
.
SUCCESS
)
{
SuccessMessage
(
msg
);
SuccessMessage
(
result
.
msg
);
return
result
;
}
else
{
}
else
{
WarningMessage
(
msg
);
WarningMessage
(
result
.
msg
);
return
false
;
}
}
return
true
;
}
catch
(
error
)
{
}
catch
(
error
)
{
return
false
;
return
false
;
}
}
...
...
dinky-web/src/services/constants.tsx
View file @
e119a075
...
@@ -95,6 +95,7 @@ export const API_CONSTANTS = {
...
@@ -95,6 +95,7 @@ export const API_CONSTANTS = {
DATASOURCE_GET_SCHEMA_TABLES
:
"/api/database/getSchemasAndTables"
,
DATASOURCE_GET_SCHEMA_TABLES
:
"/api/database/getSchemasAndTables"
,
DATASOURCE_GET_COLUMNS_BY_TABLE
:
"/api/database/listColumns"
,
DATASOURCE_GET_COLUMNS_BY_TABLE
:
"/api/database/listColumns"
,
DATASOURCE_GET_GEN_SQL
:
"/api/database/getSqlGeneration"
,
DATASOURCE_GET_GEN_SQL
:
"/api/database/getSqlGeneration"
,
DATASOURCE_QUERY_DATA
:
"/api/database/queryData"
,
// document list
// document list
...
...
dinky-web/src/utils/function.tsx
View file @
e119a075
...
@@ -27,6 +27,7 @@ import {
...
@@ -27,6 +27,7 @@ import {
JavaSvg
,
JavaSvg
,
LogSvg
,
LogSvg
,
MarkDownSvg
,
MarkDownSvg
,
PythonSvg
,
ScalaSvg
,
ScalaSvg
,
ShellSvg
,
ShellSvg
,
XMLSvg
,
XMLSvg
,
...
@@ -187,7 +188,6 @@ export const getLanguage = (type: string): string => {
...
@@ -187,7 +188,6 @@ export const getLanguage = (type: string): string => {
case
DIALECT
.
SCALA
:
case
DIALECT
.
SCALA
:
return
DIALECT
.
SCALA
;
return
DIALECT
.
SCALA
;
case
DIALECT
.
PYTHON
:
case
DIALECT
.
PYTHON
:
return
DIALECT
.
PYTHON
;
case
DIALECT
.
PYTHON_LONG
:
case
DIALECT
.
PYTHON_LONG
:
return
DIALECT
.
PYTHON_LONG
;
return
DIALECT
.
PYTHON_LONG
;
case
DIALECT
.
SQL
:
case
DIALECT
.
SQL
:
...
@@ -207,6 +207,9 @@ export const getIcon = (type: string) => {
...
@@ -207,6 +207,9 @@ export const getIcon = (type: string) => {
return
<
JavaSvg
/>;
return
<
JavaSvg
/>;
case
DIALECT
.
SCALA
:
case
DIALECT
.
SCALA
:
return
<
ScalaSvg
/>;
return
<
ScalaSvg
/>;
case
DIALECT
.
PYTHON
:
case
DIALECT
.
PYTHON_LONG
:
return
<
PythonSvg
/>;
case
DIALECT
.
MD
:
case
DIALECT
.
MD
:
case
DIALECT
.
MDX
:
case
DIALECT
.
MDX
:
return
<
MarkDownSvg
/>;
return
<
MarkDownSvg
/>;
...
...
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