[icinga-checkins] icinga.org: icinga-web/master: * Change default endtime for scheduled service/host downtime events to ( current time) + 2 hours (fixes #871).

git at icinga.org git at icinga.org
Mon Jan 10 09:12:33 CET 2011


Module: icinga-web
Branch: master
Commit: 1cd709ea2d15f6fe7d7aefc8b4a18a670f3f1ee7
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=1cd709ea2d15f6fe7d7aefc8b4a18a670f3f1ee7

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Jan  7 12:02:56 2011 +0100

* Change default endtime for scheduled service/host downtime events to (current time) + 2 hours (fixes #871).

---

 .../Cronks/data/xml/grid/icinga-host-template.xml  |    1 +
 .../data/xml/grid/icinga-service-template.xml      |    1 +
 .../System/ViewProc/js/IcingaCommandHandler.js     |    7 ++++++-
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
index 811f65c..8ccddb1 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
@@ -67,6 +67,7 @@
         	
         	<parameter name="predefined">
         		<parameter name="IcingaApi::COMMAND_AUTHOR">${xmlfn.author}</parameter>
+			<parameter name="IcingaApi::COMMAND_ENDTIME">now+7200</parameter>
         	</parameter>
         	
         	<!-- 
diff --git a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
index 22cff70..480d847 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
@@ -68,6 +68,7 @@
         	
         	<parameter name="predefined">
         		<parameter name="IcingaApi::COMMAND_AUTHOR">${xmlfn.author}</parameter>
+			<parameter name="IcingaApi::COMMAND_ENDTIME">now+7200</parameter>
         	</parameter>
         	
         	<!-- 
diff --git a/app/modules/Cronks/templates/System/ViewProc/js/IcingaCommandHandler.js b/app/modules/Cronks/templates/System/ViewProc/js/IcingaCommandHandler.js
index 047738c..b9d4f4b 100755
--- a/app/modules/Cronks/templates/System/ViewProc/js/IcingaCommandHandler.js
+++ b/app/modules/Cronks/templates/System/ViewProc/js/IcingaCommandHandler.js
@@ -155,7 +155,12 @@ IcingaCommandHandler.prototype = {
 			break;
 			case 'date':
 				oDef.format = 'Y-m-d H:i:s';
-				oDef.value = new Date();
+
+				if (oDef.value == '') {
+					oDef.value = new Date();
+				} else if (oDef.value.match(/^now[\+-]\d+$/)) {
+					oDef.value = new Date(new Date().getTime() + 1000 * Number(oDef.value.substr(3)));
+				}
 				return new Ext.form.DateField(oDef);
 			break;
 			





More information about the icinga-checkins mailing list