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 {
isCanPushDolphin,
isOnline,
isRunning,
projectCommonShow,
isSql
isSql,
projectCommonShow
} from '@/pages/DataStudio/HeaderContainer/function';
import PushDolphin from '@/pages/DataStudio/HeaderContainer/PushDolphin';
import {
......@@ -191,7 +191,9 @@ const HeaderContainer = (props: connect) => {
let selectsql = null;
if (currentTab.editorInstance) {
selectsql = currentTab.editorInstance.getModel().getValueInRange(currentTab.editorInstance.getSelection());
selectsql = currentTab.editorInstance
.getModel()
.getValueInRange(currentTab.editorInstance.getSelection());
}
if (selectsql == null || selectsql == '') {
selectsql = currentData.statement;
......@@ -199,7 +201,7 @@ const HeaderContainer = (props: connect) => {
const res = await debugTask(
l('pages.datastudio.editor.debugging', '', { jobName: currentData.name }),
{...currentData, statement: selectsql}
{ ...currentData, statement: selectsql }
);
if (!res) return;
......
......@@ -18,7 +18,6 @@
*/
import { handleGetOption, handleOption } from '@/services/BusinessCrud';
import { DIALECT } from '@/services/constants';
export async function explainSql(title: string, params: any) {
return handleOption('/api/task/explainSql', title, params);
......
......@@ -17,6 +17,7 @@
*
*/
import { Authorized } from '@/hooks/useAccess';
import {
RuleType,
TriggerType
......@@ -45,7 +46,9 @@ import {
ProFormTextArea
} from '@ant-design/pro-components';
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 = {
onCancel: (flag?: boolean) => void;
......@@ -72,6 +75,20 @@ const RuleEditForm = (props: AlertRuleFormProps) => {
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 = () => {
return [
<Button key={'RuleCancel'} onClick={() => handleModalVisible(false)}>
......@@ -119,6 +136,7 @@ const RuleEditForm = (props: AlertRuleFormProps) => {
request={async () => getAlertTemplate()}
placeholder={l('sys.alert.rule.template')}
rules={[{ required: true, message: l('sys.alert.rule.template') }]}
fieldProps={{ dropdownRender: (item) => renderTemplateDropDown(item) }}
/>
</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