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

Show reverse relationships #3638

Merged
merged 4 commits into from
Aug 23, 2022

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Aug 19, 2022

Motivations

  • The relationships tab only shows the current mod's dependencies (etc.) on other mods, but some users may wish to browse other mods' dependencies (etc.) on the current mod, for example if they are trying to decide which mods would be the least disruptive to uninstall when trying to narrow down which mod is causing a bug in-game. This information is available via a dep:identifier search but not easily accessible.
  • The mod info control loads everything in the foreground, which can slow down response times when the user clicks a mod:
    • The relationships tab can take a long time to load fully if you use the new reverse relationships option described below because we have to search all mods and check them (see ModuleManager)
    • The contents tab can load slowly if a cached mod has a big ZIP with a lot of files (see BluedogDB)
    • The versions tab can load slowly if a mod has many versions and a lot of deep, complex dependencies because we have to check them to determine whether each version of the mod is installable (see RP-0)
  • The contents tab is a user-unfriendly flat list of long pathnames, despite the underlying data being tree-shaped
  • The relationships tab's thumb-up icon for recommendations is very heavy-looking in contrast to the other relationship icons, which makes it stand out more than it needs to:
    image
  • The relationships tab shows installed mods in a different format for no good reason (version and sub-relationships missing), and shows mods that conflict with installed mods as non-indexed:
    image

Changes

  • Now only the active tab of mod info loads initially to reduce CPU load, and the others load if you activate them
  • Now the relationships tab has a "Reverse relationships" checkbox:
    image
    When unchecked, the usual relationships are shown as before. When checked, the reverse relationships are shown instead and the checkbox will revert to unchecked when you switch mods. If you shift-click or ctrl-click, it becomes checked-and-gray (the indeterminate state), the reverse relationships are shown, and the state of the checkbox is "sticky" (persists when switching mods, for when the user wants to look at reverse relationships for many mods in a row)
  • Now the relationships tab is loaded in a background thread to keep the GUI responsive, and the mouse cursor will be an hourglass if hovered over it while loading. The grandchildren dependencies are loaded separately in yet more background threads, because they are the slowest part (especially for reverse relationships). We start one thread for each group of ten dependencies (because it flickers a lot if we update for each mod), and if the last group is smaller than ten, we combine it with the one before to reduce the chance of it finishing before the other groups. In practice this means you can scroll through the list and watch the + icons appear for nodes with children.
  • Now the relationships tab uses the outlined version of the thumb-up icon for recommendations, which will blend in better with the other icons:
    image
  • Now the relationships tab shows the version and sub-relationships for installed modules, and mods that conflict with installed mods are displayed normally
  • ModuleInstaller.GetModuleContentsList now returns an empty sequence instead of null if it can't find any files, to make it easier for System.Linq-style code to use it
  • ModuleInstaller.GetModuleContentsList now skips directories and only returns files, because otherwise we would need to know which entries are directories and which are files, and it's really hard to do that just from strings. We don't need the directories anyway.
  • Now the contents tab is loaded in the background to keep the GUI responsive, and the mouse cursor will be an hourglass if hovered over it while loading.
  • Now the contents tab displays a collapsible tree of the contents of the ZIP, with file, folder, and zipped-folder icons care of Google's Material Icons (as we did for the relationship icons in Fix missing entries in dependency graphs #2226, Apache 2.0 license):
    image
  • Now the top node of the contents tab shows the file name in cache instead of the mod name for cached mods, since this information wasn't otherwise available in the GUI
  • Now the top node of the contents tab shows both the name and version for uncached mods, since the version may be useful
  • Now the fast part of the mod versions list, the text, is loaded in the foreground, and the slow part, the colors indicating compatibility, is loaded in a background thread to keep the GUI responsive, and the mouse cursor will be an hourglass if hovered over it while loading. In practice this means you can watch the rows turn green one at a time for mods that load slowly.
  • Very minor unrelated usability improvement, the columns in the changeset tab now resize themselves to fit the contents, so you don't need to resize them manually to read long strings

After these changes, there is no noticeable delay when you click a row in the main mod list.

Fixes #3616.

@HebaruSan HebaruSan added Enhancement GUI Issues affecting the interactive GUI Pull request Relationships Issues affecting depends, recommends, etc. labels Aug 19, 2022
@HebaruSan HebaruSan force-pushed the feature/reverse-relationships branch 2 times, most recently from dbc6a81 to 5b82eed Compare August 20, 2022 15:01
@HebaruSan HebaruSan force-pushed the feature/reverse-relationships branch 2 times, most recently from fb115e2 to 4b45bdd Compare August 21, 2022 17:34
@HebaruSan
Copy link
Member Author

@tjanke42, FYI, we got some feedback that the tri-state UI was a bit confusing as-is, and I agreed, so I've changed it so the checkbox works normally unless you ctrl-click or shift-click it, in which case it goes to the special "sticky" state.

@HebaruSan HebaruSan force-pushed the feature/reverse-relationships branch from 4b45bdd to cc7b2f4 Compare August 21, 2022 21:53
@HebaruSan HebaruSan force-pushed the feature/reverse-relationships branch from cc7b2f4 to 2ab9837 Compare August 22, 2022 00:04
Copy link
Member

@techman83 techman83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really neat, constrained PR. LGTM 🎉

@HebaruSan HebaruSan merged commit c392fa1 into KSP-CKAN:master Aug 23, 2022
@HebaruSan HebaruSan deleted the feature/reverse-relationships branch August 23, 2022 06:37
@tjanke42
Copy link

Damn, you guys are awesome. Based on the comments, that's a lot of work you did, HebaruSan. I appreciate it very, very much. You da man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement GUI Issues affecting the interactive GUI Pull request Relationships Issues affecting depends, recommends, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Show reverse relationships
3 participants