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
+2 -2
View File
@@ -22,7 +22,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<!-- the admin check is to check for spaces user -->
<span ng-if="user.admin">{{ (!appConfigure.location ? '' : (appConfigure.domain.config.hyphenatedSubdomains ? '-' : '.')) + appConfigure.domain.domain }}</span>
<span ng-if="!user.admin">{{ (!appConfigure.location ? '' : '-') + user.username + '.' + appConfigure.domain.domain }}</span>
<span ng-if="!user.admin">{{ (!appConfigure.location ? '' : '-') + spacesSuffix + '.' + appConfigure.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@@ -263,7 +263,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<!-- the admin check is to check for spaces user -->
<span ng-if="user.admin">{{ (!appRestore.location ? '' : (appRestore.domain.config.hyphenatedSubdomains ? '-' : '.')) + appRestore.domain.domain }}</span>
<span ng-if="!user.admin">{{ (!appRestore.location ? '' : '-') + user.username + '.' + appRestore.domain.domain }}</span>
<span ng-if="!user.admin">{{ (!appRestore.location ? '' : '-') + spacesSuffix + '.' + appRestore.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
+4 -1
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();
+1 -1
View File
@@ -25,7 +25,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<!-- the admin check is to check for spaces user -->
<span ng-if="user.admin">{{ (appInstall.location ? (appInstall.domain.config.hyphenatedSubdomains ? '-' : '.') : '') + appInstall.domain.domain }}</span>
<span ng-if="!user.admin">{{ (appInstall.location ? '-' : '') + user.username + '.' + appInstall.domain.domain }}</span>
<span ng-if="!user.admin">{{ (appInstall.location ? '-' : '') + spacesSuffix + '.' + appInstall.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
+3
View File
@@ -18,6 +18,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.searchString = '';
$scope.validAppstoreAccount = false;
$scope.appstoreConfig = null;
$scope.spacesSuffix = '';
$scope.showView = function (view) {
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already
@@ -526,6 +527,8 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
function init() {
$scope.ready = false;
$scope.spacesSuffix = $scope.user.username.replace(/\./g, '-');
getAppList(function (error, apps) {
if (error) {
console.error(error);