Make dataDir configurable

This commit is contained in:
Girish Ramakrishnan
2019-01-15 11:13:41 -08:00
parent 56191d0cd9
commit 093491c5b4
2 changed files with 18 additions and 1 deletions
+7
View File
@@ -158,6 +158,13 @@
<input type="text" class="form-control" id="appConfigureXFrameOptionsInput" name="xFrameOptions" placeholder="https://example.com" ng-model="appConfigure.xFrameOptions" uib-tooltip="Leave blank to not allow embedding">
</div>
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.dataDir.$dirty && appConfigure.error.dataDir }">
<input type="checkbox" id="appConfigureEnableDataDir" ng-model="appConfigure.dataDirEnabled">
<label class="control-label" for="appConfigureEnableDataDir">Custom Data Directory</label>
<div class="control-label" ng-show="appConfigure.error.dataDir">{{appConfigure.error.dataDir}}</div>
<input type="text" class="form-control" id="appConfigureDataDirInput" name="dataDir" ng-disabled="!appConfigure.dataDirEnabled" placeholder="/mnt/appdata" ng-model="appConfigure.dataDir">
</div>
<div class="form-group">
<label class="control-label">Specify robots.txt file content</label>
<textarea ng-model="appConfigure.robotsTxt" placeholder="Leave empty to allow all bots to index this app." class="form-control" rows="3"></textarea>
+11 -1
View File
@@ -35,8 +35,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
accessRestrictionOption: 'any',
accessRestriction: { users: [], groups: [] },
xFrameOptions: '',
dataDir: null,
alternateDomainEnabled: false,
mailboxNameEnabled: false,
dataDirEnabled: false,
alternateSubdomain: '',
alternateDomain: null,
ssoAuth: false,
@@ -60,6 +62,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.portBindingsInfo = angular.extend({}, app.manifest.tcpPorts, app.manifest.udpPorts); // Portbinding map only for information
$scope.appConfigure.memoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
$scope.appConfigure.xFrameOptions = app.xFrameOptions.indexOf('ALLOW-FROM') === 0 ? app.xFrameOptions.split(' ')[1] : '';
$scope.appConfigure.dataDirEnabled = !!app.dataDir;
$scope.appConfigure.dataDir = app.dataDir;
$scope.appConfigure.alternateDomainEnabled = !!app.alternateDomains[0];
$scope.appConfigure.alternateSubdomain = app.alternateDomains[0] ? app.alternateDomains[0].subdomain : '';
$scope.appConfigure.alternateDomain = app.alternateDomains[0] ? $scope.domains.filter(function (d) { return d.domain === app.alternateDomains[0].domain; })[0] : $scope.appConfigure.domain;
@@ -114,6 +118,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.error.other = null;
$scope.appConfigure.error.location = null;
$scope.appConfigure.error.xFrameOptions = null;
$scope.appConfigure.error.dataDir = null;
$scope.appConfigure.error.alternateDomains = null;
$scope.appConfigure.error.mailboxName = null;
@@ -150,6 +155,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
// The backend supports multiple alternateDomains, however we only have ui for one
if ($scope.appConfigure.alternateDomainEnabled) data.alternateDomains = [{ domain: $scope.appConfigure.alternateDomain.domain, subdomain: $scope.appConfigure.alternateSubdomain }];
if ($scope.appConfigure.dataDirEnabled) data.dataDir = $scope.appConfigure.dataDir;
if ($scope.appConfigure.mailboxNameEnabled) {
data.mailboxName = $scope.appConfigure.mailboxName;
@@ -159,7 +166,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
if (error && error.statusCode !== 409) console.error(error); // it's fine if it already exists
});
}
} else { // setting to empty will reset to .app name
data.mailboxName = '';
}
@@ -190,6 +196,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.error.alternateDomains = error.message;
$scope.appConfigureForm.alternateDomains.$setPristine();
$('#appConfigureAlternateSubdomainInput').focus();
} else if (error.statusCode === 400 && error.message.indexOf('dataDir') !== -1 ) {
$scope.appConfigure.error.dataDir = error.message;
$scope.appConfigureForm.dataDir.$setPristine();
$('#appConfigureDataDirInput').focus();
} else {
$scope.appConfigure.error.other = error.message;
}