forked from Github/Axter-Stash
Added Docker warnings
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
const { Link, NavLink, } = PluginApi.libraries.ReactRouterDOM;
|
const { Link, NavLink, } = PluginApi.libraries.ReactRouterDOM;
|
||||||
var iconToUse = faFileCircleXmark;
|
var iconToUse = faFileCircleXmark;
|
||||||
var FileMonitorRunningStatusStr = "";
|
var FileMonitorRunningStatusStr = "";
|
||||||
|
var IS_DOCKER = false;
|
||||||
|
var DockerWarning = null;
|
||||||
function RunPluginFileMonitor(Mode, ActionID = 0, DataType = "text", Async = false) {
|
function RunPluginFileMonitor(Mode, ActionID = 0, DataType = "text", Async = false) {
|
||||||
console.log("Mode = " + Mode);
|
console.log("Mode = " + Mode);
|
||||||
const AjaxData = $.ajax({method: "POST", url: "/graphql", contentType: "application/json", dataType: DataType, cache: Async, async: Async,
|
const AjaxData = $.ajax({method: "POST", url: "/graphql", contentType: "application/json", dataType: DataType, cache: Async, async: Async,
|
||||||
@@ -33,6 +35,13 @@
|
|||||||
iconToUse = faFileCircleXmark;
|
iconToUse = faFileCircleXmark;
|
||||||
FileMonitorRunningStatusStr = "FileMonitor is NOT running!!!";
|
FileMonitorRunningStatusStr = "FileMonitor is NOT running!!!";
|
||||||
}
|
}
|
||||||
|
if (result.indexOf("IS_DOCKER:'True'") > 0){
|
||||||
|
IS_DOCKER = true;
|
||||||
|
DockerWarning = React.createElement("div", null,
|
||||||
|
React.createElement("h4", null, "Must run FileMonitor on host machine. Do not run directly in Docker! For more information see following link:"),
|
||||||
|
React.createElement("a", {href: "https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker", style:{color:"pink"}, target:"_blank"}, "https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker"));
|
||||||
|
console.log("FileMonitor must run on host machine. Do NOT run FileMonitor directly in Docker. See following link for more details.\n https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker");
|
||||||
|
}
|
||||||
console.log(FileMonitorRunningStatusStr);
|
console.log(FileMonitorRunningStatusStr);
|
||||||
if (ActionID == 0)
|
if (ActionID == 0)
|
||||||
PluginApi.patch.before("MainNavBar.UtilityItems", function (props) {
|
PluginApi.patch.before("MainNavBar.UtilityItems", function (props) {
|
||||||
@@ -57,15 +66,6 @@
|
|||||||
$("body").css("cursor", "default");
|
$("body").css("cursor", "default");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// if (Async == true)
|
|
||||||
// return true;
|
|
||||||
// if (DataType == "text")
|
|
||||||
// {
|
|
||||||
// console.log(AjaxData.responseText);
|
|
||||||
// return AjaxData.responseText;
|
|
||||||
// }
|
|
||||||
// console.log(AjaxData.responseJSON);
|
|
||||||
// return JSON.parse(AjaxData.responseJSON.data.runPluginOperation.replaceAll("'", "\""));
|
|
||||||
}
|
}
|
||||||
RunPluginFileMonitor("getFileMonitorRunningStatus");
|
RunPluginFileMonitor("getFileMonitorRunningStatus");
|
||||||
const HomePage = () => {
|
const HomePage = () => {
|
||||||
@@ -76,7 +76,8 @@
|
|||||||
MyHeader,
|
MyHeader,
|
||||||
React.createElement("p", null),
|
React.createElement("p", null),
|
||||||
React.createElement("p", null),
|
React.createElement("p", null),
|
||||||
React.createElement("h4", null, FileMonitorRunningStatusStr)
|
React.createElement("h4", null, FileMonitorRunningStatusStr),
|
||||||
|
DockerWarning
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
PluginApi.register.route("/FileMonitor", HomePage);
|
PluginApi.register.route("/FileMonitor", HomePage);
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ if not parse_args.docker == None and len(parse_args.docker) > 0:
|
|||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
stash.Error(f"Exception while parsing Docker file {parse_args.docker}; Error: {e}\nTraceBack={tb}")
|
stash.Error(f"Exception while parsing Docker file {parse_args.docker}; Error: {e}\nTraceBack={tb}")
|
||||||
|
|
||||||
if stash.IS_DOCKER:
|
if stash.IS_DOCKER and stash.PLUGIN_TASK_NAME != "stop_library_monitor" and not parse_args.stop and stash.PLUGIN_TASK_NAME != "getFileMonitorRunningStatus":
|
||||||
stash.Error("You are running this script from within Docker. This is NOT supported. Run this script in the host machine instead.")
|
stash.Error("You are running this script from within Docker. This is NOT supported. Run this script in the host machine instead.")
|
||||||
stash.Warn("For more information on running FileMonitor on host machine see following link:\n https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker")
|
stash.Warn("For more information on running FileMonitor on host machine see following link:\n https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker")
|
||||||
stash.Warn("Performing early exit because FileMonitor has to run on the host machine, and can NOT run on Docker directly.")
|
stash.Warn("Performing early exit because FileMonitor has to run on the host machine, and can NOT run on Docker directly.")
|
||||||
@@ -937,7 +937,7 @@ def getFileMonitorRunningStatus():
|
|||||||
pass
|
pass
|
||||||
stash.Log("FileMonitor is NOT running!!!")
|
stash.Log("FileMonitor is NOT running!!!")
|
||||||
stash.Log(f"{stash.PLUGIN_TASK_NAME} complete")
|
stash.Log(f"{stash.PLUGIN_TASK_NAME} complete")
|
||||||
sys.stdout.write("{" + f"{stash.PLUGIN_TASK_NAME} : 'complete', FileMonitorStatus:'{FileMonitorStatus}'" + "}")
|
sys.stdout.write("{" + f"{stash.PLUGIN_TASK_NAME} : 'complete', FileMonitorStatus:'{FileMonitorStatus}', IS_DOCKER:'{stash.IS_DOCKER}'" + "}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if parse_args.stop or parse_args.restart or stash.PLUGIN_TASK_NAME == "stop_library_monitor":
|
if parse_args.stop or parse_args.restart or stash.PLUGIN_TASK_NAME == "stop_library_monitor":
|
||||||
|
|||||||
Reference in New Issue
Block a user