remove isCustomDomain usage from the UI

This also adds domains.provider that we should add to the db itself
at some point
This commit is contained in:
Girish Ramakrishnan
2018-01-09 09:58:06 -08:00
parent 9d386bd071
commit f236bd3316
6 changed files with 34 additions and 40 deletions

View File

@@ -121,7 +121,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
revision: null,
update: { box: null, apps: null },
progress: {},
isCustomDomain: false,
region: null,
size: null,
memory: 0

View File

@@ -17,12 +17,12 @@
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{ appConfigure.usingAltDomain ? 'External Domain' : ((!appConfigure.location ? '' : (config.isCustomDomain ? '.' : '-')) + appConfigure.domain) }}
{{ appConfigure.usingAltDomain ? 'External Domain' : ((!appConfigure.location ? '' : (appConfigure.domain.provider !== 'caas' ? '.' : '-')) + appConfigure.domain.domain) }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li ng-repeat="domain in domains">
<a href="" ng-click="useAltDomain(false, domain)">{{ domain }}</a>
<a href="" ng-click="useAltDomain(false, domain)">{{ domain.domain }}</a>
</li>
<li>
<a href="" ng-click="useAltDomain(true)"><i class="fa fa-star"></i> External Domain</a>
@@ -141,9 +141,9 @@
</div>
<div class="hide">
<label class="control-label" for="appConfigureCertificateInput" ng-show="config.isCustomDomain">Certificate (optional)</label>
<div class="has-error text-center" ng-show="appConfigure.error.cert && config.isCustomDomain">{{ appConfigure.error.cert }}</div>
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.certificate.$dirty && appConfigure.error.cert }" ng-show="config.isCustomDomain">
<label class="control-label" for="appConfigureCertificateInput" ng-show="appConfigure.domain.provider !== 'caas'">Certificate (optional)</label>
<div class="has-error text-center" ng-show="appConfigure.error.cert && appConfigure.domain.provider !== 'caas'">{{ appConfigure.error.cert }}</div>
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.certificate.$dirty && appConfigure.error.cert }" ng-show="appConfigure.domain.provider !== 'caas'">
<div class="input-group">
<input type="file" id="appConfigureCertificateFileInput" style="display:none"/>
<input type="text" class="form-control" placeholder="Certificate" ng-model="appConfigure.certificateFileName" id="appConfigureCertificateInput" name="certificate" onclick="getElementById('appConfigureCertificateFileInput').click();" style="cursor: pointer;" ng-required="appConfigure.keyFileName">
@@ -152,7 +152,7 @@
</span>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.key.$dirty && appConfigure.error.cert }" ng-show="config.isCustomDomain">
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.key.$dirty && appConfigure.error.cert }" ng-show="appConfigure.domain.provider !== 'caas'">
<div class="input-group">
<input type="file" id="appConfigureKeyFileInput" style="display:none"/>
<input type="text" class="form-control" placeholder="Key" ng-model="appConfigure.keyFileName" id="appConfigureKeyInput" name="key" onclick="getElementById('appConfigureKeyFileInput').click();" style="cursor: pointer;" ng-required="appConfigure.certificateFileName">

View File

@@ -60,7 +60,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
// fill relevant info from the app
$scope.appConfigure.app = app;
$scope.appConfigure.location = app.altDomain || app.location;
$scope.appConfigure.domain = app.domain;
$scope.appConfigure.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
$scope.appConfigure.usingAltDomain = !!app.altDomain;
$scope.appConfigure.portBindingsInfo = app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope. Option = app.accessRestriction ? 'groups' : 'any';
@@ -132,7 +132,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
var data = {
location: $scope.appConfigure.usingAltDomain ? $scope.appConfigure.app.location : $scope.appConfigure.location,
altDomain: $scope.appConfigure.usingAltDomain ? $scope.appConfigure.location : null,
domain: $scope.appConfigure.usingAltDomain ? undefined : $scope.appConfigure.domain,
domain: $scope.appConfigure.usingAltDomain ? undefined : $scope.appConfigure.domain.domain,
portBindings: finalPortBindings,
accessRestriction: finalAccessRestriction,
cert: $scope.appConfigure.certificateFile,
@@ -273,7 +273,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
// reset configure dialog
$scope.appConfigure.error = {};
$scope.appConfigure.app = {};
$scope.appConfigure.domain = '';
$scope.appConfigure.domain = null;
$scope.appConfigure.location = '';
$scope.appConfigure.advancedVisible = false;
$scope.appConfigure.usingAltDomain = false;
@@ -485,7 +485,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
return $timeout(getDomains, 5000);
}
$scope.domains = result.map(function (d) { return d.domain; });
$scope.domains = result;
});
}

View File

@@ -23,12 +23,12 @@
<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">
{{ (config.isCustomDomain ? '.' : '-') + appInstall.domain }}
{{ (appInstall.location ? (appInstall.domain.provider !== 'caas' ? '.' : '-') : '') + appInstall.domain.domain }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li ng-repeat="domain in domains">
<a href="" ng-click="appInstall.domain = domain">{{ domain }}</a>
<a href="" ng-click="appInstall.domain = domain">{{ domain.domain }}</a>
</li>
</ul>
</div>
@@ -107,9 +107,9 @@
</p>
<div class="hide">
<label class="control-label" for="appInstallCertificateInput" ng-show="config.isCustomDomain">Certificate (optional)</label>
<div class="has-error text-center" ng-show="appInstall.error.cert && config.isCustomDomain">{{ appInstall.error.cert }}</div>
<div class="form-group" ng-class="{ 'has-error': !appInstallForm.certificate.$dirty && appInstall.error.cert }" ng-show="config.isCustomDomain">
<label class="control-label" for="appInstallCertificateInput" ng-show="appInstall.domain.provider !== 'caas'">Certificate (optional)</label>
<div class="has-error text-center" ng-show="appInstall.error.cert && appInstall.domain.provider !== 'caas'">{{ appInstall.error.cert }}</div>
<div class="form-group" ng-class="{ 'has-error': !appInstallForm.certificate.$dirty && appInstall.error.cert }" ng-show="appInstall.domain.provider !== 'caas'">
<div class="input-group">
<input type="file" id="appInstallCertificateFileInput" style="display:none"/>
<input type="text" class="form-control" placeholder="Certificate" ng-model="appInstall.certificateFileName" id="appInstallCertificateInput" name="certificate" onclick="getElementById('appInstallCertificateFileInput').click();" style="cursor: pointer;" ng-required="appInstall.keyFileName">
@@ -118,7 +118,7 @@
</span>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error': !appInstallForm.key.$dirty && appInstall.error.cert }" ng-show="config.isCustomDomain">
<div class="form-group" ng-class="{ 'has-error': !appInstallForm.key.$dirty && appInstall.error.cert }" ng-show="appInstall.domain.provider !== 'caas'">
<div class="input-group">
<input type="file" id="appInstallKeyFileInput" style="display:none"/>
<input type="text" class="form-control" placeholder="Key" ng-model="appInstall.keyFileName" id="appInstallKeyInput" name="key" onclick="getElementById('appInstallKeyFileInput').click();" style="cursor: pointer;" ng-required="appInstall.certificateFileName">

View File

@@ -39,7 +39,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
error: {},
app: {},
location: '',
domain: '',
domain: null,
portBindings: {},
mediaLinks: [],
certificateFile: null,
@@ -60,7 +60,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstall.app = {};
$scope.appInstall.error = {};
$scope.appInstall.location = '';
$scope.appInstall.domain = '';
$scope.appInstall.domain = null;
$scope.appInstall.portBindings = {};
$scope.appInstall.state = 'appInfo';
$scope.appInstall.mediaLinks = [];
@@ -106,7 +106,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstall.mediaLinks = $scope.appInstall.app.manifest.mediaLinks || [];
$scope.appInstall.location = app.location;
$scope.appInstall.domain = $scope.config.fqdn; // FIXME needs to come from domains dropdown
$scope.appInstall.domain = $scope.domains[0];
$scope.appInstall.portBindingsInfo = $scope.appInstall.app.manifest.tcpPorts || {}; // 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
@@ -150,7 +150,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
var data = {
location: $scope.appInstall.location || '',
domain: $scope.appInstall.domain,
domain: $scope.appInstall.domain.domain,
portBindings: finalPortBindings,
accessRestriction: finalAccessRestriction,
cert: $scope.appInstall.certificateFile,
@@ -498,17 +498,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
});
}
function getDomains() {
Client.getDomains(function (error, result) {
if (error) {
console.error(error);
return $timeout(getDomains, 5000);
}
$scope.domains = result.map(function (d) { return d.domain; });
});
}
function fetchAppstoreConfig(callback) {
callback = callback || function (error) { if (error) console.error(error); };
@@ -557,20 +546,25 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.apps = apps;
// show install app dialog immediately if an app id was passed in the query
// hashChangeListener calls $apply, so make sure we don't double digest here
setTimeout(hashChangeListener, 1);
fetchUsers();
fetchGroups();
getDomains();
getMailConfig();
fetchAppstoreConfig(function (error) {
// domains is required since we populate the dropdown with domains[0]
Client.getDomains(function (error, result) {
if (error) console.error(error);
$scope.ready = true;
$scope.domains = result;
setTimeout(function () { $('#appstoreSearch').focus(); }, 1000);
// show install app dialog immediately if an app id was passed in the query
// hashChangeListener calls $apply, so make sure we don't double digest here
setTimeout(hashChangeListener, 1);
fetchAppstoreConfig(function (error) {
if (error) console.error(error);
$scope.ready = true;
setTimeout(function () { $('#appstoreSearch').focus(); }, 1000);
});
});
});
}