Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows file paths in the UI #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -657,16 +657,16 @@ <h4 style="display: inline-block; ">
// CLICK IN TREE
$("#jstree").on("changed.jstree", (e, data) => {
if (data.node && data.node.type === "file") {
let p = data.node.original.path;
//p = p.substr(p.indexOf("/") + 1);
p = p.substring(p, p.lastIndexOf("."));
// Convert Windows path separators with linux ones so they can be dealt with in the same way
let filePath = data.node.original.path.replaceAll("\\", "/");
let comandPath = filePath.substring(filePath, filePath.lastIndexOf("."));
const commands = config.recording.path ? config.recording.path : "commands";
const p1 = p.substring(p.lastIndexOf("/") + 1);
const p2 = p.substring(0,p.lastIndexOf("/"));
const message = comandPath.substring(comandPath.lastIndexOf("/") + 1);
const topic = comandPath.substring(0,comandPath.lastIndexOf("/"));

//console.log("click", {data, p, p1, p2, subscribeBasePath:config.mqtt.subscribeBasePath});
$("#inputTopic").val(config.mqtt.subscribeBasePath + p2);
$("#inputMessage").val(p1);
// console.log("click", {data, filePath, comandPath, message, topic, subscribeBasePath:config.mqtt.subscribeBasePath});
$("#inputTopic").val(config.mqtt.subscribeBasePath + topic);
$("#inputMessage").val(message);
$("#btnDelete").attr("disabled", false);
selectedNode = data.node.original;
} else {
Expand Down