Add option to instantly go to new container? #3538
Replies: 26 comments
-
Maybe the options should be
I have seen this happen too. But I am not sure why. The redirect happens in javascript so the tab needs to be active. Can you help out and figure out when it doesn't work? The code is pretty simple. dozzle/assets/components/LogViewer/ContainerEventLogItem.vue Lines 47 to 58 in 513e511 It also only works with containers not swarm. I don't use this often so if you use it a lot then help make it better. ❤️ |
Beta Was this translation helpful? Give feedback.
-
Perfect :)
Maybe that's what it is. I'll have to pay closer attention, since I do a ton of tab switching. Maybe the js can keep checking if the tab is active and only do the switch when it is. That way even if tab isn't active during the container shutdown/restart it'll still switch once the js detects the tab is active no matter how much time elapses? I don't really know much js so I'm just thinking outloud. |
Beta Was this translation helpful? Give feedback.
-
@amir20 why are you checking for |
Beta Was this translation helpful? Give feedback.
-
Hey @FrancYescO. I missed this comment. You are right that I look for Is that what you think is happening? If you can think of an example of where "running" is not what the user wants then a quick PR is easy. |
Beta Was this translation helpful? Give feedback.
-
yes, or maybe is sloooowly starting, as the check for redirect is done at a specific time (at +5s from the exit of the old container?) and not "waiting for the new container running" maybe redirect to a container that have a newer create date (if any), ignoring the state is the best thing to do.. for the scope of the issue maybe having the actually hardcoded 5000 value configurable from settings is enough... putting it to 0 and the redirect will be instant. ;) |
Beta Was this translation helpful? Give feedback.
-
That's not what's happening. That piece of code is reactive, and it gets triggered every time a container's state changes. This could occur 15 seconds later, causing the The hardcoded value is simply a UI wait time. |
Beta Was this translation helpful? Give feedback.
-
So assume there are 2 edge case that does not trigger the redirect if i got it right: the actual container gets destroyed before the new one go in the running status (this is pretty standard during portainer stack redeploy) and simply if the new container crashes/go in a restart loop on start |
Beta Was this translation helpful? Give feedback.
-
@FrancYescO while doing some testing I noticed some times it was in a bad state. When your container stops, do you see a "container stopped" component? The log that does the forwarding is inside that component. I noticed some times it wasn't showing up correctly. I think I fixed it in #3445 Can you try |
Beta Was this translation helpful? Give feedback.
-
thinking about it, maybe sometime this not popupped, but just done a container update via portainer, the component correctly popupped, but i was not redirected to the new container (i was on another tab, but i dont think this matters i never get redirected while portainer updates a container, maybe becouse while stopped the old container, the new one is still not renamed) btw i'll see if something changes with #3445 |
Beta Was this translation helpful? Give feedback.
-
Hmm. I have been doing
Dozzle should redirect to the new one. |
Beta Was this translation helpful? Give feedback.
-
This is an example test case where you will be not redirected (also with #3445):
PS: not used echo container cause: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v3) |
Beta Was this translation helpful? Give feedback.
-
Interesting 🤔 This should work because I added support for rename. But I haven't tested the redirect. Your directions help so let me try it out. |
Beta Was this translation helpful? Give feedback.
-
It didn't for me either. I think the problem is |
Beta Was this translation helpful? Give feedback.
-
Maybe adding a "container created/started/renamed" stub logs (like the stopped one) and attach the logic to these? Btw try to have the browser dozzle tab not as the active one (but for me seems not working also when the tab is active) |
Beta Was this translation helpful? Give feedback.
-
I think I fixed it by updating the logic for created. #3446 Can you try |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, the redirect does occur in JavaScript. This behavior depends on the browser. I'll try to reproduce it in Chrome, but it's challenging because the browser may terminate the JavaScript at any time. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I was not. I didn't think that makes a difference. The problem is I don't have all containers enabled. But I can enable it. Question to you, is a container dying right away a valid use case? Do you start a container, it dies and then start a new one again?
That's right. Easy fix when I get to it. |
Beta Was this translation helpful? Give feedback.
-
Ah, this makes sense because of I think it would be helpful to understand your use case. Are you using |
Beta Was this translation helpful? Give feedback.
-
I have 2 cases when this happens:
In both cases i think is preferable being redirected to the newest logs PS. The "container stopped" label, if you click on an already stopped container shows the actual timestamp instead of timestamp when the container was really stopped, this is a little misleading I don't know if can have his part of culprit in this issue |
Beta Was this translation helpful? Give feedback.
-
I see. Those use cases make sense. But I think now I remembering why it was implemented this way. 😟 Imagine With the PR at #3446 I have removed running as a requirement. Give it a try. I am not sure how it will work out, I think it will need a little more testing.
It's a little wacky right now. I could find when the container exited. Instead, I just use when the stream received Can you test #3446 again? You'll have to play around with it to make sure it works. |
Beta Was this translation helpful? Give feedback.
-
The instant redirect indirectly solve this issue :D but maybe, the best thing to do when delayed is to reset the timer of the ongoing redirect and follow the new one if any newer found (but hey, here we are just restarting the cointainer, not recreating that changes the ID, so the redirect should work and this case should of new instances found should be very limited) |
Beta Was this translation helpful? Give feedback.
-
basically looks it's working, noticed a bug: if stopped (restarted) multiple time, the redirect will happen multiple times :D |
Beta Was this translation helpful? Give feedback.
-
D'OH. Not sure how to fix it though. The two rows are isolated so they have no knowledge of each other. |
Beta Was this translation helpful? Give feedback.
-
just ignore it, nothing really important :P maybe this redirect can be moved in the future to some other component not related to the stopped row.. |
Beta Was this translation helpful? Give feedback.
-
I have merged for now. Thinking about this a little more, if the IDs are the same then the popup shouldn't show up. But for now I'll leave as is. I won't be releasing a new version until next week. Meanwhile, |
Beta Was this translation helpful? Give feedback.
-
I have the 'auto-redirect to new container w/matching name' option checked (works about half the time), and I'd also love to have it do so immediately w/out the delay it currently has. (the dialog showing there's a matching container, with the progress bar on the button).
When working on building images, and doing tweak after tweak with a million restarts, the delay slows the flow. :)
Beta Was this translation helpful? Give feedback.
All reactions