ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-10856. Cloned widget should show in widget layout and widget browser. (jaimin)
Date Thu, 30 Apr 2015 05:41:46 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 97c524d96 -> 89144ad4e


AMBARI-10856. Cloned widget should show in widget layout and widget browser. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/89144ad4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/89144ad4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/89144ad4

Branch: refs/heads/trunk
Commit: 89144ad4e04223d46571d6f7e9124c35ee48c791
Parents: 97c524d
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Wed Apr 29 22:41:31 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Wed Apr 29 22:41:31 2015 -0700

----------------------------------------------------------------------
 .../common-services/HDFS/2.1.0.2.0/widgets.json |  1 +
 .../controllers/main/service/info/summary.js    | 20 +++++++++++++-------
 .../app/mixins/common/widgets/widget_mixin.js   | 15 ++++++++++-----
 3 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89144ad4/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
index 1ff75ec..5e910ae 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
@@ -243,6 +243,7 @@
     {
       "layout_name": "default_hdfs_heatmap",
       "section_name": "HDFS_HEATMAPS",
+      "display_name": "HDFS Heatmaps",
       "widgetLayoutInfo": [
         {
           "widget_name": "HDFS Bytes Read",

http://git-wip-us.apache.org/repos/asf/ambari/blob/89144ad4/ambari-web/app/controllers/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js
index df49e8c..22eae54 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -354,7 +354,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
    * @param {object|null} data
    */
   loadAllSharedWidgetsSuccessCallback: function (data) {
-    var addedWidgetsNames = this.get('widgets').mapProperty('widgetName');
+    var widgetIds = this.get('widgets').mapProperty('id');
     if (data.items[0] && data.items.length) {
       this.set("allSharedWidgets",
         data.items.filter(function (widget) {
@@ -362,16 +362,17 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
         }).map(function (widget) {
           var widgetType = widget.WidgetInfo.widget_type;
           var widgetName = widget.WidgetInfo.widget_name;
+          var widgetId =  widget.WidgetInfo.id;
           return Em.Object.create({
-            id: widget.WidgetInfo.id,
+            id: widgetId,
             widgetName: widgetName,
             displayName: widget.WidgetInfo.display_name,
             description: widget.WidgetInfo.description,
             widgetType: widgetType,
             iconPath: "/img/widget-" + widgetType.toLowerCase() + ".png",
             serviceName: JSON.parse(widget.WidgetInfo.metrics).mapProperty('service_name').uniq().join('-'),
-            added: addedWidgetsNames.contains(widgetName),
-            isShared: true
+            added: widgetIds.contains(widgetId),
+            isShared: widget.WidgetInfo.scope == "CLUSTER"
           });
         })
       );
@@ -403,7 +404,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
    * @param {object|null} data
    */
   loadMineWidgetsSuccessCallback: function (data) {
-    var addedWidgetsNames = this.get('widgets').mapProperty('widgetName');
+    var widgetIds = this.get('widgets').mapProperty('id');
     if (data.items[0] && data.items.length) {
       this.set("mineWidgets",
         data.items.filter(function (widget) {
@@ -411,6 +412,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
         }).map(function (widget) {
           var widgetType = widget.WidgetInfo.widget_type;
           var widgetName = widget.WidgetInfo.widget_name;
+          var widgetId =  widget.WidgetInfo.id;
           return Em.Object.create({
             id: widget.WidgetInfo.id,
             widgetName: widgetName,
@@ -419,7 +421,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
             widgetType: widgetType,
             iconPath: "/img/widget-" + widgetType.toLowerCase() + ".png",
             serviceName: JSON.parse(widget.WidgetInfo.metrics).mapProperty('service_name').uniq().join('-'),
-            added: addedWidgetsNames.contains(widgetName),
+            added: widgetIds.contains(widgetId),
             isShared: widget.WidgetInfo.scope == "CLUSTER"
           });
         })
@@ -668,7 +670,11 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
          */
         services: function () {
           var view = this;
-          return App.Service.find().map(function (service) {
+          var services = App.Service.find().filter(function(item){
+            var stackService =  App.StackService.find().findProperty('serviceName', item.get('serviceName'));
+            return stackService.get('isServiceWithWidgets');
+          });
+          return services.map(function (service) {
             return Em.Object.create({
               value: service.get('serviceName'),
               label: service.get('displayName'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/89144ad4/ambari-web/app/mixins/common/widgets/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index c9b2614..935a8d4 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -457,10 +457,10 @@ App.WidgetMixin = Ember.Mixin.create({
         "metrics": this.get('content.metrics').map(function (metric) {
           return {
             "name": metric.name,
-            "service_name": metric.serviceName,
-            "component_name": metric.componentName,
-            "metric_path": metric.metric_path,
-            "category": metric.category
+            "service_name": metric.service_name,
+            "component_name": metric.component_name,
+            "host_component_criteria":  metric.host_component_criteria,
+            "metric_path": metric.metric_path
           }
         }),
         values: this.get('content.values'),
@@ -478,6 +478,8 @@ App.WidgetMixin = Ember.Mixin.create({
     var data = this.collectWidgetData();
     if (isClone) {
       data.WidgetInfo.widget_name += this.get('CLONE_SUFFIX');
+      //TODO remove setting diplay_name once API supports it
+      data.WidgetInfo.display_name = data.WidgetInfo.widget_name;
     }
     return App.ajax.send({
       name: 'widgets.wizard.add',
@@ -494,7 +496,10 @@ App.WidgetMixin = Ember.Mixin.create({
     widgets.pushObject(Em.Object.create({
       id: data.resources[0].WidgetInfo.id
     }));
-    App.router.get('mainServiceInfoSummaryController').saveWidgetLayout(widgets);
+    var mainServiceInfoSummaryController =  App.router.get('mainServiceInfoSummaryController');
+    mainServiceInfoSummaryController.saveWidgetLayout(widgets).done(function(){
+      mainServiceInfoSummaryController.updateActiveLayout();
+    });
   },
 
   /*


Mime
View raw message