Browse Source

AMBARI-1540. Reassign Master Wizard - Steps 3 and 4 (reconfigure component and review). (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1451739 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
e0a9a13816

+ 3 - 0
CHANGES.txt

@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
 
  NEW FEATURES
  NEW FEATURES
 
 
+ AMBARI-1540. Reassign Master Wizard - Steps 3 and 4 (reconfigure
+ component and review). (yusaku)
+
  AMBARI-1538. Stack Upgrade Wizard - Step 3 (Progress and Retry). (yusaku) 
  AMBARI-1538. Stack Upgrade Wizard - Step 3 (Progress and Retry). (yusaku) 
 
 
  AMBARI-1509. Frontend: For service configurations provide ability to 
  AMBARI-1509. Frontend: For service configurations provide ability to 

+ 2 - 0
ambari-web/app/controllers.js

@@ -80,6 +80,8 @@ require('controllers/wizard/step8_controller');
 require('controllers/wizard/step9_controller');
 require('controllers/wizard/step9_controller');
 require('controllers/wizard/step10_controller');
 require('controllers/wizard/step10_controller');
 require('controllers/wizard/step11_controller');
 require('controllers/wizard/step11_controller');
+require('controllers/wizard/step12_controller');
+require('controllers/wizard/step13_controller');
 require('controllers/wizard/stack_upgrade/step1_controller');
 require('controllers/wizard/stack_upgrade/step1_controller');
 require('controllers/wizard/stack_upgrade/step2_controller');
 require('controllers/wizard/stack_upgrade/step2_controller');
 require('controllers/wizard/stack_upgrade/step3_controller');
 require('controllers/wizard/stack_upgrade/step3_controller');

+ 58 - 2
ambari-web/app/controllers/main/service/reassign_controller.js

@@ -143,8 +143,27 @@ App.ReassignMasterController = App.WizardController.extend({
     }
     }
     this.set("content.masterComponentHosts", masterComponentHosts);
     this.set("content.masterComponentHosts", masterComponentHosts);
     console.log("ReassignMasterController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
     console.log("ReassignMasterController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
+  },
+
+  /**
+   * Save Master Component Hosts data to Main Controller
+   * @param stepController App.WizardStep5Controller
+   */
+  saveMasterComponentHosts: function (stepController) {
+    var obj = stepController.get('selectedServicesMasters');
 
 
-    this.set('content.missMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
+    var masterComponentHosts = [];
+    obj.forEach(function (_component) {
+      masterComponentHosts.push({
+        display_name: _component.get('display_name'),
+        component: _component.get('component_name'),
+        hostName: _component.get('selectedHost'),
+        serviceId: _component.get('serviceId'),
+        isInstalled: true
+      });
+    });
+    App.db.setMasterComponentHosts(masterComponentHosts);
+    this.set('content.masterComponentHosts', masterComponentHosts);
   },
   },
 
 
   loadComponentToReassign: function () {
   loadComponentToReassign: function () {
@@ -155,7 +174,44 @@ App.ReassignMasterController = App.WizardController.extend({
   },
   },
 
 
   saveComponentToReassign: function (masterComponent) {
   saveComponentToReassign: function (masterComponent) {
-      App.db.setMasterToReassign(masterComponent);
+    var component = {
+      component_name: masterComponent.get('componentName'),
+      display_name: masterComponent.get('displayName'),
+      service_id: masterComponent.get('service.serviceName'),
+      host_id: masterComponent.get('host.hostName')
+    };
+    App.db.setMasterToReassign(component);
+  },
+
+  /**
+   * Save config properties
+   * @param stepController Step7WizardController
+   */
+  saveServiceConfigProperties: function (stepController) {
+    var serviceConfigProperties = [];
+    stepController.get('stepConfigs').forEach(function (_content) {
+      _content.get('configs').forEach(function (_configProperties) {
+        var displayType = _configProperties.get('displayType');
+        if (displayType === 'directories' || displayType === 'directory') {
+          var value = _configProperties.get('value').trim().split(/\s+/g).join(',');
+          _configProperties.set('value', value);
+        }
+        var configProperty = {
+          id: _configProperties.get('id'),
+          name: _configProperties.get('name'),
+          value: _configProperties.get('value'),
+          defaultValue: _configProperties.get('defaultValue'),
+          service: _configProperties.get('serviceName'),
+          domain:  _configProperties.get('domain'),
+          filename: _configProperties.get('filename')
+        };
+        serviceConfigProperties.push(configProperty);
+      }, this);
+
+    }, this);
+
+    App.db.setServiceConfigProperties(serviceConfigProperties);
+    this.set('content.serviceConfigProperties', serviceConfigProperties);
   },
   },
 
 
   /**
   /**

+ 60 - 0
ambari-web/app/controllers/wizard/step12_controller.js

@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+App.WizardStep12Controller = App.MainServiceInfoConfigsController.extend({
+
+  modifiedConfigs: [],
+
+  afterLoad: function () {
+    if (this.get('dataIsLoaded')) {
+      this.get('stepConfigs').objectAt(0).get('configs').filterProperty('isEditable', false).setEach('isEditable', true);
+      this.get('stepConfigs').objectAt(0).get('configs').filterProperty('displayType', 'masterHost').setEach('isVisible', false);
+    }
+  }.observes('dataIsLoaded'),
+
+  addHostNamesToGlobalConfig: function () {
+    var hostComponents = [];
+    this.get('content.masterComponentHosts').forEach(function (component) {
+      hostComponents.push(Ember.Object.create({
+        componentName: component.component,
+        host: {hostName: component.hostName}
+      }))
+    });
+    this.set('content.hostComponents', hostComponents);
+    this._super();
+  },
+
+  submit: function () {
+    if (this.get('isSubmitDisabled')) {
+      return false;
+    }
+    var self = this;
+    this.get('modifiedConfigs').clear();
+    this.get('stepConfigs').objectAt(0).get('configs').forEach(function (config) {
+      if (config.get('defaultValue') !== config.get('value')) {
+        self.get('modifiedConfigs').push({
+          name: config.get('displayName'),
+          oldValue: config.get('defaultValue'),
+          value: config.get('value'),
+          unit: config.get('unit') || false
+        });
+      }
+    });
+    App.router.send('next');
+  }
+});

+ 21 - 0
ambari-web/app/controllers/wizard/step13_controller.js

@@ -0,0 +1,21 @@
+/**
+ * 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.WizardStep13Controller = Em.Controller.extend()

+ 7 - 0
ambari-web/app/messages.js

@@ -397,6 +397,13 @@ Em.I18n.translations = {
   'installer.step10.installTime.seconds':'Install and start completed in {0} seconds',
   'installer.step10.installTime.seconds':'Install and start completed in {0} seconds',
   'installer.step10.installTime.minutes':'Install and start completed in {0} minutes and {1} seconds',
   'installer.step10.installTime.minutes':'Install and start completed in {0} minutes and {1} seconds',
   'installer.step11.header':'Prerequisites',
   'installer.step11.header':'Prerequisites',
+  'installer.step12.header':'Reconfigure',
+  'installer.step13.header':'Review',
+  'installer.step13.body':'Please review the changes you made',
+  'installer.step13.targetHost':'Target Host:',
+  'installer.step13.sourceHost':'Source Host:',
+  'installer.step13.changes':'Configs to change:',
+  'installer.step13.component':'Component name:',
 
 
   'installer.stackUpgrade.header':'Stack Upgrade Wizard',
   'installer.stackUpgrade.header':'Stack Upgrade Wizard',
   'installer.stackUpgrade.step1.newVersion':'New Version',
   'installer.stackUpgrade.step1.newVersion':'New Version',

+ 45 - 1
ambari-web/app/routes/reassign_master_routes.js

@@ -64,6 +64,7 @@ module.exports = Em.Route.extend({
       })
       })
     },
     },
     next: function (router) {
     next: function (router) {
+      App.db.setMasterComponentHosts(undefined);
       router.transitionTo('step2');
       router.transitionTo('step2');
     }
     }
   }),
   }),
@@ -81,10 +82,53 @@ module.exports = Em.Route.extend({
 
 
     },
     },
     back: Em.Router.transitionTo('step1'),
     back: Em.Router.transitionTo('step1'),
-    next: function () {
+    next: function (router) {
+      var controller = router.get('reassignMasterController');
+      var wizardStep5Controller = router.get('wizardStep5Controller');
+      controller.saveMasterComponentHosts(wizardStep5Controller);
+      router.transitionTo('step3');
+    }
+  }),
+
+  step3: Em.Route.extend({
+    route: '/step3',
+    connectOutlets: function (router) {
+      console.log('in reassignMaster.step3:connectOutlets');
+      var controller = router.get('reassignMasterController');
+      controller.setCurrentStep('3');
+      controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
+        controller.set('content.serviceName', controller.get('content.reassign.service_id'));
+        controller.connectOutlet('wizardStep12', controller.get('content'));
+      })
+    },
+    back: Em.Router.transitionTo('step2'),
+    next: function (router) {
+      var controller = router.get('reassignMasterController');
+      var wizardStep12Controller = router.get('wizardStep12Controller');
+      controller.set('content.modifiedConfigs', wizardStep12Controller.get('modifiedConfigs'));
+      controller.saveServiceConfigProperties(wizardStep12Controller);
+      router.transitionTo('step4');
+    }
+  }),
+
+  step4: Em.Route.extend({
+    route: '/step3',
+    connectOutlets: function (router) {
+      console.log('in reassignMaster.step4:connectOutlets');
+      var controller = router.get('reassignMasterController');
+      controller.setCurrentStep('4');
+      controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('wizardStep13', controller.get('content'));
+      })
+    },
+    back: Em.Router.transitionTo('step3'),
+    next: function (router) {
     }
     }
   }),
   }),
 
 
+
   gotoStep1: Em.Router.transitionTo('step1'),
   gotoStep1: Em.Router.transitionTo('step1'),
 
 
   gotoStep2: Em.Router.transitionTo('step2'),
   gotoStep2: Em.Router.transitionTo('step2'),

+ 2 - 0
ambari-web/app/templates/main/service/reassign.hbs

@@ -27,6 +27,8 @@
               <li class="nav-header">{{t services.reassign.header}}</li>
               <li class="nav-header">{{t services.reassign.header}}</li>
               <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep1 target="controller"}}>{{t installer.step11.header}}</a></li>
               <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep1 target="controller"}}>{{t installer.step11.header}}</a></li>
               <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep2 target="controller"}}>{{t installer.step5.reassign.header}}</a></li>
               <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep2 target="controller"}}>{{t installer.step5.reassign.header}}</a></li>
+              <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep3 target="controller"}}>{{t installer.step12.header}}</a></li>
+              <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep4 target="controller"}}>{{t installer.step8.header}}</a></li>
             </ul>
             </ul>
           </div>
           </div>
         </div>
         </div>

+ 35 - 0
ambari-web/app/templates/wizard/step12.hbs

@@ -0,0 +1,35 @@
+{{!
+* 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="serviceConfig">
+  <h2>{{t installer.step12.header}}</h2>
+
+  {{#if controller.dataIsLoaded}}
+    {{view App.ServiceConfigView}}
+  {{else}}
+    {{t app.loadingPlaceholder}}
+  {{/if}}
+
+  <div class="btn-area">
+    <a class="btn" {{action back}}>&larr; {{t common.back}}</a>
+
+    <a
+            class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
+            {{action submit target="controller"}}>{{t common.next}} &rarr;</a>
+  </div>
+</div>

+ 55 - 0
ambari-web/app/templates/wizard/step13.hbs

@@ -0,0 +1,55 @@
+{{!
+* 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.
+}}
+
+<h2>{{t installer.step13.header}}</h2>
+
+<div class="alert alert-info">
+  {{t installer.step13.body}}
+</div>
+
+<div id="step8-content" class="well pre-scrollable">
+  <div id="printReview">
+    <a class="btn btn-info pull-right" {{action printReview target="view"}}>{{t common.print}}</a> <br/>
+  </div>
+  <div id="step8-info">
+    <p><b>{{t installer.step13.component}}</b> {{controller.content.reassign.display_name}}</p>
+
+    <p><b>{{t installer.step13.sourceHost}}</b> {{view.sourceHost}}</p>
+
+    <p><b>{{t installer.step13.targetHost}}</b> {{view.targetHost}}</p>
+
+    {{#if view.changes}}<p><b>{{t installer.step13.changes}}</b></p>{{/if}}
+    {{#each item in view.changes}}
+    <div>
+      <ul><em> <b>{{item.name}}</b></em>
+
+        <div>
+          <ul>Old value: &nbsp;<span class="text text-info">{{item.oldValue}} {{#if item.unit}}{{item.unit}}{{/if}}</span></ul>
+          <ul>New value: <span class="text text-info">{{item.value}} {{#if item.unit}}{{item.unit}}{{/if}}</span></ul>
+        </div>
+
+      </ul>
+    </div>
+    {{/each}}
+  </div>
+</div>
+<div class="btn-area">
+  <a class="btn pull-left" {{action back href="true"}}>&larr; {{t common.back}}</a>
+  <a class="btn btn-success pull-right"
+     id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action next}}>{{t common.deploy}} &rarr;</a>
+</div>

+ 0 - 6
ambari-web/app/utils/db.js

@@ -230,12 +230,6 @@ App.db.setMasterToReassign = function (masterComponent) {
   localStorage.setObject('ambari', App.db.data);
   localStorage.setObject('ambari', App.db.data);
 };
 };
 
 
-App.db.setMasterToReassign = function (masterComponent) {
-  App.db.data = localStorage.getObject('ambari');
-  App.db.data.ReassignMaster.masterComponent = masterComponent;
-  localStorage.setObject('ambari', App.db.data);
-};
-
 /**
 /**
  * Set current step value for specified Wizard Type
  * Set current step value for specified Wizard Type
  * @param wizardType
  * @param wizardType

+ 2 - 0
ambari-web/app/views.js

@@ -131,6 +131,8 @@ require('views/wizard/step8_view');
 require('views/wizard/step9_view');
 require('views/wizard/step9_view');
 require('views/wizard/step10_view');
 require('views/wizard/step10_view');
 require('views/wizard/step11_view');
 require('views/wizard/step11_view');
+require('views/wizard/step12_view');
+require('views/wizard/step13_view');
 require('views/wizard/stack_upgrade/step1_view');
 require('views/wizard/stack_upgrade/step1_view');
 require('views/wizard/stack_upgrade/step2_view');
 require('views/wizard/stack_upgrade/step2_view');
 require('views/wizard/stack_upgrade/step3_view');
 require('views/wizard/stack_upgrade/step3_view');

+ 29 - 0
ambari-web/app/views/wizard/step12_view.js

@@ -0,0 +1,29 @@
+/**
+ * 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.WizardStep12View = Em.View.extend({
+
+  templateName: require('templates/wizard/step12'),
+  didInsertElement: function () {
+    this.get('controller').loadStep();
+  }
+
+});

+ 39 - 0
ambari-web/app/views/wizard/step13_view.js

@@ -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.
+ */
+
+
+var App = require('app');
+
+App.WizardStep13View = Em.View.extend({
+
+  templateName: require('templates/wizard/step13'),
+
+  changes: function () {
+    return this.get('controller.content.modifiedConfigs');
+  }.property('controller.content.modifiedConfigs'),
+  sourceHost: function () {
+    return this.get('controller.content.reassign.host_id')
+  }.property('controller.content.reassign.host_id'),
+  targetHost: function () {
+    return this.get('controller.content.masterComponentHosts').findProperty('component', this.get('controller.content.reassign.component_name')).hostName;
+  }.property('controller.content.masterComponentHosts'),
+
+  printReview: function() {
+    $("#step8-info").jqprint();
+  }
+});