mirror of https://github.com/openspug/spug
U 优化报警配置提示信息
parent
2efd68237b
commit
9a03bccb88
|
@ -2,11 +2,12 @@
|
||||||
# Copyright: (c) <spug.dev@gmail.com>
|
# Copyright: (c) <spug.dev@gmail.com>
|
||||||
# Released under the AGPL-3.0 License.
|
# Released under the AGPL-3.0 License.
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
from django.conf import settings
|
||||||
|
from django_redis import get_redis_connection
|
||||||
from libs import json_response, JsonParser, Argument, human_datetime, auth
|
from libs import json_response, JsonParser, Argument, human_datetime, auth
|
||||||
from apps.monitor.models import Detection
|
from apps.monitor.models import Detection
|
||||||
from django_redis import get_redis_connection
|
|
||||||
from django.conf import settings
|
|
||||||
from apps.monitor.executors import dispatch
|
from apps.monitor.executors import dispatch
|
||||||
|
from apps.setting.utils import AppSetting
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +35,10 @@ class DetectionView(View):
|
||||||
Argument('notify_mode', type=list, help='请选择报警方式'),
|
Argument('notify_mode', type=list, help='请选择报警方式'),
|
||||||
).parse(request.body)
|
).parse(request.body)
|
||||||
if error is None:
|
if error is None:
|
||||||
|
if set(form.notify_mode).intersection(['1', '2', '4']):
|
||||||
|
if not AppSetting.get_default('spug_key'):
|
||||||
|
return json_response(error='报警方式 微信、短信、邮件需要配置调用凭据(系统设置/基本设置),请配置后再启用该报警方式。')
|
||||||
|
|
||||||
form.targets = json.dumps(form.targets)
|
form.targets = json.dumps(form.targets)
|
||||||
form.notify_grp = json.dumps(form.notify_grp)
|
form.notify_grp = json.dumps(form.notify_grp)
|
||||||
form.notify_mode = json.dumps(form.notify_mode)
|
form.notify_mode = json.dumps(form.notify_mode)
|
||||||
|
|
|
@ -54,10 +54,10 @@ export default observer(function () {
|
||||||
<a target="_blank" rel="noopener noreferrer"
|
<a target="_blank" rel="noopener noreferrer"
|
||||||
href="https://spug.cc/docs/install-error/#%E9%92%89%E9%92%89%E6%94%B6%E4%B8%8D%E5%88%B0%E9%80%9A%E7%9F%A5%EF%BC%9F">官方文档</a>
|
href="https://spug.cc/docs/install-error/#%E9%92%89%E9%92%89%E6%94%B6%E4%B8%8D%E5%88%B0%E9%80%9A%E7%9F%A5%EF%BC%9F">官方文档</a>
|
||||||
</span>}>
|
</span>}>
|
||||||
<Input placeholder="请输入钉钉机器人完整地址"/>
|
<Input placeholder="https://oapi.dingtalk.com/robot/send?access_token=xxx"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="qy_wx" label="企业微信">
|
<Form.Item name="qy_wx" label="企业微信">
|
||||||
<Input placeholder="请输入企业微信机器人完整地址"/>
|
<Input placeholder="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
Loading…
Reference in New Issue