ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject [2/4] ambari git commit: AMBARI-14797. Register Version: display loaded version definition info in different categories and Save them.(XIWANG)
Date Thu, 04 Feb 2016 21:56:52 GMT
AMBARI-14797. Register Version: display loaded version definition info in different categories
and Save them.(XIWANG)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 0b47564002b295efb6be1b41aa66381561dbe7e4
Parents: e4d03b5
Author: Xi Wang <xiwang@apache.org>
Authored: Wed Feb 3 15:58:18 2016 -0800
Committer: Xi Wang <xiwang@apache.org>
Committed: Wed Feb 3 16:02:48 2016 -0800

----------------------------------------------------------------------
 .../app/assets/data/version/version.json        |   3 +
 .../stackVersions/StackVersionsCreateCtrl.js    |  46 ++---
 .../ui/admin-web/app/scripts/i18n.config.js     |  12 +-
 .../ui/admin-web/app/scripts/services/Stack.js  | 170 ++++++++++++++++++-
 .../resources/ui/admin-web/app/styles/main.css  |  15 ++
 .../views/stackVersions/stackVersionPage.html   |  87 +++++-----
 6 files changed, 269 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
index b5b3601..d6530e2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/version/version.json
@@ -26,6 +26,7 @@
             "services": [
               {
                 "name": "HDFS",
+                "display_name": "HDFS",
                 "versions": [
                   {
                     "version": "2.1.1",
@@ -36,6 +37,7 @@
               },
               {
                 "name": "HIVE",
+                "display_name": "Hive",
                 "versions": [
                   {
                     "version": "1.2.1"
@@ -44,6 +46,7 @@
               },
               {
                 "name": "ZOOKEEPER",
+                "display_name": "ZooKeeper",
                 "versions": [
                   {
                     "version": "3.4.5"

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
index 40aa103..81ad7f7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
@@ -156,14 +156,14 @@ angular.module('ambariAdminConsole')
     index: 1,
     displayName: 'Upload Version Definition File',
     url: 'files://',
-    selected: true,
-    hasError: true
+    //selected: true,
+    hasError: false
   };
   $scope.option2 = {
     index: 2,
     displayName: 'Version Definition File URL',
     url: 'https://',
-    selected: false,
+    //selected: false,
     hasError: false
   };
   $scope.selectedOption = 1;
@@ -172,8 +172,8 @@ angular.module('ambariAdminConsole')
    * User can select ONLY one option to upload version definition file
    */
   $scope.toggleOptionSelect = function () {
-    $scope.option1.selected = $scope.selectedOption == $scope.option1.index;
-    $scope.option2.selected = $scope.selectedOption == $scope.option2.index;
+    //$scope.option1.selected = $scope.selectedOption == $scope.option1.index;
+    //$scope.option2.selected = $scope.selectedOption == $scope.option2.index;
     $scope.option1.hasError = false;
     $scope.option2.hasError = false;
   };
@@ -215,11 +215,11 @@ angular.module('ambariAdminConsole')
     return Stack.getLatestRepo('HDP').then(function (response) {
       $scope.id = response.id;
       $scope.isPatch = response.type == 'PATCH';
-      $scope.stackNameVersion = response.stackNameVersion;
-      $scope.displayName = response.displayName;
-      $scope.version = response.version;
-      $scope.actualVersion = response.actualVersion;
-      $scope.services = response.services;
+      $scope.stackNameVersion = response.stackNameVersion || 'n/a';
+      $scope.displayName = response.displayName || 'n/a';
+      $scope.version = response.version || 'n/a';
+      $scope.actualVersion = response.actualVersion || 'n/a';
+      $scope.services = response.services || [];
       //save default values of repos to check if they were changed
       $scope.defaulfOSRepos = {};
       response.updateObj.operating_systems.forEach(function(os) {
@@ -236,19 +236,19 @@ angular.module('ambariAdminConsole')
       $scope.osList = response.osList;
       // if user reach here from UI click, repo status should be cached
       // otherwise re-fetch repo status from cluster end point.
-      $scope.repoStatus = Cluster.repoStatusCache[$scope.id];
-      if (!$scope.repoStatus) {
-        $scope.fetchClusters()
-          .then(function () {
-            return $scope.fetchRepoClusterStatus();
-          })
-          .then(function () {
-            $scope.deleteEnabled = $scope.isDeletable();
-          });
-      } else {
-        $scope.deleteEnabled = $scope.isDeletable();
-      }
-      $scope.addMissingOSList();
+//      $scope.repoStatus = Cluster.repoStatusCache[$scope.id];
+//      if (!$scope.repoStatus) {
+//        $scope.fetchClusters()
+//          .then(function () {
+//            return $scope.fetchRepoClusterStatus();
+//          })
+//          .then(function () {
+//            $scope.deleteEnabled = $scope.isDeletable();
+//          });
+//      } else {
+//        $scope.deleteEnabled = $scope.isDeletable();
+//      }
+      //$scope.addMissingOSList();
     });
   };
 }]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 21622b5..ed42b45 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -306,7 +306,17 @@ angular.module('ambariAdminConsole')
       'os': 'OS',
       'baseURL': 'Base URL',
       'skipValidation': 'Skip Repository Base URL validation (Advanced)',
-
+      'contents': {
+        'title': 'Contents',
+        'empty': 'No contents to display'
+      },
+      'details': {
+        'stackName': 'Stack Name',
+        'displayName': 'Display Name',
+        'version': 'Version',
+        'actualVersion': 'Actual Version',
+        'releaseNotes': 'Release Notes'
+      },
       'changeBaseURLConfirmation': {
         'title': 'Confirm Base URL Change',
         'message': 'You are about to change repository Base URLs that are already in use.
Please confirm that you intend to make this change and that the new Base URLs point to the
same exact Stack version and build'

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
index a28943c..aa81b5d 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Stack.js
@@ -176,11 +176,176 @@ angular.module('ambariAdminConsole')
     getLatestRepo: function (stack_name) {
       var url = Settings.baseUrl + '/stacks/' + stack_name + '/versions?' +
         'fields=repository_versions/operating_systems/repositories/*' +
-        ',repository_versions/RepositoryVersions/*';
+        ',repository_versions/RepositoryVersions/*';  // tbd
       var deferred = $q.defer();
       $http.get(url, {mock: 'version/version.json'})
         .success(function (data) {
-          data = data.items[0];
+          //data = data.items[0];
+          data = {
+            "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2",
+            "Versions" : {
+              "stack_name" : "HDP",
+              "stack_version" : "2.2"
+            },
+            "repository_versions" : [
+              {
+                "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15",
+                "RepositoryVersions" : {
+                  "id" : 15,
+                  "repository_version" : "2.2.0.1-901",
+                  "stack_name" : "HDP",
+                  "stack_version" : "2.2",
+                  "release": {
+                    "type": "PATCH",
+                    "stack_id": "HDP-2.2",
+                    "version": "2.2.0.1",
+                    "build": "901",
+                    "compatible_with": "2.2.0.1-[1-9]",
+                    "release_notes": "http://someurl"
+                  },
+                  "services": [
+                    {
+                      "name": "HDFS",
+                      "display_name": "HDFS",
+                      "versions": [
+                        {
+                          "version": "2.1.1",
+                          "version_id": "10",
+                          "components": [ "NAMENODE"]
+                        }
+                      ]
+                    },
+                    {
+                      "name": "HIVE",
+                      "display_name": "Hive",
+                      "versions": [
+                        {
+                          "version": "1.2.1"
+                        }
+                      ]
+                    },
+                    {
+                      "name": "ZOOKEEPER",
+                      "display_name": "ZooKeeper",
+                      "versions": [
+                        {
+                          "version": "3.4.5"
+                        }
+                      ]
+                    },
+                    {
+                      "name": "YARN",
+                      "versions": [
+                        {
+                          "version": "2.7.1"
+                        }
+                      ]
+                    },
+                    {
+                      "name": "SPARK",
+                      "versions": [
+                        {
+                          "version": "1.4.1"
+                        }
+                      ]
+                    },
+                    {
+                      "name": "SPARK",
+                      "versions": [
+                        {
+                          "version": "1.5.2"
+                        }
+                      ]
+                    }
+                  ]
+                },
+                "operating_systems" : [
+                  {
+                    "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5",
+                    "OperatingSystems" : {
+                      "os_type" : "redhat5",
+                      "repository_version_id" : 15,
+                      "stack_name" : "HDP",
+                      "stack_version" : "2.2"
+                    },
+                    "repositories" : [
+                      {
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-2.2.0.1-901",
+                        "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" : "redhat5",
+                          "repo_id" : "HDP-2.2.0.1-901",
+                          "repo_name" : "HDP",
+                          "repository_version_id" : 15,
+                          "stack_name" : "HDP",
+                          "stack_version" : "2.2"
+                        }
+                      },
+                      {
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat5/repositories/HDP-UTILS-2.2.0.1-901",
+                        "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" : "redhat5",
+                          "repo_id" : "HDP-UTILS-2.2.0.1-901",
+                          "repo_name" : "HDP-UTILS",
+                          "repository_version_id" : 15,
+                          "stack_name" : "HDP",
+                          "stack_version" : "2.2"
+                        }
+                      }
+                    ]
+                  },
+                  {
+                    "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6",
+                    "OperatingSystems" : {
+                      "os_type" : "redhat6",
+                      "repository_version_id" : 15,
+                      "stack_name" : "HDP",
+                      "stack_version" : "2.2"
+                    },
+                    "repositories" : [
+                      {
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-2.2.0.1-901",
+                        "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.0.1-901",
+                          "repo_name" : "HDP",
+                          "repository_version_id" : 15,
+                          "stack_name" : "HDP",
+                          "stack_version" : "2.2"
+                        }
+                      },
+                      {
+                        "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.2/repository_versions/15/operating_systems/redhat6/repositories/HDP-UTILS-2.2.0.1-901",
+                        "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-2.2.0.1-901",
+                          "repo_name" : "HDP-UTILS",
+                          "repository_version_id" : 15,
+                          "stack_name" : "HDP",
+                          "stack_version" : "2.2"
+                        }
+                      }
+                    ]
+                  }
+                ]
+              }
+            ]
+          };
           var response = {
             id : data.repository_versions[0].RepositoryVersions.id,
             stackVersion : data.Versions.stack_version,
@@ -189,6 +354,7 @@ angular.module('ambariAdminConsole')
             stackNameVersion: data.Versions.stack_name + '-' + data.Versions.stack_version,
/// HDP-2.3
             actualVersion: data.repository_versions[0].RepositoryVersions.repository_version,
/// 2.3.4.0-3846
             version: data.repository_versions[0].RepositoryVersions.release.version, ///
2.3.4.0
+            releaseNotes: data.repository_versions[0].RepositoryVersions.release.release_notes,
             displayName: data.Versions.stack_name + '-' + data.repository_versions[0].RepositoryVersions.release.version,
//HDP-2.3.4.0
             repoVersionFullName : data.Versions.stack_name + '-' + data.repository_versions[0].RepositoryVersions.repository_version,
             osList: data.repository_versions[0].operating_systems,

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index de3d526..8385e48 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1398,3 +1398,18 @@ thead.view-permission-header > tr > th {
   padding-bottom: 20px;
 }
 
+.register-version-form .patch-icon {
+  color: #ff4500;
+}
+
+.register-version-form .version-info {
+  padding-top: 7px;
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+.version-contents-body {
+  max-height: 150px;
+  overflow: scroll;
+}
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b475640/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
index e23aecb..488f077 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
@@ -31,58 +31,69 @@
 <hr>
 
 
-
-<div class="clearfix register-version-options">
-  <div class="col-sm-5 option-radio-button">
-    <label class="option-label">
-      <input type="radio" ng-model="selectedOption" value="{{option1.index}}" ng-change="toggleOptionSelect()">
{{'versions.uploadFile' | translate}}
-    </label>
-  </div>
-  <div class="col-sm-7">
-    <input type="file" class="choose-file-input" ng-file-select="onFileSelect($files)"/>
-  </div>
-</div>
-<div class="clearfix register-version-options border-bottom bottom-margin">
-  <div class="col-sm-5 option-radio-button">
-    <label class="option-label">
-      <input type="radio" ng-model="selectedOption" value="{{option2.index}}" ng-change="toggleOptionSelect()">
{{'versions.enterURL' | translate}}
-    </label>
+<div id="upload-definition-file-panel" ng-if="createController">
+  <div class="clearfix register-version-options">
+    <div class="col-sm-5 option-radio-button">
+      <label class="option-label">
+        <input type="radio" ng-model="selectedOption" value="{{option1.index}}" ng-change="toggleOptionSelect()">
{{'versions.uploadFile' | translate}}
+      </label>
+    </div>
+    <div class="col-sm-7">
+      <input type="file" class="choose-file-input" ng-file-select="onFileSelect($files)"/>
+    </div>
   </div>
+  <div class="clearfix register-version-options border-bottom bottom-margin">
+    <div class="col-sm-5 option-radio-button">
+      <label class="option-label">
+        <input type="radio" ng-model="selectedOption" value="{{option2.index}}" ng-change="toggleOptionSelect()">
{{'versions.enterURL' | translate}}
+      </label>
+    </div>
     <div class="col-sm-7">
       <div class="form-group {{option2.name}}" ng-class="{'has-error': option2.url.hasError
}">
-        <div class=""><input type="text" class="form-control" ng-model="option2.url"
ng-change="clearOptionsError()" ng-disabled="!option2.selected"></div>
+        <div class=""><input type="text" class="form-control" ng-model="option2.url"
ng-change="clearOptionsError()" ng-disabled="!(selectedOption==2)"></div>
       </div>
     </div>
     <div class="col-sm-12 read-info-button">
-    <button class="btn btn-primary pull-right" ng-click="readVersionInfo()"
-        ng-disabled="readInfoButtonDisabled()">{{'versions.readInfo' | translate}}</button>
+      <button class="btn btn-primary pull-right" ng-click="readVersionInfo()"
+            ng-disabled="readInfoButtonDisabled()">{{'versions.readInfo' | translate}}</button>
     </div>
+  </div>
 </div>
 
-
 <form class="form-horizontal register-version-form" role="form" name="repoRegForm" novalidate>
-  <div class="panel panel-default" ng-if="createController">
+  <div class="panel panel-default">
     <div class="panel-heading">
       <h3 class="panel-title">{{'common.details' | translate}}</h3>
     </div>
     <div class="panel-body">
-      <div class="form-inline repo-version-inline">
-        <label class="control-label col-sm-2 repo-version-label">{{'common.name' |
translate}}</label>
-        <div class="col-sm-10">
-          <select class="form-control repo-version-select"
-                  ng-model="$parent.upgradeStack.selected"
-                  ng-options="o as o.displayName for o in upgradeStack.options"
-                  ng-change="afterStackVersionChange()">
-          </select>
-          <span class="bold-dot">.</span>
-          <div class="form-group" ng-class="{'has-error' : repoRegForm.version.$error.pattern}">
-            <input class="form-control" name="version" type="text" ng-model="$parent.repoSubversion"
ng-pattern="subversionPattern"
-                   placeholder="{{'versions.placeholder' | translate}}" ng-change="updateCurrentVersionInput()"
required/>
-            <span class="text-danger" ng-show="repoRegForm.version.$error.pattern">
-              &nbsp{{'common.alerts.isInvalid' | translate: '{term: currentVersionInput}'}}
-            </span>
-          </div>
-        </div>
+      <div class="clearfix">
+        <label class="control-label col-sm-3">{{'versions.details.stackName' | translate}}</label>
+        <div class="version-info col-sm-7">{{stackNameVersion}}</div>
+        <div class="col-sm-2 patch-icon" ng-if="isPatch"><span class="glyphicon
glyphicon-tree-deciduous">Patch</span></div>
+      </div>
+      <div class="clearfix">
+        <label class="control-label col-sm-3">{{'versions.details.displayName' | translate}}</label>
+        <div class="version-info col-sm-9">{{displayName}}</div>
+      </div>
+      <div class="clearfix">
+        <label class="control-label col-sm-3">{{'versions.details.version' | translate}}</label>
+        <div class="version-info col-sm-9">{{version}}</div>
+      </div>
+      <div class="clearfix">
+        <label class="control-label col-sm-3">{{'versions.details.actualVersion' |
translate}}</label>
+        <div class="version-info col-sm-9">{{actualVersion}}</div>
+      </div>
+    </div>
+  </div>
+  <div class="panel panel-default">
+    <div class="panel-heading">
+      <h3 class="panel-title">{{'versions.contents.title' | translate}}</h3>
+    </div>
+    <div class="panel-body version-contents-body">
+      <div class="alert alert-info hide-soft" ng-class="{'visible' : !services || !services.length}"
role="alert">{{'versions.contents.empty' | translate}}</div>
+      <div class="clearfix" ng-repeat="service in services">
+        <label class="control-label col-sm-3">{{service.name}}</label>
+        <div class="version-info col-sm-9">{{service.version}}</div>
       </div>
     </div>
   </div>


Mime
View raw message