Browse Source

AMBARI-9969. Complete button to be enabled even if Start Services fails in Move Master,Disable Security and Enable HA wizard (alexantonenko)

Alex Antonenko 10 years ago
parent
commit
0ae9158965

+ 1 - 0
ambari-web/app/assets/test/tests.js

@@ -139,6 +139,7 @@ var files = ['test/init_model_test',
   'test/mixins/wizard/addSeccurityConfigs_test',
   'test/mixins/wizard/wizard_menu_view_test',
   'test/mixins/wizard/wizardProgressPageController_test',
+  'test/mixins/wizard/wizardEnableDone_test',
   'test/utils/ajax/ajax_test',
   'test/utils/ajax/ajax_queue_test',
   'test/utils/batch_scheduled_requests_test',

+ 1 - 1
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js

@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageController.extend({
+App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
 
   name:"highAvailabilityWizardStep9Controller",
 

+ 1 - 1
ambari-web/app/controllers/main/admin/kerberos/disable_controller.js

@@ -20,7 +20,7 @@ var App = require('app');
 require('controllers/main/admin/kerberos/progress_controller');
 require('controllers/main/admin/security/security_progress_controller');
 
-App.KerberosDisableController = App.KerberosProgressPageController.extend({
+App.KerberosDisableController = App.KerberosProgressPageController.extend(App.WizardEnableDone, {
 
   name: 'kerberosDisableController',
   clusterDeployState: 'DEFAULT',

+ 1 - 1
ambari-web/app/controllers/main/service/reassign/step6_controller.js

@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageController.extend({
+App.ReassignMasterWizardStep6Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
 
   isReassign: true,
 

+ 1 - 0
ambari-web/app/mixins.js

@@ -31,6 +31,7 @@ require('mixins/wizard/wizardProgressPageController');
 require('mixins/wizard/wizardDeployProgressController');
 require('mixins/wizard/wizardProgressPageView');
 require('mixins/wizard/wizardDeployProgressView');
+require('mixins/wizard/wizardEnableDone');
 require('mixins/wizard/selectHost');
 require('mixins/wizard/addSecurityConfigs');
 require('mixins/wizard/wizard_menu_view');

+ 35 - 0
ambari-web/app/mixins/wizard/wizardEnableDone.js

@@ -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.
+ */
+
+var App = require('app');
+
+/**
+ * Mixin for wizard controller for enabling done/complete buttons if last task fails
+ * This should
+ * @type {Ember.Mixin}
+ */
+App.WizardEnableDone = Em.Mixin.create({
+  statusChangeCallback: function (data) {
+    this._super(data);
+    if (this.get('tasks.lastObject.id') === this.get('currentTaskId')) {
+      if (this.get('tasks.lastObject.status') === 'FAILED') {
+        this.set('isSubmitDisabled', false);
+      }
+    }
+  }
+});

+ 39 - 0
ambari-web/test/mixins/wizard/wizardEnableDone_test.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');
+
+describe('App.WizardEnableDone', function () {
+  var baseObject = Em.Object.extend({
+        statusChangeCallback: function (data) {
+          isSubmitDisabled: true
+        }
+      }),
+      mixedObject = baseObject.extend(App.WizardEnableDone);
+  beforeEach(function () {
+    mixedObjectInstance = mixedObject.create({
+      tasks: [{id: 77, status: 'FAILED'}],
+      currentTaskId: 77
+    });
+  });
+
+  it('#statusChangeCallback should enable done/complete button', function () {
+    mixedObjectInstance.statusChangeCallback();
+    expect(mixedObjectInstance.isSubmitDisabled).to.be.false;
+  });
+});