Remove spaces code

This commit is contained in:
Girish Ramakrishnan
2019-05-04 18:40:10 -07:00
parent e7f614cdf3
commit 34eadebe00
6 changed files with 11 additions and 39 deletions
+6 -12
View File
@@ -20,9 +20,7 @@
<div class="input-group-btn">
<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 ? '' : '-') + spacesSuffix + (appConfigure.domain.config.hyphenatedSubdomains ? '-' : '.') + appConfigure.domain.domain }}</span>
<span>{{ (!appConfigure.location ? '' : (appConfigure.domain.config.hyphenatedSubdomains ? '-' : '.')) + appConfigure.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@@ -150,9 +148,7 @@
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" ng-disabled="!appConfigure.alternateDomainEnabled">
<!-- the admin check is to check for spaces user -->
<span ng-if="user.admin">{{ (!appConfigure.alternateSubdomain ? '' : (appConfigure.alternateDomain.config.hyphenatedSubdomains ? '-' : '.')) + appConfigure.alternateDomain.domain }}</span>
<span ng-if="!user.admin">{{ (!appConfigure.alternateSubdomain ? '' : '-') + spacesSuffix + (appConfigure.alternateDomain.config.hyphenatedSubdomains ? '-' : '.') + appConfigure.alternateDomain.domain }}</span>
<span>{{ (!appConfigure.alternateSubdomain ? '' : (appConfigure.alternateDomain.config.hyphenatedSubdomains ? '-' : '.')) + appConfigure.alternateDomain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@@ -297,9 +293,7 @@
<input type="text" class="form-control" ng-model="appRestore.location" id="appRestoreLocationInput" name="location" placeholder="Leave empty to use bare domain" autofocus>
<div class="input-group-btn">
<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 ? '' : '-') + spacesSuffix + (appRestore.domain.config.hyphenatedSubdomains ? '-' : '.') + appRestore.domain.domain }}</span>
<span>{{ (!appRestore.location ? '' : (appRestore.domain.config.hyphenatedSubdomains ? '-' : '.')) + appRestore.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
@@ -500,7 +494,7 @@
<!-- Workaround for select-all issue, see commit message -->
<div style="font-size: 1px;">&nbsp;</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && (user.admin || config.features.spaces)">
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && user.admin">
<div class="col-md-12" style="text-align: center;">
<br/><br/><br/><br/>
<h1><i class="fa fa-cloud-download fa-fw"></i> No apps installed yet!</h1>
@@ -509,7 +503,7 @@
</div>
</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && !(user.admin || config.features.spaces)">
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length === 0 && !user.admin">
<div class="col-md-12" style="text-align: center;">
<br/><br/><br/><br/>
<h1>You don't have access to any apps on this Cloudron yet!</h1>
@@ -556,7 +550,7 @@
</div>
</div>
<div class="grid-item-actions" ng-show="user.admin || (config.features.spaces && app.ownerId === user.id)">
<div class="grid-item-actions" ng-show="user.admin">
<a href="" ng-click="showUninstall(app)" uib-tooltip="Uninstall" tooltip-placement="right" tooltip-class="app-tooltip"><i class="fa fa-times scale"></i></a>
<a href="" ng-click="appRestore.show(app)" ng-show="backupConfig.provider !== 'noop'" uib-tooltip="Backups" tooltip-placement="right" tooltip-class="app-tooltip"><i class="fa fa-archive scale"></i></a>
<a href="" ng-click="appConfigure.show(app)" ng-show="(app.installationState === 'installed' || app.installationState === 'pending_configure') && !(app | installError)" uib-tooltip="Configure" tooltip-placement="right" tooltip-class="app-tooltip"><i class="fa fa-pencil-alt scale"></i></a>
+2 -9
View File
@@ -17,7 +17,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.groups = [];
$scope.users = [];
$scope.backupConfig = {};
$scope.spacesSuffix = '';
$scope.disableIndexingTemplate = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /';
$scope.appConfigure = {
@@ -63,11 +62,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
// fill relevant info from the app
$scope.appConfigure.app = app;
if ($scope.user.admin) {
$scope.appConfigure.location = app.location;
} else { // strip the trailing username in spaces mode
$scope.appConfigure.location = app.location === $scope.spacesSuffix ? '' : app.location.replace(new RegExp('-' + $scope.spacesSuffix + '$'),'');
}
$scope.appConfigure.location = app.location;
$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
$scope.appConfigure.memoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
@@ -684,9 +679,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
Client.onReady(function () {
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.features.spaces) {
if ($scope.user.admin) {
fetchUsers();
fetchGroups();
getDomains();
+1 -3
View File
@@ -23,9 +23,7 @@
<input type="text" class="form-control" ng-model="appInstall.location" id="appInstallLocationInput" name="location" placeholder="Leave empty to use bare domain" autofocus>
<div class="input-group-btn">
<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 ? '-' : '') + spacesSuffix + (appInstall.domain.config.hyphenatedSubdomains ? '-' : '.') + appInstall.domain.domain }}</span>
<span>{{ (appInstall.location ? (appInstall.domain.config.hyphenatedSubdomains ? '-' : '.') : '') + appInstall.domain.domain }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
+1 -10
View File
@@ -4,7 +4,7 @@
/* global $:false */
angular.module('Application').controller('AppStoreController', ['$scope', '$location', '$timeout', '$routeParams', 'Client', 'AppStore', function ($scope, $location, $timeout, $routeParams, Client, AppStore) {
Client.onReady(function () { if (!Client.getUserInfo().admin && !Client.getConfig().features.spaces) $location.path('/'); });
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;
@@ -21,7 +21,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.searchString = '';
$scope.validAppstoreAccount = false;
$scope.appstoreConfig = null;
$scope.spacesSuffix = '';
$scope.unstableApps = false;
$scope.showView = function (view) {
@@ -479,12 +478,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
function fetchAppstoreConfig(callback) {
callback = callback || function (error) { if (error) console.error(error); };
// non admins cannot read appstore settings in spaces mode
if (!$scope.user.admin && $scope.config.features.spaces) {
$scope.validAppstoreAccount = true;
return callback();
}
if ($scope.user.admin && $scope.config.managed) {
$scope.validAppstoreAccount = true;
return callback();
@@ -524,8 +517,6 @@ 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);