From f236bd33165ba317f8b1091dbbd21ac4a0429c4e Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 9 Jan 2018 09:58:06 -0800 Subject: [PATCH] remove isCustomDomain usage from the UI This also adds domains.provider that we should add to the db itself at some point --- src/domaindb.js | 1 + webadmin/src/js/client.js | 1 - webadmin/src/views/apps.html | 12 +++++----- webadmin/src/views/apps.js | 8 +++---- webadmin/src/views/appstore.html | 12 +++++----- webadmin/src/views/appstore.js | 40 ++++++++++++++------------------ 6 files changed, 34 insertions(+), 40 deletions(-) diff --git a/src/domaindb.js b/src/domaindb.js index 03c403ea5..0cebb0142 100644 --- a/src/domaindb.js +++ b/src/domaindb.js @@ -22,6 +22,7 @@ var assert = require('assert'), function postProcess(data) { data.config = safe.JSON.parse(data.configJson); + data.provider = data.config.provider; // FIXME, make provider a db column delete data.configJson; return data; diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index 01b964a8d..25e23144f 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -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 diff --git a/webadmin/src/views/apps.html b/webadmin/src/views/apps.html index 8c0f6dbb8..96cdf955a 100644 --- a/webadmin/src/views/apps.html +++ b/webadmin/src/views/apps.html @@ -17,12 +17,12 @@
- -
{{ appConfigure.error.cert }}
-
+ +
{{ appConfigure.error.cert }}
+
@@ -152,7 +152,7 @@
-
+
diff --git a/webadmin/src/views/apps.js b/webadmin/src/views/apps.js index c4d441d00..128f8e975 100644 --- a/webadmin/src/views/apps.js +++ b/webadmin/src/views/apps.js @@ -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; }); } diff --git a/webadmin/src/views/appstore.html b/webadmin/src/views/appstore.html index 0af12f191..6c1d9a690 100644 --- a/webadmin/src/views/appstore.html +++ b/webadmin/src/views/appstore.html @@ -23,12 +23,12 @@
@@ -107,9 +107,9 @@

- -
{{ appInstall.error.cert }}
-
+ +
{{ appInstall.error.cert }}
+
@@ -118,7 +118,7 @@
-
+
diff --git a/webadmin/src/views/appstore.js b/webadmin/src/views/appstore.js index 30bff8a91..a1648a582 100644 --- a/webadmin/src/views/appstore.js +++ b/webadmin/src/views/appstore.js @@ -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); + }); }); }); }