diff --git a/src/views/app.html b/src/views/app.html
index 9a61a8506..5c7398e5c 100644
--- a/src/views/app.html
+++ b/src/views/app.html
@@ -382,7 +382,7 @@
-
-
-
@@ -406,7 +398,29 @@
+
+
+
diff --git a/src/views/app.js b/src/views/app.js
index 9d6e46321..b675c9880 100644
--- a/src/views/app.js
+++ b/src/views/app.js
@@ -286,13 +286,14 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources = {
busy: false,
+ busyDataDir: false,
error: {},
- success: false,
currentMemoryLimit: 0,
memoryLimit: 0,
memoryTicks: [],
dataDir: null,
+ currentDataDirEnabled: false,
dataDirEnabled: false,
show: function () {
@@ -301,6 +302,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources.currentMemoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
$scope.resources.memoryLimit = $scope.resources.currentMemoryLimit;
$scope.resources.dataDirEnabled = !!app.dataDir;
+ $scope.resources.currentDataDirEnabled = $scope.resources.dataDirEnabled
$scope.resources.dataDir = app.dataDir;
// create ticks starting from manifest memory limit. the memory limit here is currently split into ram+swap (and thus *2 below)
@@ -315,20 +317,37 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
},
- submit: function () {
+ submitMemoryLimit: function () {
$scope.resources.busy = true;
$scope.resources.error = {};
- // TODO handle data dir once we show it
-
var memoryLimit = $scope.resources.memoryLimit === $scope.resources.memoryTicks[0] ? 0 : $scope.resources.memoryLimit;
Client.configureApp($scope.app.id, 'memory_limit', { memoryLimit: memoryLimit }, function (error) {
if (error) return Client.error(error);
$scope.resources.currentMemoryLimit = $scope.resources.memoryLimit;
- $scope.resources.success = true;
$scope.resources.busy = false;
+ refreshApp();
+ });
+ },
+
+ submitDataDir: function () {
+ $scope.resources.busyDataDir = true;
+ $scope.resources.error = {};
+
+ Client.configureApp($scope.app.id, 'data_dir', { dataDir: $scope.resources.dataDirEnabled ? $scope.resources.dataDir : null }, function (error) {
+ if (error && error.statusCode === 400) {
+ $scope.resources.error.dataDir = error.message;
+ $scope.resources.busyDataDir = false;
+ return;
+ }
+ if (error) return Client.error(error);
+
+ $scope.resources.currentDataDirEnabled = $scope.resources.dataDirEnabled;
+ $scope.resourcesDataDirForm.$setPristine();
+ $scope.resources.busyDataDir = false;
+
refreshApp();
});
}