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:
@@ -22,6 +22,7 @@ var assert = require('assert'),
|
|||||||
|
|
||||||
function postProcess(data) {
|
function postProcess(data) {
|
||||||
data.config = safe.JSON.parse(data.configJson);
|
data.config = safe.JSON.parse(data.configJson);
|
||||||
|
data.provider = data.config.provider; // FIXME, make provider a db column
|
||||||
delete data.configJson;
|
delete data.configJson;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
|
|||||||
revision: null,
|
revision: null,
|
||||||
update: { box: null, apps: null },
|
update: { box: null, apps: null },
|
||||||
progress: {},
|
progress: {},
|
||||||
isCustomDomain: false,
|
|
||||||
region: null,
|
region: null,
|
||||||
size: null,
|
size: null,
|
||||||
memory: 0
|
memory: 0
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
<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>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||||
<li ng-repeat="domain in domains">
|
<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>
|
||||||
<li>
|
<li>
|
||||||
<a href="" ng-click="useAltDomain(true)"><i class="fa fa-star"></i> External Domain</a>
|
<a href="" ng-click="useAltDomain(true)"><i class="fa fa-star"></i> External Domain</a>
|
||||||
@@ -141,9 +141,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hide">
|
<div class="hide">
|
||||||
<label class="control-label" for="appConfigureCertificateInput" ng-show="config.isCustomDomain">Certificate (optional)</label>
|
<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 && config.isCustomDomain">{{ appConfigure.error.cert }}</div>
|
<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="config.isCustomDomain">
|
<div class="form-group" ng-class="{ 'has-error': !appConfigureForm.certificate.$dirty && appConfigure.error.cert }" ng-show="appConfigure.domain.provider !== 'caas'">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="file" id="appConfigureCertificateFileInput" style="display:none"/>
|
<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">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="input-group">
|
||||||
<input type="file" id="appConfigureKeyFileInput" style="display:none"/>
|
<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">
|
<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">
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
|||||||
// fill relevant info from the app
|
// fill relevant info from the app
|
||||||
$scope.appConfigure.app = app;
|
$scope.appConfigure.app = app;
|
||||||
$scope.appConfigure.location = app.altDomain || app.location;
|
$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.usingAltDomain = !!app.altDomain;
|
||||||
$scope.appConfigure.portBindingsInfo = app.manifest.tcpPorts || {}; // Portbinding map only for information
|
$scope.appConfigure.portBindingsInfo = app.manifest.tcpPorts || {}; // Portbinding map only for information
|
||||||
$scope. Option = app.accessRestriction ? 'groups' : 'any';
|
$scope. Option = app.accessRestriction ? 'groups' : 'any';
|
||||||
@@ -132,7 +132,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
|||||||
var data = {
|
var data = {
|
||||||
location: $scope.appConfigure.usingAltDomain ? $scope.appConfigure.app.location : $scope.appConfigure.location,
|
location: $scope.appConfigure.usingAltDomain ? $scope.appConfigure.app.location : $scope.appConfigure.location,
|
||||||
altDomain: $scope.appConfigure.usingAltDomain ? $scope.appConfigure.location : null,
|
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,
|
portBindings: finalPortBindings,
|
||||||
accessRestriction: finalAccessRestriction,
|
accessRestriction: finalAccessRestriction,
|
||||||
cert: $scope.appConfigure.certificateFile,
|
cert: $scope.appConfigure.certificateFile,
|
||||||
@@ -273,7 +273,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
|||||||
// reset configure dialog
|
// reset configure dialog
|
||||||
$scope.appConfigure.error = {};
|
$scope.appConfigure.error = {};
|
||||||
$scope.appConfigure.app = {};
|
$scope.appConfigure.app = {};
|
||||||
$scope.appConfigure.domain = '';
|
$scope.appConfigure.domain = null;
|
||||||
$scope.appConfigure.location = '';
|
$scope.appConfigure.location = '';
|
||||||
$scope.appConfigure.advancedVisible = false;
|
$scope.appConfigure.advancedVisible = false;
|
||||||
$scope.appConfigure.usingAltDomain = false;
|
$scope.appConfigure.usingAltDomain = false;
|
||||||
@@ -485,7 +485,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
|||||||
return $timeout(getDomains, 5000);
|
return $timeout(getDomains, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.domains = result.map(function (d) { return d.domain; });
|
$scope.domains = result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
<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">
|
<div class="input-group-btn">
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
<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>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||||
<li ng-repeat="domain in domains">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,9 +107,9 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="hide">
|
<div class="hide">
|
||||||
<label class="control-label" for="appInstallCertificateInput" ng-show="config.isCustomDomain">Certificate (optional)</label>
|
<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 && config.isCustomDomain">{{ appInstall.error.cert }}</div>
|
<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="config.isCustomDomain">
|
<div class="form-group" ng-class="{ 'has-error': !appInstallForm.certificate.$dirty && appInstall.error.cert }" ng-show="appInstall.domain.provider !== 'caas'">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="file" id="appInstallCertificateFileInput" style="display:none"/>
|
<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">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="input-group">
|
||||||
<input type="file" id="appInstallKeyFileInput" style="display:none"/>
|
<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">
|
<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">
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
|||||||
error: {},
|
error: {},
|
||||||
app: {},
|
app: {},
|
||||||
location: '',
|
location: '',
|
||||||
domain: '',
|
domain: null,
|
||||||
portBindings: {},
|
portBindings: {},
|
||||||
mediaLinks: [],
|
mediaLinks: [],
|
||||||
certificateFile: null,
|
certificateFile: null,
|
||||||
@@ -60,7 +60,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
|||||||
$scope.appInstall.app = {};
|
$scope.appInstall.app = {};
|
||||||
$scope.appInstall.error = {};
|
$scope.appInstall.error = {};
|
||||||
$scope.appInstall.location = '';
|
$scope.appInstall.location = '';
|
||||||
$scope.appInstall.domain = '';
|
$scope.appInstall.domain = null;
|
||||||
$scope.appInstall.portBindings = {};
|
$scope.appInstall.portBindings = {};
|
||||||
$scope.appInstall.state = 'appInfo';
|
$scope.appInstall.state = 'appInfo';
|
||||||
$scope.appInstall.mediaLinks = [];
|
$scope.appInstall.mediaLinks = [];
|
||||||
@@ -106,7 +106,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
|||||||
|
|
||||||
$scope.appInstall.mediaLinks = $scope.appInstall.app.manifest.mediaLinks || [];
|
$scope.appInstall.mediaLinks = $scope.appInstall.app.manifest.mediaLinks || [];
|
||||||
$scope.appInstall.location = app.location;
|
$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.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.portBindings = {}; // This is the actual model holding the env:port pair
|
||||||
$scope.appInstall.portBindingsEnabled = {}; // This is the actual model holding the enabled/disabled flag
|
$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 = {
|
var data = {
|
||||||
location: $scope.appInstall.location || '',
|
location: $scope.appInstall.location || '',
|
||||||
domain: $scope.appInstall.domain,
|
domain: $scope.appInstall.domain.domain,
|
||||||
portBindings: finalPortBindings,
|
portBindings: finalPortBindings,
|
||||||
accessRestriction: finalAccessRestriction,
|
accessRestriction: finalAccessRestriction,
|
||||||
cert: $scope.appInstall.certificateFile,
|
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) {
|
function fetchAppstoreConfig(callback) {
|
||||||
callback = callback || function (error) { if (error) console.error(error); };
|
callback = callback || function (error) { if (error) console.error(error); };
|
||||||
|
|
||||||
@@ -557,20 +546,25 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
|
|||||||
|
|
||||||
$scope.apps = apps;
|
$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();
|
fetchUsers();
|
||||||
fetchGroups();
|
fetchGroups();
|
||||||
getDomains();
|
|
||||||
getMailConfig();
|
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);
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user