From 354e7d0703f55d80171151aef4adcd34c05e88b5 Mon Sep 17 00:00:00 2001 From: laf Date: Thu, 27 Aug 2015 18:19:06 +0000 Subject: [PATCH] Added response to test transport button --- html/pages/settings/alerting.inc.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/html/pages/settings/alerting.inc.php b/html/pages/settings/alerting.inc.php index ef58465db..f6c1bda0a 100644 --- a/html/pages/settings/alerting.inc.php +++ b/html/pages/settings/alerting.inc.php @@ -834,12 +834,33 @@ echo '
$(".toolTip").tooltip(); $("button#test-alert").click(function() { - var transport = $(this).data("transport"); + var $this = $(this); + var transport = $this.data("transport"); $.ajax({ type: 'POST', url: '/ajax_form.php', data: { type: "test-transport", transport: transport }, - dataType: "json" + dataType: "json", + success: function(data){ + if (data.status == 'ok') { + $this.removeClass('btn-primary').addClass('btn-success'); + setTimeout(function(){ + $this.removeClass('btn-success').addClass('btn-primary'); + }, 2000); + } + else { + $this.removeClass('btn-primary').addClass('btn-danger'); + setTimeout(function(){ + $this.removeClass('btn-danger').addClass('btn-primary'); + }, 2000); + } + }, + error: function(){ + $this.removeClass('btn-primary').addClass('btn-danger'); + setTimeout(function(){ + $this.removeClass('btn-danger').addClass('btn-primary'); + }, 2000); + } }); });