Use spaces suffix that replaces dots in username

This assumes usernames only have . or - but not both
This commit is contained in:
Girish Ramakrishnan
2018-08-28 12:07:55 -07:00
parent 937a165711
commit 0f6c0a2ccd
4 changed files with 10 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.groups = [];
$scope.users = [];
$scope.backupConfig = {};
$scope.spacesSuffix = '';
$scope.appConfigure = {
busy: false,
@@ -52,7 +53,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
if ($scope.user.admin) {
$scope.appConfigure.location = app.location;
} else { // strip the trailing username
$scope.appConfigure.location = app.location === $scope.user.username ? '' : app.location.replace(new RegExp('-' + $scope.user.username + '$'),'');
$scope.appConfigure.location = app.location === $scope.spacesSuffix ? '' : app.location.replace(new RegExp('-' + $scope.spacesSuffix + '$'),'');
}
$scope.appConfigure.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
$scope.appConfigure.portBindingsInfo = angular.extend({}, app.manifest.tcpPorts, app.manifest.udpPorts); // Portbinding map only for information
@@ -601,6 +602,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
Client.onReady(function () {
Client.refreshInstalledApps(); // refresh the new list immediately when switching from another view (appstore)
$scope.spacesSuffix = $scope.user.username.replace(/\./g, '-');
if ($scope.user.admin || $scope.config.spaces.enabled) {
fetchUsers();
fetchGroups();