-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,242 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"plugins": [ | ||
"babel-plugin-styled-components", | ||
[ | ||
"@babel/plugin-proposal-decorators", | ||
{ | ||
"legacy": true | ||
} | ||
] | ||
], | ||
"presets": [ | ||
"react-app" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { useBabelRc, override } = require("customize-cra"); | ||
|
||
module.exports = override( useBabelRc() ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "config-overrides", | ||
"version": "2.0.0", | ||
"main": "index.js", | ||
"license": "UNLICENSED", | ||
"author": "nikelborm" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { AllSensorsRecordsStore } from "../store/AllSensorsRecords"; | ||
|
||
const RegExpForSearchTemperatureLines = /T:(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,})) \/(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,})) B:(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,})) \/(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,})) @:(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,})) B@:(([+-]{0,1}[0-9]{1,}[.][0-9]{1,})|([+-]{0,1}[0-9]{1,}))/; | ||
|
||
export const connectWSHandlersFromAllSensorsRecordsStore = AppWSChannel => { | ||
AppWSChannel.addMessageListener( data => { | ||
if ( data.event !== "printerSendedLine" ) return; | ||
if( RegExpForSearchTemperatureLines.test( data.line ) ) return; | ||
AllSensorsRecordsStore.parseTemperatureLineAndArrangeIntoDatasets( data.line, data.time ); | ||
} ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { action } from "mobx"; | ||
import { AuthInfoStore, login } from "../store/AuthManager"; | ||
|
||
export const connectWSHandlersFromAuthInfoStore = AppWSChannel => { | ||
AppWSChannel.addEventListener( "open", action( () => { | ||
if ( AuthInfoStore.amIAuthorized ) login( AuthInfoStore.storedPassword ); | ||
} ) ); | ||
|
||
AppWSChannel.addMessageListener( action( data => { | ||
if ( data.event !== "userAuthReply" ) return; | ||
AuthInfoStore.finishAuthProcess(); | ||
if ( data.report.isError ) { | ||
alert( data.report.errorField + " " + data.report.info ); | ||
} else { | ||
AuthInfoStore.savePassword( data.reply.password ); | ||
} | ||
} ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { PrinterStatusStore } from "../store/PrinterStatus"; | ||
|
||
export const connectWSHandlersFromPrinterStatusStore = AppWSChannel => { | ||
AppWSChannel.addEventListener( "close", () => { | ||
PrinterStatusStore.setUnknownConnectionStatus(); | ||
} ); | ||
|
||
AppWSChannel.addMessageListener( data => { | ||
switch ( data.event ) { | ||
case "printerState": { | ||
PrinterStatusStore.setPrinterConnectionStatus( data.isPrinterConnected ); | ||
break; | ||
} | ||
case "modelPrintingStatusWasChanged": { | ||
if ( data.isPrintingActive ) { | ||
PrinterStatusStore.setActivePrintingStatus( { | ||
secondsCost: data.secondsCost, | ||
gCodeFileName: data.gCodeFileName, | ||
startTime: data.startTime, | ||
finishTime: data.finishTime, | ||
} ); | ||
} else { | ||
PrinterStatusStore.setInactivePrintingStatus(); | ||
} | ||
break; | ||
} | ||
default: break; | ||
} | ||
} ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { TerminalLogsStore } from "../store/TerminalLogs"; | ||
|
||
export const connectWSHandlersFromTerminalLogsStore = AppWSChannel => { | ||
AppWSChannel.addEventListener( "open", () => { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date(), | ||
prefixcontent: "wserver", | ||
name: "connect-success", | ||
linecontent: "Соединение с сервером установлено!" | ||
} ); | ||
} ); | ||
|
||
AppWSChannel.addEventListener( "close", () => { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date(), | ||
prefixcontent: "wserver", | ||
name: "connect-error", | ||
linecontent: "Соединение с сервером разорвано, переподключение..." | ||
} ); | ||
} ); | ||
|
||
AppWSChannel.addMessageListener( data => { | ||
switch ( data.event ) { | ||
case "clientSendedGCommand": { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date( data.time ), | ||
name: "client", | ||
prefixcontent: "command", | ||
linecontent: data.command, | ||
id: data.id | ||
} ); | ||
break; | ||
} | ||
case "printerState": { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date( data.time ), | ||
name: data.isPrinterConnected ? "connect-success" : "connect-error", | ||
prefixcontent: "printer", | ||
linecontent: data.isPrinterConnected ? "Принтер подключён" : "Принтер отключён" | ||
} ); | ||
break; | ||
} | ||
case "clientSendedGCodeFile": { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date( data.time ), | ||
name: "client", | ||
prefixcontent: "_.gcode", | ||
linecontent: data.preview | ||
} ); | ||
break; | ||
} | ||
case "printerSendedLine": { | ||
TerminalLogsStore.addLineIntoTerminalLogs( { | ||
time: new Date( data.time ), | ||
name: "printer", | ||
prefixcontent: "printer", | ||
linecontent: data.line | ||
} ); | ||
break; | ||
} | ||
default: break; | ||
} | ||
} ); | ||
} |
2 changes: 1 addition & 1 deletion
2
src/components/FilePrintingStatusBar/components/CloseButton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
src/components/FilePrintingStatusBar/components/FilePrintingProgressBar.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import { observer } from "mobx-react"; | ||
import { StyledProgressBar } from "./StyledProgressBar"; | ||
import { PrinterStatusStore } from "../../../store/PrinterStatus"; | ||
|
||
export const FilePrintingProgressBar = observer( () => { | ||
const { isPrintingFinished, printingPercentFinished } = PrinterStatusStore; | ||
return ( | ||
<StyledProgressBar | ||
isPrintingFinished={ isPrintingFinished } | ||
percent={ printingPercentFinished } | ||
/> | ||
); | ||
} ); | ||
export const FilePrintingProgressBar = observer( () => ( | ||
<StyledProgressBar | ||
isPrintingFinished={ PrinterStatusStore.isPrintingFinished } | ||
percent={ PrinterStatusStore.printingPercentFinished } | ||
/> | ||
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.