ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject [1/2] ambari git commit: AMBARI-10547. Integrate displaying defined Number widget type from the API on service summary page. (jaimin)
Date Thu, 16 Apr 2015 20:15:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c7e310d62 -> 6dae33e54


http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/mixins/common/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widget_mixin.js b/ambari-web/app/mixins/common/widget_mixin.js
index 48fbf8f..7667bf4 100644
--- a/ambari-web/app/mixins/common/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widget_mixin.js
@@ -24,13 +24,13 @@ App.WidgetMixin = Ember.Mixin.create({
    * @type {RegExp}
    * @const
    */
-  EXPRESSION_REGEX: /\$\{([\w\.\+\-\*\/\(\)\:\=\[\]]*)\}/g,
+  EXPRESSION_REGEX: /\$\{([\w\s\.\,\+\-\*\/\(\)\:\=\[\]]*)\}/g,
 
   /**
    * @type {RegExp}
    * @const
    */
-  MATH_EXPRESSION_REGEX: /^[\d\+\-\*\/\(\)\.]+$/,
+  MATH_EXPRESSION_REGEX: /^[\d\s\+\-\*\/\(\)\.]+$/,
 
   /**
    * @type {RegExp}
@@ -59,36 +59,15 @@ App.WidgetMixin = Ember.Mixin.create({
     this.loadMetrics();
   },
 
-  /**
-   * draw widget
-   */
-  drawWidget: function () {
-    if (this.get('isLoaded')) {
-      this.calculateValues();
-      this.set('value', this.get('content.values')[0] && this.get('content.values')[0].computedValue);
-    }
-  },
-
-  /**
-   * callback on metrics loaded
-   */
-  onMetricsLoaded: function () {
-    var self = this;
-    this.set('isLoaded', true);
-    this.drawWidget();
-    setTimeout(function() {
-      self.loadMetrics();
-    }, App.contentUpdateInterval);
-  },
 
   /**
    * load metrics
    */
   loadMetrics: function () {
     var requestData = this.getRequestData(this.get('content.metrics')),
-        request,
-        requestCounter = 0,
-        self = this;
+      request,
+      requestCounter = 0,
+      self = this;
 
     for (var i in requestData) {
       request = requestData[i];
@@ -108,23 +87,106 @@ App.WidgetMixin = Ember.Mixin.create({
   },
 
   /**
-   * extract expressions
-   * Example:
-   *  input: "${a/b} equal ${b+a}"
-   *  expressions: ['a/b', 'b+a']
-   *
-   * @param {object} input
-   * @returns {Array}
+   * get data formatted for request
+   * @param {Array} metrics
    */
-  extractExpressions: function (input) {
-    var pattern = this.get('EXPRESSION_REGEX'),
-      expressions = [],
-      match;
+  getRequestData: function (metrics) {
+    var requestsData = {};
 
-    while (match = pattern.exec(input.value)) {
-      expressions.push(match[1]);
+    metrics.forEach(function (metric, index) {
+      var key;
+      if (metric.host_component_criteria) {
+        key = metric.service_name + '_' + metric.component_name + '_' + metric.host_component_criteria;
+      } else {
+        key = metric.service_name + '_' + metric.component_name;
+      }
+      var requestMetric = $.extend({}, metric);
+
+      if (requestsData[key]) {
+        requestsData[key]["metric_paths"].push(requestMetric["metric_path"]);
+      } else {
+        requestMetric["metric_paths"] = [requestMetric["metric_path"]];
+        delete requestMetric["metric_path"];
+        requestsData[key] = requestMetric;
+      }
+    }, this);
+    return requestsData;
+  },
+
+  /**
+   * make GET call to server in order to fetch service-component metrics
+   * @param {object} request
+   * @returns {$.ajax}
+   */
+  getServiceComponentMetrics: function (request) {
+    return App.ajax.send({
+      name: 'widgets.serviceComponent.metrics.get',
+      sender: this,
+      data: {
+        serviceName: request.service_name,
+        componentName: request.component_name,
+        metricPaths: request.metric_paths.join(',')
+      },
+      success: 'getMetricsSuccessCallback'
+    });
+  },
+
+  /**
+   * make GET call to server in order to fetch host-component metrics
+   * @param {object} request
+   * @returns {$.ajax}
+   */
+  getHostComponentMetrics: function (request) {
+    return App.ajax.send({
+      name: 'widgets.hostComponent.metrics.get',
+      sender: this,
+      data: {
+        serviceName: request.service_name,
+        componentName: request.component_name,
+        metricPaths: request.metric_paths.join(','),
+        hostComponentCriteria: 'host_components/HostRoles/' + request.host_component_criteria
+      },
+      success: 'getMetricsSuccessCallback'
+    });
+  },
+
+  /**
+   * callback on getting aggregated metrics and host component metrics
+   * @param data
+   */
+  getMetricsSuccessCallback: function (data) {
+    var metrics = [];
+
+    this.get('content.metrics').forEach(function (_metric) {
+      if (!Em.isNone(Em.get(data, _metric.metric_path.replace(/\//g, '.')))) {
+        _metric.data = Em.get(data, _metric.metric_path.replace(/\//g, '.'));
+        this.get('metrics').pushObject(_metric);
+      }
+    }, this);
+  },
+
+
+  /**
+   * callback on metrics loaded
+   */
+  onMetricsLoaded: function () {
+    var self = this;
+    this.set('isLoaded', true);
+    this.drawWidget();
+    setTimeout(function() {
+      self.loadMetrics();
+    }, App.contentUpdateInterval);
+  },
+
+
+  /**
+   * draw widget
+   */
+  drawWidget: function () {
+    if (this.get('isLoaded')) {
+      this.calculateValues();
+      this.set('value', this.get('content.values')[0] && this.get('content.values')[0].computedValue);
     }
-    return expressions;
   },
 
   /**
@@ -142,6 +204,28 @@ App.WidgetMixin = Ember.Mixin.create({
     }, this);
   },
 
+
+  /**
+   * extract expressions
+   * Example:
+   *  input: "${a/b} equal ${b+a}"
+   *  expressions: ['a/b', 'b+a']
+   *
+   * @param {object} input
+   * @returns {Array}
+   */
+  extractExpressions: function (input) {
+    var pattern = this.get('EXPRESSION_REGEX'),
+      expressions = [],
+      match;
+
+    while (match = pattern.exec(input.value)) {
+      expressions.push(match[1]);
+    }
+    return expressions;
+  },
+
+
   /**
    * compute expression
    * @param expressions
@@ -176,80 +260,6 @@ App.WidgetMixin = Ember.Mixin.create({
     return result;
   },
 
-  /**
-   * get data formatted for request
-   * @param {Array} metrics
-   */
-  getRequestData: function (metrics) {
-    var requestsData = {};
-
-    metrics.forEach(function (metric) {
-      var key = metric.service_name + '_' + metric.component_name + '_' + metric.host_component_criteria;
-      var requestMetric = $.extend({}, metric);
-
-      if (requestsData[key]) {
-        requestsData[key]["widget_ids"].push(requestMetric["widget_id"]);
-      } else {
-        requestMetric["widget_ids"] = [requestMetric["widget_id"]];
-        delete requestMetric["widget_id"];
-        requestsData[key] = requestMetric;
-      }
-    }, this);
-    return requestsData;
-  },
-
-  /**
-   * make GET call to server in order to fetch service-component metrics
-   * @param {object} request
-   * @returns {$.ajax}
-   */
-  getServiceComponentMetrics: function (request) {
-    return App.ajax.send({
-      name: 'widgets.serviceComponent.metrics.get',
-      sender: this,
-      data: {
-        serviceName: request.service_name,
-        componentName: request.component_name,
-        widgetIds: request.widget_ids.join(',')
-      },
-      success: 'getServiceComponentMetricsSuccessCallback'
-    });
-  },
-
-  getServiceComponentMetricsSuccessCallback: function (data, opt, params) {
-    var metrics = [];
-
-    this.get('content.metrics').forEach(function (_metric) {
-      if (!Em.isNone(Em.get(data, _metric.widget_id.replace(/\//g, '.')))) {
-        _metric.data = Em.get(data, _metric.widget_id.replace(/\//g, '.'));
-        this.get('metrics').pushObject(_metric);
-      }
-    }, this);
-  },
-
-  /**
-   * make GET call to server in order to fetch host-component metrics
-   * @param {object} request
-   * @returns {$.ajax}
-   */
-  getHostComponentMetrics: function (request) {
-    return App.ajax.send({
-      name: 'widgets.hostComponent.metrics.get',
-      sender: this,
-      data: {
-        serviceName: request.service_name,
-        componentName: request.component_name,
-        widgetIds: request.widget_ids.join(','),
-        hostComponentCriteria: 'host_components/HostRoles/' + request.host_component_criteria
-      },
-      success: 'getHostComponentMetricsSuccessCallback'
-    });
-  },
-
-  getHostComponentMetricsSuccessCallback: function () {
-    //TODO push data to metrics after response structure approved
-  },
-
   /*
    * make call when clicking on "remove icon" on widget
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/models/widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/widget.js b/ambari-web/app/models/widget.js
index 6147bf5..99c86d0 100644
--- a/ambari-web/app/models/widget.js
+++ b/ambari-web/app/models/widget.js
@@ -32,17 +32,17 @@ App.Widget = DS.Model.extend({
    */
   widgetType: DS.attr('string'),
   displayName: DS.attr('string'),
+  description: DS.attr('string'),
   serviceName: DS.attr('string'),
-  componentName: DS.attr('string'),
   timeCreated: DS.attr('number'),
   sectionName: DS.attr('string'),
   author: DS.attr('string'),
+  scope: DS.attr('string'),
   properties: DS.attr('object'),
   expression: DS.attr('array'),
   metrics: DS.attr('array'),
   values: DS.attr('array'),
-  isVisible: DS.attr('boolean'),
-
+  isVisible: DS.attr('boolean', {defaultValue: true}),
   /**
    * @type {number}
    * @default 0
@@ -69,6 +69,8 @@ App.Widget = DS.Model.extend({
   }.property('widgetType')
 });
 
+App.Widget.FIXTURES = [];
+
 App.WidgetType = DS.Model.extend({
   name: DS.attr('string'),
   displayName: DS.attr('string'),
@@ -77,8 +79,6 @@ App.WidgetType = DS.Model.extend({
 });
 
 
-App.Widget.FIXTURES = [];
-
 App.WidgetType.FIXTURES = [
   {
     id: 1,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/models/widget_layout.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/widget_layout.js b/ambari-web/app/models/widget_layout.js
index 2c29670..7427375 100644
--- a/ambari-web/app/models/widget_layout.js
+++ b/ambari-web/app/models/widget_layout.js
@@ -20,8 +20,9 @@ var App = require('app');
 
 App.WidgetLayout = DS.Model.extend({
   layoutName: DS.attr('string'),
+  displayName: DS.attr('string'),
   sectionName: DS.attr('string'),
-  widgetLayoutInfo: DS.attr('string'),
+  widgets: DS.hasMany('App.Widget'),
   scope: DS.attr('string'),
   user: DS.attr('string')
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/templates/main/service/info/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs
index 81e1e6d..2c2668c 100644
--- a/ambari-web/app/templates/main/service/info/summary.hbs
+++ b/ambari-web/app/templates/main/service/info/summary.hbs
@@ -90,7 +90,7 @@
                 {{/each}}
               </ul>
             </div>
-            {{#if App.supports.customizedWidgets}}
+            {{#if isServiceWithEnhancedWidgets}}
               <div class="btn-group pull-right actions">
                 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                   {{t common.actions}} &nbsp;<span class="caret"></span>
@@ -122,7 +122,7 @@
             {{/if}}
           </div>
           <div>
-            {{#if App.supports.customizedWidgets}}
+            {{#if isServiceWithEnhancedWidgets}}
               <div id="widget_layout" class="row-fluid">
                 {{#each widget in controller.widgets}}
                   <div class="widget span2p4" {{bindAttr id="widget.id"}}>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index e7d28bc..f82263d 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2421,6 +2421,11 @@ var urls = {
     mock: '/data/widget_layouts/HBASE/stack_layout.json'
   },
 
+  'widget.layout.get': {
+    real: '/clusters/{clusterName}/widget_layouts?WidgetLayoutInfo/layout_name={layoutName}',
+    mock: '/data/widget_layouts/{serviceName}/default_dashboard.json'
+  },
+
   'widgets.layout.userDefined.get': {
     real: '/users/{loginName}/widget_layouts?section_name={sectionName}',
     mock: '/data/widget_layouts/HBASE/empty_user_layout.json'
@@ -2453,12 +2458,12 @@ var urls = {
   },
 
   'widgets.serviceComponent.metrics.get': {
-    real: '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields={widgetIds}',
+    real: '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields={metricPaths}',
     mock: '/data/metrics/{serviceName}/Append_num_ops_&_Delete_num_ops.json'
   },
 
   'widgets.hostComponent.metrics.get': {
-    real: '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?{hostComponentCriteria}&fields={widgetIds}',
+    real: '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?{hostComponentCriteria}&fields={metricPaths}',
     mock: '/data/metrics/{serviceName}/Append_num_ops.json'
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/views/common/widget/graph_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/graph_widget_view.js b/ambari-web/app/views/common/widget/graph_widget_view.js
index e886b9b..8baa8cc 100644
--- a/ambari-web/app/views/common/widget/graph_widget_view.js
+++ b/ambari-web/app/views/common/widget/graph_widget_view.js
@@ -56,19 +56,20 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, {
   calculateValues: function () {
     var metrics = this.get('metrics');
     var seriesData = [];
-
-    this.get('content.values').forEach(function (value) {
-      var expression =  this.extractExpressions(value)[0];
-      var computedExpressions;
-
-      if (expression) {
-        computedExpressions = this.computeExpression(expression, metrics);
-        seriesData.push({
-          name: value.name,
-          data: computedExpressions[value.value.match(this.get('EXPRESSION_REGEX'))[0]]
-        });
-      }
-    }, this);
+     if (this.get('content.values')) {
+       this.get('content.values').forEach(function (value) {
+         var expression = this.extractExpressions(value)[0];
+         var computedExpressions;
+
+         if (expression) {
+           computedExpressions = this.computeExpression(expression, metrics);
+           seriesData.push({
+             name: value.name,
+             data: computedExpressions[value.value.match(this.get('EXPRESSION_REGEX'))[0]]
+           });
+         }
+       }, this);
+     }
     return seriesData;
   },
 
@@ -124,9 +125,9 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, {
       data: {
         serviceName: request.service_name,
         componentName: request.component_name,
-        widgetIds: this.addTimeProperties(request.widget_ids).join(',')
+        metricPaths: this.addTimeProperties(request.metric_paths).join(',')
       },
-      success: 'getServiceComponentMetricsSuccessCallback'
+      success: 'getMetricsSuccessCallback'
     });
   },
 
@@ -142,10 +143,10 @@ App.GraphWidgetView = Em.View.extend(App.WidgetMixin, {
       data: {
         serviceName: request.service_name,
         componentName: request.component_name,
-        widgetIds: this.addTimeProperties(request.widget_ids).join(','),
+        metricPaths: this.addTimeProperties(request.metric_paths).join(','),
         hostComponentCriteria: 'host_components/HostRoles/' + request.host_component_criteria
       },
-      success: 'getHostComponentMetricsSuccessCallback'
+      success: 'getMetricsSuccessCallback'
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index af3e359..d88cf8a 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -380,7 +380,33 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
    * list of static actions of widget
    * @type {Array}
    */
-  staticWidgetActions: [
+  staticGeneralWidgetActions: [
+    Em.Object.create({
+      label: Em.I18n.t('dashboard.widgets.actions.browse'),
+      class: 'icon-th',
+      action: 'goToWidgetsBrowser',
+      isAction: true
+    })
+  ],
+
+  /**
+   *list of static actions of widget accessible to Admin/Operator privelege
+   * @type {Array}
+   */
+
+  staticAdminPrivelegeWidgetActions: [
+    Em.Object.create({
+      label: Em.I18n.t('dashboard.widgets.create'),
+      class: 'icon-plus',
+      action: 'createWidget',
+      isAction: true
+    })
+  ],
+
+  /**
+   * List of static actions related to widget layout
+   */
+  staticWidgetLayoutActions: [
     Em.Object.create({
       label: Em.I18n.t('dashboard.widgets.layout.save'),
       class: 'icon-download-alt',
@@ -392,18 +418,6 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
       class: 'icon-file',
       isAction: true,
       layouts: App.WidgetLayout.find()
-    }),
-    Em.Object.create({
-      label: Em.I18n.t('dashboard.widgets.create'),
-      class: 'icon-plus',
-      action: 'createWidget',
-      isAction: true
-    }),
-    Em.Object.create({
-      label: Em.I18n.t('dashboard.widgets.actions.browse'),
-      class: 'icon-th',
-      action: 'goToWidgetsBrowser',
-      isAction: true
     })
   ],
 
@@ -412,7 +426,13 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
    */
   widgetActions: function() {
     var options = [];
-    options.pushObjects(this.get('staticWidgetActions'));
+    if (App.isAccessible('MANAGER')) {
+      if (App.supports.customizedWidgetLayout) {
+        options.pushObjects(this.get('staticWidgetLayoutActions'));
+      }
+      options.pushObjects(this.get('staticAdminPrivelegeWidgetActions'));
+    }
+    options.pushObjects(this.get('staticGeneralWidgetActions'));
     return options;
   }.property(''),
 
@@ -531,10 +551,8 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, {
     var isMetricsSupported = svcName != 'STORM' || App.get('isStormMetricsSupported');
 
     if (App.get('supports.customizedWidgets')) {
-      var serviceName = this.get('controller.content.serviceName');
-      var stackService = App.StackService.find().findProperty('serviceName', serviceName);
-      if (stackService.get('isServiceWithWidgets')) {
-        this.get('controller').loadWidgets();
+        this.get('controller').loadActiveWidgetLayout();
+      if (App.supports.customizedWidgetLayout) {
         this.get('controller').loadWidgetLayouts();
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index 8ce848c..fa626ef 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -227,77 +227,39 @@ describe('App.MainServiceInfoSummaryController', function () {
 
   });
 
-  describe("#loadWidgets()", function () {
+  describe("#loadActiveWidgetLayout() for Enhanced Dashboard", function () {
     before(function () {
-      controller = App.MainServiceInfoSummaryController.create();
       sinon.stub(App.ajax, 'send');
     });
     after(function () {
       App.ajax.send.restore();
     });
     it("make GET call", function () {
-      controller.loadWidgets();
-      expect(App.ajax.send.getCall(0).args[0].name).to.equal('widgets.layout.userDefined.get');
+      var controller = App.MainServiceInfoSummaryController.create({
+        isServiceWithEnhancedWidgets: true,
+        content: Em.Object.create({serviceName: 'HDFS'})
+      });
+      controller.loadActiveWidgetLayout();
+      expect(App.ajax.send.getCall(0).args[0].name).to.equal('widget.layout.get');
     });
   });
 
-  describe("#loadWidgetsSuccessCallback()", function () {
+  describe("#loadActiveWidgetLayoutSuccessCallback()", function () {
     beforeEach(function () {
-      controller = App.MainServiceInfoSummaryController.create();
-      sinon.stub(App.widgetMapper, 'map');
-      sinon.stub(controller, 'loadStackWidgetsLayout');
+      sinon.stub( App.widgetLayoutMapper, 'map');
     });
     afterEach(function () {
-      App.widgetMapper.map.restore();
-      controller.loadStackWidgetsLayout.restore();
-    });
-    it("empty data", function () {
-      controller.loadWidgetsSuccessCallback({items: []});
-      expect(controller.loadStackWidgetsLayout.calledOnce).to.be.true;
+      App.widgetLayoutMapper.map.restore();
     });
-    it("filled data", function () {
-      controller.loadWidgetsSuccessCallback({items: ['1']});
-      expect(App.widgetMapper.map.calledWith('1')).to.be.true;
+    it("isWidgetLayoutsLoaded should be set to true", function () {
+      var controller = App.MainServiceInfoSummaryController.create({
+        isServiceWithEnhancedWidgets: true,
+        content: Em.Object.create({serviceName: 'HDFS'})
+      });
+      controller.loadActiveWidgetLayoutSuccessCallback({items:[true]});
+      expect(controller.get('isWidgetsLoaded')).to.be.true;
     });
-  });
 
-  describe("#loadStackWidgetsLayout()", function () {
-    before(function () {
-      controller = App.MainServiceInfoSummaryController.create();
-      sinon.stub(App.ajax, 'send');
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
-    it("make GET call", function () {
-      controller.loadStackWidgetsLayout();
-      expect(App.ajax.send.getCall(0).args[0].name).to.equal('widgets.layout.stackDefined.get');
-    });
   });
 
-  describe("#loadStackWidgetsLayoutSuccessCallback()", function () {
-    before(function () {
-      controller = App.MainServiceInfoSummaryController.create();
-      sinon.stub(App.widgetMapper, 'map');
-    });
-    after(function () {
-      App.widgetMapper.map.restore();
-    });
-    it("make GET call", function () {
-      var data = {
-        artifact_data: {
-          layouts: [
-            {
-              section_name: 'S1_SUMMARY'
-            }
-          ]
-        }
-      };
-      controller.set('content', Em.Object.create({serviceName: 'S1'}));
-      controller.loadStackWidgetsLayoutSuccessCallback(data);
-      expect(App.widgetMapper.map.calledWith({
-        section_name: 'S1_SUMMARY'
-      })).to.be.true;
-    });
-  });
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/test/mappers/stack_service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js
index 1b6ccfa..0d13925 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -178,8 +178,8 @@ describe('App.stackServiceMapper', function () {
         stackName: "HDP",
         isInstalled: false,
         isInstallable: true,
+        isServiceWithWidgets: false,
         serviceCheckSupported: true,
-        isServiceWithWidgets: true,
         requiredServices: ["ZOOKEEPER"]
       },
       componentResult = {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index edb5359..9ef82a4 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -95,26 +95,26 @@ describe('App.WidgetMixin', function() {
       var data = [
         {
           "name": "regionserver.Server.percentFilesLocal",
-          "widget_id": "metrics/hbase/regionserver/percentFilesLocal",
+          "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
           "service_name": "HBASE",
           "component_name": "HBASE_REGIONSERVER"
         },
         {
           "name": "regionserver.Server.percentFilesLocal2",
-          "widget_id": "w2",
+          "metric_path": "w2",
           "service_name": "HBASE",
           "component_name": "HBASE_REGIONSERVER"
         },
         {
           "name": "regionserver.Server.percentFilesLocal",
-          "widget_id": "metrics/hbase/regionserver/percentFilesLocal",
+          "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
           "service_name": "HBASE",
           "component_name": "HBASE_REGIONSERVER",
           "host_component_criteria": 'c1'
         },
         {
           "name": "regionserver.Server.percentFilesLocal",
-          "widget_id": "metrics/hbase/regionserver/percentFilesLocal",
+          "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
           "service_name": "HDFS",
           "component_name": "DATANODE",
           "host_component_criteria": 'c1'
@@ -122,11 +122,11 @@ describe('App.WidgetMixin', function() {
       ];
 
       expect(mixinObject.getRequestData(data)).to.eql({
-        "HBASE_HBASE_REGIONSERVER_undefined": {
+        "HBASE_HBASE_REGIONSERVER": {
           "name": "regionserver.Server.percentFilesLocal",
           "service_name": "HBASE",
           "component_name": "HBASE_REGIONSERVER",
-          "widget_ids": [
+          "metric_paths": [
             "metrics/hbase/regionserver/percentFilesLocal",
             "w2"
           ]
@@ -136,7 +136,7 @@ describe('App.WidgetMixin', function() {
           "service_name": "HBASE",
           "component_name": "HBASE_REGIONSERVER",
           "host_component_criteria": "c1",
-          "widget_ids": [
+          "metric_paths": [
             "metrics/hbase/regionserver/percentFilesLocal"
           ]
         },
@@ -145,7 +145,7 @@ describe('App.WidgetMixin', function() {
           "service_name": "HDFS",
           "component_name": "DATANODE",
           "host_component_criteria": "c1",
-          "widget_ids": [
+          "metric_paths": [
             "metrics/hbase/regionserver/percentFilesLocal"
           ]
         }
@@ -165,7 +165,7 @@ describe('App.WidgetMixin', function() {
       var request = {
         service_name: 'S1',
         component_name: 'C1',
-        widget_ids: ['w1', 'w2']
+        metric_paths: ['w1', 'w2']
       };
       mixinObject.getServiceComponentMetrics(request);
       expect(App.ajax.send.getCall(0).args[0]).to.eql({
@@ -174,14 +174,14 @@ describe('App.WidgetMixin', function() {
         data: {
           serviceName: 'S1',
           componentName: 'C1',
-          widgetIds: 'w1,w2'
+          metricPaths: 'w1,w2'
         },
-        success: 'getServiceComponentMetricsSuccessCallback'
+        success: 'getMetricsSuccessCallback'
       })
     });
   });
 
-  describe("#getServiceComponentMetricsSuccessCallback()", function () {
+  describe("#getMetricsSuccessCallback()", function () {
     var mixinObject = mixinClass.create();
     it("", function () {
       var data = {
@@ -197,11 +197,11 @@ describe('App.WidgetMixin', function() {
       };
       mixinObject.set('content.metrics', [
         {
-          widget_id: 'metrics/hbase/ipc/IPC/numOpenConnections'
+          metric_path: 'metrics/hbase/ipc/IPC/numOpenConnections'
         }
       ]);
-      mixinObject.getServiceComponentMetricsSuccessCallback(data);
-      expect(mixinObject.get('metrics').findProperty('widget_id', 'metrics/hbase/ipc/IPC/numOpenConnections').data).to.equal(11.5);
+      mixinObject.getMetricsSuccessCallback(data);
+      expect(mixinObject.get('metrics').findProperty('metric_path', 'metrics/hbase/ipc/IPC/numOpenConnections').data).to.equal(11.5);
     });
   });
 
@@ -217,7 +217,7 @@ describe('App.WidgetMixin', function() {
       var request = {
         service_name: 'S1',
         component_name: 'C1',
-        widget_ids: ['w1', 'w2'],
+        metric_paths: ['w1', 'w2'],
         host_component_criteria: 'c1'
       };
       mixinObject.getHostComponentMetrics(request);
@@ -227,10 +227,10 @@ describe('App.WidgetMixin', function() {
         data: {
           serviceName: 'S1',
           componentName: 'C1',
-          widgetIds: 'w1,w2',
+          metricPaths: 'w1,w2',
           hostComponentCriteria: 'host_components/HostRoles/c1'
         },
-        success: 'getHostComponentMetricsSuccessCallback'
+        success: 'getMetricsSuccessCallback'
       })
     });
   });


Mime
View raw message