Skip to content

Realtime graph window is not resizing properly #3581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ahouston opened this issue May 28, 2020 · 3 comments
Closed

Realtime graph window is not resizing properly #3581

ahouston opened this issue May 28, 2020 · 3 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@ahouston
Copy link
Contributor

ahouston commented May 28, 2020

Realtime graph window not resizing

Realtime graph popout windows rely on the realtimePopout variable being true in order execute setRealtimeWindowSize().

realtimePopout is set twice as far as I can see, once in graph_realtime.php (var realtimePopout = true;) and again in realtime.js (var realtimePopout = false;)

Setting the realtime.js one to true fixes the resizing problem, but I'm not sure if the original intention was that the resize only happens when the window is a smaller than than the #rtfilter and #rimage elements?

If so, this one liner should only resize if the window is too small:

realtimePopout = $('#rtfilter').outerHeight() + 60 + $('#rimage').outerHeight() + 30 > window.innerHeight || $('#rimage').outerWidth() + 40 > window.innerWidth ? true : false;

If the window is too small then it will expand to fit the graph, if you manually resize it larger then it'll return false and keep the window size.

I put it in the .done handler after the graph is loaded and it seems to work fine:

$.getJSON(url)
		.done(function(data) {
			if ($('#rimage').length) {
				$('#rimage').attr('src', 'data:image/png;base64,'+data.data);
			} else {
				$('#image').html('<img id="rimage" class="realtimeimage" src="data:image/png;base64,'+data.data+'"/>');
			}

			realtimePopout = $('#rtfilter').outerHeight() + 60 + $('#rimage').outerHeight() + 30 > window.innerHeight || $('#rimage').outerWidth() + 40 > window.innerWidth ? true : false;
			 
			if (realtimePopout) {
				setRealtimeWindowSize();
...

To Reproduce

Steps to reproduce the behavior:

Start a realtime graph where the graph template size is sufficiently large that it won't fit in the default popped window size. I use 700x300 for example.

Expected behavior

The popup window should resize to fit the #rtfilter and #rimage elements

Desktop (please complete the following information)

  • OS: Windows 10

  • Browser Chrome

  • Version 81.0.4044.138 (Official Build) (64-bit)

@ahouston ahouston added bug Undesired behaviour unverified Some days we don't have a clue labels May 28, 2020
@netniV
Copy link
Member

netniV commented May 28, 2020

Seems a sound fix as far as I can see, I will have to verify what the intention was with the variable, but I suspect it was to set the window dimensions manually rather than just relying on the last browser state.

@netniV
Copy link
Member

netniV commented Jun 7, 2020

Have you submitted this as a PR yet?

TheWitness added a commit that referenced this issue Jun 13, 2020
Realtime graph window not resizing
@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Jun 13, 2020
@TheWitness
Copy link
Member

It was simple. I just fixed it.

@TheWitness TheWitness added this to the 1.2.13 milestone Jun 13, 2020
@netniV netniV changed the title Realtime graph window not resizing Realtime graph window is not resizing properly Jul 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants