You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/12/18 01:56:44 UTC
ambari git commit: AMBARI-8744. Admin View: Create Repo version form
changes. (Richard Zang via yusaku)
Repository: ambari
Updated Branches:
refs/heads/trunk 6f948db83 -> 2b09328fa
AMBARI-8744. Admin View: Create Repo version form changes. (Richard Zang via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b09328f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b09328f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b09328f
Branch: refs/heads/trunk
Commit: 2b09328fa3ea304271e4db145268494c81ef0abd
Parents: 6f948db
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Wed Dec 17 16:56:19 2014 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Wed Dec 17 16:56:19 2014 -0800
----------------------------------------------------------------------
.../stackVersions/StackVersionsCreateCtrl.js | 15 ++++++--
.../stackVersions/StackVersionsListCtrl.js | 2 +-
.../ui/admin-web/app/scripts/services/Stack.js | 6 ++--
.../resources/ui/admin-web/app/styles/main.css | 9 +++++
.../app/views/stackVersions/create.html | 18 ++++++----
.../stackVersions/StackversionsListCtrl_test.js | 38 ++++++++++++++++++++
.../stackVersions/StackversoinsListCtrl_test.js | 38 --------------------
7 files changed, 76 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/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 e6cc743..9f3e0fa 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
@@ -27,8 +27,14 @@ angular.module('ambariAdminConsole')
$scope.fetchStackVersionFilterList = function () {
Stack.allStackVersions()
.then(function (allStackVersions) {
- $scope.upgradeStack.options = allStackVersions;
- $scope.upgradeStack.value = allStackVersions[allStackVersions.length - 1].value;
+ var versions = [];
+ angular.forEach(allStackVersions, function (version) {
+ if (version.upgrade_packs.length > 0) {
+ versions.push(version);
+ }
+ });
+ $scope.upgradeStack.options = versions;
+ $scope.upgradeStack.value = versions[versions.length - 1].value;
})
.catch(function (data) {
Alert.error('Fetch stack version filter list error', data.message);
@@ -73,6 +79,11 @@ angular.module('ambariAdminConsole')
}
];
+ $scope.selectedOS = 0;
+ $scope.toggleOSSelect = function () {
+ this.repository.selected? $scope.selectedOS++ : $scope.selectedOS--;
+ };
+
$scope.create = function () {
Stack.addRepo($scope.upgradeStack.value, $scope.versionName, $scope.repositories)
.success(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index 034537f..4702db8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -75,7 +75,7 @@ angular.module('ambariAdminConsole')
};
$scope.fetchRepos = function () {
- Stack.allRepos($scope.filter, $scope.pagination).then(function (stacks) {
+ return Stack.allRepos($scope.filter, $scope.pagination).then(function (stacks) {
$scope.pagination.totalStacks = stacks.items.length;
var repos = [];
angular.forEach(stacks.items, function(stack) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/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 aa574c8..76783b6 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
@@ -51,7 +51,7 @@ angular.module('ambariAdminConsole')
return {
allStackVersions: function () {
- var url = Settings.baseUrl + '/stacks?fields=*';
+ var url = Settings.baseUrl + '/stacks?fields=versions/Versions';
var deferred = $q.defer();
$http.get(url, {mock: 'stack/allStackVersions.json'})
.success(function (data) {
@@ -60,9 +60,11 @@ angular.module('ambariAdminConsole')
angular.forEach(stack.versions, function (version) {
var stack_name = version.Versions.stack_name;
var stack_version = version.Versions.stack_version;
+ var upgrade_packs = version.Versions.upgrade_packs;
allStackVersions.push({
displayName: stack_name + '-' + stack_version,
- value: stack_version
+ value: stack_version,
+ upgrade_packs: upgrade_packs
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/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 8136088..a565534 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
@@ -1291,9 +1291,18 @@ accordion .panel-group .panel{
.repo-version-inline .bold-dot {
font-weight: bold;
+ padding-right: 4px;
}
.status-current
{
background-color: green;
+}
+
+.repo-version-select {
+ direction: rtl;
+}
+
+.repo-version-left {
+ text-align: right;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/create.html
index 20fe4c4..70d55a1 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/create.html
@@ -21,7 +21,7 @@
<li class="active">Register Version</li>
</ol>
<hr>
-<form class="form-horizontal register-version-form" role="form" name="form-registerVersionForm" novalidate>
+<form class="form-horizontal register-version-form" role="form" name="repoRegForm" novalidate>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Details</h3>
@@ -29,15 +29,18 @@
<div class="panel-body">
<div class="form-inline repo-version-inline">
<label class="control-label col-sm-2 repo-version-label">Version</label>
- <div class="form-group col-sm-3">
- <select class="form-control"
+ <div class="form-group col-sm-3 repo-version-left">
+ <select class="form-control repo-version-select"
ng-model="upgradeStack.value"
ng-options="o.value as o.displayName for o in upgradeStack.options">
</select>
<span class="bold-dot">.</span>
</div>
- <div class="form-group col-sm-3">
- <input class="form-control" type="text" ng-model="versionName" placeholder="Version Name">
+ <div class="form-group col-sm-6" ng-class="{'has-error' : repoRegForm.version.$error.pattern}">
+ <input class="form-control" name="version" type="text" ng-model="versionName" ng-pattern="/^\d(\.\d)?(\-\d*)?$/"
+ placeholder="Version Name" required/>
+ <span class="text-primary" ng-show="!repoRegForm.version.$error.pattern"> {{upgradeStack.value + '.' + versionName}}</span>
+ <span class="text-danger" ng-show="repoRegForm.version.$error.pattern">Invalid subversion. eg: 1.0-123</span>
</div>
</div>
</div>
@@ -59,7 +62,7 @@
<div class="col-sm-3">
<div class="checkbox">
<label>
- <input type="checkbox" ng-model="repository.selected"> {{repository.os}}
+ <input type="checkbox" ng-model="repository.selected" ng-change="toggleOSSelect()"> {{repository.os}}
</label>
</div>
</div>
@@ -82,7 +85,8 @@
</div>
</div>
<div class="col-sm-12">
- <button class="btn btn-primary pull-right left-margin" ng-click="create()">Save</button>
+ <button class="btn btn-primary pull-right left-margin" ng-click="create()"
+ ng-disabled="repoRegForm.version.$invalid || selectedOS === 0">Save</button>
<button class="btn btn-default pull-right">Cancel</button>
</div>
</form>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
new file mode 100644
index 0000000..d3c1b2e
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversionsListCtrl_test.js
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+describe('#Cluster', function () {
+ describe('StackVersionsListCtrl', function() {
+ var scope, ctrl;
+
+ beforeEach(module('ambariAdminConsole', function($provide) {
+
+ }));
+
+ beforeEach(inject(function($rootScope, $controller) {
+ scope = $rootScope.$new();
+ ctrl = $controller('StackVersionsListCtrl', {$scope: scope});
+ }));
+
+ it('saves list of stacks', function() {
+ scope.fetchRepos().then(function() {
+ expect(Array.isArray(scope.repos)).toBe(true);
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b09328f/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversoinsListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversoinsListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversoinsListCtrl_test.js
deleted file mode 100644
index 8865180..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/stackVersions/StackversoinsListCtrl_test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.
- */
-
-describe('#Cluster', function () {
- describe('StackVersionsListCtrl', function() {
- var scope, ctrl;
-
- beforeEach(module('ambariAdminConsole', function($provide) {
-
- }));
-
- beforeEach(inject(function($rootScope, $controller) {
- scope = $rootScope.$new();
- ctrl = $controller('StackVersionsListCtrl', {$scope: scope});
- }));
-
- it('saves list of stacks', function() {
- scope.fetchRepos().then(function() {
- expect(Array.isArray(scope.stacks)).toBe(true);
- });
- });
- });
-});