mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-27 02:01:40 +00:00
Reword restart modal (#374)
Clarifies that photon will restart (when running as service)
This commit is contained in:
@@ -250,7 +250,7 @@ export default {
|
||||
{headers: {"Content-Type": "multipart/form-data"}}).then(() => {
|
||||
this.snackbar = {
|
||||
color: "success",
|
||||
text: "Settings imported successfully! Program will now exit...",
|
||||
text: "Settings imported successfully! PhotonVision will restart in the background...",
|
||||
};
|
||||
this.snack = true;
|
||||
}).catch(err => {
|
||||
@@ -296,7 +296,7 @@ export default {
|
||||
}).then(() => {
|
||||
this.snackbar = {
|
||||
color: "success",
|
||||
text: "New .jar copied successfully! Program will now exit...",
|
||||
text: "New .jar copied successfully! PhotonVision will restart in the background...",
|
||||
};
|
||||
this.snack = true;
|
||||
}).catch(err => {
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.PosixFileAttributes;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
@@ -60,7 +61,7 @@ public class FileUtils {
|
||||
public static void deleteFile(Path path) {
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (FileNotFoundException fe) {
|
||||
} catch (FileNotFoundException | NoSuchFileException fe) {
|
||||
logger.warn("Tried to delete file \"" + path + "\" but it did not exist");
|
||||
} catch (IOException e) {
|
||||
logger.error("Exception deleting file \"" + path + "\"!", e);
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.photonvision.common.logging.LogGroup;
|
||||
import org.photonvision.common.logging.Logger;
|
||||
import org.photonvision.common.networking.NetworkManager;
|
||||
import org.photonvision.common.util.ShellExec;
|
||||
import org.photonvision.common.util.TimedTaskManager;
|
||||
import org.photonvision.common.util.file.ProgramDirectoryUtilities;
|
||||
import org.photonvision.vision.processes.VisionModuleManager;
|
||||
import org.photonvision.vision.target.TargetModel;
|
||||
@@ -99,8 +100,7 @@ public class RequestHandler {
|
||||
|
||||
ctx.status(200);
|
||||
logger.info("Settings uploaded, going down for restart.");
|
||||
restartProgram(ctx);
|
||||
|
||||
restartProgram();
|
||||
} else {
|
||||
logger.error("Couldn't read uploaded file! Ignoring.");
|
||||
ctx.status(500);
|
||||
@@ -128,7 +128,7 @@ public class RequestHandler {
|
||||
|
||||
ctx.status(200);
|
||||
logger.info("New .jar in place, going down for restart...");
|
||||
restartProgram(ctx);
|
||||
restartProgram();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.error(
|
||||
@@ -224,13 +224,19 @@ public class RequestHandler {
|
||||
ctx.status(HardwareManager.getInstance().restartDevice() ? 200 : 500);
|
||||
}
|
||||
|
||||
public static void restartProgram(Context ctx) {
|
||||
restartProgram();
|
||||
}
|
||||
|
||||
public static void restartProgram() {
|
||||
TimedTaskManager.getInstance().addOneShotTask(RequestHandler::restartProgramInternal, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note that this doesn't actually restart the program itself -- instead, it relies on systemd or
|
||||
* an equivalent.
|
||||
*/
|
||||
public static void restartProgram(Context ctx) {
|
||||
ctx.status(200);
|
||||
|
||||
public static void restartProgramInternal() {
|
||||
if (Platform.isRaspberryPi()) {
|
||||
try {
|
||||
new ShellExec().executeBashCommand("systemctl restart photonvision.service");
|
||||
|
||||
Reference in New Issue
Block a user