You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/04/10 01:49:09 UTC

svn commit: r1466296 [4/4] - in /incubator/ambari/trunk: ./ ambari-web/app/ ambari-web/app/assets/data/dashboard/ ambari-web/app/assets/data/wizard/stack/ ambari-web/app/assets/data/wizard/stack/hdp/version130/ ambari-web/app/controllers/ ambari-web/ap...

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/cluster.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/cluster.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/cluster.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/cluster.js Tue Apr  9 23:49:08 2013
@@ -28,13 +28,13 @@ App.MainAdminClusterController = Em.Cont
   updateUpgradeVersion: function(){
     if(App.router.get('clusterController.isLoaded')){
       var url = App.formatUrl(
-        App.apiPrefix + "/stacks",
+        App.apiPrefix + "/stacks2/HDP/versions?fields=stackServices/StackServices,Versions",
         {},
         '/data/wizard/stack/stacks.json'
       );
       var upgradeVersion = this.get('upgradeVersion') || App.defaultStackVersion;
-      var installedServices = {};
-      var newServices = {};
+      var currentStack = {};
+      var upgradeStack = {};
       $.ajax({
         type: "GET",
         url: url,
@@ -45,17 +45,16 @@ App.MainAdminClusterController = Em.Cont
           var currentVersion = App.currentStackVersion.replace(/HDP-/, '');
           var minUpgradeVersion = currentVersion;
           upgradeVersion = upgradeVersion.replace(/HDP-/, '');
-          data = data.filterProperty('name', 'HDP');
-          data.mapProperty('version').forEach(function(version){
+          data.items.mapProperty('Versions.stack_version').forEach(function(version){
             upgradeVersion = (upgradeVersion < version) ? version : upgradeVersion;
           });
-          //TODO remove hardcoded upgrade version
-          upgradeVersion = (App.testMode)?'1.3.0': upgradeVersion;
-          minUpgradeVersion = data.findProperty('version', upgradeVersion).minUpgradeVersion;
-          minUpgradeVersion = (minUpgradeVersion) ? minUpgradeVersion : currentVersion;
-          upgradeVersion = (minUpgradeVersion <= currentVersion) ? upgradeVersion : currentVersion;
-          installedServices = data.findProperty('version', currentVersion);
-          newServices = data.findProperty('version', upgradeVersion);
+          currentStack = data.items.findProperty('Versions.stack_version', currentVersion);
+          upgradeStack = data.items.findProperty('Versions.stack_version', upgradeVersion);
+          minUpgradeVersion = upgradeStack.Versions.min_upgrade_version;
+          if(minUpgradeVersion && (minUpgradeVersion > currentVersion)){
+            upgradeVersion = currentVersion;
+            upgradeStack = currentStack;
+          }
           upgradeVersion = 'HDP-' + upgradeVersion;
         },
         error: function (request, ajaxOptions, error) {
@@ -64,8 +63,8 @@ App.MainAdminClusterController = Em.Cont
         statusCode: require('data/statusCodes')
       });
       this.set('upgradeVersion', upgradeVersion);
-      if(installedServices && newServices){
-        this.parseServicesInfo(installedServices, newServices);
+      if(currentStack && upgradeStack){
+        this.parseServicesInfo(currentStack, upgradeStack);
       } else {
         console.log('HDP stack doesn\'t have services with defaultStackVersion');
       }
@@ -74,32 +73,36 @@ App.MainAdminClusterController = Em.Cont
   /**
    * parse services info(versions, description) by version
    */
-  parseServicesInfo: function (oldServices, newServices) {
+  parseServicesInfo: function (currentStack, upgradeStack) {
     var result = [];
     var installedServices = App.Service.find().mapProperty('serviceName');
     var displayOrderConfig = require('data/services');
-    if(oldServices.services && newServices.services){
+    if(currentStack.stackServices.length && upgradeStack.stackServices.length){
       // loop through all the service components
       for (var i = 0; i < displayOrderConfig.length; i++) {
-        var entry = oldServices.services.findProperty("name", displayOrderConfig[i].serviceName);
+        var entry = currentStack.stackServices.
+          findProperty("StackServices.service_name", displayOrderConfig[i].serviceName);
         if (entry) {
-          if (installedServices.contains(entry.name)) {
-            var myService = Em.Object.create({
-              serviceName: entry.name,
-              displayName: displayOrderConfig[i].displayName,
-              isDisabled: i === 0,
-              isSelected: true,
-              isInstalled: false,
-              isHidden: displayOrderConfig[i].isHidden,
-              description: entry.comment,
-              version: entry.version,
-              newVersion: newServices.services.findProperty("name", displayOrderConfig[i].serviceName).version
-            });
-            //From 1.3.0 for Hive we display only "Hive" (but it installes HCat and WebHCat as well)
-            if (this.get('upgradeVersion').replace(/HDP-/, '') >= '1.3.0' && displayOrderConfig[i].serviceName == 'HIVE') {
-              myService.set('displayName', 'Hive');
-            }
-            result.push(myService);
+          entry = entry.StackServices;
+        if (installedServices.contains(entry.service_name)) {
+          var myService = Em.Object.create({
+            serviceName: entry.service_name,
+            displayName: displayOrderConfig[i].displayName,
+            isDisabled: i === 0,
+            isSelected: true,
+            isInstalled: false,
+            isHidden: displayOrderConfig[i].isHidden,
+            description: entry.comments,
+            version: entry.service_version,
+            newVersion: upgradeStack.stackServices.
+              findProperty("StackServices.service_name", displayOrderConfig[i].serviceName).
+              StackServices.service_version
+          });
+          //From 1.3.0 for Hive we display only "Hive" (but it install HCat and WebHCat as well)
+          if (this.get('upgradeVersion').replace(/HDP-/, '') >= '1.3.0' && displayOrderConfig[i].serviceName == 'HIVE') {
+            myService.set('displayName', 'Hive');
+          }
+          result.push(myService);
           }
         }
         else {

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js Tue Apr  9 23:49:08 2013
@@ -93,7 +93,7 @@ App.AddHostController = App.WizardContro
    */
   loadServicesFromServer: function() {
     var displayOrderConfig = require('data/services');
-    var apiUrl = App.get('stackVersionURL');
+    var apiUrl = App.get('stack2VersionURL');
     var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
     //
     apiService.forEach(function(item, index){

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js Tue Apr  9 23:49:08 2013
@@ -95,7 +95,7 @@ App.AddServiceController = App.WizardCon
       return;
     }
     var displayOrderConfig = require('data/services');
-    var apiUrl = App.get('stackVersionURL');
+    var apiUrl = App.get('stack2VersionURL');
     var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
     //
     apiService.forEach(function(item, index){

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js Tue Apr  9 23:49:08 2013
@@ -71,7 +71,7 @@ App.ReassignMasterController = App.Wizar
    */
   loadServicesFromServer: function() {
     var displayOrderConfig = require('data/services');
-    var apiUrl = App.get('stackVersionURL');
+    var apiUrl = App.get('stack2VersionURL');
     var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
     //
     apiService.forEach(function(item, index){

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard.js Tue Apr  9 23:49:08 2013
@@ -431,7 +431,7 @@ App.WizardController = Em.Controller.ext
     var result = null;
     var method = 'GET';
     var testUrl = '/data/wizard/stack/hdp/version/1.3.0.json';
-    var url = (App.testMode) ? testUrl : App.apiPrefix + apiUrl;
+    var url = (App.testMode) ? testUrl : App.apiPrefix + apiUrl + '?fields=stackServices/StackServices';
     $.ajax({
       type: method,
       url: url,
@@ -458,17 +458,18 @@ App.WizardController = Em.Controller.ext
 
         // loop through all the service components
         for (var i = 0; i < displayOrderConfig.length; i++) {
-          var entry = jsonData.services.findProperty("name", displayOrderConfig[i].serviceName);
+          var entry = jsonData.stackServices.findProperty("StackServices.service_name", displayOrderConfig[i].serviceName);
           if (entry) {
+            entry = entry.StackServices;
             var myService = Service.create({
-              serviceName: entry.name,
+              serviceName: entry.service_name,
               displayName: displayOrderConfig[i].displayName,
               isDisabled: i === 0,
               isSelected: true,
               isInstalled: false,
               isHidden: displayOrderConfig[i].isHidden,
-              description: entry.comment,
-              version: entry.version
+              description: entry.comments,
+              version: entry.service_version
             });
 
             data.push(myService);
@@ -501,7 +502,7 @@ App.WizardController = Em.Controller.ext
       return;
     }
     var displayOrderConfig = require('data/services');
-    var apiUrl = App.get('stackVersionURL');
+    var apiUrl = App.get('stack2VersionURL');
     var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
     this.set('content.services', apiService);
     App.db.setService(apiService);

Modified: incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js Tue Apr  9 23:49:08 2013
@@ -42,7 +42,7 @@ module.exports = Em.Route.extend({
       });
       var statuses = ['STOPPING_SERVICES', 'STACK_UPGRADING', 'STACK_UPGRADE_FAILED', 'STACK_UPGRADED'];
       var currentClusterStatus = App.clusterStatus.get('value');
-      App.db.data = currentClusterStatus.localdb;
+      if (currentClusterStatus.localdb) App.db.data = currentClusterStatus.localdb;
       if (statuses.contains(currentClusterStatus.clusterState)) {
         stackUpgradeController.setCurrentStep(3);
       }

Modified: incubator/ambari/trunk/ambari-web/app/utils/ajax.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/ajax.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/ajax.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/ajax.js Tue Apr  9 23:49:08 2013
@@ -199,7 +199,7 @@ var urls = {
     }
   },
   'config.advanced': {
-    'real': '{stackVersionUrl}/services/{serviceName}',
+    'real': '{stack2VersionUrl}/stackServices/{serviceName}/configurations?fields=*',
     'mock': '/data/wizard/stack/hdp/version130/{serviceName}.json',
     'format': function(data){
       return {

Modified: incubator/ambari/trunk/ambari-web/app/utils/config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/config.js?rev=1466296&r1=1466295&r2=1466296&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Tue Apr  9 23:49:08 2013
@@ -458,7 +458,7 @@ App.config = Em.Object.create({
       sender: this,
       data: {
         serviceName: serviceName,
-        stackVersionUrl: App.get('stackVersionURL')
+        stack2VersionUrl: App.get('stack2VersionURL')
       },
       success: 'loadAdvancedConfigSuccess'
     });
@@ -468,10 +468,22 @@ App.config = Em.Object.create({
 
   loadAdvancedConfigSuccess: function (data, opt, params) {
     console.log("TRACE: In success function for the loadAdvancedConfig; url is ", opt.url);
-    data.properties.setEach('serviceName', params.serviceName);
-    serviceComponents[params.serviceName] = data.properties;
+    var properties = [];
+    if (data.items.length) {
+      data.items.forEach(function (item) {
+        item = item.StackConfigurations;
+        properties.push({
+          serviceName: item.service_name,
+          name: item.property_name,
+          value: item.property_value,
+          description: item.property_description,
+          filename: item.filename
+        });
+      }, this);
+      serviceComponents[data.items[0].StackConfigurations.service_name] = properties;
+    }
   },
-  
+
   /**
    * Determine the map which shows which services
    * each global property effects.