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 01967176B5 for ; Thu, 16 Oct 2014 13:14:49 +0000 (UTC) Received: (qmail 48565 invoked by uid 500); 16 Oct 2014 13:14:48 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 48536 invoked by uid 500); 16 Oct 2014 13:14:48 -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 48527 invoked by uid 99); 16 Oct 2014 13:14:48 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Oct 2014 13:14:48 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A14749990CA; Thu, 16 Oct 2014 13:14:48 +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-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko) Date: Thu, 16 Oct 2014 13:14:48 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-1.7.0 7df59aa3f -> 26503deb0 AMBARI-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26503deb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26503deb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26503deb Branch: refs/heads/branch-1.7.0 Commit: 26503deb0d993d71197009f2f416bf9d2bfcc794 Parents: 7df59aa Author: Oleg Nechiporenko Authored: Thu Oct 16 15:22:12 2014 +0300 Committer: Oleg Nechiporenko Committed: Thu Oct 16 15:22:12 2014 +0300 ---------------------------------------------------------------------- .../createAppWizard/step2_controller.js | 35 ++++++++++++-------- .../processes/create_new_app_test.js | 31 ++++++++++++++++- 2 files changed, 51 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/26503deb/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js index 7adbf08..181e81d 100644 --- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js +++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js @@ -77,24 +77,31 @@ App.CreateAppWizardStep2Controller = Ember.ArrayController.extend({ /** * Fill content with objects created from App.SliderAppTypeComponent + * If user come from 3 or 4 step, newApp.components are used * @method loadTypeComponents */ loadTypeComponents: function () { var content = [], - component = this.get('typeComponent'), - allTypeComponents = this.get('newApp.appType.components'); - if (allTypeComponents && allTypeComponents.get('length')) { - allTypeComponents.forEach(function (typeComponent) { - content.push(component.create({ - displayName: typeComponent.get('displayName'), - name: typeComponent.get('name'), - priority: typeComponent.get('priority'), - numInstances: typeComponent.get('defaultNumInstances').toString(), - yarnMemory: typeComponent.get('defaultYARNMemory').toString(), - yarnCPU: typeComponent.get('defaultYARNCPU').toString() - })); - }); - this.set('content', content); + component = this.get('typeComponent'), + allTypeComponents = this.get('newApp.appType.components'), + existingComponents = this.get('appWizardController.newApp.components'); // user may back to current step from 3 or 4 + if (existingComponents && existingComponents.get('length')) { + this.set('content', existingComponents); + } + else { + if (allTypeComponents && allTypeComponents.get('length')) { + allTypeComponents.forEach(function (typeComponent) { + content.push(component.create({ + displayName: typeComponent.get('displayName'), + name: typeComponent.get('name'), + priority: typeComponent.get('priority'), + numInstances: typeComponent.get('defaultNumInstances').toString(), + yarnMemory: typeComponent.get('defaultYARNMemory').toString(), + yarnCPU: typeComponent.get('defaultYARNCPU').toString() + })); + }); + this.set('content', content); + } } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/26503deb/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js index a26d22c..ddef342 100644 --- a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js +++ b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js @@ -75,7 +75,7 @@ var appTypes = { var selectors = { buttonNext: 'button.next-btn', - buttonBack: 'button.btn:eq(1)', + buttonBack: '.btn-area button.btn:eq(1)', step2: { content: '#step2 table tbody' }, @@ -96,6 +96,7 @@ var selectors = { HBASE_MASTER: 4, HBASE_REGIONSERVER: 5 }, + yarnLabel: 'SOME LABEL', categoriesCount: 6, newConfig: { name: 'new_property', @@ -318,4 +319,32 @@ test('check step3', function () { }); }); }); +}); + +test('check step3 back', function () { + + visit('/createAppWizard/step1'); + fillIn('#app-name-input', newApp.name); + click(selectors.buttonNext); + + andThen(function () { + fillIn(selectors.step2.content + ' tr:eq(0) .numInstances', newApp.components.HBASE_MASTER); + find(selectors.step2.content + ' tr:eq(0) .checkbox-inline').click(); + fillIn(selectors.step2.content + ' tr:eq(0) .yarnLabel', newApp.yarnLabel); + fillIn(selectors.step2.content + ' tr:eq(1) .numInstances', newApp.components.HBASE_REGIONSERVER); + click(selectors.buttonNext); + + andThen(function () { + click(selectors.buttonBack); + + andThen(function () { + equal(find(selectors.step2.content + ' tr:eq(0) .numInstances').val(), newApp.components.HBASE_MASTER, 'Components count restored'); + equal(find(selectors.step2.content + ' tr:eq(0) .checkbox-inline').attr('checked'), 'checked', 'YARN label checkbox restored'); + equal(find(selectors.step2.content + ' tr:eq(0) .yarnLabel').val(), newApp.yarnLabel, 'YARN label input restored'); + equal(find(selectors.step2.content + ' tr:eq(0) .yarnLabel').attr('disabled'), null, 'YARN label input not disabled'); + equal(find(selectors.step2.content + ' tr:eq(1) .numInstances').val(), newApp.components.HBASE_REGIONSERVER, 'Components count restored (2)'); + }); + }); + }); + }); \ No newline at end of file