Browse Source

HPCC-9651 Move Timings TreeMap to new Graphs list

Double clicking TreeMap SubGraph Item will open graphs tab and select subgraph
item.

Fixes HPCC-9651
Fixes HPCC-9653

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 12 years ago
parent
commit
8db23f31b8

+ 20 - 2
esp/files/scripts/GraphPageWidget.js

@@ -17,6 +17,7 @@ define([
     "dojo/_base/declare",
     "dojo/_base/declare",
     "dojo/_base/lang",
     "dojo/_base/lang",
     "dojo/_base/array",
     "dojo/_base/array",
+    "dojo/_base/Deferred",
     "dojo/dom",
     "dojo/dom",
     "dojo/dom-construct",
     "dojo/dom-construct",
     "dojo/on",
     "dojo/on",
@@ -57,7 +58,7 @@ define([
     "dijit/form/SimpleTextarea",
     "dijit/form/SimpleTextarea",
     "dijit/form/NumberSpinner",
     "dijit/form/NumberSpinner",
     "dijit/form/DropDownButton"
     "dijit/form/DropDownButton"
-], function (declare, lang, arrayUtil, dom, domConstruct, on, html, Memory, Observable,
+], function (declare, lang, arrayUtil, Deferred, dom, domConstruct, on, html, Memory, Observable,
             BorderContainer, TabContainer, ContentPane, registry, Dialog,
             BorderContainer, TabContainer, ContentPane, registry, Dialog,
             entities,
             entities,
             OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
             OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
@@ -286,6 +287,11 @@ define([
             this._initItemGrid(this.edgesGrid);
             this._initItemGrid(this.edgesGrid);
         },
         },
 
 
+        _onMainRefresh: function () {
+            this.main.setMessage("Performing Layout...");
+            this.main.startLayout("dot");
+        },
+
         _onLocalRefresh: function () {
         _onLocalRefresh: function () {
             this.refreshLocal(this.local.getSelectionAsGlobalID());
             this.refreshLocal(this.local.getSelectionAsGlobalID());
         },
         },
@@ -406,7 +412,9 @@ define([
                         onGetGraphs: function (graphs) {
                         onGetGraphs: function (graphs) {
                             if (firstLoad == true) {
                             if (firstLoad == true) {
                                 firstLoad = false;
                                 firstLoad = false;
-                                context.loadGraph(context.wu, context.graphName);
+                                context.loadGraph(context.wu, context.graphName).then(function (response) {
+                                    context.refresh(params);
+                                });
                             } else {
                             } else {
                                 context.refreshGraph(context.wu, context.graphName);
                                 context.refreshGraph(context.wu, context.graphName);
                             }
                             }
@@ -425,6 +433,13 @@ define([
 
 
         },
         },
 
 
+        refresh: function (params) {
+            if (params && params.SubGraphId) {
+                this.global.setSelectedAsGlobalID([params.SubGraphId]);
+                this.syncSelectionFrom(this.global);
+            }
+        },
+
         loadGraphFromXGMML: function (xgmml) {
         loadGraphFromXGMML: function (xgmml) {
             this.global.loadXGMML(xgmml, false);
             this.global.loadXGMML(xgmml, false);
             this.refreshMain();
             this.refreshMain();
@@ -444,6 +459,7 @@ define([
         },
         },
 
 
         loadGraph: function (wu, graphName) {
         loadGraph: function (wu, graphName) {
+            var deferred = new Deferred();
             this.overview.setMessage("Fetching Data...");
             this.overview.setMessage("Fetching Data...");
             this.main.setMessage("Fetching Data...");
             this.main.setMessage("Fetching Data...");
             this.local.setMessage("Fetching Data...");
             this.local.setMessage("Fetching Data...");
@@ -453,7 +469,9 @@ define([
                 context.main.setMessage("");
                 context.main.setMessage("");
                 context.local.setMessage("");
                 context.local.setMessage("");
                 context.loadGraphFromXGMML(xgmml, svg);
                 context.loadGraphFromXGMML(xgmml, svg);
+                deferred.resolve();
             });
             });
+            return deferred.promise;
         },
         },
 
 
         refreshGraph: function (wu, graphName) {
         refreshGraph: function (wu, graphName) {

+ 1 - 2
esp/files/scripts/GraphWidget.js

@@ -300,8 +300,7 @@ require([
                     if (this._isPluginInstalled) {
                     if (this._isPluginInstalled) {
                         var pluginID = this.id + "Plugin";
                         var pluginID = this.id + "Plugin";
                         if (has("ie")) {
                         if (has("ie")) {
-                            this.graphContentPane.domNode.innerHTML = '<object '
-                                                    + 'type="application/x-hpccsystemsgraphviewcontrol" '
+                            this.graphContentPane.domNode.innerHTML = '<object type="application/x-hpccsystemsgraphviewcontrol" '
                                                     + 'id="' + pluginID + '" '
                                                     + 'id="' + pluginID + '" '
                                                     + 'name="' + pluginID + '" '
                                                     + 'name="' + pluginID + '" '
                                                     + 'width="100%" '
                                                     + 'width="100%" '

+ 66 - 7
esp/files/scripts/GraphsWidget.js

@@ -15,6 +15,7 @@
 ############################################################################## */
 ############################################################################## */
 define([
 define([
     "dojo/_base/declare",
     "dojo/_base/declare",
+    "dojo/_base/array",
     "dojo/on",
     "dojo/on",
 
 
     "dijit/form/Button",
     "dijit/form/Button",
@@ -29,12 +30,13 @@ define([
     "hpcc/GridDetailsWidget",
     "hpcc/GridDetailsWidget",
     "hpcc/ESPWorkunit",
     "hpcc/ESPWorkunit",
     "hpcc/GraphPageWidget",
     "hpcc/GraphPageWidget",
+    "hpcc/TimingTreeMapWidget",
     "hpcc/ESPUtil"
     "hpcc/ESPUtil"
 
 
-], function (declare, on,
+], function (declare, arrayUtil, on,
                 Button,
                 Button,
                 OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
                 OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
-                GridDetailsWidget, ESPWorkunit, GraphPageWidget, ESPUtil) {
+                GridDetailsWidget, ESPWorkunit, GraphPageWidget, TimingTreeMapWidget, ESPUtil) {
     return declare("GraphsWidget", [GridDetailsWidget], {
     return declare("GraphsWidget", [GridDetailsWidget], {
 
 
         gridTitle: "Graphs",
         gridTitle: "Graphs",
@@ -42,6 +44,18 @@ define([
 
 
         wu: null,
         wu: null,
 
 
+        postCreate: function (args) {
+            this.inherited(arguments);
+            this.timingTreeMap = new TimingTreeMapWidget({
+                id: this.id + "TimingTreeMap",
+                region: "right",
+                splitter: true,
+                style: "width: 33%",
+                minSize: 120
+            });
+            this.timingTreeMap.placeAt(this.gridTab, "last");
+        },
+
         init: function (params) {
         init: function (params) {
             if (this.inherited(arguments))
             if (this.inherited(arguments))
                 return;
                 return;
@@ -56,6 +70,15 @@ define([
                     }
                     }
                 });
                 });
             }
             }
+            this.timingTreeMap.init(params);
+            this.timingTreeMap.onClick = function (value) {
+                context.syncSelectionFrom(context.timingTreeMap);
+            }
+            this.timingTreeMap.onDblClick = function (item) {
+                context._onOpen(item, {
+                    SubGraphId: item.SubGraphId
+                });
+            }
             this._refreshActionState();
             this._refreshActionState();
         },
         },
 
 
@@ -93,6 +116,10 @@ define([
             }, domID);
             }, domID);
 
 
             var context = this;
             var context = this;
+            retVal.on(".dgrid-row:click", function (evt) {
+                context.syncSelectionFrom(evt);
+            });
+
             on(document, "." + this.id + "GraphClick:click", function (evt) {
             on(document, "." + this.id + "GraphClick:click", function (evt) {
                 if (context._onRowDblClick) {
                 if (context._onRowDblClick) {
                     var row = retVal.row(evt).data;
                     var row = retVal.row(evt).data;
@@ -103,10 +130,6 @@ define([
         },
         },
 
 
         createDetail: function (id, row, params) {
         createDetail: function (id, row, params) {
-            var safeMode = false;
-            if (params && params.safeMode) {
-                var safeMode = true;
-            }
             return new GraphPageWidget({
             return new GraphPageWidget({
                 id: id,
                 id: id,
                 title: row.Name,
                 title: row.Name,
@@ -116,7 +139,8 @@ define([
                     params: {
                     params: {
                         Wuid: this.wu.Wuid,
                         Wuid: this.wu.Wuid,
                         GraphName: row.Name,
                         GraphName: row.Name,
-                        SafeMode: safeMode
+                        SubGraphId: (params && params.SubGraphId) ? params.SubGraphId : null,
+                        SafeMode: (params && params.safeMode) ? true : false
                     }
                     }
                 }
                 }
             });
             });
@@ -139,6 +163,41 @@ define([
             this.inherited(arguments);
             this.inherited(arguments);
 
 
             this.openSafeMode.set("disabled", !selection.length);
             this.openSafeMode.set("disabled", !selection.length);
+        },
+
+        syncSelectionFrom: function (sourceControl) {
+            var graphItems = [];
+            var timingItems = [];
+
+            //  Get Selected Items  ---
+            if (sourceControl == this.grid) {
+                arrayUtil.forEach(sourceControl.getSelected(), function (item, idx) {
+                    timingItems.push(item);
+                });
+            }
+            if (sourceControl == this.timingTreeMap) {
+                arrayUtil.forEach(sourceControl.getSelected(), function (item, idx) {
+                    if (item.children) {
+                        if (item.children.length) {
+                            graphItems.push({
+                                Name: item.children[0].GraphName
+                            })
+                        }
+                    } else {
+                        graphItems.push({
+                            Name: item.GraphName
+                        })
+                    }
+                });
+            }
+
+            //  Set Selected Items  ---
+            if (sourceControl != this.grid) {
+                this.grid.setSelected(graphItems);
+            }
+            if (sourceControl != this.timingTreeMap) {
+                this.timingTreeMap.setSelectedGraphs(timingItems);
+            }
         }
         }
     });
     });
 });
 });

+ 14 - 5
esp/files/scripts/GridDetailsWidget.js

@@ -15,6 +15,7 @@
 ############################################################################## */
 ############################################################################## */
 define([
 define([
     "dojo/_base/declare",
     "dojo/_base/declare",
+    "dojo/_base/lang",
     "dojo/store/Memory",
     "dojo/store/Memory",
     "dojo/store/Observable",
     "dojo/store/Observable",
 
 
@@ -31,7 +32,7 @@ define([
     "dijit/ToolbarSeparator",
     "dijit/ToolbarSeparator",
     "dijit/layout/ContentPane"
     "dijit/layout/ContentPane"
 
 
-], function (declare, Memory, Observable,
+], function (declare, lang, Memory, Observable,
                 registry,
                 registry,
                 _TabContainerWidget,
                 _TabContainerWidget,
                 template) {
                 template) {
@@ -105,11 +106,15 @@ define([
 
 
         initTab: function () {
         initTab: function () {
             var currSel = this.getSelectedChild();
             var currSel = this.getSelectedChild();
-            if (currSel && !currSel.initalized) {
-                if (currSel.hpcc) {
-                    currSel.init(currSel.hpcc.params);
+            if (currSel) {
+                if (!currSel.initalized) {
+                    if (currSel.hpcc) {
+                        currSel.init(currSel.hpcc.params);
+                    }
+                    currSel.initalized = true;
+                } else if (currSel.refresh) {
+                    currSel.refresh(currSel.hpcc.refreshParams);
                 }
                 }
-                currSel.initalized = true;
             }
             }
         },
         },
 
 
@@ -123,6 +128,10 @@ define([
             if (!retVal) {
             if (!retVal) {
                 retVal = this.createDetail(id, row, params);
                 retVal = this.createDetail(id, row, params);
                 this.addChild(retVal);
                 this.addChild(retVal);
+            } else {
+                lang.mixin(retVal.hpcc, {
+                    refreshParams: params
+                });
             }
             }
             return retVal;
             return retVal;
         },
         },

+ 1 - 1
esp/files/scripts/TimingGridWidget.js

@@ -70,7 +70,7 @@ define([
                     columns: {
                     columns: {
                         id: { label: "##", width: 45 },
                         id: { label: "##", width: 45 },
                         Name: { label: "Component" },
                         Name: { label: "Component" },
-                        Seconds: { label: "Time (Seconds)", width: 54 }
+                        Seconds: { label: "Time (Seconds)", width: 124 }
                     },
                     },
                     store: this.timingStore
                     store: this.timingStore
                 }, this.id + "TimingGrid");
                 }, this.id + "TimingGrid");

+ 1 - 29
esp/files/scripts/TimingPageWidget.js

@@ -22,20 +22,18 @@ define([
 
 
     "hpcc/_Widget",
     "hpcc/_Widget",
     "hpcc/TimingGridWidget",
     "hpcc/TimingGridWidget",
-    "hpcc/TimingTreeMapWidget",
 
 
     "dojo/text!../templates/TimingPageWidget.html"
     "dojo/text!../templates/TimingPageWidget.html"
 ],
 ],
     function (declare,
     function (declare,
             registry, BorderContainer,
             registry, BorderContainer,
-            _Widget, TimingGridWidget, TimingTreeMapWidget,
+            _Widget, TimingGridWidget,
             template) {
             template) {
         return declare("TimingPageWidget", [_Widget], {
         return declare("TimingPageWidget", [_Widget], {
             templateString: template,
             templateString: template,
             baseClass: "TimingPageWidget",
             baseClass: "TimingPageWidget",
             borderContainer: null,
             borderContainer: null,
             timingGrid: null,
             timingGrid: null,
-            timingTreeMap: null,
 
 
             buildRendering: function (args) {
             buildRendering: function (args) {
                 this.inherited(arguments);
                 this.inherited(arguments);
@@ -45,7 +43,6 @@ define([
                 this.inherited(arguments);
                 this.inherited(arguments);
                 this.borderContainer = registry.byId(this.id + "BorderContainer");
                 this.borderContainer = registry.byId(this.id + "BorderContainer");
                 this.timingGrid = registry.byId(this.id + "Grid");
                 this.timingGrid = registry.byId(this.id + "Grid");
-                this.timingTreeMap = registry.byId(this.id + "TreeMap");
             },
             },
 
 
             startup: function (args) {
             startup: function (args) {
@@ -68,31 +65,6 @@ define([
 
 
                 var context = this;
                 var context = this;
                 this.timingGrid.init(params);
                 this.timingGrid.init(params);
-                this.timingGrid.onClick = function (items) {
-                    context.syncSelectionFrom(context.timingGrid);
-                };
-
-                this.timingTreeMap.init(params);
-                this.timingTreeMap.onClick = function (value) {
-                    context.syncSelectionFrom(context.timingTreeMap);
-                }
-            },
-
-            syncSelectionFrom: function (sourceControl) {
-                var items = [];
-
-                //  Get Selected Items  ---
-                if (sourceControl == this.timingGrid || sourceControl == this.timingTreeMap) {
-                    items = sourceControl.getSelected();
-                }
-
-                //  Set Selected Items  ---
-                if (sourceControl != this.timingGrid) {
-                    this.timingGrid.setSelected(items);
-                }
-                if (sourceControl != this.timingTreeMap) {
-                    this.timingTreeMap.setSelected(items);
-                }
             }
             }
         });
         });
     });
     });

+ 16 - 1
esp/files/scripts/TimingTreeMapWidget.js

@@ -17,6 +17,7 @@
 define([
 define([
     "dojo/_base/declare",
     "dojo/_base/declare",
     "dojo/_base/lang",
     "dojo/_base/lang",
+    "dojo/_base/array",
     "dojo/store/Memory",
     "dojo/store/Memory",
 
 
     "dijit/registry",
     "dijit/registry",
@@ -28,7 +29,7 @@ define([
 
 
     "dojo/text!../templates/TimingTreeMapWidget.html"
     "dojo/text!../templates/TimingTreeMapWidget.html"
 ],
 ],
-    function (declare, lang, Memory,
+    function (declare, lang, arrayUtil, Memory,
             registry, 
             registry, 
             TreeMap,
             TreeMap,
             _Widget, ESPWorkunit,
             _Widget, ESPWorkunit,
@@ -132,6 +133,20 @@ define([
                 }
                 }
             },
             },
 
 
+            setSelectedGraphs: function (selItems) {
+                if (this.store) {
+                    var selectedItems = [];
+                    for (var i = 0; i < selItems.length; ++i) {
+                        arrayUtil.forEach(this.store.data, function (item, idx) {
+                            if (item.GraphName == selItems[i].Name) {
+                                selectedItems.push(item);
+                            }
+                        });
+                    }
+                    this.treeMap.set("selectedItems", selectedItems);
+                }
+            },
+
             loadTimers: function (timers, query) {
             loadTimers: function (timers, query) {
                 this.largestValue = 0;
                 this.largestValue = 0;
                 var timerData = [];
                 var timerData = [];

+ 0 - 2
esp/files/templates/TimingPageWidget.html

@@ -2,7 +2,5 @@
     <div id="${id}BorderContainer" class="${baseClass}BorderContainer" style="width: 100%; height: 100%" data-dojo-type="dijit.layout.BorderContainer">
     <div id="${id}BorderContainer" class="${baseClass}BorderContainer" style="width: 100%; height: 100%" data-dojo-type="dijit.layout.BorderContainer">
         <div id="${id}Grid" data-dojo-props="region: 'center'" data-dojo-type="TimingGridWidget">
         <div id="${id}Grid" data-dojo-props="region: 'center'" data-dojo-type="TimingGridWidget">
         </div>
         </div>
-        <div id="${id}TreeMap" style="width: 33%;overflow:auto;" data-dojo-props="region: 'right', splitter:true, minSize: 120" data-dojo-type="TimingTreeMapWidget">
-        </div>
     </div>
     </div>
 </div>
 </div>