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
5d87ce9c
Unverified
Commit
5d87ce9c
authored
Jun 14, 2024
by
Zzm0809
Committed by
GitHub
Jun 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix] Fix compatibility issues with MySQL stored procedures (#3594)
Signed-off-by:
Zzm0809
<
934230207@qq.com
>
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
d33d97f6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
124 deletions
+127
-124
V1.1.0__release.sql
...src/main/resources/db/migration/mysql/V1.1.0__release.sql
+1
-1
constants.ts
...r/Alert/AlertRule/AlertRuleList/RuleEditForm/constants.ts
+10
-10
function.tsx
...r/Alert/AlertRule/AlertRuleList/RuleEditForm/function.tsx
+2
-2
index.tsx
...nter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx
+113
-110
data.d.ts
dinky-web/src/types/SettingCenter/data.d.ts
+1
-1
No files found.
dinky-admin/src/main/resources/db/migration/mysql/V1.1.0__release.sql
View file @
5d87ce9c
...
...
@@ -15,7 +15,7 @@ SET FOREIGN_KEY_CHECKS = 0;
DELIMITER
$$
DROP
PROCEDURE
IF
EXISTS
add_column_if_not_exists
$$
CREATE
PROCEDURE
if
not
exists
add_column_if_not_exists
(
IN
tableName
VARCHAR
(
64
),
IN
columnName
VARCHAR
(
64
),
IN
columnDefinitionType
VARCHAR
(
64
),
IN
columnDefinitionDefaultValue
VARCHAR
(
128
),
IN
columnDefinitionComment
VARCHAR
(
255
),
in
afterColumnName
VARCHAR
(
64
))
CREATE
PROCEDURE
add_column_if_not_exists
(
IN
tableName
VARCHAR
(
64
),
IN
columnName
VARCHAR
(
64
),
IN
columnDefinitionType
VARCHAR
(
64
),
IN
columnDefinitionDefaultValue
VARCHAR
(
128
),
IN
columnDefinitionComment
VARCHAR
(
255
),
in
afterColumnName
VARCHAR
(
64
))
BEGIN
IF
NOT
EXISTS
(
SELECT
*
...
...
dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/constants.ts
View file @
5d87ce9c
...
...
@@ -22,7 +22,7 @@ import { ClusterType } from '@/pages/RegCenter/Cluster/constants';
import
{
l
}
from
'@/utils/intl'
;
import
{
CheckboxOptionType
}
from
'antd/es/checkbox/Group'
;
import
{
DefaultOptionType
}
from
'antd/es/select'
;
import
{
RUN_MODE
}
from
"@/services/constants"
;
import
{
RUN_MODE
}
from
'@/services/constants'
;
export
enum
RuleType
{
SYSTEM
=
'SYSTEM'
,
...
...
@@ -41,19 +41,19 @@ export const TriggerType: CheckboxOptionType[] = [
];
export
const
AllRuleOperator
:
DefaultOptionType
[]
=
[
{
label
:
'>'
,
value
:
'GT'
,
key
:
'GT'
},
{
label
:
'<'
,
value
:
'LT'
,
key
:
'LT'
},
{
label
:
'='
,
value
:
'EQ'
,
key
:
'EQ'
},
{
label
:
'!='
,
value
:
'NE'
,
key
:
'NE'
},
{
label
:
'>='
,
value
:
'GE'
,
key
:
'GE'
},
{
label
:
'<='
,
value
:
'LE'
,
key
:
'LE'
}
{
label
:
'>'
,
value
:
'GT'
,
key
:
'GT'
},
{
label
:
'<'
,
value
:
'LT'
,
key
:
'LT'
},
{
label
:
'='
,
value
:
'EQ'
,
key
:
'EQ'
},
{
label
:
'!='
,
value
:
'NE'
,
key
:
'NE'
},
{
label
:
'>='
,
value
:
'GE'
,
key
:
'GE'
},
{
label
:
'<='
,
value
:
'LE'
,
key
:
'LE'
}
];
export
const
EqRuleOperator
:
DefaultOptionType
[]
=
[{
label
:
'='
,
value
:
'EQ'
,
key
:
'EQ'
}];
export
const
EqRuleOperator
:
DefaultOptionType
[]
=
[{
label
:
'='
,
value
:
'EQ'
,
key
:
'EQ'
}];
export
const
BOOLEAN_VALUE_ENUM
:
DefaultOptionType
[]
=
[
{
label
:
'True'
,
value
:
'true'
,
key
:
'true'
},
{
label
:
'False'
,
value
:
'false'
,
key
:
'false'
}
{
label
:
'True'
,
value
:
'true'
,
key
:
'true'
},
{
label
:
'False'
,
value
:
'false'
,
key
:
'false'
}
];
export
const
AlertRules
:
any
=
{
...
...
dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/function.tsx
View file @
5d87ce9c
...
...
@@ -34,7 +34,7 @@ export const AlertRulesOption = () => {
// @ts-ignore
label
:
v
.
label
,
value
:
k
,
key
:
k
,
key
:
k
});
}
return
res
;
...
...
@@ -77,7 +77,7 @@ export const buildValueItem = (key: string, isSystem: boolean) => {
disabled=
{
isSystem
}
fieldProps=
{
{
defaultActiveFirstOption
:
true
,
showSearch
:
true
,
showSearch
:
true
}
}
name=
'ruleValue'
mode=
{
'single'
}
...
...
dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx
View file @
5d87ce9c
...
...
@@ -17,20 +17,23 @@
*
*/
import
{
Authorized
}
from
'@/hooks/useAccess'
;
import
{
Authorized
}
from
'@/hooks/useAccess'
;
import
{
RuleType
,
TriggerType
}
from
'@/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/constants'
;
import
{
RuleType
,
TriggerType
}
from
'@/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/constants'
;
import
{
AlertRulesOption
,
buildValueItem
,
getOperatorOptions
}
from
'@/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/function'
;
import
{
getData
}
from
'@/services/api'
;
import
{
SWITCH_OPTIONS
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Alert
}
from
'@/types/RegCenter/data'
;
import
{
AlertRule
,
AlertRuleCondition
}
from
'@/types/SettingCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
getData
}
from
'@/services/api'
;
import
{
SWITCH_OPTIONS
}
from
'@/services/constants'
;
import
{
API_CONSTANTS
}
from
'@/services/endpoints'
;
import
{
Alert
}
from
'@/types/RegCenter/data'
;
import
{
AlertRule
,
AlertRuleCondition
}
from
'@/types/SettingCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
DrawerForm
,
ProCard
,
...
...
@@ -43,10 +46,10 @@ import {
ProFormText
,
ProFormTextArea
}
from
'@ant-design/pro-components'
;
import
{
ProFormDependency
}
from
'@ant-design/pro-form'
;
import
{
Button
,
Divider
,
Form
,
Space
,
Typography
}
from
'antd'
;
import
{
ProFormDependency
}
from
'@ant-design/pro-form'
;
import
{
Button
,
Divider
,
Form
,
Space
,
Typography
}
from
'antd'
;
const
{
Link
}
=
Typography
;
const
{
Link
}
=
Typography
;
type
AlertRuleFormProps
=
{
onCancel
:
(
flag
?:
boolean
)
=>
void
;
...
...
@@ -56,112 +59,112 @@ type AlertRuleFormProps = {
};
const
RuleEditForm
=
(
props
:
AlertRuleFormProps
)
=>
{
const
{
onSubmit
:
handleSubmit
,
onCancel
:
handleModalVisible
,
modalVisible
,
values
}
=
props
;
// if is system rule disable edit
const
isSystem
=
values
.
ruleType
==
RuleType
.
SYSTEM
;
const
[
form
]
=
Form
.
useForm
<
AlertRule
>
();
const
getAlertTemplate
=
async
()
=>
{
const
template
:
Alert
.
AlertTemplate
[]
=
(
await
getData
(
API_CONSTANTS
.
ALERT_TEMPLATE
)).
data
;
return
template
.
map
((
t
)
=>
({
label
:
t
.
name
,
value
:
t
.
id
}));
};
const
submit
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
return
handleSubmit
({...
values
,...
fieldsValue
});
};
const
renderTemplateDropDown
=
(
item
:
any
)
=>
{
return
(
<>
{
item
}
<
Authorized
key=
'create'
path=
'/registration/alert/template/add'
>
<>
<
Divider
style=
{
{
margin
:
'8px 0'
}
}
/>
<
Link
href=
{
'#/registration/alert/template'
}
>
+
{
l
(
'rc.alert.template.new'
)
}
</
Link
>
</>
</
Authorized
>
</>
);
};
const
renderFooter
=
()
=>
{
return
[
<
Button
key=
{
'RuleCancel'
}
onClick=
{
()
=>
handleModalVisible
(
false
)
}
>
{
l
(
'button.cancel'
)
}
</
Button
>,
<
Button
key=
{
'RuleFinish'
}
type=
'primary'
htmlType=
{
'submit'
}
autoFocus
onClick=
{
()
=>
submit
()
}
>
{
l
(
'button.finish'
)
}
</
Button
>
];
};
const
{
onSubmit
:
handleSubmit
,
onCancel
:
handleModalVisible
,
modalVisible
,
values
}
=
props
;
return
(
<
DrawerForm
layout=
{
'vertical'
}
form=
{
form
}
width=
{
'40%'
}
open=
{
modalVisible
}
submitter=
{
{
render
:
()
=>
[...
renderFooter
()]}
}
drawerProps=
{
{
onClose
:
()
=>
handleModalVisible
(
false
),
destroyOnClose
:
true
}
}
initialValues=
{
values
}
>
<
ProFormGroup
>
<
ProFormText
name=
'id'
hidden=
{
true
}
/>
<
ProFormText
name=
'ruleType'
hidden=
{
true
}
/>
<
ProFormText
disabled=
{
isSystem
}
rules=
{
[{
required
:
true
}]
}
name=
'name'
width=
'md'
label=
{
l
(
'sys.alert.rule.name'
)
}
placeholder=
{
l
(
'sys.alert.rule.name'
)
}
/>
<
ProFormSelect
label=
{
l
(
'sys.alert.rule.template'
)
}
width=
'md'
name=
'templateId'
request=
{
async
()
=>
getAlertTemplate
()
}
placeholder=
{
l
(
'sys.alert.rule.template'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'sys.alert.rule.template'
)}]
}
fieldProps=
{
{
dropdownRender
:
(
item
)
=>
renderTemplateDropDown
(
item
)}
}
/>
</
ProFormGroup
>
// if is system rule disable edit
const
isSystem
=
values
.
ruleType
==
RuleType
.
SYSTEM
;
<
ProFormGroup
>
<
ProFormTextArea
width=
'md'
name=
'description'
label=
{
l
(
'global.table.note'
)
}
/>
<
ProFormSwitch
name=
'enabled'
{
...
SWITCH_OPTIONS
()}
label=
{
l
(
'global.table.isEnable'
)
}
/>
</
ProFormGroup
>
const
[
form
]
=
Form
.
useForm
<
AlertRule
>
();
const
getAlertTemplate
=
async
()
=>
{
const
template
:
Alert
.
AlertTemplate
[]
=
(
await
getData
(
API_CONSTANTS
.
ALERT_TEMPLATE
)).
data
;
return
template
.
map
((
t
)
=>
({
label
:
t
.
name
,
value
:
t
.
id
}));
};
<
Divider
orientation=
{
'left'
}
>
{
l
(
'sys.alert.rule.trigger'
)
}
</
Divider
>
const
submit
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
return
handleSubmit
({
...
values
,
...
fieldsValue
});
};
<
ProFormRadio
.
Group
const
renderTemplateDropDown
=
(
item
:
any
)
=>
{
return
(
<>
{
item
}
<
Authorized
key=
'create'
path=
'/registration/alert/template/add'
>
<>
<
Divider
style=
{
{
margin
:
'8px 0'
}
}
/>
<
Link
href=
{
'#/registration/alert/template'
}
>
+
{
l
(
'rc.alert.template.new'
)
}
</
Link
>
</>
</
Authorized
>
</>
);
};
const
renderFooter
=
()
=>
{
return
[
<
Button
key=
{
'RuleCancel'
}
onClick=
{
()
=>
handleModalVisible
(
false
)
}
>
{
l
(
'button.cancel'
)
}
</
Button
>,
<
Button
key=
{
'RuleFinish'
}
type=
'primary'
htmlType=
{
'submit'
}
autoFocus
onClick=
{
()
=>
submit
()
}
>
{
l
(
'button.finish'
)
}
</
Button
>
];
};
return
(
<
DrawerForm
layout=
{
'vertical'
}
form=
{
form
}
width=
{
'40%'
}
open=
{
modalVisible
}
submitter=
{
{
render
:
()
=>
[...
renderFooter
()]
}
}
drawerProps=
{
{
onClose
:
()
=>
handleModalVisible
(
false
),
destroyOnClose
:
true
}
}
initialValues=
{
values
}
>
<
ProFormGroup
>
<
ProFormText
name=
'id'
hidden=
{
true
}
/>
<
ProFormText
name=
'ruleType'
hidden=
{
true
}
/>
<
ProFormText
disabled=
{
isSystem
}
name=
'triggerConditions'
label=
{
l
(
'sys.alert.rule.triggerConditions'
)
}
rules=
{
[{
required
:
true
}]
}
options=
{
TriggerType
}
rules=
{
[{
required
:
true
}]
}
name=
'name'
width=
'md'
label=
{
l
(
'sys.alert.rule.name'
)
}
placeholder=
{
l
(
'sys.alert.rule.name'
)
}
/>
<
ProFormList
<
AlertRuleCondition
>
name='rule'
label=
{
l
(
'sys.alert.rule.triggerRule'
)
}
creatorButtonProps=
{
isSystem
?
false
:
{
<
ProFormSelect
label=
{
l
(
'sys.alert.rule.template'
)
}
width=
'md'
name=
'templateId'
request=
{
async
()
=>
getAlertTemplate
()
}
placeholder=
{
l
(
'sys.alert.rule.template'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'sys.alert.rule.template'
)
}]
}
fieldProps=
{
{
dropdownRender
:
(
item
)
=>
renderTemplateDropDown
(
item
)
}
}
/>
</
ProFormGroup
>
<
ProFormGroup
>
<
ProFormTextArea
width=
'md'
name=
'description'
label=
{
l
(
'global.table.note'
)
}
/>
<
ProFormSwitch
name=
'enabled'
{
...
SWITCH_OPTIONS
()}
label=
{
l
(
'global.table.isEnable'
)
}
/>
</
ProFormGroup
>
<
Divider
orientation=
{
'left'
}
>
{
l
(
'sys.alert.rule.trigger'
)
}
</
Divider
>
<
ProFormRadio
.
Group
disabled=
{
isSystem
}
name=
'triggerConditions'
label=
{
l
(
'sys.alert.rule.triggerConditions'
)
}
rules=
{
[{
required
:
true
}]
}
options=
{
TriggerType
}
/>
<
ProFormList
<
AlertRuleCondition
>
name='rule'
label=
{
l
(
'sys.alert.rule.triggerRule'
)
}
creatorButtonProps=
{
isSystem
?
false
:
{
creatorButtonText
:
l
(
'sys.alert.rule.addRule'
)
}
}
...
...
dinky-web/src/types/SettingCenter/data.d.ts
View file @
5d87ce9c
...
...
@@ -65,7 +65,7 @@ export type AlertRuleCondition = {
ruleOperator
:
string
;
ruleValue
:
string
;
rulePriority
?:
number
;
}
}
;
// ============================ System Settings ============================
export
type
Settings
=
{
...
...
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