@cryptotaxi247 / netdata-1 / commits / a5ad389dc

registry items propagate URL hash even if they are used with open in new window/tab

Costa Tsaousis (ktsaou) committed Nov 18, 2017 at 05:10 UTC a5ad389dcdc82a102df02ac73cc16d6730bfd595
2 files changed +41 -17
web/dashboard.js
+33 -14
@@ -5674,17 +5674,19 @@ var NETDATA = window.NETDATA || {};
5674 state.tmp.dygraph_mouse_down = true;
5675 context.initializeMouseDown(event, dygraph, context);
5676
5677 - // console.log(event);
5677 + //console.log(event);
5678 if(event.button && event.button === 1) {
5679 if (event.shiftKey) {
5680 - // middle mouse button dragging (PAN)
5680 + //console.log('middle mouse button dragging (PAN)');
5681 +
5682 state.setMode('pan');
5683 // NETDATA.globalSelectionSync.delay();
5683 - state.tmp.dygraph_highlight_after = undefined;
5684 + state.tmp.dygraph_highlight_after = null;
5685 Dygraph.startPan(event, dygraph, context);
5686 }
5687 else if(event.altKey || event.ctrlKey || event.metaKey) {
5687 - // middle mouse button highlight
5688 + //console.log('middle mouse button highlight');
5689 +
5690 if (!(event.offsetX && event.offsetY)) {
5691 event.offsetX = event.layerX - event.target.offsetLeft;
5692 event.offsetY = event.layerY - event.target.offsetTop;
@@ -5693,23 +5695,26 @@ var NETDATA = window.NETDATA || {};
5695 Dygraph.startZoom(event, dygraph, context);
5696 }
5697 else {
5696 - // middle mouse button selection for zoom (ZOOM)
5698 + //console.log('middle mouse button selection for zoom (ZOOM)');
5699 +
5700 state.setMode('zoom');
5701 // NETDATA.globalSelectionSync.delay();
5699 - state.tmp.dygraph_highlight_after = undefined;
5702 + state.tmp.dygraph_highlight_after = null;
5703 Dygraph.startZoom(event, dygraph, context);
5704 }
5705 }
5706 else {
5707 if (event.shiftKey) {
5705 - // left mouse button selection for zoom (ZOOM)
5708 + //console.log('left mouse button selection for zoom (ZOOM)');
5709 +
5710 state.setMode('zoom');
5711 // NETDATA.globalSelectionSync.delay();
5708 - state.tmp.dygraph_highlight_after = undefined;
5712 + state.tmp.dygraph_highlight_after = null;
5713 Dygraph.startZoom(event, dygraph, context);
5714 }
5715 else if(event.altKey || event.ctrlKey || event.metaKey) {
5712 - // left mouse button highlight
5716 + //console.log('left mouse button highlight');
5717 +
5718 if (!(event.offsetX && event.offsetY)) {
5719 event.offsetX = event.layerX - event.target.offsetLeft;
5720 event.offsetY = event.layerY - event.target.offsetTop;
@@ -5718,10 +5723,11 @@ var NETDATA = window.NETDATA || {};
5723 Dygraph.startZoom(event, dygraph, context);
5724 }
5725 else {
5721 - // left mouse button dragging (PAN)
5726 + //console.log('left mouse button dragging (PAN)');
5727 +
5728 state.setMode('pan');
5729 // NETDATA.globalSelectionSync.delay();
5724 - state.tmp.dygraph_highlight_after = undefined;
5730 + state.tmp.dygraph_highlight_after = null;
5731 Dygraph.startPan(event, dygraph, context);
5732 }
5733 }
@@ -5730,12 +5736,16 @@ var NETDATA = window.NETDATA || {};
5736 if(NETDATA.options.debug.dygraph === true || state.debug === true)
5737 state.log('interactionModel.mousemove()');
5738
5733 - if(typeof state.tmp.dygraph_highlight_after !== 'undefined') {
5739 + if(state.tmp.dygraph_highlight_after !== null) {
5740 + //console.log('highlight selection...');
5741 +
5742 state.tmp.dygraph_user_action = true;
5743 Dygraph.moveZoom(event, dygraph, context);
5744 event.preventDefault();
5745 }
5746 else if(context.isPanning) {
5747 + //console.log('panning...');
5748 +
5749 state.tmp.dygraph_user_action = true;
5750 //NETDATA.globalSelectionSync.stop();
5751 //NETDATA.globalSelectionSync.delay();
@@ -5744,6 +5754,8 @@ var NETDATA = window.NETDATA || {};
5754 Dygraph.movePan(event, dygraph, context);
5755 }
5756 else if(context.isZooming) {
5757 + //console.log('zooming...');
5758 +
5759 state.tmp.dygraph_user_action = true;
5760 //NETDATA.globalSelectionSync.stop();
5761 //NETDATA.globalSelectionSync.delay();
@@ -5757,7 +5769,9 @@ var NETDATA = window.NETDATA || {};
5769 if(NETDATA.options.debug.dygraph === true || state.debug === true)
5770 state.log('interactionModel.mouseup()');
5771
5760 - if(typeof state.tmp.dygraph_highlight_after !== 'undefined') {
5772 + if(state.tmp.dygraph_highlight_after !== null) {
5773 + //console.log('done highlight selection');
5774 +
5775 if (!(event.offsetX && event.offsetY)){
5776 event.offsetX = event.layerX - event.target.offsetLeft;
5777 event.offsetY = event.layerY - event.target.offsetTop;
@@ -5766,7 +5780,7 @@ var NETDATA = window.NETDATA || {};
5780 context.isZooming = false;
5781 NETDATA.options.highlight_after = state.tmp.dygraph_highlight_after;
5782 NETDATA.options.highlight_before = dygraph.toDataXCoord(event.offsetX);
5769 - state.tmp.dygraph_highlight_after = undefined;
5783 + state.tmp.dygraph_highlight_after = null;
5784 dygraph.clearZoomRect_();
5785 dygraph.drawGraph_(false);
5786 NETDATA.globalPanAndZoom.setMaster(state, state.view_after, state.view_before);
@@ -5775,11 +5789,15 @@ var NETDATA = window.NETDATA || {};
5789 NETDATA.options.highlightCallback(true, NETDATA.options.highlight_after, NETDATA.options.highlight_before);
5790 }
5791 else if (context.isPanning) {
5792 + //console.log('done panning');
5793 +
5794 state.tmp.dygraph_user_action = true;
5795 //NETDATA.globalSelectionSync.delay();
5796 Dygraph.endPan(event, dygraph, context);
5797 }
5798 else if (context.isZooming) {
5799 + //console.log('done zomming');
5800 +
5801 state.tmp.dygraph_user_action = true;
5802 //NETDATA.globalSelectionSync.delay();
5803 Dygraph.endZoom(event, dygraph, context);
@@ -6020,6 +6038,7 @@ var NETDATA = window.NETDATA || {};
6038 state.tmp.dygraph_force_zoom = false;
6039 state.tmp.dygraph_user_action = false;
6040 state.tmp.dygraph_last_rendered = Date.now();
6041 + state.tmp.dygraph_highlight_after = null;
6042
6043 if(state.tmp.dygraph_options.valueRange[0] === null && state.tmp.dygraph_options.valueRange[1] === null) {
6044 if (typeof state.tmp.dygraph_instance.axes_[0].extremeRange !== 'undefined') {
web/index.html
+8 -3
@@ -895,8 +895,8 @@
895 icon = "window-restore";
896 }
897
898 - el += '<li id="registry_server_hosted_' + len.toString() + '"><a class="registry_link" href="' + url + '" onClick="return gotoHostedModalHandler(\'' + url + '\');">' + hostname + '</a></li>';
899 - a1 += '<li id="registry_action_hosted_' + len.toString() + '"><a class="registry_link" href="' + url + '" onClick="return gotoHostedModalHandler(\'' + url + '\');"><i class="fa fa-' + icon + '" aria-hidden="true" style="color: #999;"></i></a></li>';
898 + el += '<li id="registry_server_hosted_' + len.toString() + '"><a class="registry_link" href="' + url + '#" onClick="return gotoHostedModalHandler(\'' + url + '\');">' + hostname + '</a></li>';
899 + a1 += '<li id="registry_action_hosted_' + len.toString() + '"><a class="registry_link" href="' + url + '#" onClick="return gotoHostedModalHandler(\'' + url + '\');"><i class="fa fa-' + icon + '" aria-hidden="true" style="color: #999;"></i></a></li>';
900 hosted++;
901 i++;
902 }
@@ -925,7 +925,7 @@
925 while(len--) {
926 var u = machines[i++];
927 found++;
928 - el += '<li id="registry_server_' + u.guid + '"><a class="registry_link" href="' + u.url + '" onClick="return gotoServerModalHandler(\'' + u.guid + '\');">' + u.name + '</a></li>';
928 + el += '<li id="registry_server_' + u.guid + '"><a class="registry_link" href="' + u.url + '#" onClick="return gotoServerModalHandler(\'' + u.guid + '\');">' + u.name + '</a></li>';
929 a1 += '<li id="registry_action_' + u.guid + '"><a href="#" onclick="deleteRegistryModalHandler(\'' + u.guid + '\',\'' + u.name + '\',\'' + u.url + '\'); return false;"><i class="fa fa-trash-o" aria-hidden="true" style="color: #999;"></i></a></li>';
930 }
931 }
@@ -3928,6 +3928,11 @@
3928
3929 $('#myNetdataDropdownParent')
3930 .on('show.bs.dropdown', function () {
3931 + var hash = urlOptions.genHash();
3932 + $('.registry_link').each(function(idx) {
3933 + this.setAttribute('href', this.getAttribute("href").replace(/#.*$/, hash));
3934 + });
3935 +
3936 NETDATA.pause(function() {});
3937 })
3938 .on('shown.bs.dropdown', function () {