mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Propagate changes after modifying OD model (#2299)
## Description <!-- What changed? Why? (the code + comments should speak for itself on the "how") --> <!-- Fun screenshots or a cool video or something are super helpful as well. If this touches platform-specific behavior, this is where test evidence should be collected. --> <!-- Any issues this pull request closes or pull requests this supersedes should be linked with `Closes #issuenumber`. --> This PR adjusts how model modification is handled. Any updates to metadata, or deletion is handled in the frontend after sending data to the backend. Any creation of models occurs in the backend, and we push an update to the frontend. This PR also fixes a typo in PhotonUtils which meant we hit the wrong endpoint when an IP was passed into the status check. ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added
This commit is contained in:
@@ -852,6 +852,12 @@ public class RequestHandler {
|
||||
ctx.result("There was an error while saving the uploaded object detection models");
|
||||
logger.error("There was an error while saving the uploaded object detection models");
|
||||
}
|
||||
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(
|
||||
new OutgoingUIEvent<>(
|
||||
"fullsettings",
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig())));
|
||||
}
|
||||
|
||||
private record DeleteObjectDetectionModelRequest(Path modelPath) {}
|
||||
@@ -898,17 +904,17 @@ public class RequestHandler {
|
||||
|
||||
ctx.status(200).result("Successfully deleted object detection model");
|
||||
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(
|
||||
new OutgoingUIEvent<>(
|
||||
"fullsettings",
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig())));
|
||||
|
||||
} catch (Exception e) {
|
||||
ctx.status(500);
|
||||
ctx.result("Error deleting object detection model: " + e.getMessage());
|
||||
logger.error("Error deleting object detection model", e);
|
||||
}
|
||||
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(
|
||||
new OutgoingUIEvent<>(
|
||||
"fullsettings",
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig())));
|
||||
}
|
||||
|
||||
private record RenameObjectDetectionModelRequest(Path modelPath, String newName) {}
|
||||
@@ -951,6 +957,12 @@ public class RequestHandler {
|
||||
|
||||
NeuralNetworkModelManager.getInstance().discoverModels();
|
||||
ctx.status(200).result("Successfully renamed object detection model");
|
||||
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(
|
||||
new OutgoingUIEvent<>(
|
||||
"fullsettings",
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig())));
|
||||
} catch (Exception e) {
|
||||
ctx.status(500);
|
||||
ctx.result("Error renaming object detection model: " + e.getMessage());
|
||||
@@ -970,6 +982,12 @@ public class RequestHandler {
|
||||
ctx.result("Error clearing object detection models: " + e.getMessage());
|
||||
logger.error("Error clearing object detection models", e);
|
||||
}
|
||||
|
||||
DataChangeService.getInstance()
|
||||
.publishEvent(
|
||||
new OutgoingUIEvent<>(
|
||||
"fullsettings",
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig())));
|
||||
}
|
||||
|
||||
public static void onDeviceRestartRequest(Context ctx) {
|
||||
|
||||
Reference in New Issue
Block a user