Fix click2go not displaying toast when saving settings due to typo

rename repository of clicktogo as click2go as the extension name
remove click2go console.log now is finalized
bump click2go version to 1.0.1 and build package
Remove auto toast messages in extensions API because it is extensions to handle toast on failure / success
Bump webui version and build packages
This commit is contained in:
Luc
2024-06-23 07:28:45 +08:00
parent f741bc385f
commit f77d421e86
17 changed files with 5 additions and 39 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,5 @@
<script type="text/javascript">
const click2go_version = "1.0.0";
const click2go_version = "1.0.1";
let margin = 40; // Définir la taille de la marge
let xPos = 0;
let yPos = 0;
@@ -216,7 +216,6 @@
//Save settings
function onSave(settings) {
console.log("Settings saved:", settings);
currentSettings.gotoxmin = parseFloat(settings.gotoxmin);
currentSettings.gotoxmax = parseFloat(settings.gotoxmax);
currentSettings.gotoymin = parseFloat(settings.gotoymin);
@@ -230,7 +229,6 @@
drawCanvas();
//Todo: Save settings to preferences.json
save_settings_msg.content = currentSettings;
console.log("Save settings:", save_settings_msg);
sendMessage(save_settings_msg);
}
@@ -246,12 +244,10 @@
//Command function
function commandFn() {
console.log("Last click position:", lastClickPosition);
let command = currentSettings.gotocommand
.replace("{X}", lastClickPosition.x.toFixed(currentSettings.gotoprecision))
.replace("{Y}", lastClickPosition.y.toFixed(currentSettings.gotoprecision))
.replace("{F}", currentSettings.gotofeedrate);
console.log("Command:", command);
command_msg.args.cmd = command;
sendMessage(command_msg);
@@ -264,7 +260,6 @@
//Process message from WebUI
function processMessage(eventMsg) {
console.log("Got:", eventMsg.data);
//Check if icons are loaded
if (!iconsLoaded) {
if (eventMsg.data.type && eventMsg.data.id && iconsToLoad.includes(eventMsg.data.id)) {
@@ -282,7 +277,6 @@
//Check if message is a response to a modal for settings
if (eventMsg.data.type === "capabilities" && eventMsg.data.id === "extensions") {
if (eventMsg.data.content.initiator.name === "click2go") {
console.log("Got:", eventMsg.data);
applySettings(eventMsg.data.content.response)
}
@@ -291,13 +285,11 @@
eventMsg.data.type &&
(!eventMsg.data.id || eventMsg.data.id.startsWith("click2go"))) {
if (eventMsg.data.type === "modal" && eventMsg.data.id === "click2go_settings") {
console.log("Got:", eventMsg.data);
if (eventMsg.data.content.response === "update") {
onSave(eventMsg.data.content.inputData)
}
} else // Check if message is a response to a extensionsData for saving settings
if (eventMsg.data.type === "extensionsData" && eventMsg.data.id === "click2go") {
console.log("Got:", eventMsg.data);
processSavingSettings(eventMsg.data.content.response)
}
}
@@ -306,11 +298,12 @@
}
function processSavingSettings(response) {
if (response === "success") {
//Displaying result
if (response.status == "success") {
toast_msg.content.text = "Settings saved successfully";
toast_msg.content.type = "success";
sendMessage(toast_msg);
} else if (response === "error") {
} else if (response.status == "error") {
toast_msg.content.text = "Error saving settings";
toast_msg.content.type = "error";
sendMessage(toast_msg);
@@ -329,10 +322,8 @@
}
function applySettings(settings) {
console.log("Settings loaded:", settings);
settingsLoaded = true;
if (settings != null && (Object.keys(settings).length > 2)){
console.log("Apply Settings:", settings, Object.keys(settings).length);
if (!isNaN(parseFloat(settings.gotoxmin)))currentSettings.gotoxmin = parseFloat(settings.gotoxmin);
if (!isNaN(parseFloat(settings.gotoxmax)))currentSettings.gotoxmax = parseFloat(settings.gotoxmax);
if (!isNaN(parseFloat(settings.gotoymin)))currentSettings.gotoymin = parseFloat(settings.gotoymin);
@@ -664,7 +655,6 @@
// Onload add listener to collect messages from WebUI and init extension
window.onload = (event) => {
console.log("Extension chargée");
window.addEventListener("message", processMessage, false);
loadIcons();
loadSettings();

Binary file not shown.

View File

@@ -108,10 +108,6 @@ const ContentContainer = () => {
)
},
onFail: (error) => {
toasts.addToast({
content: error,
type: "error",
})
console.log(error)
if (!eventMsg.data.noDispatch)
dispatchToExtensions(
@@ -151,10 +147,6 @@ const ContentContainer = () => {
)
},
onFail: (error) => {
toasts.addToast({
content: error,
type: "error",
})
console.log(error)
if (!eventMsg.data.noDispatch)
dispatchToExtensions(
@@ -215,10 +207,6 @@ const ContentContainer = () => {
)
},
onFail: (error) => {
toasts.addToast({
content: error,
type: "error",
})
if (!eventMsg.data.noDispatch)
dispatchToExtensions(
"upload",
@@ -263,10 +251,6 @@ const ContentContainer = () => {
)
},
onFail: (error) => {
toasts.addToast({
content: error,
type: "error",
})
if (!eventMsg.data.noDispatch)
dispatchToExtensions(
"download",
@@ -720,10 +704,6 @@ const ContentContainer = () => {
},
{
onSuccess: (result) => {
toasts.addToast({
content: T("S62"),
type: "success",
})
dispatchToExtensions(
"extensionsData",
{
@@ -734,10 +714,6 @@ const ContentContainer = () => {
)
},
onFail: (error) => {
toasts.addToast({
content: T("S44"),
type: "Error",
})
dispatchToExtensions(
"extensionsData",
{

View File

@@ -17,7 +17,7 @@
*/
import { h } from "preact"
import { webUIbuild } from "../../targets"
export const webUIversion = "3.0.0-a66"
export const webUIversion = "3.0.0-a67"
export const Esp3dVersion = () => (
<span>
{webUIversion}.{webUIbuild}