Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const importWidth = ref<number | null>(null);
const importVersion = ref<string | null>(null);

// TODO gray out the button when model is uploading
const handleImport = async () => {
const handleImport = () => {
if (importModelFile.value === null) return;

const formData = new FormData();
Expand Down Expand Up @@ -72,13 +72,13 @@ const handleImport = async () => {
importVersion.value = null;
};

const deleteModel = async (model: ObjectDetectionModelProperties) => {
const deleteModel = (model: ObjectDetectionModelProperties) => {
axiosPost("/objectdetection/delete", "delete an object detection model", {
modelPath: model.modelPath
});
};

const renameModel = async (model: ObjectDetectionModelProperties, newName: string) => {
const renameModel = (model: ObjectDetectionModelProperties, newName: string) => {
useStateStore().showSnackbarMessage({
message: "Renaming Object Detection Model...",
color: "secondary",
Expand Down
2 changes: 1 addition & 1 deletion photon-client/src/lib/PhotonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const statusCheck = async (timeout: number, ip?: string): Promise<boolean
while (pollLimit > 0) {
try {
pollLimit--;
await axios.get(ip ? `http://${ip}/status` : "/status");
await axios.get(ip ? `http://${ip}/api/status` : "/status");
return true;
} catch {
// Backend not ready yet, wait and retry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,12 @@ public static void onBulkImportObjectDetectionModelRequest(Context ctx) {
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) {}
Expand Down Expand Up @@ -898,17 +904,17 @@ public static void onDeleteObjectDetectionModelRequest(Context ctx) {

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) {}
Expand Down Expand Up @@ -951,6 +957,12 @@ public static void onRenameObjectDetectionModelRequest(Context ctx) {

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());
Expand All @@ -970,6 +982,12 @@ public static void onNukeObjectDetectionModelsRequest(Context ctx) {
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) {
Expand Down
Loading