AMBARI-21660 Stack selection page does not load the HDP stacks. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4cd96576 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4cd96576 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4cd96576 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: 4cd96576ed5cab53a271b4892d548002c33fb2e7 Parents: 2d1ac66 Author: ababiichuk <ababiic...@hortonworks.com> Authored: Fri Aug 4 15:05:39 2017 +0300 Committer: ababiichuk <ababiic...@hortonworks.com> Committed: Fri Aug 4 15:05:39 2017 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step1_controller.js | 2 + ambari-web/app/routes/installer.js | 4 +- ambari-web/app/templates/wizard/step1.hbs | 326 ++++++++++--------- ambari-web/app/views/wizard/step1_view.js | 2 +- .../test/controllers/wizard/step1_test.js | 2 + ambari-web/test/views/wizard/step1_view_test.js | 2 +- 6 files changed, 182 insertions(+), 156 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/controllers/wizard/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step1_controller.js b/ambari-web/app/controllers/wizard/step1_controller.js index 22456af..c137d96 100644 --- a/ambari-web/app/controllers/wizard/step1_controller.js +++ b/ambari-web/app/controllers/wizard/step1_controller.js @@ -136,6 +136,8 @@ App.WizardStep1Controller = Em.Controller.extend({ */ selectedStackType: Em.computed.findBy('availableStackTypes', 'isSelected', true), + isLoadingComplete: Em.computed.equal('wizardController.loadStacksRequestsCounter', 0), + /** * Load selected file to current page content */ http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/routes/installer.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js index eae03a7..ec8f1b9 100644 --- a/ambari-web/app/routes/installer.js +++ b/ambari-web/app/routes/installer.js @@ -149,9 +149,11 @@ module.exports = Em.Route.extend(App.RouterRedirections, { connectOutlets: function (router) { console.time('step1 connectOutlets'); var self = this; - var controller = router.get('installerController'); + var controller = router.get('installerController'), + wizardStep1Controller = router.get('wizardStep1Controller'); controller.setCurrentStep('1'); controller.loadAllPriorSteps().done(function () { + wizardStep1Controller.set('wizardController', controller); controller.connectOutlet('wizardStep1', controller.get('content')); self.scrollTop(); console.timeEnd('step1 connectOutlets'); http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/templates/wizard/step1.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs index 5faf056..6b15e65 100644 --- a/ambari-web/app/templates/wizard/step1.hbs +++ b/ambari-web/app/templates/wizard/step1.hbs @@ -21,121 +21,136 @@ <div class="panel panel-default"> <div class="panel-body"> - {{! left tabs }} - <div class="tabs-menu"> - <ul class="nav nav-tabs" {{QAAttr "stack-tabs"}}> - {{#each stack in availableStackTypes}} - <li {{bindAttr class="stack.isSelected:active"}} {{QAAttr "stack-tab"}}><a {{QAAttr "stack-link-{stack.stackName}"}} {{action "selectRepoInList" stack target="controller"}} href="#">{{stack.stackName}}</a></li> - {{/each}} - </ul> - </div> - <div class="stacks-options"> - <div class="details-panel"> - <div class="btn-group" {{QAAttr "select-version"}}> - <button type="button" data-toggle="dropdown" class="btn dropdown-toggle btn-default" {{QAAttr "select-version-button"}}>{{controller.selectedStack.displayName}} <span class="caret"></span></button> - <ul class="dropdown-menu"> - {{#each stack in selectedStackType.stacks}} - <li> - {{!view view.stackRadioButton stackBinding="stack"}} - <a href="#" {{action "changeVersion" stack target="controller"}} {{QAAttr "{stack.displayName}"}}>{{stack.displayName}} - {{#if stack.stackDefault}} - ({{t installer.step1.changeVersion.defaultVersion}}) - {{/if}} - </a> - </li> - {{/each}} - <li><a href="#" {{action "uploadVdf" target="controller"}} {{QAAttr "add-new-version"}}>{{t installer.step1.addVersion}} ...</a></li> - </ul> - </div> - <div class="version-contents-section"> - {{#unless servicesForSelectedStack}} - <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div> - {{/unless}} - <table class="table table-hover"> - <tbody> + {{#if isLoadingComplete}} + {{! left tabs }} + <div class="tabs-menu"> + <ul class="nav nav-tabs" {{QAAttr "stack-tabs"}}> + {{#each stack in availableStackTypes}} + <li {{bindAttr class="stack.isSelected:active"}} {{QAAttr "stack-tab"}}> + <a {{QAAttr "stack-link-{stack.stackName}"}} {{action "selectRepoInList" stack target="controller"}} + href="#">{{stack.stackName}}</a></li> + {{/each}} + </ul> + </div> + <div class="stacks-options"> + <div class="details-panel"> + <div class="btn-group" {{QAAttr "select-version"}}> + <button type="button" data-toggle="dropdown" + class="btn dropdown-toggle btn-default" {{QAAttr "select-version-button"}}>{{controller.selectedStack.displayName}} + <span class="caret"></span></button> + <ul class="dropdown-menu"> + {{#each stack in selectedStackType.stacks}} + <li> + {{!view view.stackRadioButton stackBinding="stack"}} + <a + href="#" {{action "changeVersion" stack target="controller"}} {{QAAttr "{stack.displayName}"}}>{{stack.displayName}} + {{#if stack.stackDefault}} + ({{t installer.step1.changeVersion.defaultVersion}}) + {{/if}} + </a> + </li> + {{/each}} + <li><a + href="#" {{action "uploadVdf" target="controller"}} {{QAAttr "add-new-version"}}>{{t installer.step1.addVersion}} + ...</a></li> + </ul> + </div> + <div class="version-contents-section"> + {{#unless servicesForSelectedStack}} + <div class="alert alert-info" + role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div> + {{/unless}} + <table class="table table-hover"> + <tbody> {{#each service in servicesForSelectedStack}} <tr> <td class="col-md-4">{{service.displayName}}</td> <td class="col-md-8">{{service.latestVersion}}</td> </tr> {{/each}} - </tbody> - </table> + </tbody> + </table> + </div> </div> </div> - </div> - {{! left tabs end }} + {{! left tabs end }} - {{#if App.router.nextBtnClickInProgress}} - {{view App.SpinnerView}} - {{else}} - <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate> + {{#if App.router.nextBtnClickInProgress}} + {{view App.SpinnerView}} + {{else}} + <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate> - <div class="panel panel-default repos-panel"> - <div class="step-title"> - <p>{{t common.repositories}}</p> - </div> - <p class="step-description">{{t installer.step1.repo.body}}</p> - <div class="panel-body version-contents-body"> - <div class="row radio-group"> - {{! Public Repository radio }} - <div {{bindAttr class=":col-sm-4 :radio :big-radio :public-radio :wizard-plain-text"}}> - {{view view.usePublicRepoRadioButton classNames="display-inline-block" labelIdentifier="use-public-repo"}} - {{#if stackRepoUpdateLinkExists}} - {{#if networkIssuesExist}} - <a id="public-disabled-link" class="display-inline-block" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a> - {{/if}} - {{/if}} + <div class="panel panel-default repos-panel"> + <div class="step-title"> + <p>{{t common.repositories}}</p> </div> - {{!--Local repo radio--}} - {{view view.useLocalRepoRadioButton classNames="radio big-radio col-sm-4" labelIdentifier="use-local-repo"}} - </div> - <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div> - {{#if view.showWarning}} - <div class="alert alert-warning" {{QAAttr "step1-warning"}}>{{t installer.step1.attentionNeeded}}</div> - {{/if}} + <p class="step-description">{{t installer.step1.repo.body}}</p> + <div class="panel-body version-contents-body"> + <div class="row radio-group"> + {{! Public Repository radio }} + <div {{bindAttr class=":col-sm-4 :radio :big-radio :public-radio :wizard-plain-text"}}> + {{view view.usePublicRepoRadioButton classNames="display-inline-block" labelIdentifier="use-public-repo"}} + {{#if stackRepoUpdateLinkExists}} + {{#if networkIssuesExist}} + <a id="public-disabled-link" + class="display-inline-block" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a> + {{/if}} + {{/if}} + </div> + {{!--Local repo radio--}} + {{view view.useLocalRepoRadioButton classNames="radio big-radio col-sm-4" labelIdentifier="use-local-repo"}} + </div> + <div class="alert alert-info" + role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div> + {{#if view.showWarning}} + <div + class="alert alert-warning" {{QAAttr "step1-warning"}}>{{t installer.step1.attentionNeeded}}</div> + {{/if}} - {{! OSes and Repositories }} - <div class="row"> - <div class="table-controls row col-sm-12 pull-right"> - <div class="col-sm-12"> - {{! Add OS }} - <div class="btn-group pull-right"> - <button - type="button" {{bindAttr data-original-title="view.addOsButtonTooltip" class=":btn :btn-default :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}} - {{QAAttr "add-os-button"}} - data-toggle="dropdown"> - <i class="glyphicon glyphicon-plus"></i> {{t common.add}} <span class="caret"></span> - </button> - <ul class="dropdown-menu"> - {{#each operatingSystem in selectedStack.operatingSystems}} - {{#unless operatingSystem.isSelected}} - <li><a {{action "addOS" operatingSystem target="controller"}} {{QAAttr "add-os-{operatingSystem.osType}"}}>{{operatingSystem.osType}}</a></li> - {{/unless}} - {{/each}} - </ul> + {{! OSes and Repositories }} + <div class="row"> + <div class="table-controls row col-sm-12 pull-right"> + <div class="col-sm-12"> + {{! Add OS }} + <div class="btn-group pull-right"> + <button + type="button" {{bindAttr data-original-title="view.addOsButtonTooltip" class=":btn :btn-default :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}} + {{QAAttr "add-os-button"}} + data-toggle="dropdown"> + <i class="glyphicon glyphicon-plus"></i> {{t common.add}} <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + {{#each operatingSystem in selectedStack.operatingSystems}} + {{#unless operatingSystem.isSelected}} + <li> + <a {{action "addOS" operatingSystem target="controller"}} {{QAAttr "add-os-{operatingSystem.osType}"}}>{{operatingSystem.osType}}</a> + </li> + {{/unless}} + {{/each}} + </ul> + </div> + {{! Add OS END}} + </div> </div> - {{! Add OS END}} </div> - </div> - </div> - <table class="table table-hover"> - <thead> - <tr> - <th class="col-sm-2">{{t common.os}}</th> - <th class="col-sm-3">{{t common.name}}</th> - <th class="col-sm-6">{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</th> - <th class="col-sm-1"></th> - </tr> - </thead> - <tbody> - {{#each operatingSystem in selectedStack.operatingSystems}} - {{#if operatingSystem.isSelected}} - <tr {{QAAttr "os-wrapper"}}> - <td class="col-sm-2" {{QAAttr "os-type-label"}}>{{operatingSystem.osType}}</td> - <td class="col-sm-9" colspan="2"> - <table class="table table-condensed no-borders inner-table" {{QAAttr "{operatingSystem.osType}"}}> - <tbody> + <table class="table table-hover"> + <thead> + <tr> + <th class="col-sm-2">{{t common.os}}</th> + <th class="col-sm-3">{{t common.name}}</th> + <th class="col-sm-6">{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</th> + <th class="col-sm-1"></th> + </tr> + </thead> + <tbody> + {{#each operatingSystem in selectedStack.operatingSystems}} + {{#if operatingSystem.isSelected}} + <tr {{QAAttr "os-wrapper"}}> + <td class="col-sm-2" {{QAAttr "os-type-label"}}>{{operatingSystem.osType}}</td> + <td class="col-sm-9" colspan="2"> + <table + class="table table-condensed no-borders inner-table" {{QAAttr "{operatingSystem.osType}"}}> + <tbody> {{#each repository in operatingSystem.repositories}} <tr {{QAAttr "{repository.repoName}"}}> <td class="col-sm-3">{{repository.repoId}}</td> @@ -161,63 +176,68 @@ </div> </td> </tr> - {{/each}} - </tbody> - </table> - </td> - <td class="col-sm-1"> - <a class="action remove-icon" href="#" {{action "removeOS" operatingSystem target="view"}} {{QAAttr "remove-icon"}}> - <span class="icon icon-minus"></span> + {{/each}} + </tbody> + </table> + </td> + <td class="col-sm-1"> + <a class="action remove-icon" + href="#" {{action "removeOS" operatingSystem target="view"}} {{QAAttr "remove-icon"}}> + <span class="icon icon-minus"></span> {{t common.remove}} - </a> - </td> - </tr> - {{/if}} - {{/each}} - </tbody> - </table> - {{! OSes and Repositories END }} + </a> + </td> + </tr> + {{/if}} + {{/each}} + </tbody> + </table> + {{! OSes and Repositories END }} - {{! Skip Repository Base URL validation }} - <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}> - {{#view App.CheckboxView - labelTranslate="installer.step1.advancedRepo.skipValidation.message" - labelClassNamesBinding="controller.selectedStack.useRedhatSatellite:disabled" - checkedBinding="skipValidationChecked" - disabledBinding="controller.selectedStack.useRedhatSatellite" - labelIdentifier="skip-validation" - }} - <i class="glyphicon glyphicon-question-sign" rel="skip-validation-tooltip" - data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.skipValidation.tooltip"}}> - </i> - {{/view}} - <div class="clearfix"></div> - </div> - {{! Skip Repository Base URL validation END }} + {{! Skip Repository Base URL validation }} + <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}> + {{#view App.CheckboxView + labelTranslate="installer.step1.advancedRepo.skipValidation.message" + labelClassNamesBinding="controller.selectedStack.useRedhatSatellite:disabled" + checkedBinding="skipValidationChecked" + disabledBinding="controller.selectedStack.useRedhatSatellite" + labelIdentifier="skip-validation" + }} + <i class="glyphicon glyphicon-question-sign" rel="skip-validation-tooltip" + data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.skipValidation.tooltip"}}> + </i> + {{/view}} + <div class="clearfix"></div> + </div> + {{! Skip Repository Base URL validation END }} - {{! Use RedHat Satellite/Spacewalk }} - <div id="use-redhat" class="checkbox"> - {{#view view.redhatCheckBoxView - classNames="use-redhat-checkbox" - }} - <label {{bindAttr for="view.checkboxId" class=":redhat-label :display-inline-block controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}> - {{t installer.step1.advancedRepo.useRedhatSatellite.message}} - </label> - <i class="glyphicon glyphicon-question-sign" rel="use-redhat-tooltip" - data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}> - </i> - {{/view}} + {{! Use RedHat Satellite/Spacewalk }} + <div id="use-redhat" class="checkbox"> + {{#view view.redhatCheckBoxView + classNames="use-redhat-checkbox" + }} + <label {{bindAttr for="view.checkboxId" class=":redhat-label :display-inline-block controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}> + {{t installer.step1.advancedRepo.useRedhatSatellite.message}} + </label> + <i class="glyphicon glyphicon-question-sign" rel="use-redhat-tooltip" + data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}> + </i> + {{/view}} + </div> + {{! Use RedHat Satellite/Spacewalk END }} + </div> </div> - {{! Use RedHat Satellite/Spacewalk END }} + </form> + {{/if}} + {{#if view.invalidUrlExist}} + <div class="alert alert-warning"> + {{t installer.step1.invalidURLAttention}} + <a + href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a> </div> - </div> - </form> - {{/if}} - {{#if view.invalidUrlExist}} - <div class="alert alert-warning"> - {{t installer.step1.invalidURLAttention}} - <a href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a> - </div> + {{/if}} + {{else}} + {{view App.SpinnerView}} {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/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 9ab4fde..a12c0c7 100644 --- a/ambari-web/app/views/wizard/step1_view.js +++ b/ambari-web/app/views/wizard/step1_view.js @@ -80,7 +80,7 @@ App.WizardStep1View = Em.View.extend({ * * @type {bool} */ - isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress'), + isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete'), /** * Show warning message flag http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/test/controllers/wizard/step1_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step1_test.js b/ambari-web/test/controllers/wizard/step1_test.js index 296fe50..88cb231 100644 --- a/ambari-web/test/controllers/wizard/step1_test.js +++ b/ambari-web/test/controllers/wizard/step1_test.js @@ -76,6 +76,8 @@ describe('App.WizardStep1Controller', function () { App.TestAliases.testAsComputedEveryBy(getController(), 'networkIssuesExist', 'content.stacks', 'stackDefault', true); + App.TestAliases.testAsComputedEqual(getController(), 'isLoadingComplete', 'wizardController.loadStacksRequestsCounter', 0); + describe('#usePublicRepo', function () { beforeEach(function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/test/views/wizard/step1_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js index edf8e0c..12ce412 100644 --- a/ambari-web/test/views/wizard/step1_view_test.js +++ b/ambari-web/test/views/wizard/step1_view_test.js @@ -35,7 +35,7 @@ describe('App.WizardStep1View', function () { App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'controller.selectedStack.operatingSystems', 'isSelected', false); - App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress']); + App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete']); App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', 'INVALID');