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
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
23 additions
and
46 deletions
+23
-46
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
+6
-12
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 {
'pages.datastudio.footer.codePosition'
:
'行{Ln}:列{Col} '
,
'pages.datastudio.label.result.query.latest.data'
:
'获取最新数据'
,
'pages.datastudio.help.sqlChangedPrompt'
:
'检测到当前页远程有更改,是否刷新更新数据?'
,
'pages.datastudio.help.sqlChanged'
:
'Sql内容或配置变更'
,
'datastudio.middle.qg'
:
'快捷引导'
,
'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 }) => {
return
icon
?
React
.
createElement
(
Icons
[
icon
])
:
null
;
};
const
renderMenuType
=
(
menu
Y
ype
:
string
)
=>
{
switch
(
menu
Y
ype
)
{
const
renderMenuType
=
(
menu
T
ype
:
string
)
=>
{
switch
(
menu
T
ype
)
{
case
'F'
:
return
<>
{
l
(
'menu.type.button'
)
}
</>;
case
'M'
:
...
...
@@ -111,7 +111,7 @@ export const buildMenuTree = (
// 获取当前级别最大的 orderNum
let
maxChildOrderNum
=
item
.
children
&&
item
.
children
.
length
>
0
item
.
children
?
.
length
>
0
?
Math
.
max
(...
item
.
children
.
map
((
item
)
=>
item
.
orderNum
))
:
item
.
orderNum
;
...
...
@@ -154,10 +154,6 @@ export const buildMenuTree = (
/**
* build menu form tree (filter button)
* @param {SysMenu[]} data
* @param {string} searchValue
* @param {boolean} filterButton
* @returns {any}
*/
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) => {
/**
* close
* @type {() => void}
*/
const
handleClose
=
useCallback
(()
=>
{
onClose
();
...
...
@@ -73,14 +72,13 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
*/
const
handleSubmit
=
async
()
=>
{
setLoading
(
true
);
await
onSubmit
(
selectValue
);
onSubmit
(
selectValue
);
setLoading
(
false
);
setMenuData
({
menus
:
[],
selectedMenuIds
:
[]
});
};
/**
* render extra buttons
* @returns {JSX.Element}
*/
const
renderExtraButtons
=
()
=>
{
return
(
...
...
@@ -97,7 +95,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
/**
* search tree node
* @type {(e: {target: {value: React.SetStateAction<string>}}) => void}
*/
const
onSearchChange
=
useCallback
(
(
e
:
{
target
:
{
value
:
React
.
SetStateAction
<
string
>
}
})
=>
{
...
...
@@ -111,7 +108,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
};
return
(
<>
<
Drawer
title=
{
l
(
'role.assignMenu'
,
''
,
{
roleName
:
values
.
roleName
})
}
open=
{
open
}
...
...
@@ -149,7 +145,6 @@ const AssignMenu: React.FC<AssignMenuProps> = (props) => {
<
Empty
className=
{
'code-content-empty'
}
/>
)
}
</
Drawer
>
</>
);
};
...
...
dinky-web/src/pages/AuthCenter/Role/components/RoleModalForm/index.tsx
View file @
2c644be3
...
...
@@ -76,8 +76,8 @@ const RoleModalForm: React.FC<RoleModalProps> = (props) => {
*/
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleSubmit
({
...
values
,
...
fieldsValue
});
handleCancel
();
};
/**
...
...
dinky-web/src/pages/AuthCenter/Role/components/RoleProTable/index.tsx
View file @
2c644be3
...
...
@@ -54,7 +54,7 @@ const RoleProTable: React.FC = () => {
const
actionRef
=
useRef
<
ActionType
>
();
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
await
callback
();
setLoading
(
false
);
...
...
dinky-web/src/pages/AuthCenter/RowPermissions/components/PermissionsModal/PermissionsForm/index.tsx
View file @
2c644be3
...
...
@@ -43,7 +43,6 @@ type PermissionsFormProps = {
/**
* CodeEditProps
* @type {{lineNumbers: string, height: string}}
*/
const
CodeEditProps
=
{
height
:
'25vh'
,
...
...
@@ -52,26 +51,21 @@ const CodeEditProps = {
const
PermissionsForm
:
React
.
FC
<
PermissionsFormProps
>
=
(
props
)
=>
{
const
{
values
,
roles
,
form
}
=
props
;
const
[
expression
,
setExpression
]
=
useState
<
string
>
(
values
.
expression
||
''
);
const
[
expression
,
setExpression
]
=
useState
<
string
>
(
values
.
expression
??
''
);
/**
* get role options
* @returns {DefaultOptionType[]}
*/
const
getRoleOptions
=
()
=>
{
const
itemList
:
DefaultOptionType
[]
=
[];
roles
.
map
((
item
)
=>
{
return
itemList
.
push
({
label
:
item
.
roleName
,
value
:
item
.
id
,
});
});
const
itemList
:
DefaultOptionType
[]
=
roles
.
map
((
item
)
=>
({
label
:
item
.
roleName
,
value
:
item
.
id
,
}));
return
itemList
;
};
/**
* render row permissions form
* @returns {JSX.Element}
*/
const
renderRowPermissionsForm
=
()
=>
{
return
(
...
...
@@ -111,7 +105,7 @@ const PermissionsForm: React.FC<PermissionsFormProps> = (props) => {
>
<
CodeEdit
onChange=
{
(
value
)
=>
{
setExpression
(
value
);
setExpression
(
value
??
''
);
}
}
code=
{
expression
}
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> = (
/**
* submit form
* @returns {Promise<void>}
*/
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleSubmit
({
...
values
,
...
fieldsValue
});
handleCancel
();
};
/**
* render
*/
return
(
<>
<
Modal
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
...
...
@@ -115,6 +113,5 @@ export const PermissionsModal: React.FC<RoleSelectPermissionsFormProps> = (
>
<
PermissionsForm
form=
{
form
}
values=
{
values
}
roles=
{
roleList
}
/>
</
Modal
>
</>
);
};
dinky-web/src/pages/AuthCenter/RowPermissions/components/PermissionsProTable/index.tsx
View file @
2c644be3
...
...
@@ -38,7 +38,7 @@ const PermissionsProTable: React.FC = () => {
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
actionRef
=
useRef
<
ActionType
>
();
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
await
callback
();
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) => {
*/
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleSubmit
({
...
values
,
...
fieldsValue
});
handleCancel
();
};
/**
* render
*/
return
(
<>
<
Modal
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
values
.
id
?
l
(
'tenant.update'
)
:
l
(
'tenant.create'
)
}
...
...
@@ -85,7 +84,6 @@ const TenantModalForm: React.FC<TenantModalFormProps> = (props) => {
>
<
TenantForm
values=
{
values
}
form=
{
form
}
/>
</
Modal
>
</>
);
};
...
...
dinky-web/src/pages/AuthCenter/Tenant/components/TenantProTable/index.tsx
View file @
2c644be3
...
...
@@ -59,7 +59,7 @@ const TenantProTable: React.FC = () => {
);
};
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
void
)
=>
{
const
executeAndCallbackRefresh
=
async
(
callback
:
()
=>
Promise
<
void
>
)
=>
{
setLoading
(
true
);
await
callback
();
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) => {
const
{
values
,
form
}
=
props
;
const
[
globalVarValue
,
setGlobalVarValue
]
=
useState
<
string
>
(
values
.
fragmentValue
||
''
,
values
.
fragmentValue
??
''
,
);
const
handleGlobalVarChange
=
(
value
:
string
)
=>
{
...
...
@@ -85,7 +85,7 @@ const GlobalVarForm: React.FC<GlobalVarModalProps> = (props) => {
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.gv.valuePlaceholder'
)
}]
}
>
<
CodeEdit
onChange=
{
(
value
)
=>
handleGlobalVarChange
(
value
)
}
onChange=
{
(
value
)
=>
handleGlobalVarChange
(
value
??
''
)
}
code=
{
globalVarValue
}
language=
{
'sql'
}
{
...
CodeEditProps
}
...
...
dinky-web/src/pages/RegCenter/GlobalVar/components/GlobalVarModal/index.tsx
View file @
2c644be3
...
...
@@ -75,8 +75,8 @@ const GlobalVarModal: React.FC<GlobalVarModalProps> = (props) => {
*/
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
await
handleSubmit
({
...
values
,
...
fieldsValue
});
await
handleCancel
();
handleSubmit
({
...
values
,
...
fieldsValue
});
handleCancel
();
};
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