فهرست منبع

AMBARI-11107 Remove conditionals for experimental flag on enhanced dashboard work. (atkach)

Andrii Tkach 10 سال پیش
والد
کامیت
868c6da5fa

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

@@ -71,7 +71,6 @@ App.supports = {
   customizeAgentUserAccount: false,
   installGanglia: false,
   opsDuringRollingUpgrade: false,
-  customizedWidgets: true,
   customizedWidgetLayout: false,
   enhancedConfigs: true
 };

+ 6 - 10
ambari-web/app/data/service_graph_config.js

@@ -98,16 +98,12 @@ module.exports = {
   },
 
   getServiceGraphConfig: function () {
-    if (App.get('supports.customizedWidgets')) {
-      var servicesWithEnhancedDashboard = ['hdfs', 'yarn', 'hbase'];
-      var newServiceObject = jQuery.extend(true, {}, this.allServices);
-      servicesWithEnhancedDashboard.forEach(function (_serviceName) {
-        newServiceObject[_serviceName] = [];
-      });
-      return newServiceObject;
-    } else {
-      return this.allServices;
-    }
+    var servicesWithEnhancedDashboard = ['hdfs', 'yarn', 'hbase'];
+    var newServiceObject = jQuery.extend(true, {}, this.allServices);
+    servicesWithEnhancedDashboard.forEach(function (_serviceName) {
+      newServiceObject[_serviceName] = [];
+    });
+    return newServiceObject;
   }
 
 };

+ 4 - 6
ambari-web/app/mixins/common/widgets/widget_section.js

@@ -78,7 +78,7 @@ App.WidgetSectionMixin = Ember.Mixin.create({
     } else if (this.get('sectionName') === 'SYSTEM_HEATMAPS') {
       isServiceWithWidgetdescriptor = true;
     }
-    return isServiceWithWidgetdescriptor && (App.supports.customizedWidgets || this.sectionNameSuffix === "_HEATMAPS");
+    return isServiceWithWidgetdescriptor;
   }.property('content.serviceName'),
 
   /**
@@ -90,13 +90,11 @@ App.WidgetSectionMixin = Ember.Mixin.create({
    * @type {Em.A}
    */
   widgets: function () {
-    if (this.get('isWidgetsLoaded')) {
-      if (this.get('activeWidgetLayout.widgets')) {
-        return this.get('activeWidgetLayout.widgets').toArray();
-      }
+    if (this.get('isWidgetsLoaded') && this.get('activeWidgetLayout.widgets')) {
+      return this.get('activeWidgetLayout.widgets').toArray();
     }
     return [];
-  }.property('isWidgetsLoaded'),
+  }.property('isWidgetsLoaded', 'activeWidgetLayout.widgets'),
 
 
   /**

+ 7 - 14
ambari-web/app/views/main/service/info/summary.js

@@ -308,20 +308,15 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
   constructGraphObjects: function(graphNames) {
     var result = [], graphObjects = [], chunkSize = this.get('chunkSize');
     var self = this;
+    var serviceName = this.get('controller.content.serviceName');
+    var stackService = App.StackService.find().findProperty('serviceName', serviceName);
 
-    if (App.get('supports.customizedWidgets')) {
-      var serviceName = this.get('controller.content.serviceName');
-      var stackService = App.StackService.find().findProperty('serviceName', serviceName);
-      if (!graphNames && !stackService.get('isServiceWithWidgets')) {
-        self.set('serviceMetricGraphs', []);
-        self.set('isServiceMetricLoaded', false);
-        return;
-      }
-    } else if (!graphNames) {
+    if (!graphNames && !stackService.get('isServiceWithWidgets')) {
       self.set('serviceMetricGraphs', []);
       self.set('isServiceMetricLoaded', false);
       return;
     }
+
     // load time range for current service from server
     self.getUserPref(self.get('persistKey')).complete(function () {
       var index = self.get('currentTimeRangeIndex');
@@ -530,11 +525,9 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     var svcName = this.get('service.serviceName');
     var isMetricsSupported = svcName != 'STORM' || App.get('isStormMetricsSupported');
 
-    if (App.get('supports.customizedWidgets')) {
-        this.get('controller').getActiveWidgetLayout();
-      if (App.get('supports.customizedWidgetLayout')) {
-        this.get('controller').loadWidgetLayouts();
-      }
+    this.get('controller').getActiveWidgetLayout();
+    if (App.get('supports.customizedWidgetLayout')) {
+      this.get('controller').loadWidgetLayouts();
     }
 
     if (svcName && isMetricsSupported) {

+ 5 - 3
ambari-web/test/views/main/service/info/summary_test.js

@@ -29,7 +29,8 @@ describe('App.MainServiceInfoSummaryView', function() {
         id: 'HDFS',
         serviceName: 'HDFS',
         hostComponents: []
-      })
+      }),
+      getActiveWidgetLayout: Em.K
     }),
     alertsController: Em.Object.create(),
     service: Em.Object.create()
@@ -163,17 +164,18 @@ describe('App.MainServiceInfoSummaryView', function() {
 
     beforeEach(function () {
       sinon.stub(view, 'constructGraphObjects', Em.K);
+      this.mock = sinon.stub(App, 'get');
     });
 
     afterEach(function () {
       view.constructGraphObjects.restore();
-      App.get.restore();
+      this.mock.restore();
     });
 
     cases.forEach(function (item) {
       it(item.title, function () {
         view.set('service.serviceName', item.serviceName);
-        sinon.stub(App, 'get').withArgs('isStormMetricsSupported').returns(item.isStormMetricsSupported);
+        this.mock.withArgs('isStormMetricsSupported').returns(item.isStormMetricsSupported);
         view.didInsertElement();
         expect(view.constructGraphObjects.calledOnce).to.equal(item.isConstructGraphObjectsCalled);
       });