Simon Hunt
Committed by Gerrit Code Review

GUI -- [ONOS-318] - Detail pane moves into space vacated by summary pane; makes …

…room for incoming summary...

Change-Id: I1dd9af05bdb18cb8cf2c51b1dca3b2cfd09d9e37
...@@ -825,6 +825,8 @@ ...@@ -825,6 +825,8 @@
825 return noPx('height'); 825 return noPx('height');
826 } 826 }
827 827
828 + function noop() {}
829 +
828 fp = { 830 fp = {
829 id: id, 831 id: id,
830 el: el, 832 el: el,
...@@ -833,17 +835,19 @@ ...@@ -833,17 +835,19 @@
833 return on; 835 return on;
834 }, 836 },
835 837
836 - show: function () { 838 + show: function (cb) {
837 - console.log('show pane: ' + id); 839 + var endCb = isF(cb) || noop;
838 on = true; 840 on = true;
839 el.transition().duration(750) 841 el.transition().duration(750)
842 + .each('end', endCb)
840 .style(cfg.side, pxShow()) 843 .style(cfg.side, pxShow())
841 .style('opacity', 1); 844 .style('opacity', 1);
842 }, 845 },
843 - hide: function () { 846 + hide: function (cb) {
844 - console.log('hide pane: ' + id); 847 + var endCb = isF(cb) || noop;
845 on = false; 848 on = false;
846 el.transition().duration(750) 849 el.transition().duration(750)
850 + .each('end', endCb)
847 .style(cfg.side, pxHide()) 851 .style(cfg.side, pxHide())
848 .style('opacity', 0); 852 .style('opacity', 0);
849 }, 853 },
......
...@@ -770,13 +770,13 @@ ...@@ -770,13 +770,13 @@
770 function showSummary(data) { 770 function showSummary(data) {
771 evTrace(data); 771 evTrace(data);
772 populateSummary(data.payload); 772 populateSummary(data.payload);
773 - summaryPane.show(); 773 + showSummaryPane();
774 } 774 }
775 775
776 function showDetails(data) { 776 function showDetails(data) {
777 evTrace(data); 777 evTrace(data);
778 populateDetails(data.payload); 778 populateDetails(data.payload);
779 - detailPane.show(); 779 + showDetailPane();
780 } 780 }
781 781
782 function showTraffic(data) { 782 function showTraffic(data) {
...@@ -901,9 +901,39 @@ ...@@ -901,9 +901,39 @@
901 901
902 function cancelSummary() { 902 function cancelSummary() {
903 sendMessage('cancelSummary', {}); 903 sendMessage('cancelSummary', {});
904 - summaryPane.hide(); 904 + hideSummaryPane();
905 + }
906 +
907 + // encapsulate interaction between summary and details panes
908 + function showSummaryPane() {
909 + if (detailPane.isVisible()) {
910 + detailPane.down(summaryPane.show);
911 + } else {
912 + summaryPane.show();
913 + }
914 + }
915 +
916 + function hideSummaryPane() {
917 + summaryPane.hide(function () {
918 + if (detailPane.isVisible()) {
919 + detailPane.up();
920 + }
921 + });
922 + }
923 +
924 + function showDetailPane() {
925 + if (summaryPane.isVisible()) {
926 + detailPane.down(detailPane.show);
927 + } else {
928 + detailPane.up(detailPane.show);
929 + }
905 } 930 }
906 931
932 + function hideDetailPane() {
933 + detailPane.hide();
934 + }
935 +
936 +
907 // request details for the selected element 937 // request details for the selected element
908 // invoked from selection of a single node. 938 // invoked from selection of a single node.
909 function requestDetails() { 939 function requestDetails() {
...@@ -2191,7 +2221,7 @@ ...@@ -2191,7 +2221,7 @@
2191 } 2221 }
2192 2222
2193 function emptySelect() { 2223 function emptySelect() {
2194 - detailPane.hide(); 2224 + hideDetailPane();
2195 cancelTraffic(); 2225 cancelTraffic();
2196 } 2226 }
2197 2227
...@@ -2697,6 +2727,30 @@ ...@@ -2697,6 +2727,30 @@
2697 return 'translate('+((w-bdim)*.4)+','+((h-bdim)*.1)+')'; 2727 return 'translate('+((w-bdim)*.4)+','+((h-bdim)*.1)+')';
2698 } 2728 }
2699 2729
2730 + function isF(f) { return $.isFunction(f) ? f : null; }
2731 + function noop() {}
2732 +
2733 + function augmentDetailPane() {
2734 + var dp = detailPane;
2735 + dp.ypos = { up: 64, down: 320, current: 320};
2736 +
2737 + dp._move = function (y, cb) {
2738 + var endCb = isF(cb) || noop,
2739 + yp = dp.ypos;
2740 + if (yp.current !== y) {
2741 + yp.current = y;
2742 + dp.el.transition().duration(300)
2743 + .each('end', endCb)
2744 + .style('top', yp.current + 'px');
2745 + } else {
2746 + endCb();
2747 + }
2748 + };
2749 +
2750 + dp.down = function (cb) { dp._move(dp.ypos.down, cb); };
2751 + dp.up = function (cb) { dp._move(dp.ypos.up, cb); };
2752 + }
2753 +
2700 // ============================== 2754 // ==============================
2701 // View registration 2755 // View registration
2702 2756
...@@ -2710,6 +2764,7 @@ ...@@ -2710,6 +2764,7 @@
2710 2764
2711 summaryPane = onos.ui.addFloatingPanel('topo-summary'); 2765 summaryPane = onos.ui.addFloatingPanel('topo-summary');
2712 detailPane = onos.ui.addFloatingPanel('topo-detail'); 2766 detailPane = onos.ui.addFloatingPanel('topo-detail');
2767 + augmentDetailPane();
2713 oiBox = onos.ui.addFloatingPanel('topo-oibox', 'TL'); 2768 oiBox = onos.ui.addFloatingPanel('topo-oibox', 'TL');
2714 oiBox.width(20); 2769 oiBox.width(20);
2715 2770
......