Skip to content
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

uiReShowItemEx() does not work properly #7

Closed
3 tasks
roval2 opened this issue Apr 26, 2019 · 23 comments
Closed
3 tasks

uiReShowItemEx() does not work properly #7

roval2 opened this issue Apr 26, 2019 · 23 comments
Assignees
Labels
Status: Needs Review Needs to be reviewed. Type: Bug Something is not working.

Comments

@roval2
Copy link

roval2 commented Apr 26, 2019

Expected Behavior

My understanding of a database refresh is that the current item with its properties and all relationships will be loaded into the current form.

Actual Behavior

Not all relationships will be updated.
Only the current active relationship tab in the form will be refreshed.

Steps to Reproduce

How can we test this issue?

  1. Open an old superseded version of a Part item. The item has "Part BOM" and "Part CAD" relationships. The relationships contain old item versions.
  2. Press the Refresh button
  3. The current version of the item will be loaded. But only the current active relationship tab will be updated (Part BOM). The "Part CAD" relationship tab will not be refreshed - still the old version of the CAD item will be displayed! All other existing relationships in the form (eg. Part Document, etc.) will also no refreshed!

Environment Details

Aras Innovator

  • Major version: 11.0
  • Service pack(s): SP12

Browsers

  • Internet Explorer 11
  • Firefox ESR
  • [x ] Chrome
  • Edge

Project Version

What version of this project are you using? Ex: v1.1.0

Additional Details

Workaround / Solution

Have you found a workaround or solution to this issue?

Collaboration

Are you willing to collaborate on this feature? Ex: sharing code, submitting a pull request, testing, etc.

@roval2 roval2 closed this as completed Apr 26, 2019
@AngelaIp
Copy link
Contributor

Hi roval2,
why did you close this issue? Were you ale to solve it so fast? :-)
It´s a real good question, I also face this behaviour sometimes and the only solution right now is reopening the part. It´s really confusing for the enduser, espcially when revised an Item with null-relationships. The relationship looks like before, but users cannot update the relationship, as Aras still assumes they are the previous one.
I had extended by revision Methods to avoid users run into this situation, but it still sometimes happen.
Regarding this project, I use a customized version of therefresh from db button that sticks to the current version. It´s easy to do in the Method, let me know if you need more information. I would be happy about additional testers!
Angela

@roval2
Copy link
Author

roval2 commented Apr 29, 2019

Hi Angela,
i have unintentionally closed it, the issue is still open...

Yes, reopening the item would be a workaround but works only when a newer version of the item exist. When revising an item or want refresh the current version of the open item it does not work.
It seems to be a malfunction in the uiReShowItemEx() and i think this bug must be adressed to Aras.

I am interested in you customized solution, can you tell me details?

--Ronald

@roval2 roval2 reopened this Apr 29, 2019
@roval2 roval2 changed the title [BUG] uiReShowItemEx() does not work properly Apr 29, 2019
@AngelaIp
Copy link
Contributor

Hi roval2,

in the past I never assumed that the uiReShowItemEx could be the problem for the sometimes not working update. But it sounds logical. From my POV, espcially NULL-relationships sometimes make trouble.
Which version of Aras do you use? In my new SP15 version, things somehow seems to work a little bit more reliable.

In my version, I simplified the generation function in this project so it sticks to the current generation:

var generation = function(){
        // Refresh the current generation
        var itemID = doc.itemID;
        var itemType = doc.thisItem.getType();
        var oldPart = inn.newItem(itemType, "get");
        oldPart.setID(itemID);
        oldPart = oldPart.apply();       
        doc.thisItem = oldPart;
        aras.uiReShowItemEx(oldPart.getID(), doc.thisItem.node);
    };

For updating a part when using the manual revise option, I have added an additional Method to the PE_CreateNewRevision Action as "On Complete" event. It basically does the same as the DbRefresh button, but is automatically triggered after the Action is completed:

var inn = this.getInnovator();
var parentItm = this.getType();
var parentID = this.getID(); 
var configID = this.getProperty("config_id");

var currentItm = inn.newItem(parentItm, "get");
currentItm.setProperty("config_id", configID);
currentItm.setAttribute("select","id");
currentItm.setProperty("is_current", "1");
currentItm = currentItm.apply();

aras.uiReShowItemEx(parentID, currentItm.node); // Form + Tabs

This version worked 80% reliable in the past. uiReShowItemEx() sometimes failed, when the manual revision Actions is triggered several times in a row. But this normally doesn´t happen in reality, as nobody creates new revisions without a reason.

Angela

@roval2
Copy link
Author

roval2 commented Apr 30, 2019

Hi Angela,
thanks for your explanation and code.
The problem is a "refresh form the database" must work for 100%. Otherwise the user can never be sure that he see the current data and must close and reopen the item.
It lokks like a malfunction with uiReShowItemEx() - not all relationship tabs will be updated. We have updated to 11SP12 and in 11SP5 everything works properly and as expected with this function.
Hopefully someone from Aras is reading this and has a 100% "refresh from database" solution...
--Ronald

@EliJDonahue EliJDonahue added Status: Pending Work has not yet begun. Type: Bug Something is not working. labels Apr 30, 2019
@cgillis-aras
Copy link
Collaborator

Hello,

This should be fixed now in 87a0168. The issue was that the relationships frame was caching a copy of the parent item ID when the form was loaded and was using that cached ID to determine which relationship items were displayed when the user selected a relationship tab. I added some code that updates this cached copy of the ID to the most current ID when a user clicks on the refresh from database button.

@roval2
Copy link
Author

roval2 commented May 1, 2019

..thanks for the workaround.
I have tested that and seen that it works not as expected in any cases.

Our situation:
Dependent of the item state (Released, Superseded,…) we hide the tabs that contains no data. Otherwise the user has to klick into 12 tabs to see if something is attached.
The hide of the empty tabs is done in a OnFormPopulate method.
Now the parent.relationships.reload(queryString) in your workaround will unhide all hidden tabs.
Is it possible to reload only the not hidden tabs (querystring)?

In addition:
The uiReShowItemEx() is often used in methods, that would mean the workaround must be applied everywhere in the code!
Is this a known issue/bug in 11SP12 because in 11SP5 the uiReShowItemEx() works properly?
Thanks, Ronald

@cgillis-aras
Copy link
Collaborator

Hi Roval,

Thank you for the information. I'll reopen this issue, and investigate the case where hidden tabs exist on the from. Triggering a normal refresh will also trigger any OnFormPopulate events, so I believe this may just be an issue of the order in which I'm calling my functions. (I'm currently reloading the relationships grid after I refresh the form)

In regards to your second point about uiReShowItem(), I'm not aware of any standard issues with this function. The issue I was seeing should be specific to this project as we're trying to reload a different version of the item with a different ID into the same window. The standard refresh button will reload the same version of the item with the same ID into the window, so the issue I ran into with the relationship grid caching a copy of the item ID shouldn't cause any problems.

Are you seeing an issue using uiReShowItemEx() outside of this project? If so, could you describe that in more detail?

Thank you,

Chris

@cgillis-aras cgillis-aras reopened this May 1, 2019
@cgillis-aras cgillis-aras added Status: In Progress Someone is working on this. and removed Status: Pending Work has not yet begun. labels May 1, 2019
@cgillis-aras
Copy link
Collaborator

Hi Roval,

Would you be able to share the code that hides the tabs in your Form? I was unable to reproduce the issue using the sample code form this project

@cgillis-aras cgillis-aras added Status: Needs More Info Needs more detail. and removed Status: In Progress Someone is working on this. labels May 1, 2019
@roval2
Copy link
Author

roval2 commented May 1, 2019

see attached file...
HideTabsOnPartForm.txt

@cgillis-aras cgillis-aras added Status: Done Work is complete. and removed Status: Needs More Info Needs more detail. labels May 1, 2019
@cgillis-aras
Copy link
Collaborator

Thanks! I was able to reproduce the issue using that logic. I updated the order in which the refresh runs so the relationships are reloaded before the form is refreshed, and that seemed to resolve the issue on my end. Should be fixed in the latest commit now: 8e73835

@roval2
Copy link
Author

roval2 commented May 1, 2019

Thank you i will check that fix...

Regarding you question if i can see this problem also outside of this project.
Yes
I have found 27 methods in our database that use the uiReShowItemEx() function.
For example we call this function always when executing server methods that do changes on the item or relationships (eg. Update BOM) and then refresh the form so that the user can see the changes.

We have also the refresh problem when doing a revise in the items form.
I assume that the internal revise action is also calling the uiReShowItemEx().
This function will often called in the aras standard js libraries (codetree: javascript folder) - so i think this is a problem.

I don't know what has changed in 11SP12, but we never had this refresh problem in 11SP5 and before.
I can say this because we have since the version 10 our own refresh function that is very similar - but as a action not a button.

Thanks, Ronald

@roval2
Copy link
Author

roval2 commented May 2, 2019

Hi, i have tested your fix and seen that this does not work.

  1. the relationships will not be updated.
  2. in some situations (when the current item is Preliminary) the tabs exits 2 times in the tab bar.

Please see the attached video:
Open an old version and press refresh.

refresh does not work.zip

As already mentioned I suspect a general problem with uiReShowItemEx()...
--Ronald

@EliJDonahue EliJDonahue added Status: Needs Review Needs to be reviewed. and removed Status: Done Work is complete. labels May 2, 2019
@EliJDonahue EliJDonahue reopened this May 2, 2019
@roval2
Copy link
Author

roval2 commented May 9, 2019

something new with this issue?

@cgillis-aras
Copy link
Collaborator

Hi Ronald,

I haven't been able to reproduce the issue where the relationships are not updated; however, I was able to resolve the issue where the tabs would duplicate by wrapping the code from your method that makes tabs visible inside of a condition like so:

if (!isVisible)
{
    parent.relationships.relTabbar.setTabVisible(tabId, isVisible);
}

If you continue seeing issues with tabs, I'd recommend looking into your method to see if there's some logic that can be changed to resolve the issue. I'd like to limit the amount of physical manipulation of the relationships grid performed inside of the Refresh method of this project since I'm not sure this is typical use case.

To your point about the uiReShowItemEx method, I want to reiterate this project is a special use case, so I don't think the problem you're seeing lies with this function. That being said, as you're a subscriber, you can contact our Support team with any concerns you have about this function.

Please let me know if the suggested code change above resolves your issue.

Chris

@AngelaIp
Copy link
Contributor

AngelaIp commented Jun 4, 2019

Hi Ronald and Chris,
what is the current status of this issue? I tried to follow the last discussion and tried the lasted available code in my own database.

The relationship refresh with the extended seems to work well. But I also face the problem with hidden tabs that will unhide as soon users trigger the update from db button. I tried to improve the sequence of the called Methods, but without any success yet.

I frequently got people asking me, why they don´t have the right permission to edit new part revisions. It´s most of the time related to the missing update of the relationships, so I would be more than happy to find helping a solution here!

@roval2
Copy link
Author

roval2 commented Jun 5, 2019

...yes this is ugly!
There is a big refresh problem in the GUI. The use must press everytime the refresh button when he select another relationship tab! The user can not trust the displayed data!
This happens also in other functions with the uiReShowItemEx (eg. revise). My opinion is that it's up to Aras to find the root cause of the problem and fix it.
We have not seen this problems with the uiReShowItemEx in the version 9, 10 and 11SP5.

@cgillis-aras
Copy link
Collaborator

Hi Angela,
In terms making this project work with hidden tabs, I'd recommend looking into the code that runs in your system which hides the tabs to see if there's some modification you can make to the logic to resolve the issue. In my investigation into Ronald's code, I noticed the issue seemed to occur when tabs were being made visible again. It seems that if the setTabVisible function is called on the same tab twice, it will appear in the relationship grid twice.

Ronald,
Could you please provide steps to repeat the issue that you're seeing? The uiReShowItemEx function is expected to be called from standard actions like the built-in refresh button, and in that case, I'm not seeing any issue in my local environment with relationships not updating properly. Here's the steps I used.

  1. Open an existing Part
  2. Make sure the Part BOM tab is selected
  3. Using Nash, add a Part Document relationship to the opened Part
  4. Click the standard refresh button
  5. Navigate to the Part Document tab

When following these steps, the new Part Document relationship is visible as expected. Are you seeing different behavior?

@roval2
Copy link
Author

roval2 commented Jun 5, 2019

steps to reproduce:

  • open an old version of an item
  • press refresh
  • only the current visible tab will be refreshed
    The user must do a manual refresh for all other tabs!

see this video:
Refresh does not work.zip

@cgillis-aras
Copy link
Collaborator

Hi Ronald,

Are you able to reproduce this issue with standard product functionality like the built-in refresh button?

Chris

@roval2
Copy link
Author

roval2 commented Jun 5, 2019

Hi Chris,
the video is from our production system with the standard installation of the refresh-from-database package. does this answer your question or do you mean something else?
Ronald

@AngelaIp
Copy link
Contributor

AngelaIp commented Jun 5, 2019

Hi,
I so far was able to achieve a positive result with the additional code provided by Chris. I yesterday had the problem, that hidden relationships were unhided after triggering the Refresh From Db button. I noticed that my Method I used for hiding the relationships was just triggered with an onLoad event. I changed this one to a onFormLoad event and was able to achieve a positive result. I use the custom code also for refreshing the Form and relationships after manual versioning.

Regarding the updated of the not focused relationships: In my case ALL relationships were updated not just the selected one! For testing I changed a property in a non-visible relationship directly in the SQL database. During my test the update worked well. All relationship were forced to update themselves.

@roval2: What puzzles me in your video: You open a Part and have to click the refresh from db button to update the relationships. Why are the relationships not already up-to-date when you open a part?
Are all you 200500 articles versions of each other? How did you manage to show the non-current Parts in the grid? The Refresh from db button, will automatically update your Part to the latest version of your part.
In other words: You opend version 1, but by refreshing it you will see version 3. Is this really the behaviour you want to have?
I discribe something simliar in this issue: #3
In my case, I changed the Refresh from db button to stick to the original version.

@ Edit: I also tested the fresh from db button from an old version of an item. All tabs were refreshed as expected. But as mentioned before, I use a customzied version of the original Method. But I already mentioned the customzations above.

@roval2
Copy link
Author

roval2 commented Jun 26, 2019

...i got the Patch-079104 from the support.
This resolves the issue with the "relationships will not be updated".
Now it works as expected, no workaround is neccessary.

@cgillis-aras
Copy link
Collaborator

I'm happy to hear you got the issue resolved. 🙂 I'm going to go ahead and close this issue then if no additional workaround is needed from the project code itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review Needs to be reviewed. Type: Bug Something is not working.
Projects
None yet
Development

No branches or pull requests

4 participants