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
c32067d7
Unverified
Commit
c32067d7
authored
Jun 27, 2023
by
zhu-mingye
Committed by
GitHub
Jun 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimization some code (#2110)
parent
d58f1c3e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
51 deletions
+66
-51
index.tsx
...ce/components/DataSourceModal/DataSourceProForm/index.tsx
+6
-3
constants.ts
...eb/src/pages/RegCenter/DataSource/components/constants.ts
+50
-22
function.tsx
...eb/src/pages/RegCenter/DataSource/components/function.tsx
+1
-17
index.tsx
...rc/pages/RegCenter/Resource/components/FileTree/index.tsx
+1
-6
index.tsx
dinky-web/src/pages/RegCenter/Resource/index.tsx
+8
-3
No files found.
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceModal/DataSourceProForm/index.tsx
View file @
c32067d7
...
...
@@ -21,10 +21,12 @@ import {Values} from 'async-validator';
import
{
ProForm
,
ProFormGroup
,
ProFormSelect
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
AUTO_COMPLETE_TYPE
,
GROUP_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DATA_SOURCE_TYPE_OPTIONS
,
AUTO_COMPLETE_TYPE
,
GROUP_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
AutoComplete
,
Input
}
from
'antd'
;
import
CodeEdit
from
'@/components/CustomEditor/CodeEdit'
;
import
{
renderDataSourceType
}
from
'@/pages/RegCenter/DataSource/components/function'
;
type
DataSourceProFormProps
=
{
values
:
Partial
<
DataSources
.
DataSource
>
,
...
...
@@ -80,7 +82,8 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
width=
{
'sm'
}
label=
{
l
(
'rc.ds.type'
)
}
showSearch
options=
{
renderDataSourceType
()
}
initialValue=
{
dbType
}
options=
{
DATA_SOURCE_TYPE_OPTIONS
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.typePlaceholder'
)}]
}
placeholder=
{
l
(
'rc.ds.typePlaceholder'
)
}
...
...
dinky-web/src/pages/RegCenter/DataSource/components/constants.ts
View file @
c32067d7
...
...
@@ -21,30 +21,58 @@ import {l} from '@/utils/intl';
/**
* data source type
*/
export
const
DATA_SOURCE_TYPE
=
[
{
type
:
'MySQL'
,
},
{
type
:
'Oracle'
,
},
{
type
:
'PostgreSQL'
,
},
{
type
:
'ClickHouse'
,
},
{
type
:
'SQLServer'
,
},
{
type
:
'Doris'
,
},
{
type
:
'Phoenix'
,
},
{
type
:
'Hive'
,
},
{
type
:
'StarRocks'
,
},
{
type
:
'Presto'
,
}
export
const
DATA_SOURCE_TYPE_OPTIONS
=
[
{
label
:
l
(
'rc.ds.source'
),
options
:
[
{
label
:
'MySQL'
,
value
:
'MySQL'
,
},
{
label
:
'Oracle'
,
value
:
'Oracle'
,
},
],
},
{
label
:
l
(
'rc.ds.source'
),
options
:
[
{
label
:
'PostgreSQL'
,
value
:
'PostgreSQL'
,
},
{
label
:
'ClickHouse'
,
value
:
'ClickHouse'
,
},
{
label
:
'SQLServer'
,
value
:
'SQLServer'
,
},
],
},
{
label
:
l
(
'rc.ds.source'
),
options
:
[
{
label
:
'Doris'
,
value
:
'Doris'
,
},
{
label
:
'Phoenix'
,
value
:
'Phoenix'
,
},
{
label
:
'Hive'
,
value
:
'Hive'
,
},
{
label
:
'StarRocks'
,
value
:
'StarRocks'
,
},
{
label
:
'Presto'
,
value
:
'Presto'
,
}
],
}
];
/**
* data source group type
*/
...
...
dinky-web/src/pages/RegCenter/DataSource/components/function.tsx
View file @
c32067d7
...
...
@@ -16,8 +16,7 @@
*/
import
{
DATA_SOURCE_TYPE
,
QUERY_KEYWORD
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
import
{
QUERY_KEYWORD
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
ClickHouseIcons
,
DefaultDBIcons
,
DorisIcons
,
HiveIcons
,
...
...
@@ -60,21 +59,6 @@ export const renderDBIcon = (type: string, size?: number) => {
}
};
/**
* render DataSourceType
*/
export
const
renderDataSourceType
=
()
=>
{
let
dataSourceType
:
DefaultOptionType
[]
=
[];
DATA_SOURCE_TYPE
.
forEach
((
item
:
{
type
:
string
})
=>
{
dataSourceType
.
push
({
key
:
item
.
type
,
value
:
item
.
type
,
label
:
item
.
type
,
});
});
return
dataSourceType
;
};
export
const
buildColumnsQueryKeyWord
=
(
data
:
string
[])
=>
{
const
result
=
data
.
concat
(
QUERY_KEYWORD
).
map
((
item
:
string
|
number
)
=>
({
value
:
item
,
...
...
dinky-web/src/pages/RegCenter/Resource/components/FileTree/index.tsx
View file @
c32067d7
...
...
@@ -39,16 +39,11 @@ const FileTree: React.FC<FileTreeProps> = (props) => {
const
{
treeData
,
onNodeClick
,
onRightClick
}
=
props
;
return
<>
<
DirectoryTree
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
onRightClick=
{
info
=>
onRightClick
(
info
)
}
treeData=
{
buildTreeData
(
treeData
)
}
/>
{
(
treeData
.
length
>
0
)
?
<
DirectoryTree
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
onRightClick=
{
info
=>
onRightClick
(
info
)
}
treeData=
{
buildTreeData
(
treeData
)
}
/>
:
<>
...
...
dinky-web/src/pages/RegCenter/Resource/index.tsx
View file @
c32067d7
...
...
@@ -19,9 +19,13 @@
import
ResourceOverView
from
"@/pages/RegCenter/Resource/components/ResourceOverView"
;
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
import
Scale
from
"@/components/Animation/Scale"
;
export
default
()
=>
{
return
<>
<
ResourceOverView
/>
</>
return
<
Scale
>
<
PageContainer
breadcrumb=
{
{
style
:
{
display
:
'none'
}}
}
title=
{
false
}
>
<
ResourceOverView
/>
</
PageContainer
>
</
Scale
>
}
\ No newline at end of file
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