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

Software checkboxes do not react after deactivate network link #1962

Closed
jreidinger opened this issue Jan 31, 2025 · 9 comments
Closed

Software checkboxes do not react after deactivate network link #1962

jreidinger opened this issue Jan 31, 2025 · 9 comments
Assignees

Comments

@jreidinger
Copy link
Contributor

Way how to reproduce it:
go to software section and change patterns. Now deactive "active" link in VM and as result it clicks on checkboxes are ignored. Search field still works.

@dgdavid
Copy link
Contributor

dgdavid commented Jan 31, 2025

Unless I'm missing something, I'd say this an expected behavior, since these checkboxes are actually performing a PUT request against the /api/software/config. It's the only selection screen where Agama behaves in that way by the nature of the software selection design: every time user selects a pattern it has to calculate the dependencies and reflect the auto selected ones.

Something I'd like to change, but don't know either, how nor when. I believe it'd require changes at the bakend.

What we could do meanwhile is to disable the selection when Agama detects there is not network connection, and show an alert to hint the user Agama has lost connection. Indeed, would be nice to always alert user when connection has lost, unless you're using an offline medium.

@jreidinger
Copy link
Contributor Author

Forgot to mention that it is on full offline medium with repos in /install. I also do not see any PUT request in network tab in dev tools...it looks like all network traffic is stopped

@dgdavid
Copy link
Contributor

dgdavid commented Jan 31, 2025

Weird.

Not sure if related, but @imobachgs adjusted the TanStack Query network mode in #1909

@imobachgs
Copy link
Contributor

@dgdavid I would expect the opposite: the network mode is set to always when running on localhost, so it should always perform the queries. I observed that the GET requests are performed (all of them), but not the POST or PUT calls. So perhaps it is a good starting point.

The problem happens on other screens, too (e.g., in the localization settings).

@imobachgs
Copy link
Contributor

In the client options, there is an additional key mutations that works like the queries one. So according to a quick test, I would say that something like this in app.tsx would fix it:

const queryClient = new QueryClient({
  defaultOptions: {
    mutations: {
      networkMode: networkMode(),
    },
    queries: {
      networkMode: networkMode(),
    },
  },
});

@dgdavid thanks for pointing to the network mode stuff 😄

@dgdavid

This comment has been minimized.

@imobachgs imobachgs self-assigned this Jan 31, 2025
@imobachgs
Copy link
Contributor

agama/web/src/components/software/SoftwarePatternsSelection.tsx

Line 116 in 5489764
selected[name] = pattern.selectedBy === SelectedBy.NONE;

But I do not have clear the big picture of the patterns selections right now. Will continue investigating it later.

It does not happen only in the software selection screen but also elsewhere. For instance, once you get disconnected, try changing the language of the target system. You will see that it performs the GET calls but not the PUT/PATCH.

Of course, there might be additional problems in the software selection screen, but I would say they are not what this report is about.

#1963 should fix the original problem.

@dgdavid
Copy link
Contributor

dgdavid commented Jan 31, 2025

Sure, the problem seems to be the mutations connection mode, not with the selection algorithm that works nicely when there is connection. Thanks for the fix.

@imobachgs
Copy link
Contributor

The fix has been merged.

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

No branches or pull requests

3 participants