Make UDP ports configurable

Part of cloudron/box#504
This commit is contained in:
Girish Ramakrishnan
2018-08-13 08:38:47 -07:00
parent 31a62313bb
commit 6c574ead94
2 changed files with 12 additions and 11 deletions
+8 -7
View File
@@ -105,7 +105,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstall.mediaLinks = $scope.appInstall.app.manifest.mediaLinks || [];
$scope.appInstall.domain = $scope.domains.find(function (d) { return $scope.config.adminDomain === d.domain; }); // pre-select the adminDomain
$scope.appInstall.portBindingsInfo = $scope.appInstall.app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope.appInstall.portBindingsInfo = angular.extend({}, $scope.appInstall.app.manifest.tcpPorts, $scope.appInstall.app.manifest.udpPorts); // Portbinding map only for information
$scope.appInstall.portBindings = {}; // This is the actual model holding the env:port pair
$scope.appInstall.portBindingsEnabled = {}; // This is the actual model holding the enabled/disabled flag
@@ -115,18 +115,19 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
// for spaces users, the User management is hidden. thus the admin flag check
if (!$scope.user.admin) {
// just install it with access restriction as just the user
var me = $scope.users.find(function (u) { return u.id === $scope.user.id; });
$scope.appInstall.accessRestrictionOption = 'groups';
$scope.appInstall.accessRestriction = { users: [ me ], groups: [] };
// just install it with access restriction as just the user
var me = $scope.users.find(function (u) { return u.id === $scope.user.id; });
$scope.appInstall.accessRestrictionOption = 'groups';
$scope.appInstall.accessRestriction = { users: [ me ], groups: [] };
} else {
$scope.appInstall.accessRestrictionOption = 'any';
$scope.appInstall.accessRestriction = { users: [], groups: [] };
}
// set default ports
for (var env in $scope.appInstall.app.manifest.tcpPorts) {
$scope.appInstall.portBindings[env] = $scope.appInstall.app.manifest.tcpPorts[env].defaultValue || 0;
var allPorts = angular.extend({}, $scope.appInstall.app.manifest.tcpPorts, $scope.appInstall.app.manifest.udpPorts);
for (var env in allPorts) {
$scope.appInstall.portBindings[env] = allPorts[env].defaultValue || 0;
$scope.appInstall.portBindingsEnabled[env] = true;
}