Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

On tab stale event, don't refresh tabs which are queryOnLoad but are not the active tab #795

Closed
teosarca opened this issue May 25, 2017 · 17 comments

Comments

@teosarca
Copy link
Member

Type of issue

Bug

Steps to reproduce / Expected behavior

  • open a role, e.g. https://w101.metasfresh.com:8443/window/111/1000056
  • click on some tabs => remark when tab is activated, frontend asks for tab data, so those are queryOnLoad tabs.
  • Check/Uncheck the "Active" flag, to provoke tab stale events
    In network tab, take a look at what happened.
  • frontend PATCHED the document and as a response he got tab stale events.
  • frontend queried all of them => NOK: it's pointless and inefficient because as soon as you will click on a tab the tab will be queried again.

image

This is a follow-up of #769

@teosarca teosarca added this to the 2017-22 milestone May 25, 2017
@Dunkat Dunkat self-assigned this May 26, 2017
@damianprzygodzki
Copy link
Contributor

damianprzygodzki commented May 26, 2017

@teosarca we were thinking about the solution, that in the moment of update (patch response processing or modal closing) we have no information (or access is really expensive) if tab is queried on activate (update relays on data, queryOnActivate is the case of layout), what do you say if you would send us, exactly that tabs that should be marked as stale?

@teosarca
Copy link
Member Author

hmmm, let me think about it... but sounds good.

@cadavre
Copy link
Contributor

cadavre commented May 30, 2017

Waiting for API – i.e. send only

exactly that tabs that should be marked as stale

@cadavre cadavre modified the milestones: 2017-24, 2017-22 May 30, 2017
@teosarca
Copy link
Member Author

teosarca commented Jun 2, 2017

UPDATE:
I thought about this topic and I think the backend shall notify about ALL tabs that become stale.

Reason:
Imagine your current active tab has queryOnLoad.
Frontend patches the header document and let's suppose that tab becomes stale.
If the backend would not send this information (because the tab is queryOnLoad), the frontend would have no idea that it needs to refresh that tab right away (because it's active).

wdyt?

@damianprzygodzki
Copy link
Contributor

damianprzygodzki commented Jun 2, 2017

In my opinion, we want to make optimization that in total cost is less efficient than before.

QueryOnActivate is part of layout, passing it to protocol GENERATING PATCH -> PROCESS RESPONSE is very antipattern.

If we want to make patch response responsible for such a things like managing window layout and data, refreshing tabs and so on, we have to rebuild our protocol, create some sort of service that is responsible for responses processing, it has to live at low level of application, and it cant be static, because we have to be connected to model.

Still i dont know that it is good idea. We have really lightweight solution now, and i want to keep it as it is for performance and pattern.

Btw. refreshing tabs should be made the same as it is for Document List updating by WS? Patch response is update (originally) for the document that was origin of that change.

@cadavre
Copy link
Contributor

cadavre commented Jun 2, 2017

What I believe Teo has in mind is that only front-end knows which tab is currently opened – this way QueryOnActivate/queryOnLoad can be considered to refresh or not and decision is on front-end side. I'm not aware of implementation though, just trying to find logical explanation.

I would be +1 for utilizing WS since we have it in the system...

@teosarca
Copy link
Member Author

teosarca commented Jun 2, 2017

I would be +1 for utilizing WS since we have it in the system...

(Was also considering WS, but i think that's another topic because then we need to think and implement a WS endpoint for each document.. else it would be to much noise....)

But even with the WS, the requirement stays: if u got a tab stale notification from websocket and that tab is QueryOnActivate/queryOnLoad and it's not active then don't refresh it.

@teosarca
Copy link
Member Author

teosarca commented Jun 2, 2017

In my opinion, we want to make optimization that in total cost is less efficient than before.

Not so sure about that. Precisely for a case like the one that i've described in the issue summary,
e.g. https://w101.metasfresh.com:8443/window/111/1000055 ,

how much we would save in terms on time and bandwidth it's not so neglectable i would say.
take a look:
image

@damianprzygodzki
Copy link
Contributor

But even with the WS, the requirement stays: if u got a tab stale notification from websocket and that tab is QueryOnActivate/queryOnLoad and it's not active then don't refresh it.

But there is no problem. WS are connected strictly to component. Responses from patch not.

@teosarca
Copy link
Member Author

teosarca commented Jun 2, 2017

Btw. refreshing tabs should be made the same as it is for Document List updating by WS? Patch response is update (originally) for the document that was origin of that change.

Agree, but when we will have the "one WS endpoint for each document" feature implemented.
I think that's not a feature we could sneak in as a part of a fix/optimization.

@damianprzygodzki
Copy link
Contributor

damianprzygodzki commented Jun 2, 2017

Do you want to rebuild important and big node in whole structure in front-end, instead of improving it by WS? I think that with these "quickfixes" we are breaking separation of concerns that we tried hard to keep.

@teosarca
Copy link
Member Author

teosarca commented Jun 2, 2017

let's talk when you have time. I don't see it so dramatic.

@cadavre
Copy link
Contributor

cadavre commented Jun 6, 2017

After discussions, we have two options, both would probably take same amount of time.

  1. Make front-end implementation which would require refactor of tab components to achieve refreshing of currently active tab.
  2. Utilize WS to inform about windows/documents/tabs that has changed in-the-background. This is currently used for gridviews and – as agreed – this is way to do in future.

Both implementations are not small, both are "not a feature we could sneak in as a part of a fix/optimization" actually. :)

Of we go with 1st option – we will make things two times, because finally we all want to use WS. :)

@cadavre
Copy link
Contributor

cadavre commented Jun 6, 2017

@teosarca please provide some info about future implementation on agreed WS.

@teosarca
Copy link
Member Author

teosarca commented Jun 7, 2017

API provided and documented here: metasfresh/metasfresh-webui-api-legacy#435 (comment)

@teosarca
Copy link
Member Author

teosarca commented Jun 7, 2017

API ready and rolled out on w101

metas-ts added a commit to metasfresh/metasfresh that referenced this issue Jun 14, 2017
[#878](metasfresh/metasfresh-webui-frontend-legacy#878) Error firework when logout
[#880](metasfresh/metasfresh-webui-frontend-legacy#880) Change Icon for URL Link
[#881](metasfresh/metasfresh-webui-frontend-legacy#881) Error when pressing Action Menu in Collapsible Grid Window
[#883](metasfresh/metasfresh-webui-frontend-legacy#883) hu editor doesn't update
[#451](metasfresh/metasfresh-webui-api-legacy#451) Provide view sticky filters to be displayed by frontend
[#456](metasfresh/metasfresh-webui-api-legacy#456) Outbound Mail endpoint prototype
[#1807](#1807) Fix "Create primary key" process
[#879](metasfresh/metasfresh-webui-frontend-legacy#879) Avatar Picture not deleted from Header when cleared in Profile Settings
[#1802](#1802) picking terminal is not opening
[#436](metasfresh/metasfresh-webui-api-legacy#436) Manufacturing Order Issue not possible after barcode filtering
[#453](metasfresh/metasfresh-webui-api-legacy#453) Password process parameters shall allow showing the password
[#849](metasfresh/metasfresh-webui-frontend-legacy#849) manufacturing order doesn't open
[#437](metasfresh/metasfresh-webui-api-legacy#437) Load/ Reload of delivery Days window takes too long.
[#446](metasfresh/metasfresh-webui-api-legacy#446) Cannot open the menu when logged in as System Administrator
[#433](metasfresh/metasfresh-webui-api-legacy#433) Show Manufacturing Order number in window header
[#1793](#1793) fix jasper document for vendor returns
[#848](metasfresh/metasfresh-webui-frontend-legacy#848) notifications don't update
[#400](metasfresh/metasfresh-webui-api-legacy#400) minimum password length error message not displayed
[#444](metasfresh/metasfresh-webui-api-legacy#444) Make Dashboard Translatable
[#447](metasfresh/metasfresh-webui-api-legacy#447) Truncate WEBUI_ViewSelection tables on startup
[#847](metasfresh/metasfresh-webui-frontend-legacy#847) Loading of empty delivery Days Window take long
[#1735](#1735) istransferwhennull not working in webUI but in java client
[#1748](#1748) Project Documentation: Screenshots
[#795](metasfresh/metasfresh-webui-frontend-legacy#795) On tab stale event, don't refresh tabs which are queryOnLoad but are not the active tab

me-45
@metas-rc
Copy link
Member

Results of IT

Tested on webui

  • Went to a Role enty, opened it in single view
  • => OK: Only the first internal tab was refreshed and displayed in the inspection
  • Clicked on another tab
  • => OK: Only the tab I clicked on was refreshed and displayed in inspection
  • Deactivated / Activated the record
  • => OK: Only the internal tab I selected was refreshed and displayed in the inspection

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants