Monit, notifications are depricated in 19.1, remove the import here.

This commit is contained in:
Ad Schellevis 2019-01-17 15:37:14 +01:00
parent 8c547092f3
commit 6d11ffc2ab
2 changed files with 0 additions and 83 deletions

View File

@ -261,53 +261,4 @@ class SettingsController extends ApiMutableModelControllerBase
{
return ['monit' => $this->getModel()->general->getNodes(), 'result' => 'ok'];
}
/**
* import system notification settings
* @return array result
*/
public function notificationAction()
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$this->sessionClose();
$cfg = Config::getInstance();
$cfgObj = $cfg->object();
$node = $this->getModel()->getNodeByReference('general');
$generalSettings = array();
// inherit SMTP settings from System->Settings->Notifications
if (!empty($cfgObj->notifications->smtp->ipaddress)) {
$generalSettings['mailserver'] = $cfgObj->notifications->smtp->ipaddress;
}
if (!empty($cfgObj->notifications->smtp->port)) {
$generalSettings['port'] = $cfgObj->notifications->smtp->port;
}
$generalSettings['username'] = $cfgObj->notifications->smtp->username;
$generalSettings['password'] = $cfgObj->notifications->smtp->password;
if ((!empty($cfgObj->notifications->smtp->tls) && $cfgObj->notifications->smtp->tls == 1) ||
(!empty($cfgObj->notifications->smtp->ssl) && $cfgObj->notifications->smtp->ssl == 1)) {
$generalSettings['ssl'] = 1;
} else {
$generalSettings['ssl'] = 0;
}
// apply them
$node->setNodes($generalSettings);
$valMsgs = $this->getModel()->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "monit.general.", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (empty($result["validations"])) {
unset($result["validations"]);
$this->getModel()->serializeToConfig();
Config::getInstance()->save();
$result['status'] = 'ok';
$result['result'] = 'OK';
}
}
return $result;
}
}

View File

@ -72,37 +72,6 @@ POSSIBILITY OF SUCH DAMAGE.
});
});
/**
* add button 'Import System Notification'
* can't do it via base_dialog
*/
$('<button class="btn btn-primary" id="btn_ImportSystemNotification" type="button" style="margin-left: 3px;">' +
'<b> {{ lang._('Import System Notification')}} </b>' +
'<i id="frm_ImportSystemNotification_progress"></i>' +
'</button>').insertAfter('#btn_ApplyGeneralSettings');
$('#btnImportSystemNotification').unbind('click').click(function(){
$('#btnImportSystemNotificationProgress').addClass("fa fa-spinner fa-pulse");
ajaxCall("/api/monit/settings/notification", {}, function(data,status) {
$("#responseMsg").addClass("hidden");
isSubsystemDirty();
updateServiceControlUI('monit');
if (data.result) {
$("#responseMsg").html(data['result']);
$("#responseMsg").removeClass("hidden");
}
$('#btnImportSystemNotificationProgress').removeClass("fa fa-spinner fa-pulse");
$('#btnImportSystemNotification').blur();
ajaxCall("/api/monit/service/status", {}, function(data,status) {
mapDataToFormUI({'frm_GeneralSettings':"/api/monit/settings/getGeneral/"}).done(function(){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
isSubsystemDirty();
updateServiceControlUI('monit');
});
});
});
});
/**
* general settings
@ -297,9 +266,6 @@ POSSIBILITY OF SUCH DAMAGE.
<button class="btn btn-primary" id="btnSaveGeneral" type="button">
<b>{{ lang._('Save changes') }}</b><i id="btnSaveGeneralProgress"></i>
</button>
<button class="btn btn-primary" id="btnImportSystemNotification" type="button" style="margin-left: 3px;">
<b>{{ lang._('Import System Notification')}}</b><i id="btnImportSystemNotificationProgress"></i>
</button>
</td>
</tr>
</table>