ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhew...@apache.org
Subject ambari git commit: AMBARI-17016 Removing OS doesn't work (zhewang)
Date Thu, 02 Jun 2016 21:40:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 4f4e1d960 -> 1fe38e119


AMBARI-17016 Removing OS doesn't work (zhewang)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1fe38e11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1fe38e11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1fe38e11

Branch: refs/heads/branch-2.4
Commit: 1fe38e119d28a0a6d48aa0914b42adb96e5b1704
Parents: 4f4e1d9
Author: Zhe (Joe) Wang <zhewang@apache.org>
Authored: Thu Jun 2 14:39:19 2016 -0700
Committer: Zhe (Joe) Wang <zhewang@apache.org>
Committed: Thu Jun 2 14:40:31 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/controllers/installer.js | 24 ++++++++++++++----------
 ambari-web/app/utils/db.js              |  8 ++++++++
 2 files changed, 22 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1fe38e11/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 36dcfb3..ed1e2c1 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -299,6 +299,7 @@ App.InstallerController = App.WizardController.extend({
    */
   loadStacksVersionsDefinitionsSuccessCallback: function (data) {
     var stacks = App.db.getStacks();
+    var oses = App.db.getOses();
     var repos = App.db.getRepos();
     this.decrementProperty('loadStacksRequestsCounter');
     var isStacksExistInDb = stacks && stacks.length;
@@ -316,17 +317,25 @@ App.InstallerController = App.WizardController.extend({
       var stackInfo = {};
       stackInfo.isStacksExistInDb = isStacksExistInDb;
       stackInfo.stacks = stacks;
+      stackInfo.oses = oses;
       stackInfo.repos = repos;
       this.getSupportedOSList(versionDefinition, stackInfo);
     }, this);
   },
 
-  mergeChanges: function (repos, stacks) {
+  mergeChanges: function (repos, oses, stacks) {
     var _repos = repos || [];
+    var _oses = oses || [];
     var _stacks = stacks || [];
     _repos.forEach(function (repo) {
       App.Repository.find().findProperty('id', repo.id).set('baseUrl', repo.base_url);
     });
+    _oses.forEach(function (os) {
+      App.OperatingSystem.find().findProperty('id', os.id).set('isSelected', os.is_selected);
+    });
+    App.OperatingSystem.find().filterProperty('isSelected', false).forEach(function (os)
{
+      App.stackMapper.deleteRecord(os);
+    });
     _stacks.forEach(function (_stack) {
       var stack = App.Stack.find().findProperty('id', _stack.id);
       if (stack) {
@@ -430,15 +439,10 @@ App.InstallerController = App.WizardController.extend({
    * set stacks from server to content and local DB
    */
   setStacks: function () {
-    var stacks = App.Stack.find() || [];
-    Em.assert('Stack model is not populated', stacks.get('length'));
-    App.db.setStacks(stacks.slice());
+    App.db.setStacks(App.Stack.find().slice());
     this.set('content.stacks', stacks);
-    App.OperatingSystem.find().filterProperty('isSelected', false).forEach(function (os)
{
-      App.serviceMapper.deleteRecord(os);
-    });
-    var repos = App.Repository.find() || [];
-    App.db.setRepos(repos.slice());
+    App.db.setOses(App.OperatingSystem.find().slice());
+    App.db.setRepos(App.Repository.find().slice());
   },
 
   /**
@@ -723,7 +727,7 @@ App.InstallerController = App.WizardController.extend({
         var versionData = this.getSelectedRepoVersionData();
         if (versionData) {
           this.postVersionDefinitionFile(versionData.isXMLdata, versionData.data).done(function
(versionInfo) {
-            self.mergeChanges(data.stackInfo.repos, data.stackInfo.stacks);
+            self.mergeChanges(data.stackInfo.repos, data.stackInfo.oses, data.stackInfo.stacks);
             App.Stack.find().setEach('isSelected', false);
             var stackId = Em.get(versionData, 'data.VersionDefinition.available') || versionInfo.stackNameVersion
+ "-" + versionInfo.actualVersion;
             App.Stack.find().findProperty('id', stackId).set('isSelected', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1fe38e11/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index a4e96a0..a6cdef7 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -249,6 +249,10 @@ App.db.setStacks = function (stacks) {
   App.db.set('Installer', 'stacksVersions', stacks);
 };
 
+App.db.setOses = function (oses) {
+  App.db.set('Installer', 'operatingSystems', oses);
+};
+
 App.db.setRepos = function (repos) {
   App.db.set('Installer', 'repositories', repos);
 };
@@ -442,6 +446,10 @@ App.db.getStacks = function () {
   return App.db.get('Installer', 'stacksVersions');
 };
 
+App.db.getOses = function () {
+  return App.db.get('Installer', 'operatingSystems');
+};
+
 App.db.getRepos = function () {
   return App.db.get('Installer', 'repositories');
 };


Mime
View raw message