Unverified Commit 77e7d840 authored by gaoyan's avatar gaoyan Committed by GitHub

Added the method of adding a quick alarm template (#2708)

* fix log error * Added the method of adding a quick alarm template
parent 3218724e
...@@ -28,8 +28,8 @@ import { ...@@ -28,8 +28,8 @@ import {
isCanPushDolphin, isCanPushDolphin,
isOnline, isOnline,
isRunning, isRunning,
projectCommonShow, isSql,
isSql projectCommonShow
} from '@/pages/DataStudio/HeaderContainer/function'; } from '@/pages/DataStudio/HeaderContainer/function';
import PushDolphin from '@/pages/DataStudio/HeaderContainer/PushDolphin'; import PushDolphin from '@/pages/DataStudio/HeaderContainer/PushDolphin';
import { import {
...@@ -191,7 +191,9 @@ const HeaderContainer = (props: connect) => { ...@@ -191,7 +191,9 @@ const HeaderContainer = (props: connect) => {
let selectsql = null; let selectsql = null;
if (currentTab.editorInstance) { if (currentTab.editorInstance) {
selectsql = currentTab.editorInstance.getModel().getValueInRange(currentTab.editorInstance.getSelection()); selectsql = currentTab.editorInstance
.getModel()
.getValueInRange(currentTab.editorInstance.getSelection());
} }
if (selectsql == null || selectsql == '') { if (selectsql == null || selectsql == '') {
selectsql = currentData.statement; selectsql = currentData.statement;
...@@ -199,7 +201,7 @@ const HeaderContainer = (props: connect) => { ...@@ -199,7 +201,7 @@ const HeaderContainer = (props: connect) => {
const res = await debugTask( const res = await debugTask(
l('pages.datastudio.editor.debugging', '', { jobName: currentData.name }), l('pages.datastudio.editor.debugging', '', { jobName: currentData.name }),
{...currentData, statement: selectsql} { ...currentData, statement: selectsql }
); );
if (!res) return; if (!res) return;
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
import { handleGetOption, handleOption } from '@/services/BusinessCrud'; import { handleGetOption, handleOption } from '@/services/BusinessCrud';
import { DIALECT } from '@/services/constants';
export async function explainSql(title: string, params: any) { export async function explainSql(title: string, params: any) {
return handleOption('/api/task/explainSql', title, params); return handleOption('/api/task/explainSql', title, params);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
import { Authorized } from '@/hooks/useAccess';
import { import {
RuleType, RuleType,
TriggerType TriggerType
...@@ -45,7 +46,9 @@ import { ...@@ -45,7 +46,9 @@ import {
ProFormTextArea ProFormTextArea
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { ProFormDependency } from '@ant-design/pro-form'; import { ProFormDependency } from '@ant-design/pro-form';
import { Button, Divider, Form, Space } from 'antd'; import { Button, Divider, Form, Space, Typography } from 'antd';
const { Link } = Typography;
type AlertRuleFormProps = { type AlertRuleFormProps = {
onCancel: (flag?: boolean) => void; onCancel: (flag?: boolean) => void;
...@@ -72,6 +75,20 @@ const RuleEditForm = (props: AlertRuleFormProps) => { ...@@ -72,6 +75,20 @@ const RuleEditForm = (props: AlertRuleFormProps) => {
return handleSubmit({ ...fieldsValue, rule: JSON.stringify(fieldsValue.rule) }); return handleSubmit({ ...fieldsValue, rule: JSON.stringify(fieldsValue.rule) });
}; };
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 = () => { const renderFooter = () => {
return [ return [
<Button key={'RuleCancel'} onClick={() => handleModalVisible(false)}> <Button key={'RuleCancel'} onClick={() => handleModalVisible(false)}>
...@@ -119,6 +136,7 @@ const RuleEditForm = (props: AlertRuleFormProps) => { ...@@ -119,6 +136,7 @@ const RuleEditForm = (props: AlertRuleFormProps) => {
request={async () => getAlertTemplate()} request={async () => getAlertTemplate()}
placeholder={l('sys.alert.rule.template')} placeholder={l('sys.alert.rule.template')}
rules={[{ required: true, message: l('sys.alert.rule.template') }]} rules={[{ required: true, message: l('sys.alert.rule.template') }]}
fieldProps={{ dropdownRender: (item) => renderTemplateDropDown(item) }}
/> />
</ProFormGroup> </ProFormGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment