Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 07C4E10426 for ; Fri, 28 Mar 2014 12:49:31 +0000 (UTC) Received: (qmail 77734 invoked by uid 500); 28 Mar 2014 12:49:29 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 77503 invoked by uid 500); 28 Mar 2014 12:49:26 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 77372 invoked by uid 99); 28 Mar 2014 12:49:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2014 12:49:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7CAF08B125A; Fri, 28 Mar 2014 12:49:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-5258. Installer: 'Undo' button for repo BaseURL does not work. (onechiporenko) Date: Fri, 28 Mar 2014 12:49:24 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-1.5.0 7b04eab2e -> f13f4b7b1 AMBARI-5258. Installer: 'Undo' button for repo BaseURL does not work. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f13f4b7b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f13f4b7b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f13f4b7b Branch: refs/heads/branch-1.5.0 Commit: f13f4b7b1fccb9e1abce005a202cc1913fb6d320 Parents: 7b04eab Author: Oleg Nechiporenko Authored: Fri Mar 28 14:44:53 2014 +0200 Committer: Oleg Nechiporenko Committed: Fri Mar 28 14:49:19 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/installer.js | 14 ++-- ambari-web/app/views/wizard/step1_view.js | 97 ++------------------------ 2 files changed, 9 insertions(+), 102 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f13f4b7b/ambari-web/app/controllers/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js index b43b0bc..033e3ff 100644 --- a/ambari-web/app/controllers/installer.js +++ b/ambari-web/app/controllers/installer.js @@ -188,7 +188,6 @@ App.InstallerController = App.WizardController.extend({ * baseUrl: 'http://...', * originalBaseUrl: 'http://...', * defaultBaseUrl: 'http://...', - * latestBaseUrl: 'http://...', * mirrorsList: ''; * }, * { @@ -196,7 +195,6 @@ App.InstallerController = App.WizardController.extend({ * baseUrl: 'http://...', * originalBaseUrl: 'http://...', * defaultBaseUrl: 'http://...', - * latestBaseUrl: 'http://...', * mirrorsList: ''; * }, * ] @@ -206,15 +204,13 @@ App.InstallerController = App.WizardController.extend({ version.operatingSystems.forEach(function (os) { if (os.repositories) { os.repositories.forEach(function (repo) { - if(repo.Repositories.repo_name == version.Versions.stack_name) { - var defaultBaseUrl = repo.Repositories.default_base_url || repo.Repositories.base_url; - var latestBaseUrl = repo.Repositories.latest_base_url || defaultBaseUrl; + if(repo.Repositories.repo_name == version.Versions.stack_name){ oses.push({ osType: os.OperatingSystems.os_type, - baseUrl: latestBaseUrl, - originalLatestBaseUrl: latestBaseUrl, + baseUrl: repo.Repositories.base_url, originalBaseUrl: repo.Repositories.base_url, - defaultBaseUrl: defaultBaseUrl, + defaultBaseUrl: repo.Repositories.default_base_url ? + repo.Repositories.default_base_url : repo.Repositories.base_url, mirrorsList: repo.Repositories.mirrors_list }); } @@ -223,7 +219,7 @@ App.InstallerController = App.WizardController.extend({ }); } result.push( - Em.Object.create({ + Ember.Object.create({ name: version.Versions.stack_name + "-" + version.Versions.stack_version, isSelected: false, operatingSystems: oses http://git-wip-us.apache.org/repos/asf/ambari/blob/f13f4b7b/ambari-web/app/views/wizard/step1_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js index 75e71fc..c2900ee 100644 --- a/ambari-web/app/views/wizard/step1_view.js +++ b/ambari-web/app/views/wizard/step1_view.js @@ -18,13 +18,8 @@ var App = require('app'); App.WizardStep1View = Em.View.extend({ - templateName: require('templates/wizard/step1'), - /** - * List of available stacks - * @type {Em.Object[]} - */ stacks: function () { var stacks = []; this.get('controller.content.stacks').forEach(function (stack) { @@ -36,11 +31,7 @@ App.WizardStep1View = Em.View.extend({ return stacks; }.property('controller.content.stacks.@each.isSelected'), - /** - * Checkbox for each stack - * @type {Em.Checkbox} - */ - stackRadioButton: Em.Checkbox.extend({ + stackRadioButton: Ember.Checkbox.extend({ tagName: 'input', attributeBindings: [ 'type', 'checked' ], checked: function () { @@ -54,50 +45,21 @@ App.WizardStep1View = Em.View.extend({ } }), - /** - * List of all repo-groups - * @type {Object[][]} - */ allRepositoriesGroup: [[],[],[]], - - /** - * Verify if some repo has empty base-url - * @type {bool} - */ emptyRepoExist: function () { return (this.get('allRepositoriesGroup').filterProperty('empty-error', true).length != 0); }.property('allRepositoriesGroup.@each.empty-error'), - - /** - * Disable submit button flag - * @type {bool} - */ isSubmitDisabled: function() { return this.get('emptyRepoExist') || this.get('allRepoUnchecked') || this.get('invalidUrlExist') ; }.property('emptyRepoExist', 'allRepoUnchecked', 'invalidUrlExist'), - - /** - * Verify if some invalid repo-urls exist - * @type {bool} - */ invalidUrlExist: function () { var selectedStack = this.get('controller.content.stacks').findProperty('isSelected', true); var invalidExist = this.get('allRepositoriesGroup').filterProperty('validation', 'icon-exclamation-sign').length != 0; return (selectedStack.get('invalidCnt') > 0) && invalidExist; }.property('controller.content.stacks.@each.invalidCnt', 'allRepositoriesGroup.@each.validation'), - - /** - * If all repo links are unchecked - * @type {bool} - */ allRepoUnchecked: function () { return (!this.get('allRepositoriesGroup').filterProperty('checked', true).length); }.property('allRepositoriesGroup.@each.checked'), - - /** - * Overall errors count - * @type {number} - */ totalErrorCnt: function () { var emptyCnt = this.get('allRepositoriesGroup').filterProperty('empty-error', true).length; var invalidCnt = this.get('allRepositoriesGroup').filterProperty('validation', 'icon-exclamation-sign').length; @@ -117,13 +79,7 @@ App.WizardStep1View = Em.View.extend({ this.$('.accordion-body').toggle('blind', 500); this.set('isRLCollapsed', !this.get('isRLCollapsed')); }, - - /** - * Is Repositories Accordion collapsed - * @type {bool} - */ isRLCollapsed: true, - didInsertElement: function () { if (this.get('isRLCollapsed')) { this.$('.accordion-body').hide(); @@ -131,10 +87,6 @@ App.WizardStep1View = Em.View.extend({ $("[rel=skip-validation-tooltip]").tooltip({ placement: 'right'}); }, - /** - * Popover for repo-url error indicator - * @type {Em.View} - */ popoverView: Em.View.extend({ tagName: 'i', classNameBindings: ['repoGroup.validation'], @@ -144,9 +96,6 @@ App.WizardStep1View = Em.View.extend({ } }), - /** - * Format repo-group values and set it to allRepositoriesGroup - */ loadRepositories: function () { var selectedStack = this.get('controller.content.stacks').findProperty('isSelected', true); var reposGroup = [[],[],[]]; @@ -200,18 +149,10 @@ App.WizardStep1View = Em.View.extend({ } this.set('allRepositoriesGroup', reposGroup); }.observes('controller.content.stacks.@each.isSelected', 'controller.content.stacks.@each.reload'), - - /** - * Set group parameters according to operation system - * @param {Em.Object} group - * @param {Object} os - * @param {number} groupNumber - */ setGroupByOs: function (group, os, groupNumber) { var isChecked = this.get('allGroupsCheckbox')[groupNumber]; group.set('checked', isChecked); group.set('baseUrl', os.baseUrl); - group.set('latestBaseUrl', os.latestBaseUrl); group.set('defaultBaseUrl', os.defaultBaseUrl); group.set('empty-error', !os.baseUrl); group.set('invalid-error', os.validation == 'icon-exclamation-sign'); @@ -222,7 +163,6 @@ App.WizardStep1View = Em.View.extend({ group.set('errorContent', os.errorContent); group.set('group-number', groupNumber); }, - /** * Onclick handler for checkbox of each repo group */ @@ -236,10 +176,10 @@ App.WizardStep1View = Em.View.extend({ var groupNumber = self.osTypeToGroup(os.osType); var targetGroup = groups.findProperty('group-number', groupNumber); if (!targetGroup.get('checked')) { - os.baseUrl = os.latestBaseUrl; + os.baseUrl = os.defaultBaseUrl; os.validation = null; os.selected = false; - targetGroup.set('baseUrl', os.latestBaseUrl); + targetGroup.set('baseUrl', os.defaultBaseUrl); targetGroup.set('undo', targetGroup.get('baseUrl') != targetGroup.get('defaultBaseUrl')); targetGroup.set('invalid-error', false); targetGroup.set('validation', null); @@ -262,18 +202,8 @@ App.WizardStep1View = Em.View.extend({ } }.observes('allRepositoriesGroup.@each.checked', 'skipValidationChecked'), - /** - * Checked flags for each repo-checkbox - * @type {bool[]} - */ allGroupsCheckbox: [true, true, true], - - /** - * Skip repo-validation - * @type {bool} - */ skipValidationChecked: false, - /** * Onclick handler for undo action of each repo group */ @@ -283,16 +213,11 @@ App.WizardStep1View = Em.View.extend({ var selectedStack = this.get('controller.content.stacks').findProperty('isSelected', true); osTypes.forEach( function (os) { var cos = selectedStack.operatingSystems.findProperty('osType', os ); - cos.baseUrl = cos.latestBaseUrl; + cos.baseUrl = cos.defaultBaseUrl; cos.validation = null; }); this.loadRepositories(); }, - - /** - * Handler for clear icon click - * @param {object} event - */ clearGroupLocalRepository: function (event) { var group = event.context; var osTypes = this.groupToOsType(group.get('group-number')); @@ -304,10 +229,8 @@ App.WizardStep1View = Em.View.extend({ }); this.loadRepositories(); }, - /** * Handler when editing any repo group BaseUrl - * @param {object} event */ editGroupLocalRepository: function (event) { //upload to content @@ -329,12 +252,6 @@ App.WizardStep1View = Em.View.extend({ }); } }.observes('allRepositoriesGroup.@each.baseUrl'), - - /** - * Get list of OS for provided group number - * @param {number} groupNumber - * @returns {Array} - */ groupToOsType: function (groupNumber) { switch (groupNumber) { case 0: @@ -346,12 +263,6 @@ App.WizardStep1View = Em.View.extend({ } return []; }, - - /** - * Get group number for provided OS - * @param {string} osType - * @returns {number} - */ osTypeToGroup: function (osType) { switch(osType) { case 'redhat5':