GRNsight icon indicating copy to clipboard operation
GRNsight copied to clipboard

When no graph is loaded menu Export > Export Data > to Unweighted GraphML should NOT be available

Open kdahlquist opened this issue 6 months ago • 8 comments

I am going through the client-side testing document (#1158) on the wiki and discovered this issue.

When no graph is loaded menu Export > Export Data > to Unweighted GraphML should NOT be available. The rest of the options are properly grayed out, but not this one weirdly enough.

kdahlquist avatar Sep 04 '25 22:09 kdahlquist

I haven't officially opened a new branch but was just looking through the code and it seems like the export data to Unweighted GraphML option has the id unweightedGraphmlContainer. I'm not sure if the id is needed but when taken out, it is properly grayed out.

Amelie1253 avatar Sep 24 '25 16:09 Amelie1253

I deleted the id unweightedGraphmlContainer and checked that the id isn't used elsewhere. It doesn't seem to touch anything else and allows the Unweighted GraphML option to be properly grayed out. My only concern is that this id is in the upload.pug and if I remember correctly, that file isn’t supposed to be changed.

Amelie1253 avatar Oct 01 '25 05:10 Amelie1253

As referenced in #1244, I thought I had checked but I missed the reference to the id unweightedGraphmlContainer in grnstate where it is then labeled EXPORT_TO_UNWEIGHTED_GML_MENU in constants. EXPORT_TO_UNWEIGHTED_GML_MENU is then referenced in update-app where it listens for clicks. On each click, it checks the grnstate mode and if the mode is not a GRN, then it disables the Unweighted GraphML option. Otherwise, it removes the disabled class that was initialized on the unweightedGraphmlContainer id. This led to the issue of the Unweighted GraphML option not being disabled because the grnstate mode is initialized to GRN and removes the disabled class immediately. I have changed the initial value of the grnstate mode to null but this resulted in this error.

Image

For future work, I will look into an alternative solution such as checking something other than the grnstate mode, perhaps something that records whether or not something is being displayed and can be exported and then checking the grnstate mode.

Amelie1253 avatar Oct 05 '25 23:10 Amelie1253

The odd thing about this is that all of the other options for exporting are properly grayed out, it's just this one that is not. Would you be able to investigate why those are working properly?

kdahlquist avatar Oct 06 '25 19:10 kdahlquist

Sorry for the late response! Yes, the other options do not have the id unweightedGraphmlContainer, only the Unweighted GraphML option has the id. All options started disabled (grayed out) but since this id is used to check for the grnstate mode, the disabled class is specifically removed from the Unweighted GraphML option.

That does bring up a good question of when other options' disabled classes get removed. Perhaps, the Unweighted GraphML option should follow suit with when those options' disabled classes get removed. I will look into this!

Amelie1253 avatar Oct 15 '25 03:10 Amelie1253

It was pointed out during the meeting that element(s) involved also had CSS class names startDisabled, disabled, unweighted, and export: there is likely code elsewhere in update-app.js that impacts the elements involved via these other class names. @Amelie1253 will investigate these values to track down any other logic that may be affecting the enabled/disabled state

dondi avatar Oct 15 '25 17:10 dondi

For example, the constant EXPORT_WEIGHTED_CLASS matches elements with both CSS classnames weighted and export. The elements involved in this ticket are of the unweighted variety, but following/studying references to this constant may still lead to that code

dondi avatar Oct 15 '25 17:10 dondi

For this, @Amelie1253 will create a new branch because the current branch was created before @ceciliazaragoza renamed the web-client folder to web-client-classic

dondi avatar Oct 22 '25 17:10 dondi

To recap:

The issue was that the enabling of the Unweighted GraphML option was based on the grnstate mode. However, the grnstate mode is always initialized to a GRN and thus leads to enabling the Unweighted GraphML option before there is even any data.

I changed the functionality to check if there is data displayed by checking grnState.workbook and then enabling the Unweighted GraphML option.

Amelie1253 avatar Dec 02 '25 00:12 Amelie1253

Confirmed that this is fixed on beta v7.3.5, so closing.

kdahlquist avatar Dec 08 '25 20:12 kdahlquist