Author: yusaku
Date: Fri Feb 22 08:05:50 2013
New Revision: 1448923
URL: http://svn.apache.org/r1448923
Log:
AMBARI-1468. Stack Upgrade Wizard - Step 1 (show services and versions).
(yusaku)
Added:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/
incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/step1_controller.js
incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js
incubator/ambari/trunk/ambari-web/app/templates/main/admin/stack_upgrade.hbs
incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/
incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/step1.hbs
incubator/ambari/trunk/ambari-web/app/views/main/admin/stack_upgrade.js
incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/
incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step1_view.js
Added:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js?rev=1448923&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
(added)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
Fri Feb 22 08:05:50 2013
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+
+var App = require('app');
+
+App.StackUpgradeController = App.WizardController.extend({
+ name: 'stackUpgradeController',
+
+ totalSteps: 3,
+
+ /**
+ * All wizards data will be stored in this variable
+ *
+ * cluster - cluster name
+ * upgradeOptions - upgrade options
+ */
+ content: Em.Object.create({
+ cluster: null,
+ upgradeOptions: null,
+ servicesInfo: function(){
+ return App.router.get('mainAdminClusterController.services');
+ }.property('App.router.mainAdminClusterController.services'),
+ upgradeVersion: function(){
+ return App.router.get('mainAdminClusterController.upgradeVersion');
+ }.property('App.router.mainAdminClusterController.upgradeVersion'),
+ controllerName: 'stackUpgradeController',
+ isWizard: true
+ }),
+
+ /**
+ * return new object extended from clusterStatusTemplate
+ * @return Object
+ */
+ getCluster: function(){
+ return jQuery.extend({}, this.get('clusterStatusTemplate'), {name:
App.get('ClusterName')});
+ },
+ /**
+ * Load data for all steps until <code>current step</code>
+ */
+ loadAllPriorSteps: function () {
+ this.load('cluster');
+ },
+
+ /**
+ * Finish upgrade
+ */
+ finish: function () {
+ this.setCurrentStep('1');
+ App.router.get('updateController').updateAll();
+ }
+});
Added:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/step1_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/step1_controller.js?rev=1448923&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/step1_controller.js
(added)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/stack_upgrade/step1_controller.js
Fri Feb 22 08:05:50 2013
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.StackUpgradeStep1Controller = Em.Controller.extend({
+ name: 'stackUpgradeStep1Controller'
+});
Added: incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js?rev=1448923&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js (added)
+++ incubator/ambari/trunk/ambari-web/app/routes/stack_upgrade.js Fri Feb 22
08:05:50 2013
@@ -0,0 +1,127 @@
+/**
+ * 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.
+ */
+
+module.exports = Em.Route.extend({
+ route: 'admin/cluster/upgrade',
+
+ enter: function (router) {
+ console.log('in /admin/cluster/upgrade:enter');
+ var self = this;
+ Ember.run.next(function () {
+ var stackUpgradeController = router.get('stackUpgradeController');
+ App.router.get('updateController').set('isWorking', false);
+ App.ModalPopup.show({
+ classNames: ['full-width-modal'],
+ header:Em.I18n.t('installer.stackUpgrade.header'),
+ bodyClass: App.StackUpgradeView.extend({
+ controllerBinding: 'App.router.stackUpgradeController'
+ }),
+ showFooter: false,
+ onClose: function() {
+ this.hide();
+ App.router.get('updateController').set('isWorking', true);
+ router.transitionTo('admin.adminCluster');
+ },
+ didInsertElement: function(){
+ this.fitHeight();
+ }
+ });
+
+
+ /* App.clusterStatus.updateFromServer();
+ var currentClusterStatus = App.clusterStatus.get('value');
+
+ if (currentClusterStatus) {
+ switch (currentClusterStatus.clusterState) {
+ case 'STACK_UPGRADING' :
+ case 'STACK_UPGRADED' :
+ stackUpgradeController.setCurrentStep('3');
+ App.db.data = currentClusterStatus.localdb;
+ break;
+ default:
+ break;
+ }
+ }*/
+
+ router.transitionTo('step' + stackUpgradeController.get('currentStep'));
+ });
+ },
+
+ step1: Em.Route.extend({
+ route: '/step1',
+ connectOutlets: function (router) {
+ console.log('in stackUpgrade.step1:connectOutlets');
+ var controller = router.get('stackUpgradeController');
+ controller.setCurrentStep('1');
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('stackUpgradeStep1', controller.get('content'));
+ },
+ next: function(router){
+ //Em.Router.transitionTo('step2');
+ }
+ }),
+
+ step2: Em.Route.extend({
+ route: '/step2',
+ connectOutlets: function (router) {
+ console.log('in stackUpgrade.step2:connectOutlets');
+ var controller = router.get('stackUpgradeController');
+ controller.setCurrentStep('2');
+ controller.connectOutlet('stackUpgradeStep2', controller.get('content'));
+ },
+ back: Em.Router.transitionTo('step1'),
+ next: function (router, context) {
+ router.transitionTo('step3');
+ }
+ }),
+
+ step3: Em.Route.extend({
+ route: '/step3',
+ connectOutlets: function (router, context) {
+ console.log('in stackUpgrade.step3:connectOutlets');
+ var controller = router.get('stackUpgradeController');
+ controller.setCurrentStep('3');
+ controller.setLowerStepsDisable(3);
+ controller.connectOutlet('stackUpgradeStep3', controller.get('content'));
+ },
+ back: Em.Router.transitionTo('step2'),
+ complete: function (router, context) {
+ App.router.get('updateController').set('isWorking', true);
+
$(context.currentTarget).parents("#modal").find(".close").trigger('click');
+
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ /* App.clusterStatus.setClusterStatus({
+ clusterName: this.get('clusterName'),
+ clusterState: 'STACK_UPGRADED',
+ wizardControllerName: App.router.get('stackUpgradeController.name'),
+ localdb: App.db.data
+ });*/
+
+ }
+ }),
+ backToCluster: function(router, context){
+ $(context.currentTarget).parents("#modal").find(".close").trigger('click');
+ },
+
+ gotoStep1: Em.Router.transitionTo('step1'),
+
+ gotoStep2: Em.Router.transitionTo('step2'),
+
+ gotoStep3: Em.Router.transitionTo('step3')
+
+});
Added:
incubator/ambari/trunk/ambari-web/app/templates/main/admin/stack_upgrade.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/admin/stack_upgrade.hbs?rev=1448923&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/admin/stack_upgrade.hbs
(added)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/admin/stack_upgrade.hbs
Fri Feb 22 08:05:50 2013
@@ -0,0 +1,39 @@
+{{!
+* 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.
+}}
+
+<div id="stack-upgrade">
+ <div class="container">
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span3">
+ <!--Sidebar content-->
+ <div class="well">
+ <ul class="nav nav-pills nav-stacked">
+ <li {{bindAttr class="isStep1:active
view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action
gotoStep1 target="controller"}}>{{t common.start}}</a></li>
+ <li {{bindAttr class="isStep2:active
view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action
gotoStep2 target="controller"}}>{{t common.confirm}}</a></li>
+ <li {{bindAttr class="isStep3:active
view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action
gotoStep3 target="controller"}}>{{t common.upgrade}}</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="content well span9">
+ {{outlet}}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
Added:
incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/step1.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/step1.hbs?rev=1448923&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/step1.hbs
(added)
+++
incubator/ambari/trunk/ambari-web/app/templates/wizard/stack_upgrade/step1.hbs
Fri Feb 22 08:05:50 2013
@@ -0,0 +1,59 @@
+{{!
+* 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.
+}}
+
+<div class="box alert-info">
+ <div>
+ {{t installer.stackUpgrade.step1.description}}
+ </div>
+ <br/>
+ <div>
+ <div>{{t installer.stackUpgrade.step1.installedStackVersion}}:
{{App.currentStackVersion}}</div>
+ <div>{{t installer.stackUpgrade.step1.upgradeStackVersion}}:
{{content.upgradeVersion}}</div>
+ </div>
+</div>
+<div>
+ <table class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th>{{t common.service}}</th>
+ <th>{{t installer.stackUpgrade.step1.installedVersion}}</th>
+ <th>{{t installer.stackUpgrade.step1.newVersion}}</th>
+ <th>{{t common.description}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each service in content.servicesInfo}}
+ {{#unless service.isHidden}}
+ <tr>
+ <td>{{service.displayName}}</td>
+ <td>{{service.version}}</td>
+ <td>{{service.newVersion}}</td>
+ <td>{{service.description}}</td>
+ </tr>
+ {{/unless}}
+ {{/each}}
+ </tbody>
+ </table>
+</div>
+<div class="btn-area">
+ <a class="btn pull-left" {{action backToCluster}}>{{t common.cancel}}</a>
+ <a class="btn btn-success pull-right" {{action next}}>{{t common.next}}</a>
+</div>
+
+
+
Added: incubator/ambari/trunk/ambari-web/app/views/main/admin/stack_upgrade.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/admin/stack_upgrade.js?rev=1448923&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/admin/stack_upgrade.js
(added)
+++ incubator/ambari/trunk/ambari-web/app/views/main/admin/stack_upgrade.js Fri
Feb 22 08:05:50 2013
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+
+var App = require('app');
+
+App.StackUpgradeView = Em.View.extend({
+ templateName: require('templates/main/admin/stack_upgrade'),
+
+ isStep1Disabled: function () {
+ return this.isStepDisabled(1);
+ }.property('[email protected]').cacheable(),
+
+ isStep2Disabled: function () {
+ return this.isStepDisabled(2);
+ }.property('[email protected]').cacheable(),
+
+ isStep3Disabled: function () {
+ return this.isStepDisabled(3);
+ }.property('[email protected]').cacheable(),
+
+ isStepDisabled: function (index) {
+ return this.get('controller.isStepDisabled').findProperty('step',
index).get('value');
+ }
+});
Added:
incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step1_view.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step1_view.js?rev=1448923&view=auto
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step1_view.js
(added)
+++
incubator/ambari/trunk/ambari-web/app/views/wizard/stack_upgrade/step1_view.js
Fri Feb 22 08:05:50 2013
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+
+var App = require('app');
+
+App.StackUpgradeStep1View = Em.View.extend({
+ templateName: require('templates/wizard/stack_upgrade/step1')
+});