ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject [2/2] ambari git commit: AMBARI-8607 Rolling upgrade process: integration with API. (atkach)
Date Tue, 09 Dec 2014 15:48:03 GMT
AMBARI-8607 Rolling upgrade process: integration with API. (atkach)


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

Branch: refs/heads/trunk
Commit: 1f950c054c956dbc36e8531abc434752060b51bb
Parents: 80e1d9f
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Tue Dec 9 17:29:11 2014 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Tue Dec 9 17:47:37 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/app.js                           |   1 +
 .../data/stack_versions/stack_version_all.json  | 117 +--
 .../data/stack_versions/start_upgrade.json      |   9 +
 .../app/assets/data/stack_versions/upgrade.json | 807 +++++++++++++++++--
 .../data/stack_versions/upgrade_state.json      |  29 +
 .../controllers/global/cluster_controller.js    |   5 +
 .../main/admin/stack_and_upgrade_controller.js  | 149 +++-
 ambari-web/app/messages.js                      |   8 +-
 ambari-web/app/routes/stack_upgrade_routes.js   |  45 +-
 .../templates/main/admin/stack_and_upgrade.hbs  |  15 +-
 .../stack_upgrade/stack_upgrade_dialog.hbs      |  33 +-
 .../main/admin/stack_upgrade/upgrade_task.hbs   |  17 +-
 ambari-web/app/utils/ajax/ajax.js               |  22 +-
 ambari-web/app/views.js                         |   1 +
 .../views/main/admin/stack_and_upgrade_view.js  | 116 ++-
 .../admin/stack_upgrade/upgrade_task_view.js    |  39 +-
 .../stack_upgrade/upgrade_version_box_view.js   |  21 +-
 .../admin/stack_upgrade/upgrade_wizard_view.js  |  99 +++
 .../admin/stack_and_upgrade_controller_test.js  | 143 ++--
 .../main/service/info/config_test.js            |   8 +-
 .../test/controllers/wizard/step7_test.js       |  12 +-
 .../stack_upgrade/upgrade_task_view_test.js     |   8 +-
 .../upgrade_version_box_view_test.js            |   9 +-
 23 files changed, 1277 insertions(+), 436 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index a36087d..c45f48b 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -39,6 +39,7 @@ module.exports = Em.Application.create({
    * state of stack upgrade process
    * states:
    *  - INIT
+   *  - PENDING
    *  - IN_PROGRESS
    *  - STOPPED
    *  - COMPLETED

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/assets/data/stack_versions/stack_version_all.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/stack_versions/stack_version_all.json b/ambari-web/app/assets/data/stack_versions/stack_version_all.json
index 932ae8a..314d909 100644
--- a/ambari-web/app/assets/data/stack_versions/stack_version_all.json
+++ b/ambari-web/app/assets/data/stack_versions/stack_version_all.json
@@ -1,18 +1,15 @@
 {
-  "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions?fields=*,repository_versions/*,repository_versions/operatingSystems/repositories/*&_=1417611809864",
   "items" : [
     {
-      "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2",
       "ClusterStackVersions" : {
-        "cluster_name" : "1",
+        "cluster_name" : "c1",
         "id" : 1,
-        "repository_version" : 1,
         "stack" : "HDP",
         "state" : "CURRENT",
         "version" : "2.2",
         "host_states" : {
           "CURRENT" : [
-            "ab3test-2.c.pramod-thangali.internal"
+            "dev01.hortonworks.com"
           ],
           "INSTALLED" : [ ],
           "INSTALLING" : [ ],
@@ -24,74 +21,28 @@
       },
       "repository_versions" : [
         {
-          "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1",
           "RepositoryVersions" : {
-            "display_name" : "HDP 2.2.1",
+            "display_name" : "HDP-2.2",
             "id" : 1,
-            "repository_version" : "2.2.1.1-885",
+            "repository_version" : "2.2",
             "stack_name" : "HDP",
             "stack_version" : "2.2",
-            "upgrade_pack" : "upgrade-2.2"
-          },
-          "operating_systems" : [
-            {
-              "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6",
-              "OperatingSystems" : {
-                "os_type" : "redhat6",
-                "repository_version_id" : 1,
-                "stack_name" : "HDP",
-                "stack_version" : "2.2"
-              },
-              "repositories" : [
-                {
-                  "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6/repositories/HDP-2.2",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat6",
-                    "repo_id" : "HDP-2.2",
-                    "repo_name" : "HDP",
-                    "repository_version_id" : 1,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                },
-                {
-                  "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.20",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat6",
-                    "repo_id" : "HDP-UTILS-1.1.0.20",
-                    "repo_name" : "HDP-UTILS",
-                    "repository_version_id" : 1,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                }
-              ]
-            }
-          ]
+            "upgrade_pack" : ""
+          }
         }
       ]
     },
     {
-      "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2",
       "ClusterStackVersions" : {
-        "cluster_name" : "1",
+        "cluster_name" : "c1",
         "id" : 2,
-        "repository_version" : 2,
         "stack" : "HDP",
         "state" : "INSTALLED",
         "version" : "2.2",
         "host_states" : {
           "CURRENT" : [ ],
           "INSTALLED" : [
-            "ab3test-2.c.pramod-thangali.internal"
+            "dev01.hortonworks.com"
           ],
           "INSTALLING" : [ ],
           "INSTALL_FAILED" : [ ],
@@ -102,58 +53,14 @@
       },
       "repository_versions" : [
         {
-          "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1",
           "RepositoryVersions" : {
-            "display_name" : "HDP 2.2.2",
-            "id" : 2,
-            "repository_version" : "2.2.2.1-885",
+            "display_name" : "HDP-2.2.0.1-885",
+            "id" : 3,
+            "repository_version" : "2.2.0.1-885",
             "stack_name" : "HDP",
             "stack_version" : "2.2",
             "upgrade_pack" : "upgrade-2.2"
-          },
-          "operating_systems" : [
-            {
-              "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6",
-              "OperatingSystems" : {
-                "os_type" : "redhat6",
-                "repository_version_id" : 2,
-                "stack_name" : "HDP",
-                "stack_version" : "2.2"
-              },
-              "repositories" : [
-                {
-                  "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6/repositories/HDP-2.2",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat6",
-                    "repo_id" : "HDP-2.2",
-                    "repo_name" : "HDP",
-                    "repository_version_id" : 2,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                },
-                {
-                  "href" : "http://162.216.148.202:8080/api/v1/clusters/1/stack_versions/2/repository_versions/1/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.20",
-                  "Repositories" : {
-                    "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0",
-                    "default_base_url" : "",
-                    "latest_base_url" : "",
-                    "mirrors_list" : "",
-                    "os_type" : "redhat6",
-                    "repo_id" : "HDP-UTILS-1.1.0.20",
-                    "repo_name" : "HDP-UTILS",
-                    "repository_version_id" : 2,
-                    "stack_name" : "HDP",
-                    "stack_version" : "2.2"
-                  }
-                }
-              ]
-            }
-          ]
+          }
         }
       ]
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/assets/data/stack_versions/start_upgrade.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/stack_versions/start_upgrade.json b/ambari-web/app/assets/data/stack_versions/start_upgrade.json
new file mode 100644
index 0000000..0f7f5c7
--- /dev/null
+++ b/ambari-web/app/assets/data/stack_versions/start_upgrade.json
@@ -0,0 +1,9 @@
+{
+  "resources" : [
+    {
+      "Upgrade" : {
+        "request_id" : 1
+      }
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/assets/data/stack_versions/upgrade.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/stack_versions/upgrade.json b/ambari-web/app/assets/data/stack_versions/upgrade.json
index e36dbe8..934bed5 100644
--- a/ambari-web/app/assets/data/stack_versions/upgrade.json
+++ b/ambari-web/app/assets/data/stack_versions/upgrade.json
@@ -1,119 +1,754 @@
 {
+  "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42?fields=Upgrade,upgrade_groups/UpgradeGroup,upgrade_groups/upgrade_items/*,upgrade_groups/upgrade_items/tasks/*",
   "Upgrade" : {
+    "abort_reason" : null,
+    "aborted_task_count" : 0,
     "cluster_name" : "c1",
-    "id" : 1
+    "completed_task_count" : 1,
+    "create_time" : 1418134043541,
+    "end_time" : -1,
+    "exclusive" : false,
+    "failed_task_count" : 0,
+    "inputs" : null,
+    "operation_level" : null,
+    "progress_percent" : 27.0,
+    "queued_task_count" : 0,
+    "request_context" : "Upgrading to 2.2.0.1-885",
+    "request_id" : 42,
+    "request_status" : "IN_PROGRESS",
+    "resource_filters" : [ ],
+    "start_time" : 1418134043581,
+    "task_count" : 5,
+    "timed_out_task_count" : 0,
+    "type" : "INTERNAL_REQUEST",
+    "request_schedule" : {
+      "href" : null,
+      "schedule_id" : null
+    }
   },
   "upgrade_groups" : [
     {
+      "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/109",
       "UpgradeGroup" : {
-        "group_id" : 1,
+        "group_id" : 109,
         "name" : "ZOOKEEPER",
-        "state" : "COMPLETED",
-        "title" : "Upgrade Zookeepers",
-        "upgrade_id" : 1,
-        "progress": 100
+        "progress_percent" : 27.0,
+        "request_id" : 42,
+        "status" : "IN_PROGRESS",
+        "title" : "Zookeeper"
       },
-      "upgrade_items" : [
-        {
-          "UpgradeItem" : {
-            "group_id" : 1,
-            "id" : 1,
-            "upgrade_id" : 1,
-            "state": "COMPLETED"
-          }
-        },
-        {
-          "UpgradeItem" : {
-            "group_id" : 1,
-            "id" : 2,
-            "upgrade_id" : 1,
-            "state": "COMPLETED"
-          }
-        }
-      ]
+      "upgrade_items" : [ ]
     },
     {
+      "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110",
       "UpgradeGroup" : {
-        "group_id" : 2,
-        "name" : "CM",
-        "state" : "IN_PROGRESS",
-        "title" : "Upgrade Core Master",
-        "upgrade_id" : 1,
-        "progress": 4
+        "group_id" : 110,
+        "name" : "CORE_MASTER",
+        "progress_percent" : 45.0,
+        "request_id" : 42,
+        "status" : "IN_PROGRESS",
+        "title" : "Core Masters"
       },
       "upgrade_items" : [
         {
+          "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1",
           "UpgradeItem" : {
-            "group_id" : 2,
-            "id" : 1,
-            "upgrade_id" : 1,
-            "state": "IN_PROGRESS",
-            "name": "Upgrade DATANODE"
-          }
-        }
-      ]
-    },
-    {
-      "UpgradeGroup" : {
-        "group_id" : 3,
-        "name" : "CL",
-        "state" : "FAILED",
-        "title" : "Upgrade Core Slaves",
-        "upgrade_id" : 1,
-        "progress": 1
-      },
-      "upgrade_items" : [
+            "cluster_host_info" : "{}",
+            "cluster_name" : "c1",
+            "command_params" : "{}",
+            "context" : "Preparing NAMENODE on dev01.hortonworks.com",
+            "end_time" : 1418134044126,
+            "group_id" : 110,
+            "host_params" : "{\"jdk_location\":\"http://dev01.hortonworks.com:8080/resources/\"}",
+            "log_info" : null,
+            "progress_percent" : 100.0,
+            "request_id" : 42,
+            "stage_id" : 1,
+            "start_time" : 1418134043584,
+            "status" : "COMPLETED"
+          },
+          "tasks" : [
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1/tasks/192",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing NAMENODE on dev01.hortonworks.com",
+                "end_time" : 1418134044126,
+                "error_log" : "/var/lib/ambari-agent/data/errors-192.txt",
+                "exit_code" : 0,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 192,
+                "output_log" : "/var/lib/ambari-agent/data/output-192.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 1,
+                "start_time" : 1418134043584,
+                "status" : "COMPLETED",
+                "stderr" : "None",
+                "stdout" : "2014-12-09 06:07:23,948 - Task: dev01.hortonworks.com",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1/tasks/193",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/NAMENODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-193.txt",
+                "exit_code" : 777,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 193,
+                "output_log" : "/var/lib/ambari-agent/data/output-193.txt",
+                "request_id" : 42,
+                "role" : "NAMENODE",
+                "stage_id" : 2,
+                "start_time" : 1418134053610,
+                "status" : "IN_PROGRESS",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1/tasks/194",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Completing NAMENODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-194.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 194,
+                "output_log" : "/var/lib/ambari-agent/data/output-194.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 3,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1/tasks/195",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing DATANODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-195.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 195,
+                "output_log" : "/var/lib/ambari-agent/data/output-195.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 4,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/1/tasks/196",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/DATANODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-196.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 196,
+                "output_log" : "/var/lib/ambari-agent/data/output-196.txt",
+                "request_id" : 42,
+                "role" : "DATANODE",
+                "stage_id" : 5,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            }
+          ]
+        },
         {
+          "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2",
           "UpgradeItem" : {
-            "group_id" : 3,
-            "id" : 1,
-            "upgrade_id" : 1,
-            "state": "FAILED",
-            "name": "Upgrade DATANODE"
-          }
-        }
-      ]
-    },
-    {
-      "UpgradeGroup" : {
-        "group_id" : 4,
-        "name" : "MS",
-        "state" : "IN_PROGRESS",
-        "title" : "Manual Step",
-        "upgrade_id" : 1,
-        "progress": 0,
-        "type": "manual"
-      },
-      "upgrade_items" : [
+            "cluster_host_info" : "{\"all_hosts\":[\"dev01.hortonworks.com\"],\"namenode_host\":[\"0\"],\"snamenode_host\":[\"0\"],\"slave_hosts\":[\"0\"],\"ambari_server_host\":[\"dev01.hortonworks.com\"],\"all_ping_ports\":[\"8670:0\"]}",
+            "cluster_name" : "c1",
+            "command_params" : "{}",
+            "context" : "Restarting NAMENODE on dev01.hortonworks.com",
+            "end_time" : 0,
+            "group_id" : 110,
+            "host_params" : "{\"ambari_db_rca_driver\":\"org.postgresql.Driver\",\"ambari_db_rca_password\":\"mapred\",\"ambari_db_rca_url\":\"jdbc:postgresql://dev01.hortonworks.com/ambarirca\",\"ambari_db_rca_username\":\"mapred\",\"db_driver_filename\":\"mysql-connector-java.jar\",\"db_name\":\"ambari\",\"java_home\":\"/usr/jdk64/jdk1.7.0_67\",\"jce_name\":\"UnlimitedJCEPolicyJDK7.zip\",\"jdk_location\":\"http://dev01.hortonworks.com:8080/resources/\",\"jdk_name\":\"jdk-7u67-linux-x64.tar.gz\",\"mysql_jdbc_url\":\"http://dev01.hortonworks.com:8080/resources//mysql-connector-java.jar\",\"oracle_jdbc_url\":\"http://dev01.hortonworks.com:8080/resources//ojdbc6.jar\",\"stack_name\":\"HDP\",\"stack_version\":\"2.2\"}",
+            "log_info" : null,
+            "progress_percent" : 35.0,
+            "request_id" : 42,
+            "stage_id" : 2,
+            "start_time" : 1418134053610,
+            "status" : "IN_PROGRESS"
+          },
+          "tasks" : [
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2/tasks/192",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing NAMENODE on dev01.hortonworks.com",
+                "end_time" : 1418134044126,
+                "error_log" : "/var/lib/ambari-agent/data/errors-192.txt",
+                "exit_code" : 0,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 192,
+                "output_log" : "/var/lib/ambari-agent/data/output-192.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 1,
+                "start_time" : 1418134043584,
+                "status" : "COMPLETED",
+                "stderr" : "None",
+                "stdout" : "2014-12-09 06:07:23,948 - Task: dev01.hortonworks.com",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2/tasks/193",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/NAMENODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-193.txt",
+                "exit_code" : 777,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 193,
+                "output_log" : "/var/lib/ambari-agent/data/output-193.txt",
+                "request_id" : 42,
+                "role" : "NAMENODE",
+                "stage_id" : 2,
+                "start_time" : 1418134053610,
+                "status" : "IN_PROGRESS",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2/tasks/194",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Completing NAMENODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-194.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 194,
+                "output_log" : "/var/lib/ambari-agent/data/output-194.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 3,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2/tasks/195",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing DATANODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-195.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 195,
+                "output_log" : "/var/lib/ambari-agent/data/output-195.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 4,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/2/tasks/196",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/DATANODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-196.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 196,
+                "output_log" : "/var/lib/ambari-agent/data/output-196.txt",
+                "request_id" : 42,
+                "role" : "DATANODE",
+                "stage_id" : 5,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            }
+          ]
+        },
         {
+          "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3",
           "UpgradeItem" : {
-            "group_id" : 4,
-            "id" : 1,
-            "upgrade_id" : 1,
-            "state": "IN_PROGRESS"
-          }
+            "cluster_host_info" : "{}",
+            "cluster_name" : "c1",
+            "command_params" : "{}",
+            "context" : "Completing NAMENODE on dev01.hortonworks.com",
+            "end_time" : 0,
+            "group_id" : 110,
+            "host_params" : "{\"jdk_location\":\"http://dev01.hortonworks.com:8080/resources/\"}",
+            "log_info" : null,
+            "progress_percent" : 0.0,
+            "request_id" : 42,
+            "stage_id" : 3,
+            "start_time" : -1,
+            "status" : "PENDING"
+          },
+          "tasks" : [
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3/tasks/192",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing NAMENODE on dev01.hortonworks.com",
+                "end_time" : 1418134044126,
+                "error_log" : "/var/lib/ambari-agent/data/errors-192.txt",
+                "exit_code" : 0,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 192,
+                "output_log" : "/var/lib/ambari-agent/data/output-192.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 1,
+                "start_time" : 1418134043584,
+                "status" : "COMPLETED",
+                "stderr" : "None",
+                "stdout" : "2014-12-09 06:07:23,948 - Task: dev01.hortonworks.com",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3/tasks/193",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/NAMENODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-193.txt",
+                "exit_code" : 777,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 193,
+                "output_log" : "/var/lib/ambari-agent/data/output-193.txt",
+                "request_id" : 42,
+                "role" : "NAMENODE",
+                "stage_id" : 2,
+                "start_time" : 1418134053610,
+                "status" : "IN_PROGRESS",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3/tasks/194",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Completing NAMENODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-194.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 194,
+                "output_log" : "/var/lib/ambari-agent/data/output-194.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 3,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3/tasks/195",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing DATANODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-195.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 195,
+                "output_log" : "/var/lib/ambari-agent/data/output-195.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 4,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/110/upgrade_items/3/tasks/196",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/DATANODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-196.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 196,
+                "output_log" : "/var/lib/ambari-agent/data/output-196.txt",
+                "request_id" : 42,
+                "role" : "DATANODE",
+                "stage_id" : 5,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            }
+          ]
         }
       ]
     },
     {
+      "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111",
       "UpgradeGroup" : {
-        "group_id" : 5,
-        "name" : "UH",
-        "state" : "PENDING",
-        "title" : "Upgrade Hive",
-        "upgrade_id" : 1,
-        "progress": 0
+        "group_id" : 111,
+        "name" : "CORE_SLAVES",
+        "progress_percent" : 0.0,
+        "request_id" : 42,
+        "status" : "PENDING",
+        "title" : "Core Slaves"
       },
       "upgrade_items" : [
         {
+          "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4",
+          "UpgradeItem" : {
+            "cluster_host_info" : "{}",
+            "cluster_name" : "c1",
+            "command_params" : "{}",
+            "context" : "Preparing DATANODE on dev01.hortonworks.com",
+            "end_time" : 0,
+            "group_id" : 111,
+            "host_params" : "{\"jdk_location\":\"http://dev01.hortonworks.com:8080/resources/\"}",
+            "log_info" : null,
+            "progress_percent" : 0.0,
+            "request_id" : 42,
+            "stage_id" : 4,
+            "start_time" : -1,
+            "status" : "PENDING"
+          },
+          "tasks" : [
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4/tasks/192",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing NAMENODE on dev01.hortonworks.com",
+                "end_time" : 1418134044126,
+                "error_log" : "/var/lib/ambari-agent/data/errors-192.txt",
+                "exit_code" : 0,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 192,
+                "output_log" : "/var/lib/ambari-agent/data/output-192.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 1,
+                "start_time" : 1418134043584,
+                "status" : "COMPLETED",
+                "stderr" : "None",
+                "stdout" : "2014-12-09 06:07:23,948 - Task: dev01.hortonworks.com",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4/tasks/193",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/NAMENODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-193.txt",
+                "exit_code" : 777,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 193,
+                "output_log" : "/var/lib/ambari-agent/data/output-193.txt",
+                "request_id" : 42,
+                "role" : "NAMENODE",
+                "stage_id" : 2,
+                "start_time" : 1418134053610,
+                "status" : "IN_PROGRESS",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4/tasks/194",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Completing NAMENODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-194.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 194,
+                "output_log" : "/var/lib/ambari-agent/data/output-194.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 3,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4/tasks/195",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing DATANODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-195.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 195,
+                "output_log" : "/var/lib/ambari-agent/data/output-195.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 4,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/4/tasks/196",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/DATANODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-196.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 196,
+                "output_log" : "/var/lib/ambari-agent/data/output-196.txt",
+                "request_id" : 42,
+                "role" : "DATANODE",
+                "stage_id" : 5,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            }
+          ]
+        },
+        {
+          "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5",
           "UpgradeItem" : {
-            "group_id" : 5,
-            "id" : 1,
-            "upgrade_id" : 1,
-            "state": "PENDING"
-          }
+            "cluster_host_info" : "{\"all_hosts\":[\"dev01.hortonworks.com\"],\"namenode_host\":[\"0\"],\"snamenode_host\":[\"0\"],\"slave_hosts\":[\"0\"],\"ambari_server_host\":[\"dev01.hortonworks.com\"],\"all_ping_ports\":[\"8670:0\"]}",
+            "cluster_name" : "c1",
+            "command_params" : "{}",
+            "context" : "Restarting  DATANODE on dev01.hortonworks.com",
+            "end_time" : 0,
+            "group_id" : 111,
+            "host_params" : "{\"ambari_db_rca_driver\":\"org.postgresql.Driver\",\"ambari_db_rca_password\":\"mapred\",\"ambari_db_rca_url\":\"jdbc:postgresql://dev01.hortonworks.com/ambarirca\",\"ambari_db_rca_username\":\"mapred\",\"db_driver_filename\":\"mysql-connector-java.jar\",\"db_name\":\"ambari\",\"java_home\":\"/usr/jdk64/jdk1.7.0_67\",\"jce_name\":\"UnlimitedJCEPolicyJDK7.zip\",\"jdk_location\":\"http://dev01.hortonworks.com:8080/resources/\",\"jdk_name\":\"jdk-7u67-linux-x64.tar.gz\",\"mysql_jdbc_url\":\"http://dev01.hortonworks.com:8080/resources//mysql-connector-java.jar\",\"oracle_jdbc_url\":\"http://dev01.hortonworks.com:8080/resources//ojdbc6.jar\",\"stack_name\":\"HDP\",\"stack_version\":\"2.2\"}",
+            "log_info" : null,
+            "progress_percent" : 0.0,
+            "request_id" : 42,
+            "stage_id" : 5,
+            "start_time" : -1,
+            "status" : "PENDING"
+          },
+          "tasks" : [
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5/tasks/192",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing NAMENODE on dev01.hortonworks.com",
+                "end_time" : 1418134044126,
+                "error_log" : "/var/lib/ambari-agent/data/errors-192.txt",
+                "exit_code" : 0,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 192,
+                "output_log" : "/var/lib/ambari-agent/data/output-192.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 1,
+                "start_time" : 1418134043584,
+                "status" : "COMPLETED",
+                "stderr" : "None",
+                "stdout" : "2014-12-09 06:07:23,948 - Task: dev01.hortonworks.com",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5/tasks/193",
+              "Tasks" : {
+                "attempt_cnt" : 1,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/NAMENODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-193.txt",
+                "exit_code" : 777,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 193,
+                "output_log" : "/var/lib/ambari-agent/data/output-193.txt",
+                "request_id" : 42,
+                "role" : "NAMENODE",
+                "stage_id" : 2,
+                "start_time" : 1418134053610,
+                "status" : "IN_PROGRESS",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : { }
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5/tasks/194",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Completing NAMENODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-194.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 194,
+                "output_log" : "/var/lib/ambari-agent/data/output-194.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 3,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5/tasks/195",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "ACTIONEXECUTE",
+                "command_detail" : "Preparing DATANODE on dev01.hortonworks.com",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-195.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 195,
+                "output_log" : "/var/lib/ambari-agent/data/output-195.txt",
+                "request_id" : 42,
+                "role" : "ru_execute_tasks",
+                "stage_id" : 4,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            },
+            {
+              "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/42/upgrade_groups/111/upgrade_items/5/tasks/196",
+              "Tasks" : {
+                "attempt_cnt" : 0,
+                "cluster_name" : "c1",
+                "command" : "CUSTOM_COMMAND",
+                "command_detail" : "RESTART HDFS/DATANODE",
+                "custom_command_name" : "RESTART",
+                "end_time" : -1,
+                "error_log" : "/var/lib/ambari-agent/data/errors-196.txt",
+                "exit_code" : 999,
+                "host_name" : "dev01.hortonworks.com",
+                "id" : 196,
+                "output_log" : "/var/lib/ambari-agent/data/output-196.txt",
+                "request_id" : 42,
+                "role" : "DATANODE",
+                "stage_id" : 5,
+                "start_time" : -1,
+                "status" : "PENDING",
+                "stderr" : "",
+                "stdout" : "",
+                "structured_out" : null
+              }
+            }
+          ]
         }
       ]
     }
   ]
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/assets/data/stack_versions/upgrade_state.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/stack_versions/upgrade_state.json b/ambari-web/app/assets/data/stack_versions/upgrade_state.json
new file mode 100644
index 0000000..81f03c5
--- /dev/null
+++ b/ambari-web/app/assets/data/stack_versions/upgrade_state.json
@@ -0,0 +1,29 @@
+{
+  "href" : "http://192.168.56.101:8080/api/v1/clusters/c1/upgrades/7?fields=Upgrade",
+  "Upgrade" : {
+    "abort_reason" : null,
+    "aborted_task_count" : 0,
+    "cluster_name" : "c1",
+    "completed_task_count" : 5,
+    "create_time" : 1418056703338,
+    "end_time" : 1418056791194,
+    "exclusive" : false,
+    "failed_task_count" : 0,
+    "inputs" : null,
+    "operation_level" : null,
+    "progress_percent" : 100.0,
+    "queued_task_count" : 0,
+    "request_context" : "Upgrading to 2.2.0.1-885",
+    "request_id" : 7,
+    "request_status" : "COMPLETED",
+    "resource_filters" : [ ],
+    "start_time" : 1418056703366,
+    "task_count" : 5,
+    "timed_out_task_count" : 0,
+    "type" : "INTERNAL_REQUEST",
+    "request_schedule" : {
+      "href" : null,
+      "schedule_id" : null
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index e0d5841..e04adfb 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -267,6 +267,11 @@ App.ClusterController = Em.Controller.extend({
       App.router.get('mainController').startPolling();
       return;
     }
+
+    if (App.get('supports.stackUpgrade')) {
+      App.router.get('mainAdminStackAndUpgradeController').loadUpgradeData(true);
+    }
+
     var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
     var racksUrl = "/data/racks/racks.json";
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/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 c7572f8..159b525 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
@@ -19,7 +19,7 @@
 var App = require('app');
 var stringUtils = require('utils/string_utils');
 
-App.MainAdminStackAndUpgradeController = Em.Controller.extend({
+App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, {
   name: 'mainAdminStackAndUpgradeController',
 
   /**
@@ -28,15 +28,22 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend({
   serviceToInstall: null,
 
   /**
-   * @type {Array}
+   * @type {object}
+   * @default null
    */
-  upgradeGroups: [],
+  upgradeData: null,
 
   /**
-   * TODO should have actual value from call that start upgrade
-   * @type {Number|null}
+   * @type {number}
+   * @default null
    */
-  upgradeId: 1,
+  upgradeId: null,
+
+  /**
+   * @type {string}
+   * @default null
+   */
+  upgradeVersion: null,
 
   /**
    * version that currently applied to server
@@ -51,6 +58,17 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend({
   targetVersions: [],
 
   /**
+   * restore data from localStorage
+   */
+  init: function () {
+    ['upgradeId', 'upgradeVersion'].forEach(function (property) {
+      if (this.getDBProperty(property)) {
+        this.set(property, this.getDBProperty(property));
+      }
+    }, this);
+  },
+
+  /**
    * @type {Array}
    */
   services: function() {
@@ -89,43 +107,65 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend({
    * @param data
    */
   loadVersionsInfoSuccessCallback: function (data) {
-    var current = data.items.findProperty('ClusterStackVersions.state', 'CURRENT');
-    var currentVersion = current.repository_versions[0].RepositoryVersions.repository_version;
-    var targetVersions = data.items.without(current)
-      .filter(function (version) {
-        var repositoryVersion = version.repository_versions[0].RepositoryVersions.repository_version;
-        //Only higher versions that have already been installed to all the hosts are shown
-        return (version.ClusterStackVersions.state === 'INSTALLED' &&
-               stringUtils.compareVersions(repositoryVersion, currentVersion) === 1);
-      }).map(function (version) {
-        return version.ClusterStackVersions;
-      });
-
-    this.set('currentVersion', current.ClusterStackVersions);
+    var versions = this.parseVersionsData(data);
+    var current = versions.findProperty('state', 'CURRENT');
+    var targetVersions = versions.without(current).filter(function (version) {
+      //Only higher versions that have already been installed to all the hosts are shown
+      return (version.state === 'INSTALLED' &&
+        stringUtils.compareVersions(version.repository_version, current.repository_version) === 1);
+    });
+    this.set('currentVersion', current);
     this.set('targetVersions', targetVersions);
   },
 
   /**
-   * load upgrade tasks by upgrade id
-   * @return {$.ajax}
+   * parse ClusterStackVersions data to form common structure
+   * @param {object} data
+   * @return {Array}
    */
-  loadUpgradeData: function () {
-    return App.ajax.send({
-      name: 'admin.upgrade.data',
-      sender: this,
-      data: {
-        id: this.get('upgradeId')
-      },
-      success: 'loadUpgradeDataSuccessCallback'
+  parseVersionsData: function (data) {
+    return data.items.map(function (item) {
+      item.ClusterStackVersions.repository_name = item.repository_versions[0].RepositoryVersions.display_name;
+      item.ClusterStackVersions.repository_id = item.repository_versions[0].RepositoryVersions.id;
+      item.ClusterStackVersions.repository_version = item.repository_versions[0].RepositoryVersions.repository_version;
+      return item.ClusterStackVersions;
     });
   },
 
   /**
+   * load upgrade tasks by upgrade id
+   * @return {$.Deferred}
+   * @param {boolean} onlyState
+   */
+  loadUpgradeData: function (onlyState) {
+    var upgradeId = this.get('upgradeId');
+    var deferred = $.Deferred();
+
+    if (Em.isNone(upgradeId)) {
+      deferred.resolve();
+      console.log('Upgrade in INIT state');
+    } else {
+      App.ajax.send({
+        name: (onlyState) ? 'admin.upgrade.state' : 'admin.upgrade.data',
+        sender: this,
+        data: {
+          id: upgradeId
+        },
+        success: 'loadUpgradeDataSuccessCallback'
+      }).then(deferred.resolve);
+    }
+    return deferred.promise();
+  },
+
+  /**
    * parse and push upgrade tasks to controller
    * @param data
    */
   loadUpgradeDataSuccessCallback: function (data) {
-    this.set("upgradeGroups", data.upgrade_groups);
+    App.set('upgradeState', data.Upgrade.request_status);
+    if (data.upgrade_groups) {
+      this.set("upgradeData", data);
+    }
   },
 
   /**
@@ -137,10 +177,33 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend({
 
   /**
    * make call to start upgrade process and show popup with current progress
+   * @param {object} version
    */
-  upgrade: function () {
-    //TODO start upgrade
-    this.loadUpgradeData();
+  upgrade: function (version) {
+    App.ajax.send({
+      name: 'admin.upgrade.start',
+      sender: this,
+      data: {
+        version: version.value
+      },
+      success: 'upgradeSuccessCallback'
+    });
+    this.set('upgradeVersion', version.label);
+    this.setDBProperty('upgradeVersion', version.label);
+  },
+
+  /**
+   * success callback of <code>upgrade()</code>
+   * @param {object} data
+   */
+  upgradeSuccessCallback: function (data) {
+    this.set('upgradeId', data.resources[0].Upgrade.request_id);
+    this.setDBProperty('upgradeId', data.resources[0].Upgrade.request_id);
+    App.clusterStatus.setClusterStatus({
+      clusterName: App.get('clusterName'),
+      clusterState: 'DEFAULT',
+      localdb: App.db.data
+    });
     this.openUpgradeDialog();
   },
 
@@ -162,7 +225,25 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend({
    * make call to finish upgrade process
    */
   finalize: function () {
-    //TODO start finalize
+    //TODO execute finalize
+    this.finish();
+  },
+
+  /**
+   * finish upgrade wizard
+   * clean auxiliary data
+   */
+  finish: function () {
+    this.set('upgradeId', null);
+    this.setDBProperty('upgradeId', undefined);
+    App.set('upgradeState', 'INIT');
+    this.set('upgradeVersion', null);
+    this.setDBProperty('upgradeVersion', undefined);
+    App.clusterStatus.setClusterStatus({
+      clusterName: App.get('clusterName'),
+      clusterState: 'DEFAULT',
+      localdb: App.db.data
+    });
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 27c34f3..d0a58f6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1292,12 +1292,13 @@ Em.I18n.translations = {
   'admin.stackUpgrade.state.notAvailable': "No Upgrade Available",
   'admin.stackUpgrade.state.resume': "Resume Upgrade",
   'admin.stackUpgrade.state.inProgress': "Upgrade in progress",
+  'admin.stackUpgrade.state.paused': "Upgrade is paused",
   'admin.stackUpgrade.state.stopped': "Upgrade Stopped",
   'admin.stackUpgrade.state.completed': "Upgrade Finished",
   'admin.stackUpgrade.state.upgrading': "Upgrading...",
   'admin.stackUpgrade.hosts': "hosts",
   'admin.stackUpgrade.host': "host",
-  'admin.stackUpgrade.dialog.header': "Upgrade to {0} in progress",
+  'admin.stackUpgrade.dialog.header': "Upgrade to {0}",
   'admin.stackUpgrade.dialog.operationFailed': "This operation failed.",
   'admin.stackUpgrade.dialog.stop': "Stop Upgrade",
   'admin.stackUpgrade.dialog.continue': "Ignore and Proceed",
@@ -1306,9 +1307,8 @@ Em.I18n.translations = {
   'admin.stackUpgrade.dialog.failed': "Failed on:",
   'admin.stackUpgrade.dialog.manual': "Manual steps required",
   'admin.stackUpgrade.dialog.manualDone': "I have preformed the manual steps above.",
-  'admin.stackUpgrade.dialog.close': "Upgrade is in progress. \n" +
-    "Do you want to keep running Upgrade in the background," +
-    " or do you want to stop the Upgrade? If you stop the Upgrade, you can resume later.",
+  'admin.stackUpgrade.dialog.closeProgress': "Upgrade is in progress. \n If you dismiss this window, Upgrade will keep running in background.",
+  'admin.stackUpgrade.dialog.closePause': "Upgrade is paused. \n If you dismiss this window, you can resume Upgrade later.",
 
   'services.service.start':'Start',
   'services.service.stop':'Stop',

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/routes/stack_upgrade_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/stack_upgrade_routes.js b/ambari-web/app/routes/stack_upgrade_routes.js
index a0a00aa..aca2c62 100644
--- a/ambari-web/app/routes/stack_upgrade_routes.js
+++ b/ambari-web/app/routes/stack_upgrade_routes.js
@@ -24,42 +24,31 @@ module.exports = App.WizardRoute.extend({
   enter: function (router) {
     console.log('in /admin/stack/upgrade:enter');
     Ember.run.next(function () {
-      var upgradeVersion = 'HDP-2.2.1';
       App.router.get('updateController').set('isWorking', false);
 
       return App.ModalPopup.show({
-        header: Em.I18n.t('admin.stackUpgrade.dialog.header').format(upgradeVersion),
-        bodyClass: Em.View.extend({
-          controllerBinding: 'App.router.mainAdminStackAndUpgradeController',
-          templateName: require('templates/main/admin/stack_upgrade/stack_upgrade_dialog'),
-          willInsertElement: function () {
-            this.startPolling();
-          },
-          /**
-           * start polling upgrade tasks data
-           */
-          startPolling: function () {
-            this.get('controller').loadUpgradeData();
-          },
-          groups: function () {
-            return this.get('controller.upgradeGroups');
-          }.property('controller.upgradeGroups')
-        }),
+        header: function () {
+          return Em.I18n.t('admin.stackUpgrade.dialog.header').format(App.router.get('mainAdminStackAndUpgradeController').get('upgradeVersion'));
+        }.property('App.router.mainAdminStackAndUpgradeController.upgradeVersion'),
+        bodyClass: App.upgradeWizardView,
         primary: null,
         secondary: null,
         onClose: function() {
-          App.router.get('updateController').set('isWorking', true);
-          App.router.transitionTo('main.admin.stackAndUpgrade');
-          this._super();
+          var self = this;
+          var header = Em.I18n.t('admin.stackUpgrade.state.paused');
+          var body = Em.I18n.t('admin.stackUpgrade.dialog.closePause');
+          if (['IN_PROGRESS', 'PENDING'].contains(App.get('upgradeState'))) {
+            header = Em.I18n.t('admin.stackUpgrade.state.inProgress');
+            body = Em.I18n.t('admin.stackUpgrade.dialog.closeProgress');
+          }
           App.ModalPopup.show({
-            header: Em.I18n.t('admin.stackUpgrade.state.inProgress'),
-            body: Em.I18n.t('admin.stackUpgrade.dialog.close'),
-            primary: Em.I18n.t('admin.stackUpgrade.dialog.keepRunning'),
-            secondary: Em.I18n.t('admin.stackUpgrade.dialog.stop'),
-            secondaryClass: 'btn-danger',
+            header: header,
+            body: body,
             showCloseButton: false,
-            onSecondary: function() {
-              App.router.get('mainAdminStackAndUpgradeController').stopUpgrade();
+            onPrimary: function() {
+              App.router.get('updateController').set('isWorking', true);
+              App.router.transitionTo('main.admin.stackAndUpgrade');
+              self.hide();
               this._super();
             }
           })

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs b/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
index 970598a..68ed1a3 100644
--- a/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
+++ b/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
@@ -26,8 +26,8 @@
       {{#view view.sourceVersionView classNames="span2 offset3 box"}}
         <div class="version-name"><strong>{{view.versionName}}</strong></div>
         <div>
-          {{#if view.action.label}}
-            <button {{bindAttr class=":btn view.btnClass"}} {{action runAction view.action.method target="view"}}>{{view.action.label}}</button>
+          {{#if view.label}}
+            <button {{bindAttr class=":btn view.btnClass"}} {{action runAction target="view"}}>{{view.label}}</button>
           {{else}}
             {{view.hostsCount}}
             &nbsp;{{pluralize view.hostsCount singular="t:admin.stackUpgrade.host" plural="t:admin.stackUpgrade.hosts"}}
@@ -39,17 +39,18 @@
         <div>{{view.upgradeStateLabel}}</div>
       </div>
       {{#view view.targetVersionView classNames="span2 box"}}
-        {{view Em.Select classBinding="view.hasVersionsToUpgrade::hidden"
+        {{view Ember.Select
+        classBinding="view.showSelect::hidden"
         contentBinding="view.versionsSelectContent"
         optionValuePath="content.value"
         optionLabelPath="content.label"
-        selectionBinding="view.selectedVersion"
+        selectionBinding="view.version"
         }}
-        <div {{bindAttr class="view.hasVersionsToUpgrade:hidden :version-name"}}><strong>{{view.versionName}}</strong>
+        <div {{bindAttr class="view.showSelect:hidden :version-name"}}><strong>{{view.versionName}}</strong>
         </div>
         <div>
-          {{#if view.action.label}}
-            <button {{bindAttr class=":btn view.btnClass"}} {{action runAction view.action.method target="view"}}>{{view.action.label}}</button>
+          {{#if view.label}}
+            <button {{bindAttr class=":btn view.btnClass"}} {{action runAction target="view"}}>{{view.label}}</button>
           {{/if}}
         </div>
       {{/view}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_dialog.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_dialog.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_dialog.hbs
index ac5f3ea..492e4e9 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_dialog.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_dialog.hbs
@@ -17,22 +17,25 @@
 }}
 
 <div id="stack-upgrade-dialog">
-
-  <div class="row-fluid">
-    <div class="span2">{{t common.progress}}</div>
-    <div class="span9">
-      <div class="progress progress-striped active">
-        <div class="bar" style="width: 40%;"></div>
+  {{#if view.isLoaded}}
+    <div class="row-fluid">
+      <div class="span2">{{t common.progress}}</div>
+      <div class="span9">
+        <div class="progress progress-striped active">
+          <div class="bar" {{bindAttr style="view.progressWidth"}}></div>
+        </div>
+      </div>
+      <div class="span1">
+        {{view.overallProgress}}%
       </div>
     </div>
-    <div class="span1">
-      40%
-    </div>
-  </div>
 
-  <div class="task-list">
-    {{#each group in view.groups}}
-      {{view App.upgradeTaskView contentBinding="group"}}
-    {{/each}}
-  </div>
+    <div class="task-list">
+      {{#each group in view.groups}}
+        {{view App.upgradeTaskView contentBinding="group"}}
+      {{/each}}
+    </div>
+  {{else}}
+    <div class="spinner"></div>
+  {{/if}}
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
index 80c6515..511d04a 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/upgrade_task.hbs
@@ -18,21 +18,24 @@
 
 
 <div class="row-fluid">
-  <div class="span6"><i {{bindAttr class="view.iconClass"}}></i><a>{{view.content.UpgradeGroup.title}}</a></div>
-  <div class="span4">
-    {{#if view.showProgressBar}}
+  <div class="span8"><i {{bindAttr class="view.iconClass"}}></i><a>{{view.content.UpgradeGroup.title}}</a></div>
+
+  {{#if view.showProgressBar}}
+    <div class="span3">
       <div class="progress progress-striped active">
         <div class="bar" {{bindAttr style="view.progressWidth"}}></div>
       </div>
-    {{/if}}
-  </div>
-  <div class="offset2"></div>
+    </div>
+    <div class="span1">
+      <div>{{view.progress}}%</div>
+    </div>
+  {{/if}}
 </div>
 {{#if view.isInProgress}}
   <div class="box task-details">
     <div>
       {{t admin.stackUpgrade.dialog.inProgress}}&nbsp;
-      <a href>{{view.runningItem.UpgradeItem.name}}</a>
+      <a href>{{view.runningItem.UpgradeItem.context}}</a>
     </div>
   </div>
 {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index a84f2dd..1e55de3 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1338,11 +1338,29 @@ var urls = {
     'mock': '/data/wizard/{mock}'
   },
   'admin.upgrade.data': {
-    'real': '/clusters/{clusterName}/upgrades/{id}?fields=upgrade_groups/UpgradeGroup,upgrade_groups/upgrade_items',
+    'real': '/clusters/{clusterName}/upgrades/{id}?fields=Upgrade,upgrade_groups/UpgradeGroup,upgrade_groups/upgrade_items/*,upgrade_groups/upgrade_items/tasks/*',
     'mock': '/data/stack_versions/upgrade.json'
   },
+  'admin.upgrade.state': {
+    'real': '/clusters/{clusterName}/upgrades/{id}?fields=Upgrade',
+    'mock': '/data/stack_versions/upgrade_state.json'
+  },
+  'admin.upgrade.start': {
+    'real': '/clusters/{clusterName}/upgrades/{id}',
+    'mock': '/data/stack_versions/start_upgrade.json',
+    'type': 'POST',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          "Upgrade": {
+            "repository_version": data.version
+          }
+        })
+      }
+    }
+  },
   'admin.stack_versions.all': {
-    'real': '/clusters/{clusterName}/stack_versions?fields=ClusterStackVersions/*&minimal_response=true',
+    'real': '/clusters/{clusterName}/stack_versions?fields=ClusterStackVersions/*,repository_versions/RepositoryVersions/*&minimal_response=true',
     'mock': '/data/stack_versions/stack_version_all.json'
   },
   'admin.stack_version.install.repo_version': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 5a06af8..c19139a 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -103,6 +103,7 @@ require('views/main/admin/highAvailability/resourceManager/step3_view');
 require('views/main/admin/highAvailability/resourceManager/step4_view');
 require('views/main/admin/serviceAccounts_view');
 require('views/main/admin/stack_upgrade');
+require('views/main/admin/stack_upgrade/upgrade_wizard_view');
 require('views/main/admin/stack_upgrade/upgrade_version_box_view');
 require('views/main/admin/stack_upgrade/upgrade_task_view');
 require('views/main/admin/stack_and_upgrade_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_and_upgrade_view.js b/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
index 693e696..5c5a604 100644
--- a/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
+++ b/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
@@ -23,6 +23,13 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
   templateName: require('templates/main/admin/stack_and_upgrade'),
 
   /**
+   * update timer
+   * @type {number|null}
+   * @default null
+   */
+  updateTimer: null,
+
+  /**
    * label with number of HEALTHY hosts
    * @type {String}
    */
@@ -39,6 +46,7 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
     switch (App.get('upgradeState')) {
       case 'INIT':
         return (this.get('controller.targetVersions.length') > 0) ? Em.I18n.t('admin.stackUpgrade.state.available') : "";
+      case 'PENDING':
       case 'IN_PROGRESS':
         return Em.I18n.t('admin.stackUpgrade.state.inProgress');
       case 'STOPPED':
@@ -50,11 +58,37 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
     }
   }.property('App.upgradeState', 'controller.targetVersions'),
 
+  /**
+   * load ClusterStackVersions data
+   */
   willInsertElement: function () {
-    if (App.get('supports.stackUpgrade')) this.get('controller').loadVersionsInfo();
+    var self = this;
+    if (App.get('supports.stackUpgrade')) {
+      self.get('controller').loadVersionsInfo();
+      self.doPolling();
+    }
   },
 
   /**
+   * stop polling upgrade state
+   */
+  willDestroyElement: function () {
+    clearTimeout(this.get('updateTimer'));
+  },
+
+  /**
+   * poll upgrade state,
+   */
+  doPolling: function () {
+    var self = this;
+    this.set('updateTimer', setTimeout(function () {
+      self.get('controller').loadUpgradeData(true);
+      self.doPolling();
+    }, App.bgOperationsUpdateInterval));
+  },
+
+
+  /**
    * box that display info about current version
    * @type {Em.View}
    */
@@ -63,15 +97,26 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
       return this.get('controller.currentVersion');
     }.property('controller.currentVersion'),
     btnClass: 'btn-danger',
-    action: function () {
-      return {
-        method: ['UPGRADING', 'UPGRADED', 'UPGRADE_FAILED'].contains(this.get('version.state')) && 'downgrade',
-        label: ['UPGRADING', 'UPGRADED', 'UPGRADE_FAILED'].contains(this.get('version.state')) && Em.I18n.t('common.downgrade')
-      };
-    }.property('version.state'),
+
+    /**
+     * method of controller called on click of source version button
+     * @type {string}
+     * @default null
+     */
+    method: null,
+
+    /**
+     * label of source version button
+     * @type {string}
+     */
+    label: "",
+    buttonObserver: function () {
+      this.set('method', App.get('upgradeState') !== 'INIT' && 'downgrade');
+      this.set('label', App.get('upgradeState') !== 'INIT' && Em.I18n.t('common.downgrade'));
+    }.observes('App.upgradeState'),
     hostsCount: function () {
-      return this.get('version.current_hosts.length');
-    }.property('version.current_hosts.length')
+      return this.get('version.host_states.CURRENT.length');
+    }.property('version.host_states.CURRENT.length')
   }),
 
   /**
@@ -79,23 +124,43 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
    * @type {Em.View}
    */
   targetVersionView: App.UpgradeVersionBoxView.extend({
+    /**
+     * method of controller called on click of target version button
+     * @type {string}
+     * @default null
+     */
+    method: null,
+
+    /**
+     * label of target version button
+     * @type {string}
+     */
+    label: "",
     versions: function () {
       return this.get('controller.targetVersions');
     }.property('controller.targetVersions'),
     btnClass: 'btn-success',
     versionName: function () {
-      if (!this.get('hasVersionsToUpgrade')) return Em.I18n.t('admin.stackUpgrade.state.notAvailable');
-      return this.get('version.stack') + "-" + this.get('version.version');
-    }.property('version.stack', 'version.version', 'hasVersionsToUpgrade'),
-    hasVersionsToUpgrade: function () {
-      return this.get('versions.length') > 0;
-    }.property('versions.length'),
-    selectedVersion: null,
+      if (this.get('versions.length') === 0) return Em.I18n.t('admin.stackUpgrade.state.notAvailable');
+      return this.get('controller.upgradeVersion');
+    }.property('controller.upgradeVersion', 'showSelect'),
+    showSelect: function () {
+      return this.get('versions.length') > 0 && App.get('upgradeState') === 'INIT';
+    }.property('versions.length', 'App.upgradeState'),
+
+    /**
+     * fix for Ember.Select
+     * if Ember.Select initiated with empty content then after content is populated no option selected
+     */
+    initSelect: function () {
+      if (this.get('versions.length') > 0) this.set('version', this.get('versionsSelectContent')[0]);
+    }.observes('versions.length'),
+    version: null,
     versionsSelectContent: function () {
       return this.get('versions').map(function (version) {
         return {
-          label: version.stack + "-" + version.version,
-          value: version.id
+          label: version.repository_name,
+          value: version.repository_version
         }
       });
     }.property('versions.length'),
@@ -106,10 +171,10 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
      * - label <code>label</code>
      * @type {Object}
      */
-    action: function () {
+    buttonObserver: function () {
       var method = null,
-          label = "",
-          versions = this.get('versions');
+        label = "",
+        versions = this.get('versions');
       switch (App.get('upgradeState')) {
         case 'INIT':
           if (this.get('versions.length') > 0) {
@@ -117,6 +182,7 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
             method = 'upgrade';
           }
           break;
+        case 'PENDING':
         case 'IN_PROGRESS':
           label = Em.I18n.t('admin.stackUpgrade.state.upgrading');
           method = 'openUpgradeDialog';
@@ -130,11 +196,9 @@ App.MainAdminStackAndUpgradeView = Em.View.extend({
           method = 'finalize';
           break;
       }
-      return {
-        method: method,
-        label: label
-      };
-    }.property('versions.length', 'App.upgradeState')
+      this.set('method', method);
+      this.set('label',  label);
+    }.observes('versions.length', 'App.upgradeState')
   })
 });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
index df5c806..bf57734 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_task_view.js
@@ -50,59 +50,66 @@ App.upgradeTaskView = Em.View.extend({
    * @type {string}
    */
   iconClass: function () {
-    return this.get('statusIconMap')[this.get('content.UpgradeGroup.state')] || 'icon-question-sign';
-  }.property('content.UpgradeGroup.state'),
+    return this.get('statusIconMap')[this.get('content.UpgradeGroup.status')] || 'icon-question-sign';
+  }.property('content.UpgradeGroup.status'),
 
   /**
    * @type {Boolean}
    */
   isFailed: function () {
-    return this.get('content.UpgradeGroup.state') === 'FAILED';
-  }.property('content.UpgradeGroup.state'),
+    return this.get('content.UpgradeGroup.status') === 'FAILED';
+  }.property('content.UpgradeGroup.status'),
 
   /**
    * @type {Boolean}
    */
   showProgressBar: function () {
-    return ['IN_PROGRESS', 'FAILED'].contains(this.get('content.UpgradeGroup.state')) && this.get('content.UpgradeGroup.type') !== 'manual';
-  }.property('content.UpgradeGroup.state'),
+    return ['IN_PROGRESS', 'FAILED'].contains(this.get('content.UpgradeGroup.status')) && this.get('content.UpgradeGroup.type') !== 'manual';
+  }.property('content.UpgradeGroup.status'),
 
   /**
    * @type {Boolean}
    */
   isInProgress: function () {
-    return this.get('content.UpgradeGroup.state') === 'IN_PROGRESS' && this.get('content.UpgradeGroup.type') !== 'manual';
-  }.property('content.UpgradeGroup.state'),
+    return this.get('content.UpgradeGroup.status') === 'IN_PROGRESS' && this.get('content.UpgradeGroup.type') !== 'manual';
+  }.property('content.UpgradeGroup.status'),
 
   /**
    * width style of progress bar
    * @type {String}
    */
   progressWidth: function () {
-    return "width:" + this.get('content.UpgradeGroup.progress') + '%;';
-  }.property('content.UpgradeGroup.progress'),
+    return "width:" + Math.floor(this.get('progress')) + '%;';
+  }.property('content.UpgradeGroup.progress_percent'),
+
+  /**
+   * @type {number}
+   */
+  progress: function () {
+    return Math.floor(this.get('content.UpgradeGroup.progress_percent'))
+  }.property('content.UpgradeGroup.progress_percent'),
 
   /**
    * if upgrade group is in progress it should have currently running item
    * @type {Object|null}
    */
   runningItem: function () {
-    return this.get('content.upgrade_items').findProperty('UpgradeItem.state', 'IN_PROGRESS');
-  }.property('content.upgrade_items.@each.UpgradeItem.state'),
+    return this.get('content.upgrade_items').findProperty('UpgradeItem.status', 'IN_PROGRESS');
+  }.property('content.upgrade_items.@each.UpgradeItem.status'),
 
   /**
    * if upgrade group is failed it should have failed item
    * @type {Object|null}
    */
   failedItem: function () {
-    return this.get('content.upgrade_items').findProperty('UpgradeItem.state', 'FAILED');
-  }.property('content.upgrade_items.@each.UpgradeItem.state'),
+    return this.get('content.upgrade_items').findProperty('UpgradeItem.status', 'FAILED');
+  }.property('content.upgrade_items.@each.UpgradeItem.status'),
 
   /**
    * @type {Boolean}
    */
   isManualOpened: function () {
     //TODO modify logic according to actual API
-    return this.get('content.UpgradeGroup.state') === 'IN_PROGRESS' && this.get('content.UpgradeGroup.type') === 'manual'
-  }.property('content.UpgradeGroup.state', 'content.UpgradeGroup.type')
+    return this.get('content.UpgradeGroup.status') === 'IN_PROGRESS' && this.get('content.UpgradeGroup.type') === 'manual'
+  }.property('content.UpgradeGroup.status', 'content.UpgradeGroup.type')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 9689bef..20ee0fe 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -21,7 +21,14 @@ var App = require('app');
 
 App.UpgradeVersionBoxView = Em.View.extend({
   /**
-   * @type {object|null}
+   * @type {string}
+   * @default null
+   */
+  method: null,
+
+  /**
+   * @type {object}
+   * @default null
    */
   version: null,
 
@@ -30,8 +37,8 @@ App.UpgradeVersionBoxView = Em.View.extend({
    */
   versionName: function () {
     if (Em.isNone(this.get('version'))) return "";
-    return this.get('version.stack') + "-" + this.get('version.version');
-  }.property('version.stack', 'version.version'),
+    return this.get('version.repository_name');
+  }.property('version.repository_name'),
 
   /**
    * @type {string}
@@ -45,12 +52,12 @@ App.UpgradeVersionBoxView = Em.View.extend({
 
   /**
    * run action by name of method
-   * @param event
-   * @return {Boolean}
+   * @param {object} event
+   * @return {boolean}
    */
   runAction: function (event) {
-    if (typeof this.get('controller')[event.context] === 'function') {
-      this.get('controller')[event.context]();
+    if (typeof this.get('controller')[this.get('method')] === 'function') {
+      this.get('controller')[this.get('method')](this.get('version'));
       return true;
     }
     return false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f950c05/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
new file mode 100644
index 0000000..b3eaab7
--- /dev/null
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.upgradeWizardView = Em.View.extend({
+  controllerBinding: 'App.router.mainAdminStackAndUpgradeController',
+  templateName: require('templates/main/admin/stack_upgrade/stack_upgrade_dialog'),
+
+  /**
+   * update timer
+   * @type {number|null}
+   * @default null
+   */
+  updateTimer: null,
+
+  /**
+   * @type {boolean}
+   */
+  isLoaded: false,
+
+  /**
+   * string format: width:<number>%;
+   * @type {string}
+   */
+  progressWidth: function () {
+    return "width:" + this.get('overallProgress') + "%;";
+  }.property('overallProgress'),
+
+  /**
+   * progress value is rounded to floor
+   * @type {number}
+   */
+  overallProgress: function () {
+    return Math.floor(this.get('controller.upgradeData.Upgrade.progress_percent'));
+  }.property('controller.upgradeData.Upgrade.progress_percent'),
+
+  /**
+   * start polling upgrade data
+   */
+  startPolling: function () {
+    var self = this;
+    if (App.get('clusterName')) {
+      this.get('controller').loadUpgradeData().done(function () {
+        self.set('isLoaded', true);
+      });
+      this.doPolling();
+    }
+  }.observes('App.clusterName'),
+
+  /**
+   * start polling upgrade data
+   */
+  willInsertElement: function () {
+    this.startPolling();
+  },
+
+  /**
+   * stop polling upgrade data
+   */
+  willDestroyElement: function () {
+    clearTimeout(this.get('updateTimer'));
+    this.set('isLoaded', false);
+  },
+
+  /**
+   * load upgrade data with time interval
+   */
+  doPolling: function () {
+    var self = this;
+    this.set('updateTimer', setTimeout(function () {
+      self.get('controller').loadUpgradeData();
+      self.doPolling();
+    }, App.bgOperationsUpdateInterval));
+  },
+
+  /**
+   * @type {Array}
+   */
+  groups: function () {
+    return this.get('controller.upgradeData.upgrade_groups');
+  }.property('controller.upgradeData.upgrade_groups')
+});


Mime
View raw message