diff --git a/common/src/main/java/com/usthe/common/entity/manager/ParamDefine.java b/common/src/main/java/com/usthe/common/entity/manager/ParamDefine.java index 25cc5bc..1bb2af3 100644 --- a/common/src/main/java/com/usthe/common/entity/manager/ParamDefine.java +++ b/common/src/main/java/com/usthe/common/entity/manager/ParamDefine.java @@ -122,6 +122,12 @@ public class ParamDefine { @ApiModelProperty(value = "当type为key-value时有效,表示value的别名描述", example = "Value", accessMode = READ_WRITE, position = 10) private String valueAlias; + /** + * 是否是高级隐藏参数 true-是 false-否 + */ + @ApiModelProperty(value = "是否是高级隐藏参数 true-是 false-否", example = "true", accessMode = READ_WRITE, position = 11) + private boolean hide = false; + /** * 此条记录创建者 */ diff --git a/manager/src/main/resources/define/app/telnet.yml b/manager/src/main/resources/define/app/telnet.yml deleted file mode 100644 index b3bfb81..0000000 --- a/manager/src/main/resources/define/app/telnet.yml +++ /dev/null @@ -1,25 +0,0 @@ -category: service -app: telnet -name: - zh-CN: TELNET端口可用性 - en-US: PORT TELNET -configmap: - - key: host - type: 1 - - key: port - type: 0 - - key: timeout - type: 0 -metrics: - - name: summary - priority: 0 - fields: - - field: responseTime - type: 0 - unit: ms - protocol: telnet -# 当protocol为telnet协议时具体的采集配置 - telnet: - host: ^_^host^_^ - port: ^_^port^_^ - timeout: ^_^timeout^_^ \ No newline at end of file diff --git a/manager/src/main/resources/define/param/A-example.yml b/manager/src/main/resources/define/param/A-example.yml index c6d0530..c09b05e 100644 --- a/manager/src/main/resources/define/param/A-example.yml +++ b/manager/src/main/resources/define/param/A-example.yml @@ -26,10 +26,12 @@ param: # 当type为text时,用limit表示字符串限制大小 limit: 20 required: false + hide: true - field: password name: 密码 type: password required: false + hide: true - field: ssl name: 启动SSL # 当type为boolean时,前端用switch展示开关 diff --git a/manager/src/main/resources/define/param/api.yml b/manager/src/main/resources/define/param/api.yml index 20a5edb..6bda131 100644 --- a/manager/src/main/resources/define/param/api.yml +++ b/manager/src/main/resources/define/param/api.yml @@ -60,15 +60,18 @@ param: type: text placeholder: '请求BODY资源类型' required: false + hide: true - field: payload name: 请求BODY type: textarea placeholder: 'POST PUT请求时有效' required: false + hide: true - field: authType name: 认证方式 type: radio required: false + hide: true # 当type为radio单选框,checkbox复选框时,option表示可选项值列表 {name1:value1,name2:value2} options: - label: Basic Auth @@ -81,7 +84,9 @@ param: # 当type为text时,用limit表示字符串限制大小 limit: 20 required: false + hide: true - field: password name: 密码 type: password required: false + hide: true diff --git a/manager/src/main/resources/define/param/mariadb.yml b/manager/src/main/resources/define/param/mariadb.yml index 04a06d6..3d95359 100644 --- a/manager/src/main/resources/define/param/mariadb.yml +++ b/manager/src/main/resources/define/param/mariadb.yml @@ -17,6 +17,7 @@ param: required: false defaultValue: 6000 placeholder: '查询超时时间' + hide: true - field: database name: 数据库名称 type: text @@ -33,4 +34,5 @@ param: - field: url name: URL type: text - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/manager/src/main/resources/define/param/mysql.yml b/manager/src/main/resources/define/param/mysql.yml index 79be757..d68f521 100644 --- a/manager/src/main/resources/define/param/mysql.yml +++ b/manager/src/main/resources/define/param/mysql.yml @@ -15,6 +15,7 @@ param: name: 查询超时时间 type: number required: false + hide: true defaultValue: 6000 placeholder: '查询超时时间' - field: database @@ -33,4 +34,5 @@ param: - field: url name: URL type: text - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/manager/src/main/resources/define/param/oracle.yml b/manager/src/main/resources/define/param/oracle.yml index fbef8de..64d4c94 100644 --- a/manager/src/main/resources/define/param/oracle.yml +++ b/manager/src/main/resources/define/param/oracle.yml @@ -15,6 +15,7 @@ param: name: 查询超时时间 type: number required: false + hide: true defaultValue: 6000 placeholder: '查询超时时间' - field: database @@ -33,4 +34,5 @@ param: - field: url name: URL type: text - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/manager/src/main/resources/define/param/postgresql.yml b/manager/src/main/resources/define/param/postgresql.yml index 0ed5d9c..220110e 100644 --- a/manager/src/main/resources/define/param/postgresql.yml +++ b/manager/src/main/resources/define/param/postgresql.yml @@ -15,6 +15,7 @@ param: name: 查询超时时间 type: number required: false + hide: true defaultValue: 6000 placeholder: '查询超时时间' - field: database @@ -33,4 +34,5 @@ param: - field: url name: URL type: text - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/manager/src/main/resources/define/param/sqlserver.yml b/manager/src/main/resources/define/param/sqlserver.yml index a0fb0b6..7d07469 100644 --- a/manager/src/main/resources/define/param/sqlserver.yml +++ b/manager/src/main/resources/define/param/sqlserver.yml @@ -15,6 +15,7 @@ param: name: 查询超时时间 type: number required: false + hide: true defaultValue: 6000 placeholder: '查询超时时间' - field: database @@ -33,4 +34,5 @@ param: - field: url name: URL type: text - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/manager/src/main/resources/define/param/telnet.yml b/manager/src/main/resources/define/param/telnet.yml deleted file mode 100644 index 7046baf..0000000 --- a/manager/src/main/resources/define/param/telnet.yml +++ /dev/null @@ -1,27 +0,0 @@ -# 监控应用类型名称(与文件名保持一致) eg: linux windows tomcat mysql aws... -app: telnet -# 强制固定必须参数 - host(ipv4,ipv6,域名) -param: - # field-字段名称标识符 - - field: host - # name-参数字段显示名称 - name: 主机Host - # type-字段类型,样式(大部分映射input标签type属性) - type: host - # 是否是必输项 true-必填 false-可选 - required: true - - field: port - name: 端口 - type: number - # 当type为number时,用range表示范围 - range: '[0,65535]' - required: true - defaultValue: 80 - - field: timeout - name: Telnet超时时间 - type: number - # 当type为number时,用range表示范围 - range: '[0,100000]' - required: true - placeholder: '请输入超时时间,单位毫秒' - defaultValue: 6000 \ No newline at end of file diff --git a/manager/src/main/resources/define/param/website.yml b/manager/src/main/resources/define/param/website.yml index 80dd4ac..1390158 100644 --- a/manager/src/main/resources/define/param/website.yml +++ b/manager/src/main/resources/define/param/website.yml @@ -33,6 +33,7 @@ param: name: 认证方式 type: radio required: false + hide: true # 当type为radio单选框,checkbox复选框时,option表示可选项值列表 {name1:value1,name2:value2} options: - label: Basic Auth @@ -45,7 +46,9 @@ param: # 当type为text时,用limit表示字符串限制大小 limit: 20 required: false + hide: true - field: password name: 密码 type: password - required: false \ No newline at end of file + required: false + hide: true \ No newline at end of file diff --git a/web-app/src/app/pojo/ParamDefine.ts b/web-app/src/app/pojo/ParamDefine.ts index 33bf732..01c3249 100644 --- a/web-app/src/app/pojo/ParamDefine.ts +++ b/web-app/src/app/pojo/ParamDefine.ts @@ -12,4 +12,6 @@ export class ParamDefine { // 当type为key-value时有效,表示别名描述 keyAlias!: string; valueAlias!: string; + // 此参数是否隐藏 即默认不显示, 在高级设置区显示 + hide: boolean = false; } diff --git a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.html b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.html index 0bf9ff5..e4f1402 100644 --- a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.html +++ b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.html @@ -162,11 +162,151 @@ + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + + + {{ paramDefine.name }} + + + + + + + + + + + 采集间隔 - + diff --git a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.less b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.less new file mode 100644 index 0000000..a029bab --- /dev/null +++ b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.less @@ -0,0 +1,8 @@ +.dynamic-button { + font-size: 20px; + margin-left: 45%; +} + +.dynamic-button:hover { + font-size: 30px; +} diff --git a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts index e2825a9..de34a6f 100644 --- a/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts +++ b/web-app/src/app/routes/monitor/monitor-edit/monitor-edit.component.ts @@ -16,7 +16,7 @@ import { MonitorService } from '../../../service/monitor.service'; @Component({ selector: 'app-monitor-modify', templateUrl: './monitor-edit.component.html', - styles: [] + styleUrls: ['./monitor-edit.component.less'] }) export class MonitorEditComponent implements OnInit { constructor( @@ -30,6 +30,8 @@ export class MonitorEditComponent implements OnInit { paramDefines!: ParamDefine[]; params!: Param[]; + advancedParamDefines!: ParamDefine[]; + advancedParams!: Param[]; paramValueMap = new Map(); monitor = new Monitor(); profileForm: FormGroup = new FormGroup({}); @@ -59,7 +61,6 @@ export class MonitorEditComponent implements OnInit { this.paramValueMap.set(item.field, item); }); } - this.params = message.data.params; this.detected = message.data.detected ? message.data.detected : true; } else { console.warn(message.msg); @@ -73,7 +74,10 @@ export class MonitorEditComponent implements OnInit { if (message.code === 0) { this.paramDefines = message.data; this.params = []; - this.paramDefines.forEach(define => { + this.advancedParams = []; + this.paramDefines = []; + this.advancedParamDefines = []; + message.data.forEach(define => { let param = this.paramValueMap.get(define.field); if (param === undefined) { param = new Param(); @@ -100,7 +104,13 @@ export class MonitorEditComponent implements OnInit { } } } - this.params.push(param); + if (define.hide) { + this.advancedParams.push(param); + this.advancedParamDefines.push(define); + } else { + this.params.push(param); + this.paramDefines.push(define); + } }); } else { console.warn(message.msg); @@ -144,10 +154,15 @@ export class MonitorEditComponent implements OnInit { param.value = (param.value as string).trim(); } }); + this.advancedParams.forEach(param => { + if (param.value != null && typeof param.value == 'string') { + param.value = (param.value as string).trim(); + } + }); let addMonitor = { detected: this.detected, monitor: this.monitor, - params: this.params + params: this.params.concat(this.advancedParams) }; this.isSpinning = true; this.monitorSvc.editMonitor(addMonitor).subscribe( @@ -188,10 +203,15 @@ export class MonitorEditComponent implements OnInit { param.value = (param.value as string).trim(); } }); + this.advancedParams.forEach(param => { + if (param.value != null && typeof param.value == 'string') { + param.value = (param.value as string).trim(); + } + }); let detectMonitor = { detected: this.detected, monitor: this.monitor, - params: this.params + params: this.params.concat(this.advancedParams) }; this.isSpinning = true; this.monitorSvc.detectMonitor(detectMonitor).subscribe( diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html index ca6860d..a1f4d13 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.html @@ -171,6 +171,146 @@ + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + {{ paramDefine.name }} + + + + + + + + {{ paramDefine.name }} + + + + + + + + + + + diff --git a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts index fa91e3c..b1f67cb 100644 --- a/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts +++ b/web-app/src/app/routes/monitor/monitor-new/monitor-new.component.ts @@ -20,6 +20,8 @@ import { MonitorService } from '../../../service/monitor.service'; export class MonitorNewComponent implements OnInit { paramDefines!: ParamDefine[]; params!: Param[]; + advancedParamDefines!: ParamDefine[]; + advancedParams!: Param[]; monitor!: Monitor; detected: boolean = true; passwordVisible: boolean = false; @@ -53,9 +55,11 @@ export class MonitorNewComponent implements OnInit { ) .subscribe(message => { if (message.code === 0) { - this.paramDefines = message.data; this.params = []; - this.paramDefines.forEach(define => { + this.advancedParams = []; + this.paramDefines = []; + this.advancedParamDefines = []; + message.data.forEach(define => { let param = new Param(); param.field = define.field; if (define.type === 'number') { @@ -77,7 +81,13 @@ export class MonitorNewComponent implements OnInit { param.value = define.defaultValue; } } - this.params.push(param); + if (define.hide) { + this.advancedParams.push(param); + this.advancedParamDefines.push(define); + } else { + this.params.push(param); + this.paramDefines.push(define); + } }); } else { console.warn(message.msg); @@ -125,10 +135,15 @@ export class MonitorNewComponent implements OnInit { param.value = (param.value as string).trim(); } }); + this.advancedParams.forEach(param => { + if (param.value != null && typeof param.value == 'string') { + param.value = (param.value as string).trim(); + } + }); let addMonitor = { detected: this.detected, monitor: this.monitor, - params: this.params + params: this.params.concat(this.advancedParams) }; this.isSpinning = true; this.monitorSvc.newMonitor(addMonitor).subscribe( @@ -169,10 +184,15 @@ export class MonitorNewComponent implements OnInit { param.value = (param.value as string).trim(); } }); + this.advancedParams.forEach(param => { + if (param.value != null && typeof param.value == 'string') { + param.value = (param.value as string).trim(); + } + }); let detectMonitor = { detected: true, monitor: this.monitor, - params: this.params + params: this.params.concat(this.advancedParams) }; this.isSpinning = true; this.monitorSvc.detectMonitor(detectMonitor).subscribe( diff --git a/web-app/src/app/routes/monitor/monitor.module.ts b/web-app/src/app/routes/monitor/monitor.module.ts index e96d33a..f421e33 100644 --- a/web-app/src/app/routes/monitor/monitor.module.ts +++ b/web-app/src/app/routes/monitor/monitor.module.ts @@ -16,6 +16,7 @@ import { MonitorEditComponent } from './monitor-edit/monitor-edit.component'; import { MonitorListComponent } from './monitor-list/monitor-list.component'; import { MonitorNewComponent } from './monitor-new/monitor-new.component'; import { MonitorRoutingModule } from './monitor-routing.module'; +import { NzCollapseModule } from 'ng-zorro-antd/collapse'; const COMPONENTS: Array> = [ MonitorNewComponent, @@ -37,7 +38,8 @@ const COMPONENTS: Array> = [ NzRadioModule, NgxEchartsModule, NzLayoutModule, - NzSpaceModule + NzSpaceModule, + NzCollapseModule ], declarations: COMPONENTS })