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
2c644be3
Unverified
Commit
2c644be3
authored
Aug 18, 2023
by
Licho
Committed by
GitHub
Aug 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: some trivial refactor (#2243)
Signed-off-by:
Licho
<
lecho.sun@gmail.com
>
parent
748d4780
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
21 additions
and
44 deletions
+21
-44
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+0
-3
function.tsx
dinky-web/src/pages/AuthCenter/Menu/function.tsx
+3
-7
index.tsx
...src/pages/AuthCenter/Role/components/AssignMenu/index.tsx
+1
-6
index.tsx
.../pages/AuthCenter/Role/components/RoleModalForm/index.tsx
+2
-2
index.tsx
...c/pages/AuthCenter/Role/components/RoleProTable/index.tsx
+1
-1
index.tsx
...ons/components/PermissionsModal/PermissionsForm/index.tsx
+4
-10
index.tsx
...nter/RowPermissions/components/PermissionsModal/index.tsx
+2
-5
index.tsx
...r/RowPermissions/components/PermissionsProTable/index.tsx
+1
-1
index.tsx
...es/AuthCenter/Tenant/components/TenantModalForm/index.tsx
+2
-4
index.tsx
...ges/AuthCenter/Tenant/components/TenantProTable/index.tsx
+1
-1
index.tsx
...obalVar/components/GlobalVarModal/GlobalVarForm/index.tsx
+2
-2
index.tsx
...s/RegCenter/GlobalVar/components/GlobalVarModal/index.tsx
+2
-2
No files found.
dinky-web/src/locales/zh-CN/pages.ts
View file @
2c644be3
...
@@ -1152,9 +1152,6 @@ export default {
...
@@ -1152,9 +1152,6 @@ export default {
'pages.datastudio.footer.codePosition'
:
'行{Ln}:列{Col} '
,
'pages.datastudio.footer.codePosition'
:
'行{Ln}:列{Col} '
,
'pages.datastudio.label.result.query.latest.data'
:
'获取最新数据'
,
'pages.datastudio.label.result.query.latest.data'
:
'获取最新数据'
,
'pages.datastudio.help.sqlChangedPrompt'
:
'检测到当前页远程有更改,是否刷新更新数据?'
,
'pages.datastudio.help.sqlChanged'
:
'Sql内容或配置变更'
,
'datastudio.middle.qg'
:
'快捷引导'
,
'datastudio.middle.qg'
:
'快捷引导'
,
'datastudio.middle.qg.clusterInstance'
:
'注册 Session 集群'
,
'datastudio.middle.qg.clusterInstance'
:
'注册 Session 集群'
,
...
...
dinky-web/src/pages/AuthCenter/Menu/function.tsx
View file @
2c644be3
...
@@ -29,8 +29,8 @@ export const IconRender = ({ icon }: { icon: string }) => {
...
@@ -29,8 +29,8 @@ export const IconRender = ({ icon }: { icon: string }) => {
return
icon
?
React
.
createElement
(
Icons
[
icon
])
:
null
;
return
icon
?
React
.
createElement
(
Icons
[
icon
])
:
null
;
};
};
const
renderMenuType
=
(
menu
Y
ype
:
string
)
=>
{
const
renderMenuType
=
(
menu
T
ype
:
string
)
=>
{
switch
(
menu
Y
ype
)
{
switch
(
menu
T
ype
)
{
case
'F'
:
case
'F'
:
return
<>
{
l
(
'menu.type.button'
)
}
</>;
return
<>
{
l
(
'menu.type.button'
)
}
</>;
case
'M'
:
case
'M'
:
...
@@ -111,7 +111,7 @@ export const buildMenuTree = (
...
@@ -111,7 +111,7 @@ export const buildMenuTree = (
// 获取当前级别最大的 orderNum
// 获取当前级别最大的 orderNum
let
maxChildOrderNum
=
let
maxChildOrderNum
=
item
.
children
&&
item
.
children
.
length
>
0
item
.
children
?
.
length
>
0
?
Math
.
max
(...
item
.
children
.
map
((
item
)
=>
item
.
orderNum
))
?
Math
.
max
(...
item
.
children
.
map
((
item
)
=>
item
.
orderNum
))
:
item
.
orderNum
;
:
item
.
orderNum
;
...
@@ -154,10 +154,6 @@ export const buildMenuTree = (
...
@@ -154,10 +154,6 @@ export const buildMenuTree = (
/**
/**
* build menu form tree (filter button)
* build menu form tree (filter button)
* @param {SysMenu[]} data
* @param {string} searchValue
* @param {boolean} filterButton
* @returns {any}
*/
*/
export
const
buildMenuFormTree
=
(
export
const
buildMenuFormTree
=
(
...
...
dinky-web/src/pages/AuthCenter/Role/components/AssignMenu/index.tsx
View file @
2c644be3
...
@@ -61,7 +61,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -61,7 +61,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
/**
/**
* close
* close
* @type {() => void}
*/
*/
const
handleClose
=
useCallback
(()
=>
{
const
handleClose
=
useCallback
(()
=>
{
onClose
();
onClose
();
...
@@ -73,14 +72,13 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -73,14 +72,13 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
*/
*/
const
handleSubmit
=
async
()
=>
{
const
handleSubmit
=
async
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
await
onSubmit
(
selectValue
);
onSubmit
(
selectValue
);
setLoading
(
false
);
setLoading
(
false
);
setMenuData
({
menus
:
[],
selectedMenuIds
:
[]
});
setMenuData
({
menus
:
[],
selectedMenuIds
:
[]
});
};
};
/**
/**
* render extra buttons
* render extra buttons
* @returns {JSX.Element}
*/
*/
const
renderExtraButtons
=
()
=>
{
const
renderExtraButtons
=
()
=>
{
return
(
return
(
...
@@ -97,7 +95,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -97,7 +95,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
/**
/**
* search tree node
* search tree node
* @type {(e: {target: {value: React.SetStateAction<string>}}) => void}
*/
*/
const
onSearchChange
=
useCallback
(
const
onSearchChange
=
useCallback
(
(
e
:
{
target
:
{
value
:
React
.
SetStateAction
<
string
>
}
})
=>
{
(
e
:
{
target
:
{
value
:
React
.
SetStateAction
<
string
>
}
})
=>
{
...
@@ -111,7 +108,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -111,7 +108,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
};
};
return
(
return
(
<>
<
Drawer
<
Drawer
title=
{
l
(
'role.assignMenu'
,
''
,
{
roleName
:
values
.
roleName
})
}
title=
{
l
(
'role.assignMenu'
,
''
,
{
roleName
:
values
.
roleName
})
}
open=
{
open
}
open=
{
open
}
...
@@ -149,7 +145,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
...
@@ -149,7 +145,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
<
Empty
className=
{
'code-content-empty'
}
/>
<
Empty
className=
{
'code-content-empty'
}
/>
)
}
)
}
</
Drawer
>
</
Drawer
>
</>
);
);
};
};
...
...
dinky-web/src/pages/AuthCenter/Role/components/RoleModalForm/index.tsx
View file @
2c644be3
...
@@ -76,8 +76,8 @@ const RoleModalForm: React.FC<RoleModalProps> = (props) => {
...
@@ -76,8 +76,8 @@ const RoleModalForm: React.FC<RoleModalProps> = (props) => {
*/
*/
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleCancel
();
};
};
/**
/**
...
...
dinky-web/src/pages/AuthCenter/Role/components/RoleProTable/index.tsx
View file @
2c644be3
...
@@ -54,7 +54,7 @@ const RoleProTable: React.FC = () => {
...
@@ -54,7 +54,7 @@ const RoleProTable: React.FC = () => {
const
actionRef
=
useRef
<
ActionType
>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
await
callback
();
await
callback
();
setLoading
(
false
);
setLoading
(
false
);
...
...
dinky-web/src/pages/AuthCenter/RowPermissions/components/PermissionsModal/PermissionsForm/index.tsx
View file @
2c644be3
...
@@ -43,7 +43,6 @@ type PermissionsFormProps = {
...
@@ -43,7 +43,6 @@ type PermissionsFormProps = {
/**
/**
* CodeEditProps
* CodeEditProps
* @type {{lineNumbers: string, height: string}}
*/
*/
const
CodeEditProps
=
{
const
CodeEditProps
=
{
height
:
'25vh'
,
height
:
'25vh'
,
...
@@ -52,26 +51,21 @@ const CodeEditProps = {
...
@@ -52,26 +51,21 @@ const CodeEditProps = {
const
PermissionsForm
:
React
.
FC
<
PermissionsFormProps
>
=
(
props
)
=>
{
const
PermissionsForm
:
React
.
FC
<
PermissionsFormProps
>
=
(
props
)
=>
{
const
{
values
,
roles
,
form
}
=
props
;
const
{
values
,
roles
,
form
}
=
props
;
const
[
expression
,
setExpression
]
=
useState
<
string
>
(
values
.
expression
||
''
);
const
[
expression
,
setExpression
]
=
useState
<
string
>
(
values
.
expression
??
''
);
/**
/**
* get role options
* get role options
* @returns {DefaultOptionType[]}
*/
*/
const
getRoleOptions
=
()
=>
{
const
getRoleOptions
=
()
=>
{
const
itemList
:
DefaultOptionType
[]
=
[];
const
itemList
:
DefaultOptionType
[]
=
roles
.
map
((
item
)
=>
({
roles
.
map
((
item
)
=>
{
return
itemList
.
push
({
label
:
item
.
roleName
,
label
:
item
.
roleName
,
value
:
item
.
id
,
value
:
item
.
id
,
});
}));
});
return
itemList
;
return
itemList
;
};
};
/**
/**
* render row permissions form
* render row permissions form
* @returns {JSX.Element}
*/
*/
const
renderRowPermissionsForm
=
()
=>
{
const
renderRowPermissionsForm
=
()
=>
{
return
(
return
(
...
@@ -111,7 +105,7 @@ const PermissionsForm: React.FC<PermissionsFormProps> = (props) => {
...
@@ -111,7 +105,7 @@ const PermissionsForm: React.FC<PermissionsFormProps> = (props) => {
>
>
<
CodeEdit
<
CodeEdit
onChange=
{
(
value
)
=>
{
onChange=
{
(
value
)
=>
{
setExpression
(
value
);
setExpression
(
value
??
''
);
}
}
}
}
code=
{
expression
}
code=
{
expression
}
language=
{
'sql'
}
language=
{
'sql'
}
...
...
dinky-web/src/pages/AuthCenter/RowPermissions/components/PermissionsModal/index.tsx
View file @
2c644be3
...
@@ -91,19 +91,17 @@ export const PermissionsModal: React.FC<RoleSelectPermissionsFormProps> = (
...
@@ -91,19 +91,17 @@ export const PermissionsModal: React.FC<RoleSelectPermissionsFormProps> = (
/**
/**
* submit form
* submit form
* @returns {Promise<void>}
*/
*/
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleCancel
();
};
};
/**
/**
* render
* render
*/
*/
return
(
return
(
<>
<
Modal
<
Modal
{
...
NORMAL_MODAL_OPTIONS
}
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
title=
{
...
@@ -115,6 +113,5 @@ export const PermissionsModal: React.FC<RoleSelectPermissionsFormProps> = (
...
@@ -115,6 +113,5 @@ export const PermissionsModal: React.FC<RoleSelectPermissionsFormProps> = (
>
>
<
PermissionsForm
form=
{
form
}
values=
{
values
}
roles=
{
roleList
}
/>
<
PermissionsForm
form=
{
form
}
values=
{
values
}
roles=
{
roleList
}
/>
</
Modal
>
</
Modal
>
</>
);
);
};
};
dinky-web/src/pages/AuthCenter/RowPermissions/components/PermissionsProTable/index.tsx
View file @
2c644be3
...
@@ -38,7 +38,7 @@ const PermissionsProTable: React.FC = () => {
...
@@ -38,7 +38,7 @@ const PermissionsProTable: React.FC = () => {
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
actionRef
=
useRef
<
ActionType
>
();
const
actionRef
=
useRef
<
ActionType
>
();
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
await
callback
();
await
callback
();
setLoading
(
false
);
setLoading
(
false
);
...
...
dinky-web/src/pages/AuthCenter/Tenant/components/TenantModalForm/index.tsx
View file @
2c644be3
...
@@ -67,15 +67,14 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
...
@@ -67,15 +67,14 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
*/
*/
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleCancel
();
};
};
/**
/**
* render
* render
*/
*/
return
(
return
(
<>
<
Modal
<
Modal
{
...
NORMAL_MODAL_OPTIONS
}
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
values
.
id
?
l
(
'tenant.update'
)
:
l
(
'tenant.create'
)
}
title=
{
values
.
id
?
l
(
'tenant.update'
)
:
l
(
'tenant.create'
)
}
...
@@ -85,7 +84,6 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
...
@@ -85,7 +84,6 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
>
>
<
TenantForm
values=
{
values
}
form=
{
form
}
/>
<
TenantForm
values=
{
values
}
form=
{
form
}
/>
</
Modal
>
</
Modal
>
</>
);
);
};
};
...
...
dinky-web/src/pages/AuthCenter/Tenant/components/TenantProTable/index.tsx
View file @
2c644be3
...
@@ -59,7 +59,7 @@ const TenantProTable: React.FC = () => {
...
@@ -59,7 +59,7 @@ const TenantProTable: React.FC = () => {
);
);
};
};
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
await
callback
();
await
callback
();
setLoading
(
false
);
setLoading
(
false
);
...
...
dinky-web/src/pages/RegCenter/GlobalVar/components/GlobalVarModal/GlobalVarForm/index.tsx
View file @
2c644be3
...
@@ -48,7 +48,7 @@ const GlobalVarForm: React.FC<GlobalVarModalProps> = (props) => {
...
@@ -48,7 +48,7 @@ const GlobalVarForm: React.FC<GlobalVarModalProps> = (props) => {
const
{
values
,
form
}
=
props
;
const
{
values
,
form
}
=
props
;
const
[
globalVarValue
,
setGlobalVarValue
]
=
useState
<
string
>
(
const
[
globalVarValue
,
setGlobalVarValue
]
=
useState
<
string
>
(
values
.
fragmentValue
||
''
,
values
.
fragmentValue
??
''
,
);
);
const
handleGlobalVarChange
=
(
value
:
string
)
=>
{
const
handleGlobalVarChange
=
(
value
:
string
)
=>
{
...
@@ -85,7 +85,7 @@ const GlobalVarForm: React.FC<GlobalVarModalProps> = (props) => {
...
@@ -85,7 +85,7 @@ const GlobalVarForm: React.FC<GlobalVarModalProps> = (props) => {
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.gv.valuePlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.gv.valuePlaceholder'
)
}]
}
>
>
<
CodeEdit
<
CodeEdit
onChange=
{
(
value
)
=>
handleGlobalVarChange
(
value
)
}
onChange=
{
(
value
)
=>
handleGlobalVarChange
(
value
??
''
)
}
code=
{
globalVarValue
}
code=
{
globalVarValue
}
language=
{
'sql'
}
language=
{
'sql'
}
{
...
CodeEditProps
}
{
...
CodeEditProps
}
...
...
dinky-web/src/pages/RegCenter/GlobalVar/components/GlobalVarModal/index.tsx
View file @
2c644be3
...
@@ -75,8 +75,8 @@ const GlobalVarModal: React.FC<GlobalVarModalProps> = (props) => {
...
@@ -75,8 +75,8 @@ const GlobalVarModal: React.FC<GlobalVarModalProps> = (props) => {
*/
*/
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleCancel
();
};
};
return
(
return
(
...
...
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