diff --git a/browser/app.css b/browser/app.css
index b2e15213..c6d9d6a7 100644
--- a/browser/app.css
+++ b/browser/app.css
@@ -440,19 +440,8 @@ footer {
.centered {
position: fixed;
- top: 50%;
- left: 50%;
- margin-top: -50px;
- margin-left: -50px;
- }
-
- .detection-msg {
- position: fixed;
- top: 50%;
- left: 50%;
- margin-top: 70px;
- margin-left: -269px;
- color: #000000;
+ width: 92%;
+ top: 40%;
}
.installation-note .med-spinner {
diff --git a/browser/pages/confirm/confirm.html b/browser/pages/confirm/confirm.html
index 9d9197c8..4f3f9054 100644
--- a/browser/pages/confirm/confirm.html
+++ b/browser/pages/confirm/confirm.html
@@ -18,11 +18,9 @@
-
-
+
{{confCtrl.installedSearchNote}}
-
diff --git a/browser/pages/confirm/controller.js b/browser/pages/confirm/controller.js
index d8b1cfe4..ecf96d7b 100644
--- a/browser/pages/confirm/controller.js
+++ b/browser/pages/confirm/controller.js
@@ -1,8 +1,13 @@
'use strict';
import Logger from '../../services/logger';
+import pgp from '../../services/openpgp';
import Platform from '../../services/platform';
import ComponentLoader from '../../services/componentLoader';
+import meta from '../../services/metadata';
+import request from 'request';
+import pify from 'pify';
+import electron from 'electron';
class ConfirmController {
@@ -12,8 +17,6 @@ class ConfirmController {
this.timeout = $timeout;
this.installerDataSvc = installerDataSvc;
this.electron = electron;
- this.loader = new ComponentLoader(installerDataSvc);
- this.loader.loadComponents();
this.installedSearchNote = '';
this.isDisabled = false;
this.numberOfExistingInstallations = 0;
@@ -24,35 +27,84 @@ class ConfirmController {
$scope.detectionStyle = false;
$scope.virtualization = true;
+ this.sc.$watch('$viewContentLoaded', ()=>{
+ this.initPage();
+ });
+
+ this.loader = new ComponentLoader(installerDataSvc);
+ }
+
+ loadModel() {
+ this.loader.loadComponents();
for (let [key, value] of this.installerDataSvc.allInstallables().entries()) {
- $scope.checkboxModel[key] = value;
- $scope.$watch(`checkboxModel.${key}.selectedOption`, function watchInstallSelectionChange() {
- $scope.checkboxModel[key].validateVersion();
+ this.sc.checkboxModel[key] = value;
+ let that = this;
+ this.sc.$watch(`checkboxModel.${key}.selectedOption`, function watchInstallSelectionChange() {
+ that.sc.checkboxModel[key].validateVersion();
});
}
- $scope.isConfigurationValid = this.isConfigurationValid;
-
- $scope.$watch('$viewContentLoaded', ()=>{
- this.initPage();
- });
+ this.sc.isConfigurationValid = this.isConfigurationValid;
this.electron.remote.getCurrentWindow().addListener('focus', ()=> {
- this.timeout( () => {
+ this.timeout(() => {
this.activatePage();
this.sc.$apply();
});
});
}
+ checkForUpdates() {
+ this.isDisabled = true;
+ this.installedSearchNote = 'The system is checking for updates';
+ return this.timeout(true).then(()=> {
+ return pify(request)('https://raw.githubusercontent.com/dgolovin/developer-platform-install-repo/master/requirements.json').then((value)=>{
+ pgp(this.pgpPublicKey, value.body).then(({text, valid, error})=>{
+ if(!error && valid) {
+ let remoteReqs = meta(JSON.parse(text), Platform.OS);
+ let opt = {
+ type: 'none',
+ buttons: ['Yes', 'No'],
+ defaultId: 0,
+ cancelId: 1,
+ message: 'There is new set of components available for installation.\nWould you like to use it?'
+ };
+ if(this.isUpdateRequired(this.installerDataSvc.requirements, remoteReqs) && 0 === electron.remote.dialog.showMessageBox(electron.remote.getCurrentWindow(), opt)) {
+ this.installerDataSvc.clearItemsToInstall();
+ this.installerDataSvc.loadRequirements(remoteReqs);
+ }
+ }
+ this.loadModel();
+ });
+ });
+ });
+ }
+
+ isUpdateRequired(oldr, newr) {
+ let res = false;
+ for(let object in newr) {
+ if(oldr[object] === undefined || (oldr[object] && oldr[object].version !== newr[object].version)) {
+ res = true;
+ break;
+ }
+ }
+ return res;
+ }
+
initPage() {
- return this.detectInstalledComponents().then(()=> {
+ return Promise.resolve().then(()=> {
+ return this.checkForUpdates();
+ }).then(()=> {
+ this.isDisabled = false;
+ return this.detectInstalledComponents();
+ }).then(()=> {
this.graph = ComponentLoader.loadGraph(this.installerDataSvc);
this.installWatchers();
return Promise.resolve();
}).then(
()=> this.setIsDisabled()
).catch((error)=> {
+ console.error(error);
this.setIsDisabled();
});
}
@@ -105,12 +157,14 @@ class ConfirmController {
detectInstalledComponents() {
if(!this.isDisabled) {
this.isDisabled = true;
- this.installedSearchNote = ' The system is checking if you have any installed components.';
+ this.installedSearchNote = 'The system is checking if you have any installed components.';
let detectors = [];
for (var installer of this.installerDataSvc.allInstallables().values()) {
detectors.push(installer.detectExistingInstall());
}
- this.detection = Promise.all(detectors);
+ this.detection = this.timeout(true).then(()=>{
+ return Promise.all(detectors);
+ });
}
return this.detection;
}
@@ -197,6 +251,41 @@ class ConfirmController {
this.electron.remote.getCurrentWindow().removeAllListeners('focus');
this.router.go('location');
}
+
+ get pgpPublicKey() {
+ return `-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQENBFl45PABCADa3JMtyxLpEvxiqFsqM0D7p+R5bG4WDUW2Gf3A4olL3Ba1dMbY
+XuVKN2VVWF0eaX/kkPFWFQQ/zUbBR5A8BcCzWrVNm7NvbSxkwqS8U8imc+0QYz6f
+RQfYvzGaN3rg2EJ4XiGy5M7nVoPmwk9xqbhJxxv3d507oPDN1FOnoTY68Y+GbiUM
+HF3mFlBtQwxhGxlFhwPABmHypfeBCk36s0TzzvAekNcT8ROuWM+68KjtZEbizQ4J
+0ZYeLixdTyN3em4ve+hFFjiQOZbh5PKzrSP8nw1EFoAdHnefO/2vUe6pp3G8y8CB
+zlT2ZU2kuFsP7I5HeZoGi4DbbXgJyqhp4jGrABEBAAG0S0RlbmlzIEdvbG92aW4g
+KFRlc3Qgc2lnbmluZyBhbmQgdmVyaWZ5aW5nIHRleHQgZmlsZXMpIDxkZ29sb3Zp
+bkByZWRoYXQuY29tPokBOAQTAQIAIgUCWXjk8AIbAwYLCQgHAwIGFQgCCQoLBBYC
+AwECHgECF4AACgkQHrpirkCkMkpT6gf+LwCUJRHpL/V2z8A2ZDbf8nT/9AIOmpdq
+z/mUj3kJUbrPTel7jel2qAqCDC7/BySPVjToqfX/Ww8yiq48j9xtWOenPb52QO0S
+zBdxnFUK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scope', '$state', '$timeout', 'installerDataSvc', 'electron'];
diff --git a/browser/services/data.js b/browser/services/data.js
index 441219fb..0ddd45ba 100644
--- a/browser/services/data.js
+++ b/browser/services/data.js
@@ -34,18 +34,23 @@ class InstallerDataService {
this.toSetup = new Set();
this.downloading = false;
this.installing = false;
- this.requirements = loadMetadata(requirements, Platform.getOS());
- // filter download-manager urls and replace host name with stage
- // host name provided in environment variable
+ this.loadRequirements(requirements);
+ }
+
+ loadRequirements(requirements) {
+ let reqs = loadMetadata(requirements, Platform.getOS());
let stageHost = Platform.ENV['DM_STAGE_HOST'];
if(stageHost) {
- for (let variable in this.requirements) {
- let dmUrl = this.requirements[variable].dmUrl;
+ // filter download-manager urls and replace host name with stage
+ // host name provided in environment variable
+ for (let variable in reqs) {
+ let dmUrl = reqs[variable].dmUrl;
if (dmUrl && dmUrl.includes('download-manager/jdf/file')) {
- this.requirements[variable].dmUrl = dmUrl.replace('developers.redhat.com', stageHost);
+ reqs[variable].dmUrl = dmUrl.replace('developers.redhat.com', stageHost);
}
}
}
+ this.requirements = reqs;
}
setup(vboxRoot, jdkRoot, devstudioRoot, jbosseapRoot, cygwinRoot, cdkRoot, komposeRoot, fuseplatformRoot, fuseplatformkarafRoot) {
@@ -104,6 +109,11 @@ class InstallerDataService {
}
}
+ clearItemsToInstall() {
+ this.installableItems.clear();
+ this.toInstall.clear();
+ }
+
getInstallable(key) {
return this.installableItems.get(key);
}