Skip to content

Commit

Permalink
Clean console.log
Browse files Browse the repository at this point in the history
Build packages
Bump version
  • Loading branch information
luc-github committed Aug 8, 2024
1 parent aeeacd9 commit 92e711a
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 24 deletions.
Binary file modified dist/CNC/GRBL/index.html.gz
Binary file not shown.
Binary file modified dist/CNC/GRBLHal/index.html.gz
Binary file not shown.
Binary file modified dist/Plotter/HP-GL/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin-embedded/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Repetier/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Smoothieware/index.html.gz
Binary file not shown.
Binary file modified dist/SandTable/GRBL/index.html.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions src/areas/elementsCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const ElementsCache = () => {
});
return result;
};
console.log("ElementsCache is rendering")
//console.log("ElementsCache is rendering")
useEffect(() => {
if (ui.ready && interfaceSettings.current?.settings?.extracontents) {
//console.log("ElementsCache can now be created")
const isEnabled = useUiContextFn.getValue("showextracontents")
if (!isEnabled) {
console.log("ExtraContent are disabled")
// console.log("ExtraContent are disabled")
return
}
const isVisibleOnStart = useUiContextFn.getValue("openextrapanelsonstart")
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
import { h } from "preact"
import { webUIbuild } from "../../targets"
export const webUIversion = "3.0.0-a70"
export const webUIversion = "3.0.0-a71"
export const Esp3dVersion = () => (
<span>
{webUIversion}.{webUIbuild}
Expand Down
31 changes: 21 additions & 10 deletions src/components/ExtraContent/extraContentItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,17 @@ const ExtraContentItem = ({
}, [id])

const loadContent = useCallback(() => {

if (target=="page"){
console.log("Loading content for page " + id)
console.log(useUiContextFn.panels.isVisible(elementsCache.getRootfromId(id)))
//console.log("Loading content for page " + id)
//console.log(useUiContextFn.panels.isVisible(elementsCache.getRootfromId(id)))
}

if (isPaused || !visibilityState[id] || (target=="panel" && !useUiContextFn.panels.isVisible(elementsCache.getRootfromId(id)))) return
if (isPaused || !visibilityState[id] || (target=="panel" && !useUiContextFn.panels.isVisible(elementsCache.getRootfromId(id)))) {
// console.log("Not loading content for " + id + " because it is paused or not visible")
return
}
//console.log("Loading content for " + id)
setIsLoading(true)
if (source.startsWith("http")) {
setContentUrl(source)
Expand Down Expand Up @@ -117,16 +122,16 @@ const ExtraContentItem = ({
const listenerId = `listener_${id}`;
const handleUpdateState = (msg) => {
if (msg.id == id) {
console.log(`Received message for ${id} with listener ${listenerId}`, msg);
//console.log(`Received message for ${id} with listener ${listenerId}`, msg);
const element = document.getElementById(id)
if ( 'forceRefresh' in msg && msg.forceRefresh) {
console.log(`Processing forceRefresh for ${id}`);
//console.log(`Processing forceRefresh for ${id}`);
loadContent()
}
if ('isVisible' in msg) {

if (element) {
console.log("Updating visibility for element " + id + " to " + msg.isVisible)
//console.log("Updating visibility for element " + id + " to " + msg.isVisible)
element.style.display = msg.isVisible ? 'block' : 'none';
//is it the same as the current state?
if (visibilityState[id]!= msg.isVisible){
Expand All @@ -152,8 +157,8 @@ const ExtraContentItem = ({

}
if ('position' in msg) {
console.log("Updating position for element " + id )
console.log(msg.position)
//console.log("Updating position for element " + id )
//console.log(msg.position)
const element = document.getElementById(id)
element.style.top = `${msg.position.top}px`;
element.style.left = `${msg.position.left}px`;
Expand All @@ -164,18 +169,24 @@ const ExtraContentItem = ({
}
eventBus.on("updateState", handleUpdateState, listenerId)
return () => {
console.log(`Removing listener ${listenerId} for ${id}`);
//console.log(`Removing listener ${listenerId} for ${id}`);
//eventBus.off("updateState", handleUpdateState, listenerId)
}
}, [id, loadContent])

useEffect(() => {
console.log("Updating refresh interval for " + id)
if (refreshtime > 0 && (type === "camera" || type === "image") && visibilityState[id] && !isPaused) {
refreshIntervalRef.current = setInterval(loadContent, refreshtime)
if (!refreshIntervalRef.current){
console.log("Starting refresh interval for " + id+ " with refreshtime " + refreshtime)
refreshIntervalRef.current = setInterval(loadContent, refreshtime)
}
}
return () => {
if (refreshIntervalRef.current) {
console.log("Stopping refresh interval for " + id)
clearInterval(refreshIntervalRef.current)
refreshIntervalRef.current = null
}
}
}, [refreshtime, type, isPaused, loadContent])
Expand Down
12 changes: 6 additions & 6 deletions src/components/ExtraContent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>

const updateContentPosition = () => {
if (!useUiContextFn.panels.isVisible(id)&& target=="panel") {
console.log("Not updating position for element " + extra_content_id, "in target", target_id, " of panel ", id, " because it is not visible")
//console.log("Not updating position for element " + extra_content_id, "in target", target_id, " of panel ", id, " because it is not visible")
return
}
console.log("Updating position for element " + extra_content_id, "in target", target_id, " of panel ", id)
//console.log("Updating position for element " + extra_content_id, "in target", target_id, " of panel ", id)
const container = document.getElementById(target_id)
if (container) {
const { top, left, width, height } = container.getBoundingClientRect()
Expand All @@ -63,7 +63,7 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
}, [updateContentPosition]);

useEffect(() => {
console.log("Updating element " + extra_content_id + " because visible list changed")
//console.log("Updating element " + extra_content_id + " because visible list changed")
if (useUiContextFn.panels.isVisible(id)) {
const main = document.getElementById("main")
if (main) {
Expand All @@ -82,11 +82,11 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
}, [panels.updateTrigger])

useEffect(() => {
console.log("Mount element " + id)
//console.log("Mount element " + id)
if (!elementsCache.has(extra_content_id)) {
console.error("Error display element " + extra_content_id, " because it doesn't exist")
} else {
console.log("Updating element " + extra_content_id + " because it already exists")
//console.log("Updating element " + extra_content_id + " because it already exists")
if (target=="page"){
updateContentPosition()
}
Expand All @@ -107,7 +107,7 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
main.removeEventListener('resize', handleScrollAndResize)
}
window.removeEventListener('resize', handleScrollAndResize)
console.log("Hiding element " + id)
//console.log("Hiding element " + id)
eventBus.emit('updateState', { id: extra_content_id, isVisible: false, from: "extraContent(return)" })
}
}, [])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Panels/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const TerminalPanel = () => {
}, [terminal.content])
useEffect(() => {
return () => {
console.log('Resetting terminal history');
//console.log('Resetting terminal history');
inputHistoryIndex.current = terminal.inputHistory.length - 1;
};
}, []);
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/UiContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const UiContextProvider = ({ children }) => {
}, [panelsList, panelsOrder]);

const isPanelVisible = useCallback((id) => {
console.log("Checking visibility for panel " + id)
console.log(visiblePanelsListRef.current)
//console.log("Checking visibility for panel " + id)
//console.log(visiblePanelsListRef.current)
return visiblePanelsListRef.current.some((element) => element.id == id);
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/eventBus.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ on(event, callback, id = null) {
// check if listener with this ID already exists
const existingListenerIndex = this.listeners[event].findIndex(listener => listener.id === listenerId);
if (existingListenerIndex !== -1) {
console.warn(`Listener with ID ${listenerId} for event ${event} already exists. Replacing.`);
//console.warn(`Listener with ID ${listenerId} for event ${event} already exists. Replacing.`);
// Replace existing listener
this.listeners[event][existingListenerIndex] = { id: listenerId, callback };
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const Dashboard = () => {
//console.log("Init Done")
}
return () => {
console.log("Unmount dashboard")
//console.log("Unmount dashboard")
}
}, [])

Expand Down

0 comments on commit 92e711a

Please sign in to comment.