Repository navigation
Conversation
Member
|
I don't think we need this frontend change. Disconnecting active sessions when a device is disabled should be handled entirely by the server. The web app should only need to save the device's disabled state. |
Author
|
Closing this one, as you said: disconnecting a disabled device should be handled entirely by the server, so no frontend change is needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Disabling a device only prevents new connections; sessions that are already established keep reporting. The server change (traccar/traccar#6150) closes those sessions automatically and exposes
POST /api/devices/{id}/disconnectfor manual use.This change makes the web app call that endpoint when a device is saved with
disabledenabled, so the device is disconnected immediately instead of waiting for it to reconnect.Change
DevicePage: keeps the initialdisabledvalue and, when a save changes it from enabled to disabled, callsPOST api/devices/{id}/disconnect.EditItemView: awaitsonItemSavedso the disconnect request completes before navigating back.Only the enabled → disabled transition triggers the call; saving an already disabled device or re-enabling it does nothing.
Testing
npx eslint src/settings/DevicePage.jsx src/settings/components/EditItemView.jsxpasses.Disabledand save; the device disappears fromss -tn sport=:5013, the server logsClosed session for device N, and the device is rejected on reconnect.Depends on traccar/traccar#6150.