ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-21612 PATCH version should be attached right next to the STANDARD. (atkach)
Date Mon, 31 Jul 2017 11:33:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21450 a1efd2cb1 -> eb28ec374


AMBARI-21612 PATCH version should be attached right next to the STANDARD. (atkach)


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

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: eb28ec374fc6b8e40e299ada98a5e648c65d91db
Parents: a1efd2c
Author: Andrii Tkach <atkach@apache.org>
Authored: Mon Jul 31 14:22:28 2017 +0300
Committer: Andrii Tkach <atkach@apache.org>
Committed: Mon Jul 31 14:22:28 2017 +0300

----------------------------------------------------------------------
 .../main/admin/stack_and_upgrade_controller.js  |  3 ++-
 .../app/mappers/repository_version_mapper.js    | 19 ++++----------
 .../models/stack_version/repository_version.js  |  2 ++
 .../app/models/stack_version/service_simple.js  |  1 +
 ambari-web/app/styles/stack_versions.less       | 27 ++++++++++++++++++--
 .../stack_upgrade/upgrade_version_column.hbs    | 16 ++++++++++--
 .../admin/stack_upgrade/upgrade_history_view.js |  3 ++-
 .../upgrade_version_column_view.js              | 21 +++++++--------
 .../test/controllers/wizard/step8_test.js       | 14 ----------
 ambari-web/test/utils/helper_test.js            |  2 +-
 10 files changed, 63 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index e02a4c2..531c11e 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1333,7 +1333,8 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
       label: version.get('displayName'),
       type: version.get('upgradeType'),
       skipComponentFailures: version.get('skipComponentFailures') ? 'true' : 'false',
-      skipSCFailures: version.get('skipSCFailures') ? 'true' : 'false'
+      skipSCFailures: version.get('skipSCFailures') ? 'true' : 'false',
+      targetStack: version.get('displayName')
     };
     if (App.get('supports.preUpgradeCheck')) {
       this.set('requestInProgress', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/mappers/repository_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/repository_version_mapper.js b/ambari-web/app/mappers/repository_version_mapper.js
index 8ef50db..704b24e 100644
--- a/ambari-web/app/mappers/repository_version_mapper.js
+++ b/ambari-web/app/mappers/repository_version_mapper.js
@@ -61,13 +61,6 @@ App.repoVersionMapper = App.QuickDataMapper.create({
     }
   },
 
-  modelService: {
-    id: 'id',
-    name: 'name',
-    display_name: 'display_name',
-    latest_version: 'latest_version'
-  },
-
   modelRepository: {
     id: 'id',
     operating_system_id: 'Repositories.operating_system_id',
@@ -103,7 +96,6 @@ App.repoVersionMapper = App.QuickDataMapper.create({
         if (loadAll || (item[repoVersionsKey] && !App.StackVersion.find().someProperty('repositoryVersion.id',
item[repoVersionsKey].id))) {
           var repo = item;
           var osArray = [];
-          var serviceArray = [];
           if (item.operating_systems) {
             item.operating_systems.forEach(function (os) {
               os.id = item[repoVersionsKey].repository_version + os.OperatingSystems.os_type;
@@ -128,10 +120,10 @@ App.repoVersionMapper = App.QuickDataMapper.create({
                 id: item[repoVersionsKey].repository_version + service.name,
                 name: service.name,
                 display_name: service.display_name,
-                latest_version: service.versions[0] ? service.versions[0] : ''
+                latest_version: service.versions[0] ? service.versions[0] : '',
+                is_available: item[repoVersionsKey].services.someProperty('name', service.name)
               };
-              serviceArray.pushObject(serviceObj);
-              resultService.push(this.parseIt(serviceObj, this.get('modelService')));
+              resultService.push(serviceObj);
             }, this);
           } else if (item[repoVersionsKey].services) {
             item[repoVersionsKey].services.forEach(function (service) {
@@ -141,13 +133,12 @@ App.repoVersionMapper = App.QuickDataMapper.create({
                 display_name: service.display_name,
                 latest_version: service.versions[0] ? service.versions[0].version: ''
               };
-              serviceArray.pushObject(serviceObj);
-              resultService.push(this.parseIt(serviceObj, this.get('modelService')));
+              resultService.push(serviceObj);
             }, this);
           }
           repo.use_redhat_satellite = item.operating_systems[0].OperatingSystems.ambari_managed_repositories
=== false;
           repo.operating_systems = osArray;
-          repo.stack_services = serviceArray;
+          repo.stack_services = resultService;
           resultRepoVersion.push(this.parseIt(repo, this.modelRepoVersion(isCurrentStackOnly)));
         }
       }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/models/stack_version/repository_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/repository_version.js b/ambari-web/app/models/stack_version/repository_version.js
index 5ecfdd1..c0eddba 100644
--- a/ambari-web/app/models/stack_version/repository_version.js
+++ b/ambari-web/app/models/stack_version/repository_version.js
@@ -34,6 +34,8 @@ App.RepositoryVersion = DS.Model.extend({
     return this.get('stackVersionType') + '-' + this.get('repositoryVersion').split('-')[0];
   }.property('stackVersionType', 'repositoryVersion'),
 
+  isPatch: Em.computed.equal('type', 'PATCH'),
+
   /**
    * status used until corresponding stack version get created
    * @type {string}

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/models/stack_version/service_simple.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_version/service_simple.js b/ambari-web/app/models/stack_version/service_simple.js
index f693cc8..0e5df14 100644
--- a/ambari-web/app/models/stack_version/service_simple.js
+++ b/ambari-web/app/models/stack_version/service_simple.js
@@ -23,6 +23,7 @@ App.ServiceSimple = DS.Model.extend({
   name: DS.attr('string'),
   displayName: DS.attr('string'),
   latestVersion: DS.attr('string'),
+  isAvailable: DS.attr('boolean'),
   isHidden: function () {
     var hiddenServices = ['MAPREDUCE2'];
     return hiddenServices.contains(this.get('name')) || this.get('doNotShowAndInstall');

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/styles/stack_versions.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/stack_versions.less b/ambari-web/app/styles/stack_versions.less
index 09073d8..d652899 100644
--- a/ambari-web/app/styles/stack_versions.less
+++ b/ambari-web/app/styles/stack_versions.less
@@ -292,6 +292,9 @@
         cursor: pointer;
       }
     }
+    .patch-icon {
+      margin: 0 0 -5px 0;
+    }
     .state {
       margin: 5px 0px 15px 0px;
       line-height: 20px;
@@ -346,8 +349,28 @@
         }
       }
     }
-
-
+  }
+  div.version-column {
+    .services-section {
+      .service-version-info {
+        span.label.available {
+          background-color: #468847;
+        }
+      }
+    }
+  }
+  .patch-upgrade-column {
+    margin-left: -7px;
+    border-color: @health-status-red;
+    background-color: rgba(255, 0, 0, 0.1);
+    .services-section {
+      .line-separator {
+        margin-left: 0;
+      }
+      .line-separator-bottom {
+        margin-left: 0;
+      }
+    }
   }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
index ee9bb93..0c3aedc 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_version_column.hbs
@@ -21,7 +21,17 @@
 {{/if}}
 
 <p class="version-column-display-name">
-  <span>{{view.content.displayNameSimple}}</span>
+  {{#if view.content.isPatch}}
+    <span>{{view.content.displayName}}</span>
+  {{else}}
+    <span>{{view.content.displayNameSimple}}</span>
+  {{/if}}
+</p>
+
+<p class="patch-icon">
+    {{#if view.content.isPatch}}
+      <i class="icon-umbrella"></i>&nbsp;{{t common.patch}}
+    {{/if}}
 </p>
 
 <p class="version-column-show-details">
@@ -81,7 +91,9 @@
   {{#each service in view.services}}
     <div class="line-separator"></div>
     <p class="service-version-info">
-       <span {{bindAttr class="service.isVersionInvisible:invisible :label"}}>{{service.latestVersion}}</span>
+       <span {{bindAttr class="service.isVersionInvisible:invisible service.isAvailable:available
:label"}}>
+           {{service.latestVersion}}
+       </span>
     </p>
     <div class="line-separator-bottom"></div>
   {{/each}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index 3bcccdf..c1ad3cf 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -124,9 +124,10 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
   }.property('filteredContent', 'startIndex', 'endIndex'),
 
   processForDisplay: function (content) {
+    var upgradeMethods = this.get('upgradeMethods');
     return arrayUtils.flatten(content.map(function(item) {
       var versions = item.get('versions');
-      var method = this.get('upgradeMethods').findProperty('type', item.get('upgradeType'));
+      var method = upgradeMethods.findProperty('type', item.get('upgradeType'));
       return Object.keys(versions).map(function(serviceName) {
         return {
           version: versions[serviceName].to_repository_version,

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
index 66e424e..17dd1a3 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
@@ -23,6 +23,11 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
   templateName: require('templates/main/admin/stack_upgrade/upgrade_version_column'),
   isVersionColumnView: true,
   classNames: ['version-column', 'span4'],
+  classNameBindings: ['patchUpgradeClass'],
+
+  patchUpgradeClass: function() {
+    return this.get('content.isPatch') ? 'patch-upgrade-column' : '';
+  }.property('content'),
 
   didInsertElement: function () {
     App.tooltip($('.out-of-sync-badge'), {title: Em.I18n.t('hosts.host.stackVersions.status.out_of_sync')});
@@ -45,22 +50,18 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
   },
 
   services: function() {
-    var repoRecord = App.RepositoryVersion.find(this.get('content.id'));
-    var originalServices = repoRecord.get('stackServices');
+    var originalServices = this.get('content.stackServices');
     // sort the services in the order the same as service menu
-    var sorted = App.Service.find().map(function (service) {
-      var latestVersion = '';
-      if (originalServices.someProperty('name', service.get('serviceName'))){
-        latestVersion = originalServices.filterProperty('name', service.get('serviceName'))[0].get('latestVersion');
-      }
+    return App.Service.find().map(function (service) {
+      var stackService = originalServices.findProperty('name', service.get('serviceName'));
       return Em.Object.create({
         displayName: service.get('displayName'),
         name: service.get('serviceName'),
-        latestVersion: latestVersion,
-        isVersionInvisible: latestVersion == false
+        latestVersion: stackService ? stackService.get('latestVersion') : '',
+        isVersionInvisible: !stackService,
+        isAvailable: stackService ? stackService.get('isAvailable') : false
       });
     });
-    return sorted;
   }.property(),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index f725948..75168da 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -2315,18 +2315,4 @@ describe('App.WizardStep8Controller', function () {
     });
 
   });
-  //TODO
-  describe('#generateBlueprint', function () {
-     beforeEach(function () {
-         installerStep8Controller = getController();
-         installerStep8Controller.set('configs', configs);
-         installerStep8Controller.set('content.services', services.filterProperty('isSelected'))
-         installerStep8Controller.set('selectedServices', []);
-         sinon.spy(installerStep8Controller, 'getConfigurationDetailsForConfigType');
-     });
-     it('should call generateBlueprint', function() {
-       installerStep8Controller.generateBlueprint();
-       expect(installerStep8Controller.getConfigurationDetailsForConfigType.calledThrice).to.be.true;
-     });
- });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb28ec37/ambari-web/test/utils/helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/helper_test.js b/ambari-web/test/utils/helper_test.js
index ca3c372..b97dfde 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -266,7 +266,7 @@ describe('utils/helper', function() {
           expect(App.format.commandDetail(command)).to.be.equal(' Ganglia Monitor Stop');
         });
         it('should use display name for operations if specified', function() {
-          expect(App.format.commandDetail(customCommandDetail, null, opsDisplayName)).to.be.equal('
Remove Logical Mycomponent');
+          expect(App.format.commandDetail(customCommandDetail, null, opsDisplayName)).to.be.equal('
Remove Logical Mycomponent Mycomponent');
         });
         it('should ignore decommission command', function(){
           expect(App.format.commandDetail(ignored)).to.be.equal('  NameNode');


Mime
View raw message