Selaa lähdekoodia

AMBARI-8387. Alerts UI: Create definition details for 5 types of definitions. (akovalenko)

Aleksandr Kovalenko 10 vuotta sitten
vanhempi
commit
92f794eb3c

+ 4 - 0
ambari-web/app/mappers/stack_service_mapper.js

@@ -33,6 +33,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     stack_version: 'stack_version',
     is_selected: 'is_selected',
     is_installed: 'is_installed',
+    is_installable: 'is_installable',
     required_services: 'required_services',
     service_check_supported: 'service_check_supported',
     service_components_key: 'service_components',
@@ -90,6 +91,9 @@ App.stackServiceMapper = App.QuickDataMapper.create({
       }, this);
       stackService.stack_id = stackService.stack_name + '-' + stackService.stack_version;
       stackService.service_components = serviceComponents;
+      // @todo: replace with server response value after API implementation
+      stackService.is_installable = !['KERBEROS'].contains(stackService.service_name);
+      stackService.is_selected = stackService.is_installable;
       result.push(this.parseIt(stackService, this.get('config')));
     }, this);
     App.store.loadMany(this.get('component_model'), stackServiceComponents);

+ 3 - 2
ambari-web/app/models/stack_service.js

@@ -36,6 +36,7 @@ App.StackService = DS.Model.extend({
   stackVersion: DS.attr('string'),
   isSelected: DS.attr('boolean', {defaultValue: true}),
   isInstalled: DS.attr('boolean', {defaultValue: false}),
+  isInstallable: DS.attr('boolean', {defaultValue: true}),
   stack: DS.belongsTo('App.Stack'),
   serviceComponents: DS.hasMany('App.StackServiceComponent'),
   configs: DS.attr('array'),
@@ -78,8 +79,8 @@ App.StackService = DS.Model.extend({
 
   isHiddenOnSelectServicePage: function () {
     var hiddenServices = ['MAPREDUCE2'];
-    return hiddenServices.contains(this.get('serviceName'));
-  }.property('serviceName'),
+    return hiddenServices.contains(this.get('serviceName')) || !this.get('isInstallable');
+  }.property('serviceName', 'isInstallable'),
 
   // Is the service required for monitoring of other hadoop ecosystem services
   isMonitoringService: function () {

+ 1 - 1
ambari-web/app/routes/add_service_routes.js

@@ -103,7 +103,7 @@ module.exports = App.WizardRoute.extend({
       controller.set('hideBackButton', true);
       controller.dataLoading().done(function () {
         controller.loadAllPriorSteps();
-        controller.connectOutlet('wizardStep4', controller.get('content.services'));
+        controller.connectOutlet('wizardStep4', controller.get('content.services').filterProperty('isInstallable', true));
       })
     },
     next: function (router) {

+ 1 - 1
ambari-web/app/routes/installer.js

@@ -237,7 +237,7 @@ module.exports = Em.Route.extend({
       var controller = router.get('installerController');
       controller.setCurrentStep('4');
       controller.loadAllPriorSteps().done(function () {
-        controller.connectOutlet('wizardStep4', App.StackService.find());
+        controller.connectOutlet('wizardStep4', App.StackService.find().filterProperty('isInstallable', true));
       });
     },
     back: Em.Router.transitionTo('step3'),

+ 8 - 0
ambari-web/test/models/stack_service_test.js

@@ -109,10 +109,17 @@ describe('App.StackService', function () {
     var testCases = [
       {
         serviceName: 'HDFS',
+        isInstallable: true,
         result: false
       },
       {
         serviceName: 'MAPREDUCE2',
+        isInstallable: true,
+        result: true
+      },
+      {
+        serviceName: 'KERBEROS',
+        isInstallable: false,
         result: true
       }
     ];
@@ -120,6 +127,7 @@ describe('App.StackService', function () {
     testCases.forEach(function (test) {
       it('service name - ' + test.serviceName, function () {
         ss.set('serviceName', test.serviceName);
+        ss.set('isInstallable', test.isInstallable);
         ss.propertyDidChange('isHiddenOnSelectServicePage');
         expect(ss.get('isHiddenOnSelectServicePage')).to.equal(test.result);
       });

+ 2 - 2
ambari-web/test/views/common/custom_date_popup_test.js

@@ -54,8 +54,8 @@ describe('CustomDatePopup', function() {
       customDatePopup.set('customDateFormFields.startDate', '11/11/11');
       customDatePopup.set('customDateFormFields.endDate', '11/12/11');
       popup.onPrimary();
-      expect(context.get('actualValues.startTime')).to.be.equal(1320966000000);
-      expect(context.get('actualValues.endTime')).to.equal(1321052400000);
+      expect(context.get('actualValues.startTime')).to.equal(new Date('11/11/11 01:00 AM').getTime());
+      expect(context.get('actualValues.endTime')).to.equal(new Date('11/12/11 01:00 AM').getTime());
     });
   });
 });