mirror of
https://github.com/luc-github/ESP3D-WEBUI.git
synced 2026-02-20 01:11:21 +01:00
Add more capabilies to capabilities extension type
This commit is contained in:
BIN
dist/CNC/GRBL/index.html.gz
vendored
BIN
dist/CNC/GRBL/index.html.gz
vendored
Binary file not shown.
BIN
dist/CNC/GRBLHal/index.html.gz
vendored
BIN
dist/CNC/GRBLHal/index.html.gz
vendored
Binary file not shown.
BIN
dist/Plotter/HP-GL/index.html.gz
vendored
BIN
dist/Plotter/HP-GL/index.html.gz
vendored
Binary file not shown.
BIN
dist/Printer3D/Marlin-embedded/index.html.gz
vendored
BIN
dist/Printer3D/Marlin-embedded/index.html.gz
vendored
Binary file not shown.
BIN
dist/Printer3D/Marlin/index.html.gz
vendored
BIN
dist/Printer3D/Marlin/index.html.gz
vendored
Binary file not shown.
BIN
dist/Printer3D/Repetier/index.html.gz
vendored
BIN
dist/Printer3D/Repetier/index.html.gz
vendored
Binary file not shown.
BIN
dist/Printer3D/Smoothieware/index.html.gz
vendored
BIN
dist/Printer3D/Smoothieware/index.html.gz
vendored
Binary file not shown.
BIN
dist/SandTable/GRBL/index.html.gz
vendored
BIN
dist/SandTable/GRBL/index.html.gz
vendored
Binary file not shown.
@@ -455,10 +455,18 @@ There is no answer for this message, so `id` is not necessary
|
||||
---
|
||||
### Send capabilities request
|
||||
|
||||
Example: `{type:'capabilities', target:'webui', id:'transpanel'}`
|
||||
This allow to collect all capabilities for specific topic:
|
||||
if id is `connection` you will get the json of [ESP800] response jsonified
|
||||
if id is `features` you will get the [ESP400] response jsonified
|
||||
if id is `interface` you will get the preferences.json jsonified
|
||||
if id is `settings` you will get specific settings from target fw
|
||||
|
||||
Be noted this API only collect existing data, so for `features`,`interface` and `settings` you may get empty response if corresponding query has not be done.
|
||||
|
||||
Example: `{type:'capabilities', target:'webui', id:'connection'}`
|
||||
**type** is `capabilities` (mandatory)
|
||||
**target** is `webui` (mandatory)
|
||||
**id** is `infopanel` (optional)
|
||||
**id** is `connection` (mandatory)
|
||||
|
||||
* Answer format: check the `eventMsg.data`
|
||||
|
||||
@@ -466,18 +474,41 @@ Example: `{type:'capabilities', target:'webui', id:'transpanel'}`
|
||||
{
|
||||
"type": "capabilities",
|
||||
"content": {
|
||||
"response": "Your session will end soon, do you want to stay connected ?",
|
||||
"response": "{
|
||||
"FWVersion": "3.0.0.a111",
|
||||
"FWTarget": "marlin",
|
||||
"FWTargetID": "40",
|
||||
"Setup": "Enabled",
|
||||
"Screen": "HMI V3",
|
||||
"Streaming": "Enabled",
|
||||
"SDConnection": "direct",
|
||||
"SerialProtocol": "Raw",
|
||||
"Authentication": "Disabled",
|
||||
"WebCommunication": "Asynchronous",
|
||||
"WebSocketIP": "localhost",
|
||||
"WebSocketPort": "81",
|
||||
"Hostname": "esp3d",
|
||||
"WiFiMode": "STA",
|
||||
"WebUpdate": "Enabled",
|
||||
"FlashFileSystem": "LittleFS",
|
||||
"HostPath": "/",
|
||||
"Time": "none",
|
||||
"HostTarget": "files",
|
||||
"HostUploadPath": "/",
|
||||
"HostDownloadPath": "/",
|
||||
"wsID": "0"
|
||||
}",
|
||||
"initiator": {
|
||||
"type":"capabilities",
|
||||
"target":"webui",
|
||||
"id":"infopanel"
|
||||
"id":"connection"
|
||||
}
|
||||
},
|
||||
"id": "infopanel"
|
||||
"id": "connection"
|
||||
}
|
||||
```
|
||||
**type** is `capabilities`
|
||||
**id** is the id set in command message to help to screen
|
||||
**id** is the id of requested capability
|
||||
**content** has the response it self **response**, in our case a JSON and also the **initiator** is the initial command for reference
|
||||
|
||||
---
|
||||
@@ -643,4 +674,4 @@ Note: there no answer as the purpose of this is to send answer
|
||||
**id** is the id set in command message to help to screen
|
||||
**content** has the response it self **response**, in our case `create` because user clicked on button 1, and the text entered is in **inputData**, here `mydir`, and also the **initiator** is the initial command for reference
|
||||
|
||||
Note: **inputData** is present for both buttons clicked, so screening must be done according response
|
||||
Note: **inputData** is present for both buttons clicked, so screening must be done according response
|
||||
|
||||
@@ -2,14 +2,23 @@
|
||||
function sendMessage(msg){
|
||||
window.parent.postMessage(msg, '*');
|
||||
}
|
||||
|
||||
function onclickBtn(){
|
||||
const selectElement = document.getElementById('request_id');
|
||||
id_requested = selectElement.value
|
||||
sendMessage({type:'capabilities', target:'webui', id:document.getElementById('request_id').value,});
|
||||
}
|
||||
|
||||
function processMessage(eventMsg){
|
||||
if (eventMsg.data.type && (!eventMsg.data.id||eventMsg.data.id=="infopanel")){
|
||||
if (eventMsg.data.type && (!eventMsg.data.id||eventMsg.data.id==document.getElementById('request_id').value)){
|
||||
if (eventMsg.data.type=="capabilities"){
|
||||
const line = eventMsg.data.content
|
||||
const resultPanel = document.getElementById("output");
|
||||
|
||||
resultPanel.innerHTML = resultPanel.innerHTML + "<br>"+ JSON.stringify(line.response, " ", "<br>")+"</span><br><hr />";
|
||||
let res = JSON.stringify(line.response," ","\n")
|
||||
while (res.includes("\n\n")) {
|
||||
res = res.replace("\n\n", "\n");
|
||||
}
|
||||
resultPanel.innerHTML = res;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -23,8 +32,14 @@
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<button class="btn m-1" onclick="sendMessage({type:'capabilities', target:'webui', id:'infopanel',});">Capabilities</button>
|
||||
<div class="container m-2" id="output">
|
||||
</div>
|
||||
<select id="request_id" class="form-select column">
|
||||
<option value="connection">connection</option>
|
||||
<option value="features">features</option>
|
||||
<option value="interface">interface</option>
|
||||
<option value="settings">settings</option>
|
||||
</select>
|
||||
<button class="btn m-1" onclick="onclickBtn();">Capabilities</button>
|
||||
<pre class="container m-2" id="output">
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -222,11 +222,30 @@
|
||||
"opennotificationsonstart": false,
|
||||
"notifautoscroll": true,
|
||||
"showmacrospanel": true,
|
||||
"openmacrosonstart": false,
|
||||
"openmacrosonstart": true,
|
||||
"macros": [],
|
||||
"showextracontents": false,
|
||||
"openextrapanelsonstart": false,
|
||||
"extracontents": [],
|
||||
"showextracontents": true,
|
||||
"openextrapanelsonstart": true,
|
||||
"extracontents": [
|
||||
{
|
||||
"id": "xjxkqpm5o",
|
||||
"name": "Panel xjxkqpm5o",
|
||||
"icon": "Meh",
|
||||
"target": "panel",
|
||||
"source": "capabilities.html",
|
||||
"type": "extension",
|
||||
"refreshtime": "0"
|
||||
},
|
||||
{
|
||||
"id": "ooyeeka4e",
|
||||
"name": "Kiri",
|
||||
"icon": "Box",
|
||||
"target": "page",
|
||||
"source": "https://grid.space/kiri/",
|
||||
"type": "content",
|
||||
"refreshtime": "0"
|
||||
}
|
||||
],
|
||||
"showstatuspanel": true,
|
||||
"openstatusonstart": true,
|
||||
"showprobepanel": true,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
import { h, Fragment } from "preact"
|
||||
import { Menu } from "./menu"
|
||||
import { Informations } from "./informations"
|
||||
import { machineSettings} from "../targets"
|
||||
import { ConnectionContainer } from "./connection"
|
||||
import { MainContainer } from "./main"
|
||||
import { useUiContext, useUiContextFn } from "../contexts/UiContext"
|
||||
@@ -63,7 +63,7 @@ const ViewContainer = () => {
|
||||
|
||||
const ContentContainer = () => {
|
||||
const { getConnectionSettings, getInterfaceSettings } = useSettings()
|
||||
const { connectionSettings } = useSettingsContext()
|
||||
const { connectionSettings, interfaceSettings, featuresSettings } = useSettingsContext()
|
||||
const { createNewRequest } = useHttpQueue()
|
||||
const { toasts, modals } = useUiContext()
|
||||
|
||||
@@ -377,12 +377,40 @@ const ContentContainer = () => {
|
||||
}
|
||||
break
|
||||
case "capabilities":
|
||||
let response = {}
|
||||
switch (eventMsg.data.id) {
|
||||
case "connection":
|
||||
console.log(connectionSettings.current)
|
||||
response = JSON.parse(
|
||||
JSON.stringify(connectionSettings.current)
|
||||
)
|
||||
break
|
||||
case "settings":
|
||||
console.log(machineSettings)
|
||||
response = JSON.parse(
|
||||
JSON.stringify(machineSettings)
|
||||
)
|
||||
break
|
||||
break
|
||||
case "interface":
|
||||
console.log(interfaceSettings.current)
|
||||
response = JSON.parse(
|
||||
JSON.stringify(interfaceSettings.current)
|
||||
)
|
||||
break
|
||||
case "features":
|
||||
console.log(featuresSettings.current)
|
||||
response = JSON.parse(
|
||||
JSON.stringify(featuresSettings.current)
|
||||
)
|
||||
break
|
||||
default:
|
||||
response = {}
|
||||
}
|
||||
dispatchToExtensions(
|
||||
"capabilities",
|
||||
{
|
||||
response: JSON.parse(
|
||||
JSON.stringify(connectionSettings.current)
|
||||
),
|
||||
response: response,
|
||||
initiator: eventMsg.data,
|
||||
},
|
||||
eventMsg.data.id
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
import { h } from "preact"
|
||||
import { webUIbuild } from "../../targets"
|
||||
export const webUIversion = "3.0.0-a56"
|
||||
export const webUIversion = "3.0.0-a57"
|
||||
export const Esp3dVersion = () => (
|
||||
<span>
|
||||
{webUIversion}.{webUIbuild}
|
||||
|
||||
@@ -422,6 +422,7 @@ const FeaturesTab = () => {
|
||||
}
|
||||
}, [])
|
||||
console.log("feature")
|
||||
console.log(featuresSettings.current)
|
||||
return (
|
||||
<div id="features">
|
||||
<input
|
||||
|
||||
@@ -39,12 +39,12 @@ import {
|
||||
import { RefreshCcw, XCircle, Send, Flag } from "preact-feather"
|
||||
import { CMD } from "./CMD-source"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [settings, setSettings] = useState(machineSetting.cache)
|
||||
const [settings, setSettings] = useState(machineSettings.cache)
|
||||
const [collected, setCollected] = useState("0 B")
|
||||
const { createNewRequest, abortRequest } = useHttpFn
|
||||
const { modals, toasts, uisettings } = useUiContext()
|
||||
@@ -83,7 +83,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -99,7 +99,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -189,10 +189,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -261,4 +261,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings}
|
||||
|
||||
@@ -23,7 +23,7 @@ import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { gcode_parser_modes } from "./gcode_parser_modes"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -78,6 +78,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -39,12 +39,12 @@ import {
|
||||
import { RefreshCcw, XCircle, Send, Flag } from "preact-feather"
|
||||
import { CMD } from "./CMD-source"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [settings, setSettings] = useState(machineSetting.cache)
|
||||
const [settings, setSettings] = useState(machineSettings.cache)
|
||||
const [collected, setCollected] = useState("0 B")
|
||||
const { createNewRequest, abortRequest } = useHttpFn
|
||||
const { modals, toasts, uisettings } = useUiContext()
|
||||
@@ -83,7 +83,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -99,7 +99,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -189,10 +189,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -261,4 +261,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings }
|
||||
|
||||
@@ -23,7 +23,7 @@ import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { gcode_parser_modes } from "./gcode_parser_modes"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -80,6 +80,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
import { h } from "preact"
|
||||
|
||||
const MachineSettings = () => {}
|
||||
const machineSettings = {}
|
||||
machineSettings.cache=[]
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings }
|
||||
|
||||
@@ -22,7 +22,7 @@ import { iconsTarget } from "./icons"
|
||||
import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -86,6 +86,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -43,10 +43,10 @@ import {
|
||||
showProgressModal,
|
||||
} from "../../../components/Modal"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
machineSetting.toSave = []
|
||||
machineSetting.totalToSave = 0
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
machineSettings.toSave = []
|
||||
machineSettings.totalToSave = 0
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
@@ -122,12 +122,12 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const processSaving = () => {
|
||||
if (machineSetting.toSave.length > 0) {
|
||||
const index = machineSetting.toSave.pop()
|
||||
if (machineSettings.toSave.length > 0) {
|
||||
const index = machineSettings.toSave.pop()
|
||||
saveEntry(
|
||||
machineSetting.cache[index],
|
||||
machineSetting.totalToSave - machineSetting.toSave.length - 1,
|
||||
machineSetting.totalToSave
|
||||
machineSettings.cache[index],
|
||||
machineSettings.totalToSave - machineSettings.toSave.length - 1,
|
||||
machineSettings.totalToSave
|
||||
)
|
||||
} else {
|
||||
endProgression()
|
||||
@@ -135,13 +135,13 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const saveSettings = () => {
|
||||
machineSetting.totalToSave = 0
|
||||
machineSetting.toSave = []
|
||||
machineSetting.cache.map((entry, index) => {
|
||||
machineSettings.totalToSave = 0
|
||||
machineSettings.toSave = []
|
||||
machineSettings.cache.map((entry, index) => {
|
||||
if (entry.type != "comment") {
|
||||
if (entry.initial.trim() != entry.value.trim()) {
|
||||
machineSetting.totalToSave++
|
||||
machineSetting.toSave.push(index)
|
||||
machineSettings.totalToSave++
|
||||
machineSettings.toSave.push(index)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -153,7 +153,7 @@ const MachineSettings = () => {
|
||||
content: (
|
||||
<Progress
|
||||
progressBar={progressBar}
|
||||
max={machineSetting.totalToSave}
|
||||
max={machineSettings.totalToSave}
|
||||
/>
|
||||
),
|
||||
})
|
||||
@@ -161,7 +161,7 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
function checkSaveStatus() {
|
||||
let stringified = JSON.stringify(machineSetting.cache)
|
||||
let stringified = JSON.stringify(machineSettings.cache)
|
||||
let hasmodified =
|
||||
stringified.indexOf('"hasmodified":true') == -1 ? false : true
|
||||
let haserrors =
|
||||
@@ -185,7 +185,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -201,7 +201,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -294,10 +294,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -367,4 +367,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { iconsTarget } from "./icons"
|
||||
import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -76,6 +76,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -43,10 +43,10 @@ import {
|
||||
showProgressModal,
|
||||
} from "../../../components/Modal"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
machineSetting.toSave = []
|
||||
machineSetting.totalToSave = 0
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
machineSettings.toSave = []
|
||||
machineSettings.totalToSave = 0
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
@@ -122,12 +122,12 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const processSaving = () => {
|
||||
if (machineSetting.toSave.length > 0) {
|
||||
const index = machineSetting.toSave.pop()
|
||||
if (machineSettings.toSave.length > 0) {
|
||||
const index = machineSettings.toSave.pop()
|
||||
saveEntry(
|
||||
machineSetting.cache[index],
|
||||
machineSetting.totalToSave - machineSetting.toSave.length - 1,
|
||||
machineSetting.totalToSave
|
||||
machineSettings.cache[index],
|
||||
machineSettings.totalToSave - machineSettings.toSave.length - 1,
|
||||
machineSettings.totalToSave
|
||||
)
|
||||
} else {
|
||||
endProgression()
|
||||
@@ -135,13 +135,13 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const saveSettings = () => {
|
||||
machineSetting.totalToSave = 0
|
||||
machineSetting.toSave = []
|
||||
machineSetting.cache.map((entry, index) => {
|
||||
machineSettings.totalToSave = 0
|
||||
machineSettings.toSave = []
|
||||
machineSettings.cache.map((entry, index) => {
|
||||
if (entry.type != "comment") {
|
||||
if (entry.initial.trim() != entry.value.trim()) {
|
||||
machineSetting.totalToSave++
|
||||
machineSetting.toSave.push(index)
|
||||
machineSettings.totalToSave++
|
||||
machineSettings.toSave.push(index)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -153,7 +153,7 @@ const MachineSettings = () => {
|
||||
content: (
|
||||
<Progress
|
||||
progressBar={progressBar}
|
||||
max={machineSetting.totalToSave}
|
||||
max={machineSettings.totalToSave}
|
||||
/>
|
||||
),
|
||||
})
|
||||
@@ -161,7 +161,7 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
function checkSaveStatus() {
|
||||
let stringified = JSON.stringify(machineSetting.cache)
|
||||
let stringified = JSON.stringify(machineSettings.cache)
|
||||
let hasmodified =
|
||||
stringified.indexOf('"hasmodified":true') == -1 ? false : true
|
||||
let haserrors =
|
||||
@@ -185,7 +185,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -201,7 +201,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -294,10 +294,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -367,4 +367,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { iconsTarget } from "./icons"
|
||||
import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -76,6 +76,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -43,10 +43,10 @@ import {
|
||||
showProgressModal,
|
||||
} from "../../../components/Modal"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
machineSetting.toSave = []
|
||||
machineSetting.totalToSave = 0
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
machineSettings.toSave = []
|
||||
machineSettings.totalToSave = 0
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
@@ -122,12 +122,12 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const processSaving = () => {
|
||||
if (machineSetting.toSave.length > 0) {
|
||||
const index = machineSetting.toSave.pop()
|
||||
if (machineSettings.toSave.length > 0) {
|
||||
const index = machineSettings.toSave.pop()
|
||||
saveEntry(
|
||||
machineSetting.cache[index],
|
||||
machineSetting.totalToSave - machineSetting.toSave.length - 1,
|
||||
machineSetting.totalToSave
|
||||
machineSettings.cache[index],
|
||||
machineSettings.totalToSave - machineSettings.toSave.length - 1,
|
||||
machineSettings.totalToSave
|
||||
)
|
||||
} else {
|
||||
endProgression()
|
||||
@@ -135,13 +135,13 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
const saveSettings = () => {
|
||||
machineSetting.totalToSave = 0
|
||||
machineSetting.toSave = []
|
||||
machineSetting.cache.map((entry, index) => {
|
||||
machineSettings.totalToSave = 0
|
||||
machineSettings.toSave = []
|
||||
machineSettings.cache.map((entry, index) => {
|
||||
if (entry.type != "comment") {
|
||||
if (entry.initial.trim() != entry.value.trim()) {
|
||||
machineSetting.totalToSave++
|
||||
machineSetting.toSave.push(index)
|
||||
machineSettings.totalToSave++
|
||||
machineSettings.toSave.push(index)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -153,7 +153,7 @@ const MachineSettings = () => {
|
||||
content: (
|
||||
<Progress
|
||||
progressBar={progressBar}
|
||||
max={machineSetting.totalToSave}
|
||||
max={machineSettings.totalToSave}
|
||||
/>
|
||||
),
|
||||
})
|
||||
@@ -161,7 +161,7 @@ const MachineSettings = () => {
|
||||
}
|
||||
|
||||
function checkSaveStatus() {
|
||||
let stringified = JSON.stringify(machineSetting.cache)
|
||||
let stringified = JSON.stringify(machineSettings.cache)
|
||||
let hasmodified =
|
||||
stringified.indexOf('"hasmodified":true') == -1 ? false : true
|
||||
let haserrors =
|
||||
@@ -185,7 +185,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -201,7 +201,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -291,10 +291,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -364,4 +364,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { iconsTarget } from "./icons"
|
||||
import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings} from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -76,6 +76,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -606,4 +606,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings }
|
||||
|
||||
@@ -22,7 +22,7 @@ import { iconsTarget } from "./icons"
|
||||
import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings,machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -76,6 +76,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -39,12 +39,12 @@ import {
|
||||
import { RefreshCcw, XCircle, Send, Flag } from "preact-feather"
|
||||
import { CMD } from "./CMD-source"
|
||||
|
||||
const machineSetting = {}
|
||||
machineSetting.cache = []
|
||||
const machineSettings = {}
|
||||
machineSettings.cache = []
|
||||
|
||||
const MachineSettings = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [settings, setSettings] = useState(machineSetting.cache)
|
||||
const [settings, setSettings] = useState(machineSettings.cache)
|
||||
const [collected, setCollected] = useState("0 B")
|
||||
const { createNewRequest, abortRequest } = useHttpFn
|
||||
const { modals, toasts, uisettings } = useUiContext()
|
||||
@@ -83,7 +83,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
} else if (feedback.command == "eeprom") {
|
||||
machineSetting.cache = CMD.command(
|
||||
machineSettings.cache = CMD.command(
|
||||
"formatEeprom",
|
||||
feedback.content
|
||||
)
|
||||
@@ -99,7 +99,7 @@ const MachineSettings = () => {
|
||||
type: "error",
|
||||
})
|
||||
processor.stopCatchResponse()
|
||||
machineSetting.cache = []
|
||||
machineSettings.cache = []
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ const MachineSettings = () => {
|
||||
return validation
|
||||
}
|
||||
useEffect(() => {
|
||||
if (uisettings.getValue("autoload") && machineSetting.cache == "") {
|
||||
if (uisettings.getValue("autoload") && machineSettings.cache == "") {
|
||||
setIsLoading(true)
|
||||
//do not call onRefresh directly as WebSocket may still be connecting or just connected
|
||||
// and we may have a race issue, the command go but does not have answer catched
|
||||
@@ -189,10 +189,10 @@ const MachineSettings = () => {
|
||||
)}
|
||||
{!isLoading && (
|
||||
<center class="m-2">
|
||||
{machineSetting.cache.length > 0 && (
|
||||
{machineSettings.cache.length > 0 && (
|
||||
<div>
|
||||
<CenterLeft bordered>
|
||||
{machineSetting.cache.map((element) => {
|
||||
{machineSettings.cache.map((element) => {
|
||||
if (element.type == "comment")
|
||||
return (
|
||||
<div class="comment m-1 ">
|
||||
@@ -261,4 +261,4 @@ const MachineSettings = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export { MachineSettings }
|
||||
export { MachineSettings, machineSettings }
|
||||
|
||||
@@ -23,7 +23,7 @@ import { files } from "./files"
|
||||
import { processor } from "./processor"
|
||||
import { gcode_parser_modes } from "./gcode_parser_modes"
|
||||
import { defaultPanelsList } from "./panels"
|
||||
import { MachineSettings } from "./MachineSettings"
|
||||
import { MachineSettings, machineSettings } from "./MachineSettings"
|
||||
import {
|
||||
InformationsControls,
|
||||
QuickButtonsBar,
|
||||
@@ -78,6 +78,7 @@ const eventsList = {
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
fwUrl,
|
||||
Name,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import { h } from "preact"
|
||||
import {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
defaultPanelsList,
|
||||
Target,
|
||||
files,
|
||||
@@ -39,6 +40,7 @@ import {
|
||||
WebUILogo,
|
||||
QuickButtonsBar,
|
||||
BackgroundContainer,
|
||||
|
||||
} from "SubTargetDir"
|
||||
|
||||
import defaultPreferencesSubTarget from "SubTargetDir/preferences.json"
|
||||
@@ -59,6 +61,7 @@ const webUiUrl = "https://github.com/luc-github/ESP3D-WEBUI/tree/3.0"
|
||||
|
||||
export {
|
||||
MachineSettings,
|
||||
machineSettings,
|
||||
Target,
|
||||
defaultPreferences,
|
||||
files,
|
||||
|
||||
Reference in New Issue
Block a user