Changeset 105
- Timestamp:
- 03/17/08 19:21:35 (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 removed
- 4 modified
-
css/main.css (modified) (2 diffs)
-
images/icons/cog_add.png (added)
-
images/icons/link_error.png (deleted)
-
images/icons/text_align_justify.png (added)
-
js/src/hostDetail.js (modified) (1 diff)
-
js/src/npc.js (modified) (11 diffs)
-
js/src/serviceDetail.js (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/css/main.css
r104 r105 19 19 } 20 20 21 . appLightning{22 background-image:url(../images/icons/ application_lightning.png) !important;21 .cogAdd { 22 background-image:url(../images/icons/cog_add.png) !important; 23 23 } 24 24 … … 45 45 .monitoring { 46 46 background-image:url(../images/icons/application_view_gallery.png) !important; 47 } 48 49 .resultsetNext { 50 background-image:url(../images/icons/resultset_next.png) !important; 47 51 } 48 52 -
trunk/js/src/hostDetail.js
r96 r105 427 427 iconCls:'commentAdd', 428 428 handler : function(){ 429 npc.app.add HostComment(record.data.host_name);429 npc.app.addComment('host', record.data.host_name); 430 430 } 431 431 }, '-', { -
trunk/js/src/npc.js
r104 r105 86 86 }, 87 87 88 addHostComment: function(host) { 88 cmdFormButtons: [{ 89 text: 'Submit', 90 handler: function(o){ 91 o.ownerCt.getForm().submit({ 92 success: function(f, r) { 93 o.ownerCt.ownerCt.close(); 94 }, 95 failure: function(f, r) { 96 o.ownerCt.ownerCt.close(); 97 response = Ext.decode(r.response.responseText); 98 Ext.Msg.alert('Failed', response.msg); 99 } 100 }); 101 } 102 },{ 103 text: 'Cancel', 104 handler: function(o){ 105 o.ownerCt.ownerCt.close(); 106 } 107 }], 108 109 ackProblem: function(type, host, service) { 110 111 var cmd = 'ACKNOWLEDGE_' + type.toUpperCase() + '_PROBLEM'; 112 113 var hostField = { 114 name: 'p_host_name', 115 value: host, 116 xtype: 'hidden' 117 }; 118 119 if (typeof host == 'undefined') { 120 hostField.fieldLabel = 'Host Name'; 121 hostField.xtype = 'textfield'; 122 hostField.allowBlank = false; 123 } 124 125 var serviceField = { 126 name: 'p_service_description', 127 value: service, 128 xtype: 'hidden' 129 }; 130 131 if (type == 'svc') { 132 if (typeof service == 'undefined') { 133 serviceField.fieldLabel = 'Host Name'; 134 serviceField.xtype = 'textfield'; 135 serviceField.allowBlank = false; 136 } 137 } 89 138 90 139 var form = new Ext.FormPanel({ 91 labelWidth: 75,140 labelWidth: 110, 92 141 url:'npc.php?module=nagios&action=command', 93 142 frame:true, 94 143 bodyStyle:'padding:5px 5px 0', 95 width: 525, 144 width: 550, 145 defaults: {width: 150}, 146 defaultType: 'textfield', 147 items: [ 148 { 149 name: 'p_command', 150 value:cmd, 151 xtype: 'hidden' 152 }, 153 hostField, 154 serviceField, 155 { 156 fieldLabel: 'Sticky', 157 name: 'p_sticky', 158 xtype: 'xcheckbox', 159 labelStyle: 'cursor: help;', 160 tooltipText: "Disables notifications until the host recovers.", 161 listeners: { 162 render: function(o) { 163 npc.app.setFormFieldTooltip(o); 164 } 165 }, 166 checked:true 167 },{ 168 fieldLabel: 'Send Notification', 169 name: 'p_notify', 170 xtype: 'xcheckbox', 171 labelStyle: 'cursor: help;', 172 tooltipText: "Send a notification about the acknowledgement to contacts for this service.", 173 listeners: { 174 render: function(o) { 175 npc.app.setFormFieldTooltip(o); 176 } 177 }, 178 checked:true 179 },{ 180 fieldLabel: 'Persistent', 181 name: 'p_persistent', 182 xtype: 'xcheckbox', 183 labelStyle: 'cursor: help;', 184 tooltipText: "Keep the service comment even after the acknowledgement is removed.", 185 listeners: { 186 render: function(o) { 187 npc.app.setFormFieldTooltip(o); 188 } 189 }, 190 checked:false 191 },{ 192 name: 'p_author', 193 value: npc.app.params.userName, 194 xtype: 'hidden' 195 },{ 196 fieldLabel: 'Comment', 197 name: 'p_comment', 198 xtype: 'htmleditor', 199 height:200, 200 width: 500 201 },{ 202 xtype: 'panel', 203 html: '<br /><span style="font-size:10px;"><b>Note:</b> It may take a while before Nagios processes this command.</span>', 204 width: 400 205 } 206 ], 207 buttons: npc.app.cmdFormButtons 208 }); 209 210 var win = new Ext.Window({ 211 title:'Acknowledge Service Problem', 212 layout:'fit', 213 modal:true, 214 closable: true, 215 width:680, 216 height:400, 217 bodyStyle:'padding:5px;', 218 items: form 219 }); 220 win.show(); 221 222 }, 223 224 addComment: function(type, host, service) { 225 226 var cmd = 'ADD_' + type.toUpperCase() + '_COMMENT'; 227 228 var hostField = { 229 name: 'p_host_name', 230 value: host, 231 xtype: 'hidden' 232 }; 233 234 if (typeof host == 'undefined') { 235 hostField.fieldLabel = 'Host Name'; 236 hostField.xtype = 'textfield'; 237 hostField.allowBlank = false; 238 } 239 240 var serviceField = { 241 name: 'p_service_description', 242 value: service, 243 xtype: 'hidden' 244 }; 245 246 if (type == 'svc') { 247 if (typeof service == 'undefined') { 248 serviceField.fieldLabel = 'Service Description'; 249 serviceField.xtype = 'textfield'; 250 serviceField.allowBlank = false; 251 } 252 } 253 254 var form = new Ext.FormPanel({ 255 labelWidth: 110, 256 url:'npc.php?module=nagios&action=command', 257 frame:true, 258 bodyStyle:'padding:5px 5px 0', 259 width: 550, 96 260 defaults: {width: 175}, 97 261 defaultType: 'textfield', … … 99 263 { 100 264 name: 'p_command', 101 value: 'ADD_HOST_COMMENT',265 value:cmd, 102 266 xtype: 'hidden' 103 },{ 104 fieldLabel: 'Host Name', 105 name: 'p_host_name', 106 value: host, 107 allowBlank:false 108 },{ 267 }, 268 hostField, 269 serviceField, 270 { 109 271 fieldLabel: 'Persistent', 110 272 name: 'p_persistent', 111 273 xtype: 'xcheckbox', 274 labelStyle: 'cursor: help;', 275 tooltipText: "Persists the comment across Nagios restarts.", 276 listeners: { 277 render: function(o) { 278 npc.app.setFormFieldTooltip(o); 279 } 280 }, 112 281 checked:true 113 282 },{ … … 119 288 name: 'p_comment', 120 289 xtype: 'htmleditor', 290 height:200, 121 291 width: 500 122 292 },{ … … 126 296 } 127 297 ], 128 buttons: [{ 129 text: 'Submit', 130 handler: function(){ 131 form.getForm().submit({ 132 success: function(f, a) { 133 win.close(); 134 }, 135 failure: function(f, a) { 136 Ext.Msg.alert('Error', a.result.msg); 137 } 138 }); 139 } 140 },{ 141 text: 'Cancel', 142 handler: function(){ 143 win.close(); 144 } 145 }] 298 buttons: npc.app.cmdFormButtons 146 299 }); 147 300 … … 151 304 modal:true, 152 305 closable: true, 153 width:6 50,306 width:680, 154 307 height:400, 155 308 bodyStyle:'padding:5px;', … … 160 313 }, 161 314 162 addServiceComment: function(host, service) { 315 sendCustomNotification: function(type, host, service) { 316 317 var cmd = 'SEND_CUSTOM_' + type.toUpperCase() + '_NOTIFICATION'; 318 319 var hostField = { 320 name: 'p_host_name', 321 value: host, 322 xtype: 'hidden' 323 }; 324 325 if (typeof host == 'undefined') { 326 hostField.fieldLabel = 'Host Name'; 327 hostField.xtype = 'textfield'; 328 hostField.allowBlank = false; 329 } 330 331 var serviceField = { 332 name: 'p_service_description', 333 value: service, 334 xtype: 'hidden' 335 }; 336 337 if (type == 'svc') { 338 if (typeof service == 'undefined') { 339 serviceField.fieldLabel = 'Service Description'; 340 serviceField.xtype = 'textfield'; 341 serviceField.allowBlank = false; 342 } 343 } 163 344 164 345 var form = new Ext.FormPanel({ 165 labelWidth: 75,346 labelWidth: 110, 166 347 url:'npc.php?module=nagios&action=command', 167 348 frame:true, 168 349 bodyStyle:'padding:5px 5px 0', 169 width: 5 25,350 width: 550, 170 351 defaults: {width: 175}, 171 352 defaultType: 'textfield', … … 173 354 { 174 355 name: 'p_command', 175 value: 'ADD_SVC_COMMENT',356 value:cmd, 176 357 xtype: 'hidden' 177 },{ 178 fieldLabel: 'Host Name', 179 name: 'p_host_name', 180 value: host, 181 allowBlank:false 182 },{ 183 fieldLabel: 'Service', 184 name: 'p_service_description', 185 value: service, 186 allowBlank:false 187 },{ 188 fieldLabel: 'Persistent', 189 name: 'p_persistent', 358 }, 359 hostField, 360 serviceField, 361 { 362 name: 'p_options', 363 value:0, 364 xtype: 'hidden' 365 },{ 366 fieldLabel: 'Forced', 367 name: 'p_force_notification', 190 368 xtype: 'xcheckbox', 191 checked:true 369 labelStyle: 'cursor: help;', 370 tooltipText: "Selecting the Forced option will force the notification to be sent out, regardless of the time restrictions, whether or not notifications are enabled, etc.", 371 listeners: { 372 check: function() { 373 var v = 2; 374 var options = parseInt(form.form.getValues().p_options); 375 if (this.checked) { 376 options = options + v; 377 } else { 378 options = options - v; 379 } 380 form.form.setValues({p_options: options}); 381 }, 382 render: function(o) { 383 npc.app.setFormFieldTooltip(o); 384 } 385 }, 386 checked:false 387 },{ 388 fieldLabel: 'Broadcast', 389 name: 'p_broadcast_notification', 390 xtype: 'xcheckbox', 391 labelStyle: 'cursor: help;', 392 tooltipText: "Selecting the Broadcast option causes the notification to be sent out to all normal (non-escalated) and escalated contacts.", 393 listeners: { 394 check: function() { 395 var v = 1; 396 var options = parseInt(form.form.getValues().p_options); 397 if (this.checked) { 398 options = options + v; 399 } else { 400 options = options - v; 401 } 402 form.form.setValues({p_options: options}); 403 }, 404 render: function(o) { 405 npc.app.setFormFieldTooltip(o); 406 } 407 }, 408 checked:false 192 409 },{ 193 410 name: 'p_author', … … 198 415 name: 'p_comment', 199 416 xtype: 'htmleditor', 200 width: 550 417 height:200, 418 width: 500 201 419 },{ 202 420 xtype: 'panel', 203 html: '<br /><span style="font-size:10px;"><b>Note:</b> It may take a while before Nagios processes the comm ent.</span>',421 html: '<br /><span style="font-size:10px;"><b>Note:</b> It may take a while before Nagios processes the command.</span>', 204 422 width: 400 205 423 } 206 424 ], 207 buttons: [{ 208 text: 'Submit', 209 handler: function(){ 210 form.getForm().submit({ 211 success: function(f, a) { 212 win.close(); 213 }, 214 failure: function(f, a) { 215 Ext.Msg.alert('Error', a.result.msg); 216 } 217 }); 218 } 219 },{ 220 text: 'Cancel', 221 handler: function(){ 222 win.close(); 223 } 224 }] 425 buttons: npc.app.cmdFormButtons 225 426 }); 226 427 … … 230 431 modal:true, 231 432 closable: true, 232 width:6 50,233 height: 500,433 width:680, 434 height:400, 234 435 bodyStyle:'padding:5px;', 235 436 items: form … … 237 438 win.show(); 238 439 440 }, 441 442 scheduleNextCheck: function(type, host, service) { 443 444 var cmd = 'SCHEDULE_FORCED_' + type.toUpperCase() + '_CHECK'; 445 446 var dt = new Date(); 447 448 var nowDate = dt.format('Y-m-d H:i:s'); 449 var nowEpoch = dt.format('U'); 450 451 var hostField = { 452 name: 'p_host_name', 453 value: host, 454 xtype: 'hidden' 455 }; 456 457 if (typeof host == 'undefined') { 458 hostField.fieldLabel = 'Host Name'; 459 hostField.xtype = 'textfield'; 460 hostField.allowBlank = false; 461 } 462 463 var serviceField = { 464 name: 'p_service_description', 465 value: service, 466 xtype: 'hidden' 467 }; 468 469 if (type == 'svc' && typeof service == 'undefined') { 470 serviceField.fieldLabel = 'Service Description'; 471 serviceField.xtype = 'textfield'; 472 serviceField.allowBlank = false; 473 } 474 475 var form = new Ext.FormPanel({ 476 labelWidth: 100, 477 url:'npc.php?module=nagios&action=command', 478 frame:true, 479 bodyStyle:'padding:5px 5px 0', 480 width: 350, 481 defaults: {width: 175}, 482 defaultType: 'textfield', 483 items: [ 484 { 485 name: 'p_command', 486 value:cmd, 487 xtype: 'hidden' 488 }, 489 hostField, 490 serviceField, 491 { 492 fieldLabel: 'Force', 493 name: 'p_force_notification', 494 xtype: 'xcheckbox', 495 checked:true, 496 labelStyle: 'cursor: help;', 497 tooltipText: "Force a check of the service regardless of what time the scheduled check occurs and whether or not checks are enabled for the service.", 498 listeners: { 499 change: function() { 500 var cmd = parseInt(form.form.getValues().p_cmd); 501 if (this.checked) { 502 cmd = cmd.replace(/SCHEDULE_/, 'SCHEDULE_FORCED_'); 503 } else { 504 cmd = cmd.replace(/FORCED_/, ''); 505 } 506 form.form.setValues({p_cmd: cmd}); 507 }, 508 render: function(o) { 509 npc.app.setFormFieldTooltip(o); 510 } 511 } 512 },{ 513 fieldLabel: 'Check Time', 514 name: 'p_date', 515 value:nowDate, 516 labelStyle: 'cursor: help;', 517 tooltipText: "The date/time must be in the format YYYY-MM-DD HH:MM:SS.", 518 listeners: { 519 change: function() { 520 console.log(form.form.getValues()); 521 var v = form.form.getValues().p_date; 522 var d = new Date(v.replace(/-/g,' ')); 523 form.form.setValues({p_check_time: d.format('U')}); 524 console.log(form.form.getValues()); 525 }, 526 render: function(o) { 527 npc.app.setFormFieldTooltip(o); 528 } 529 }, 530 xtype: 'textfield' 531 },{ 532 name: 'p_check_time', 533 value:nowEpoch, 534 xtype:'hidden' 535 },{ 536 xtype: 'panel', 537 html: '<br /><span style="font-size:10px;"><b>Note:</b> It may take a while before Nagios processes the command.</span>', 538 width: 400 539 } 540 ], 541 buttons: npc.app.cmdFormButtons 542 }); 543 544 var win = new Ext.Window({ 545 title:'Schedule Check', 546 layout:'fit', 547 modal:true, 548 closable: true, 549 width:400, 550 height:200, 551 bodyStyle:'padding:5px;', 552 items: form 553 }); 554 win.show(); 555 }, 556 557 delayNextNotification: function(type, host, service) { 558 559 var cmd = 'DELAY_' + type.toUpperCase() + '_NOTIFICATION'; 560 561 var form = new Ext.FormPanel({ 562 labelWidth: 110, 563 url:'npc.php?module=nagios&action=command', 564 frame:true, 565 bodyStyle:'padding:5px 5px 0', 566 width: 250, 567 defaults: {width: 50}, 568 defaultType: 'textfield', 569 items: [ 570 { 571 name: 'p_command', 572 value:cmd, 573 xtype: 'hidden' 574 },{ 575 name: 'p_host_name', 576 value:host, 577 xtype: 'hidden' 578 },{ 579 name: 'p_service_description', 580 value:service, 581 xtype: 'hidden' 582 },{ 583 fieldLabel: 'Delay (minutes)', 584 name: 'p_notification_time', 585 xtype: 'textfield', 586 labelStyle: 'cursor: help;', 587 tooltipText: "The number of minutes from now that the notification should be delayed.", 588 allowBlank: false, 589 listeners: { 590 render: function(o) { 591 npc.app.setFormFieldTooltip(o); 592 } 593 }, 594 checked:true 595 },{ 596 xtype: 'panel', 597 html: '<br /><span style="font-size:10px;"><b>Note:</b> It may take a while before Nagios processes this command.</span>', 598 width: 400 599 } 600 ], 601 buttons: npc.app.cmdFormButtons 602 }); 603 604 var win = new Ext.Window({ 605 title:'Acknowledge Service Problem', 606 layout:'fit', 607 modal:true, 608 closable: true, 609 width:400, 610 height:150, 611 bodyStyle:'padding:5px;', 612 items: form 613 }); 614 win.show(); 615 win.doLayout(); 616 }, 617 618 setFormFieldTooltip: function(component) { 619 var label = Ext.get('x-form-el-' + component.id).prev('label'); 620 Ext.QuickTips.register({ 621 target: label, 622 text: component.tooltipText, 623 title: '' 624 }); 239 625 }, 240 626 … … 365 751 } 366 752 if (record.data.is_flapping) { 367 img = String.format(' <img ext:qtip=" This service is flapping between states" src="images/icons/link_error.png">') + img;753 img = String.format(' <img ext:qtip="Flapping between states" src="images/icons/text_align_justify.png">') + img; 368 754 } 369 755 if (!record.data.active_checks_enabled && !record.data.passive_checks_enabled) { -
trunk/js/src/serviceDetail.js
r104 r105 260 260 tbar: [{ 261 261 text:'Commands', 262 iconCls:' appLightning',262 iconCls:'cogAdd', 263 263 menu: menu 264 264 }], … … 526 526 iconCls:'commentAdd', 527 527 handler : function(){ 528 npc.app.add ServiceComment(record.data.host_name,record.data.service_description);528 npc.app.addComment('svc', record.data.host_name, record.data.service_description); 529 529 } 530 530 }, '-', { … … 558 558 displayInfo: true 559 559 }) 560 // The search field won't render :(561 //plugins:[new Ext.ux.grid.Search({562 // mode:'remote',563 // iconCls:false564 //})]565 560 }); 566 561 … … 663 658 }; 664 659 660 var font = '<b style="font-size: xx-small">'; 661 665 662 if (service.current_state == 2) { 666 663 item = menu.add({ 667 text: 'Acknowledge this service problem' 668 //handler: ackProblemk 664 text: font + 'Acknowledge Problem</b>', 665 handler: function(o) { 666 npc.app.ackProblem('svc', service.host_name, service.service_description); 667 } 669 668 }); 670 669 } 671 670 672 671 a = service.active_checks_enabled ? 'Disable' : 'Enable'; 673 text = a + ' active checks of this service';672 text = font + a + ' Active Checks</b>'; 674 673 item = menu.add({ 675 674 text: text, … … 681 680 682 681 a = service.notifications_enabled ? 'Disable' : 'Enable'; 683 text = a + ' notifications for this service';682 text = font + a + ' Notifications</b>'; 684 683 item = menu.add({ 685 684 text: text, … … 691 690 692 691 item = menu.add({ 693 text: 'Send custom service notification' 694 //handler: sendCustomNotification 695 }); 696 697 item = menu.add({ 698 text: 'Re-schedule the next check of this service' 699 //handler: scheduleNextCheck 692 text: font + 'Send Custom Notification</b>', 693 handler: function() { 694 npc.app.sendCustomNotification('svc', service.host_name, service.service_description); 695 } 696 }); 697 698 item = menu.add({ 699 text: font + 'Re-schedule Next Check</b>', 700 handler: function() { 701 npc.app.scheduleNextCheck('svc', service.host_name, service.service_description); 702 } 700 703 }); 701 704 702 705 if (service.passive_checks_enabled) { 703 706 item = menu.add({ 704 text: 'Submit Passive Check Result For This Service'707 text: font + 'Submit Passive Check Result</b>' 705 708 //handler: submitPassiveCheck 706 709 }); … … 708 711 709 712 item = menu.add({ 710 text: 'Schedule downtime for this service'713 text: font + 'Schedule Downtime</b>' 711 714 //handler: scheduleNextCheck 712 715 }); 713 716 714 717 a = service.passive_checks_enabled ? 'Stop' : 'Start'; 715 text = a + ' accepting passive checks for this service';718 text = font + a + ' Accepting Passive Checks</b>'; 716 719 item = menu.add({ 717 720 text: text, 718 721 handler: function(o) { 719 post.p_command = a.toUpperCase() + '_PASSIVE_SVC_CHECKS ';722 post.p_command = a.toUpperCase() + '_PASSIVE_SVC_CHECKS</b>'; 720 723 doCommand(o.text+'?',post); 721 724 } … … 723 726 724 727 a = service.obsess_over_service ? 'Stop' : 'Start'; 725 text = a + ' obsessing over this service';728 text = font + a + ' Obsessing</b>'; 726 729 item = menu.add({ 727 730 text: text, … … 733 736 734 737 a = service.event_handler_enabled ? 'Disable' : 'Enable'; 735 text = a + ' event handler for this service';738 text = font + a + ' Event Handler</b>'; 736 739 item = menu.add({ 737 740 text: text, … … 743 746 744 747 a = service.event_handler_enabled ? 'Disable' : 'Enable'; 745 text = a + ' flap detection for this service';748 text = font + a + ' Flap Detection</b>'; 746 749 item = menu.add({ 747 750 text: text, … … 751 754 } 752 755 }); 756 757 if (service.current_state == 2) { 758 item = menu.add({ 759 text: font + 'Delay next notification</b>', 760 handler: function() { 761 npc.app.delayNextNotification('svc', service.host_name,service.service_description); 762 } 763 }); 764 } 753 765 754 766 return(menu);