[web-app] bugfix-小部件渲染,新增网站类型监控

This commit is contained in:
tomsun28
2021-12-03 16:46:10 +08:00
parent afc2dde9d8
commit c5f65e10ae
8 changed files with 37 additions and 95 deletions

View File

@@ -19,10 +19,10 @@ export class HeaderClearStorageComponent {
@HostListener('click') @HostListener('click')
_click(): void { _click(): void {
this.modalSrv.confirm({ this.modalSrv.confirm({
nzTitle: 'Make sure clear all local storage?', nzTitle: '请确认是否清理缓存?',
nzOnOk: () => { nzOnOk: () => {
localStorage.clear(); localStorage.clear();
this.messageSrv.success('Clear Finished!'); this.messageSrv.success('清理成功!');
} }
}); });
} }

View File

@@ -23,25 +23,11 @@ import { NzMessageService } from 'ng-zorro-antd/message';
export class HeaderNotifyComponent { export class HeaderNotifyComponent {
data: NoticeItem[] = [ data: NoticeItem[] = [
{ {
title: '通知', title: '告警通知',
list: [], list: [],
emptyText: '你已查看所有通知', emptyText: '暂无告警通知',
emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg', emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg',
clearText: '清空通知' clearText: '清空告警'
},
{
title: '消息',
list: [],
emptyText: '您已读完所有消息',
emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg',
clearText: '清空消息'
},
{
title: '待办',
list: [],
emptyText: '你已完成所有待办',
emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/HsIsxMZiWKrNUavQUXqx.svg',
clearText: '清空待办'
} }
]; ];
count = 5; count = 5;
@@ -87,94 +73,38 @@ export class HeaderNotifyComponent {
{ {
id: '000000001', id: '000000001',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你收到了 14 份新周报', title: '监控-MYSQL_192.135.34.2-发出2级告警',
datetime: add(now, { days: 10 }), datetime: add(now, { days: 10 }),
type: '通知' type: '告警通知'
}, },
{ {
id: '000000002', id: '000000002',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你推荐的 曲妮妮 已通过第三轮面试', title: '监控-MYSQL_192.135.44.2-发出1级告警',
datetime: add(now, { days: -3 }), datetime: add(now, { days: -3 }),
type: '通知' type: '告警通知'
}, },
{ {
id: '000000003', id: '000000003',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '这种模板可以区分多种通知类型', title: '监控-WEBSITE_www.baidu.com-发出4级告警',
datetime: add(now, { months: -3 }), datetime: add(now, { months: -3 }),
read: true, read: true,
type: '通知' type: '告警通知'
}, },
{ {
id: '000000004', id: '000000004',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
title: '左侧图标用于区分不同的类型', title: '监控-REDIS_192.34.55.3-发出4级告警',
datetime: add(now, { years: -1 }), datetime: add(now, { years: -1 }),
type: '通知' type: '告警通知'
}, },
{ {
id: '000000005', id: '000000005',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '内容不要超过两行字,超出时自动截断', title: '监控-REDIS_192.34.55.6-发出4级告警',
datetime: '2017-08-07', datetime: '2020-08-07',
type: '通知' type: '告警通知'
},
{
id: '000000006',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '曲丽丽 评论了你',
description: '描述信息描述信息描述信息',
datetime: '2017-08-07',
type: '消息'
},
{
id: '000000007',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '朱偏右 回复了你',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: '消息'
},
{
id: '000000008',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '标题',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: '消息'
},
{
id: '000000009',
title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始',
status: 'todo',
type: '待办'
},
{
id: '000000010',
title: '第三方紧急代码变更',
description: '冠霖提交于 2017-01-06需在 2017-01-07 前完成代码变更任务',
extra: '马上到期',
status: 'urgent',
type: '待办'
},
{
id: '000000011',
title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天',
status: 'doing',
type: '待办'
},
{
id: '000000012',
title: 'ABCD 版本发布',
description: '冠霖提交于 2017-01-06需在 2017-01-07 前完成代码变更任务',
extra: '进行中',
status: 'processing',
type: '待办'
} }
]); ]);
@@ -184,7 +114,13 @@ export class HeaderNotifyComponent {
} }
clear(type: string): void { clear(type: string): void {
this.msg.success(`清空了 ${type}`); this.loading = true;
setTimeout(() => {
this.data = this.updateNoticeData([]);
this.loading = false;
this.cdr.detectChanges();
}, 500);
this.msg.success(`已清空 ${type}`);
} }
select(res: NoticeIconSelect): void { select(res: NoticeIconSelect): void {

View File

@@ -6,13 +6,13 @@
</a> </a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
<a [routerLink]="['/monitors']"> <a [routerLink]="['/monitors']" [queryParams]="{app: monitor.app ? monitor.app : ''}">
<i nz-icon nzType="monitor"></i> <i nz-icon nzType="monitor"></i>
<span>监控列表</span> <span>监控列表</span>
</a> </a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
<i nz-icon nzType="plus-circle"></i> <i nz-icon nzType="edit"></i>
<span>修改 {{monitor.app}} 监控</span> <span>修改 {{monitor.app}} 监控</span>
</nz-breadcrumb-item> </nz-breadcrumb-item>
</nz-breadcrumb> </nz-breadcrumb>

View File

@@ -105,12 +105,12 @@ export class MonitorEditComponent implements OnInit {
"params": this.params "params": this.params
}; };
this.isSpinning = true; this.isSpinning = true;
this.monitorSvc.newMonitor(addMonitor) this.monitorSvc.editMonitor(addMonitor)
.subscribe(message => { .subscribe(message => {
this.isSpinning = false; this.isSpinning = false;
if (message.code === 0) { if (message.code === 0) {
this.notifySvc.success("修改监控成功", ""); this.notifySvc.success("修改监控成功", "");
this.router.navigateByUrl("/monitors") this.router.navigateByUrl(`/monitors?app=${this.monitor.app}`)
} else { } else {
this.notifySvc.error("修改监控失败", message.msg); this.notifySvc.error("修改监控失败", message.msg);
}}, }},

View File

@@ -6,7 +6,7 @@
</a> </a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
<a [routerLink]="['/monitors']"> <a [routerLink]="['/monitors']" [queryParams]="{app: monitor.app ? monitor.app : ''}">
<i nz-icon nzType="monitor"></i> <i nz-icon nzType="monitor"></i>
<span>监控列表</span> <span>监控列表</span>
</a> </a>

View File

@@ -81,7 +81,7 @@ export class MonitorNewComponent implements OnInit {
this.isSpinning = false; this.isSpinning = false;
if (message.code === 0) { if (message.code === 0) {
this.notifySvc.success("新增监控成功", ""); this.notifySvc.success("新增监控成功", "");
this.router.navigateByUrl("/monitors") this.router.navigateByUrl(`/monitors?app=${this.monitor.app}`)
} else { } else {
this.notifySvc.error("新增监控失败", message.msg); this.notifySvc.error("新增监控失败", message.msg);
}}, }},

View File

@@ -34,6 +34,11 @@
"i18n": "menu.monitor.service", "i18n": "menu.monitor.service",
"icon": "anticon-cloud", "icon": "anticon-cloud",
"children": [ "children": [
{
"text": "website",
"link": "/monitors?app=website",
"i18n": "monitor.app.website"
},
{ {
"text": "api", "text": "api",
"link": "/monitors?app=api", "link": "/monitors?app=api",

View File

@@ -28,6 +28,7 @@
}, },
"app": { "app": {
"": "监控类型", "": "监控类型",
"website": "网站监测",
"api": "HTTP API", "api": "HTTP API",
"http": "HTTP API", "http": "HTTP API",
"ping": "PING连通性", "ping": "PING连通性",