Disable solr if not enough memory
This commit is contained in:
@@ -79,17 +79,21 @@
|
||||
<h4 class="modal-title">{{ 'emails.solrConfig.title' | tr }}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div ng-bind-html=" 'emails.solrConfig.description' | tr "></div>
|
||||
<br>
|
||||
<p ng-bind-html=" 'emails.solrConfig.description' | tr "></p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="solrConfig.enabled">{{ 'emails.solrConfig.enableSolrCheckbox' | tr }}</input>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- only show this when user is trying to enable -->
|
||||
<p class="has-error" ng-show="!solrConfig.currentConfig.enabled && !solrConfig.enoughMemory">{{ 'emails.solrConfig.notEnoughMemory' | tr }}</p>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'main.dialog.cancel' | tr }}</button>
|
||||
<button type="button" class="btn btn-success" ng-click="solrConfig.submit()" ng-disabled="solrConfig.enabled === solrConfig.currentConfig.enabled || solrConfig.busy"><i class="fa fa-circle-notch fa-spin" ng-show="solrConfig.busy"></i> {{ 'main.dialog.save' | tr }}</button>
|
||||
<button type="button" class="btn btn-success" ng-click="solrConfig.submit()" ng-disabled="(!solrConfig.currentConfig.enabled && !solrConfig.enoughMemory) || solrConfig.enabled === solrConfig.currentConfig.enabled || solrConfig.busy"><i class="fa fa-circle-notch fa-spin" ng-show="solrConfig.busy"></i> {{ 'main.dialog.save' | tr }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -242,7 +246,7 @@
|
||||
<div class="col-xs-6">
|
||||
<span class="text-muted">{{ 'emails.settings.solrFts' | tr }}</span>
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<div class="col-xs-6 text-right" ng-show="solrConfig.currentConfig">
|
||||
<span ng-show="solrConfig.currentConfig.enabled">
|
||||
{{ 'emails.settings.solrEnabled' | tr }}
|
||||
<span ng-show="solrConfig.running">/ {{ 'emails.settings.solrRunning' | tr }}</span>
|
||||
|
||||
+5
-2
@@ -216,19 +216,22 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
|
||||
$scope.solrConfig = {
|
||||
busy: false,
|
||||
error: {},
|
||||
currentConfig: {},
|
||||
currentConfig: null, // null means not loaded yet
|
||||
enabled: false,
|
||||
running: false,
|
||||
enoughMemory: false,
|
||||
|
||||
refresh: function () {
|
||||
Client.getService('mail', function (error, result) {
|
||||
if (error) return console.log('Error getting status of mail conatiner', error);
|
||||
|
||||
$scope.solrConfig.enoughMemory = result.config.memorySwap > (1024*1024*1024*2);
|
||||
$scope.solrConfig.running = result.healthcheck && result.healthcheck.solr.status;
|
||||
|
||||
Client.getSolrConfig(function (error, config) {
|
||||
if (error) return console.error('Failed to get solr config', error);
|
||||
|
||||
$scope.solrConfig.currentConfig = config;
|
||||
$scope.solrConfig.running = result.healthcheck && result.healthcheck.solr.status;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user