Skip to content

Commit

Permalink
chore(mailcheck): polling interval configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jan 30, 2019
1 parent dd8e02b commit 4668a9f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/public/js/angularjs/controllers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ define([
$scope.shortDateFormat = SettingsService.getSettings().shortDateFormat.value
$scope.longDateFormat = SettingsService.getSettings().longDateFormat.value

$scope.mailerCheckPolling = $scope.mailerCheckPolling / 60000

var $uploadButton = $('#logo-upload-select').parent()
var uploadLogoSettings = {
action: '/settings/general/uploadlogo',
Expand Down Expand Up @@ -1029,6 +1031,10 @@ define([
.attr('disabled', !newVal)
.parent()
.toggleClass('md-input-wrapper-disabled', !newVal)
$('input#mailerCheckPolling')
.attr('disabled', !newVal)
.parent()
.toggleClass('md-input-wrapper-disabled', !newVal)
$('button#mailerCheckSubmit')
.attr('disabled', !newVal)
.parent()
Expand Down Expand Up @@ -1102,6 +1108,7 @@ define([
.put(
'/api/v1/settings',
[
{ name: 'mailer:check:polling', value: $scope.mailerCheckPolling * 60000 },
{ name: 'mailer:check:host', value: $scope.mailerCheckHost },
{ name: 'mailer:check:port', value: $scope.mailerCheckPort },
{
Expand Down
1 change: 1 addition & 0 deletions src/settings/settingsUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ util.getSettings = function (callback) {
s.mailerFrom = parseSetting(settings, 'mailer:from', '')

s.mailerCheckEnabled = parseSetting(settings, 'mailer:check:enable', false)
s.mailerCheckPolling = parseSetting(settings, 'mailer:check:polling', 600000)
s.mailerCheckHost = parseSetting(settings, 'mailer:check:host', '')
s.mailerCheckPort = parseSetting(settings, 'mailer:check:port', 143)
s.mailerCheckUsername = parseSetting(settings, 'mailer:check:username', '')
Expand Down
22 changes: 22 additions & 0 deletions src/views/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
mailerFrom='{{data.settings.mailerFrom.value}}';
mailerCheckEnabled={{data.settings.mailerCheckEnabled.value}};
mailerCheckPolling={{data.settings.mailerCheckPolling.value}};
mailerCheckHost='{{data.settings.mailerCheckHost.value}}';
mailerCheckPort={{data.settings.mailerCheckPort.value}};
mailerCheckUsername='{{data.settings.mailerCheckUsername.value}}';
Expand Down Expand Up @@ -923,6 +924,27 @@
<label for="mailerCheckPassword">Password</label>
<input id="mailerCheckPassword" class="md-input md-input-width-medium" name="mailerCheckPassword" type="password" ng-model="mailerCheckPassword"/>
</div>
<div class="uk-clearfix uk-margin-medium-bottom">
<div class="left">
<h6 style="padding: 0; margin: 5px 0 0 0; font-size: 16px; line-height: 14px;">Polling Interval
<i class="material-icons"
style="color: #888;
font-size: 16px;
cursor: pointer;
line-height: 18px;"
data-uk-tooltip="{cls:'long-text'}" title="Caution: Polling too often can cause high CPU usage.">error</i>
</h6>
<h5 style="padding: 0 0 10px 0; margin: 2px 0 0 0; font-size: 12px;" class="uk-text-muted">
How often to poll the server for new messages. (Minutes)
</h5>
</div>
<div class="right" style="position:relative;">
<div class="left" style="width: 90px; padding-right: 10px;">
<input id="mailerCheckPolling" class="md-input md-input-width-small" name="mailerCheckPolling" type="number" ng-model="mailerCheckPolling" />
</div>
</div>
<hr style="float: left; margin-top: 10px;" />
</div>
<div class="uk-clearfix uk-margin-medium-bottom">
<div class="left">
<h6 style="padding: 0; margin: 5px 0 0 0; font-size: 16px; line-height: 14px;">Create Account</h6>
Expand Down

0 comments on commit 4668a9f

Please sign in to comment.