diff --git a/CHANGES b/CHANGES index bcf162f9d..90802378b 100644 --- a/CHANGES +++ b/CHANGES @@ -2663,5 +2663,5 @@ * translation: fix crash when translated text has single quote (french) * dyndns: show logs * mail: server location get it's own section -* turn: make it an optional service +* optional services: redis & turn . joins sendmail, recvmail diff --git a/dashboard/src/translation/en.json b/dashboard/src/translation/en.json index c80444a86..f277200fb 100644 --- a/dashboard/src/translation/en.json +++ b/dashboard/src/translation/en.json @@ -90,7 +90,8 @@ "statusEnabled": "Enabled", "statusDisabled": "Disabled", "loadingPlaceholder": "Loading", - "settings": "Settings" + "settings": "Settings", + "saveAction": "Save" }, "appstore": { "title": "App Store", @@ -1721,6 +1722,17 @@ "label": "Label", "clearIconAction": "Clear Icon", "clearIconDescription": "This will try to fetch the app's favicon on save." + }, + "servicesTabTitle": "Services", + "turn": { + "title": "TURN Setup", + "enable": "Configure the app to use the built-in TURN server", + "disable": "Do not configure the app's TURN settings. The app's TURN settings is left alone. You can configure it inside the app." + }, + "redis": { + "title": "Redis Configuration", + "enable": "Configure the app to use Redis", + "disable": "Disable Redis" } }, "login": { diff --git a/dashboard/src/views/app.html b/dashboard/src/views/app.html index 493029991..152f1ed83 100644 --- a/dashboard/src/views/app.html +++ b/dashboard/src/views/app.html @@ -632,7 +632,7 @@
Proxy
{{ 'app.accessControlTabTitle' | tr }}
{{ 'app.resourcesTabTitle' | tr }}
-
{{ 'app.servicesTabTitle' | tr }}
+
{{ 'app.servicesTabTitle' | tr }}
{{ 'app.storageTabTitle' | tr }}
{{ 'app.graphsTabTitle' | tr }}
{{ 'app.securityTabTitle' | tr }}
@@ -966,20 +966,20 @@ -
+
@@ -987,10 +987,38 @@

+ +
+ +
+
+ + +
+ +
+ +
+ +
+
+ +
+
+ +
+
+
diff --git a/dashboard/src/views/app.js b/dashboard/src/views/app.js index a918c4fb6..ee88251d8 100644 --- a/dashboard/src/views/app.js +++ b/dashboard/src/views/app.js @@ -590,12 +590,14 @@ angular.module('Application').controller('AppController', ['$scope', '$location' busy: false, enableTurn: '1', // curse of radio buttons + enableRedis: '1', show: function () { var app = $scope.app; $scope.services.error = {}; $scope.services.enableTurn = app.enableTurn ? '1' : '0'; + $scope.services.enableRedis = app.enableRedis ? '1' : '0'; }, submitTurn: function () { @@ -613,6 +615,22 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $timeout(function () { $scope.services.busy = false; }, 1000); }); }, + + submitRedis: function () { + $scope.services.busy = true; + $scope.services.error = {}; + + Client.configureApp($scope.app.id, 'redis', { enable: $scope.services.enableRedis === '1' }, function (error) { + if (error && error.statusCode === 400) { + $scope.services.busy = false; + $scope.services.error.redis = true; + return; + } + if (error) return Client.error(error); + + $timeout(function () { $scope.services.busy = false; }, 1000); + }); + }, }; $scope.storage = { diff --git a/src/services.js b/src/services.js index 52eb9a0e3..ddd61fe95 100644 --- a/src/services.js +++ b/src/services.js @@ -1812,6 +1812,9 @@ async function backupRedis(app, options) { assert.strictEqual(typeof app, 'object'); assert.strictEqual(typeof options, 'object'); + const disabled = app.manifest.addons.redis.optional && !app.enableRedis; + if (disabled) return; + debug('Backing up redis'); const result = await getContainerDetails('redis-' + app.id, 'CLOUDRON_REDIS_TOKEN'); @@ -1822,6 +1825,9 @@ async function restoreRedis(app, options) { assert.strictEqual(typeof app, 'object'); assert.strictEqual(typeof options, 'object'); + const disabled = app.manifest.addons.redis.optional && !app.enableRedis; + if (disabled) return; + debug('Restoring redis'); const result = await getContainerDetails('redis-' + app.id, 'CLOUDRON_REDIS_TOKEN');