From 70f583c3e1d7c4bc1cca6b9c1cec6ca2e1f9e7b3 Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Sun, 27 Nov 2022 18:41:12 +0100 Subject: Octoprint service (#324) (#560) Add Octoprint service. --- dummy-data/README.md | 6 +++++ dummy-data/octoprint/api/job | 30 ++++++++++++++++++++++ .../api/status_printer_offline-error.json | 26 +++++++++++++++++++ .../octoprint/api/status_printer_offline.json | 26 +++++++++++++++++++ .../octoprint/api/status_printer_operational.json | 26 +++++++++++++++++++ .../octoprint/api/status_printer_printing.json | 30 ++++++++++++++++++++++ .../api/status_printer_printing_1of2.json | 30 ++++++++++++++++++++++ .../api/status_printer_printing_2of2.json | 30 ++++++++++++++++++++++ .../octoprint/api/status_printing_completion.json | 30 ++++++++++++++++++++++ dummy-data/speedtesttracker/api/speedtest/latest | 7 +++++ 10 files changed, 241 insertions(+) create mode 100644 dummy-data/octoprint/api/job create mode 100644 dummy-data/octoprint/api/status_printer_offline-error.json create mode 100644 dummy-data/octoprint/api/status_printer_offline.json create mode 100644 dummy-data/octoprint/api/status_printer_operational.json create mode 100644 dummy-data/octoprint/api/status_printer_printing.json create mode 100644 dummy-data/octoprint/api/status_printer_printing_1of2.json create mode 100644 dummy-data/octoprint/api/status_printer_printing_2of2.json create mode 100644 dummy-data/octoprint/api/status_printing_completion.json create mode 100644 dummy-data/speedtesttracker/api/speedtest/latest (limited to 'dummy-data') diff --git a/dummy-data/README.md b/dummy-data/README.md index 6db4712..78b2243 100644 --- a/dummy-data/README.md +++ b/dummy-data/README.md @@ -3,6 +3,12 @@ This directory content makes possible to test custom services cards or create a demo without actually running the service. The principle is simple: save a sample output of the API used in the service in a static file in this directory. The path must be identical as the service endpoint to be used seamlessly. +## Start the mock server to expose dummy data + +```sh +yarn mock +``` + ## How to add a new services sample - create a directory for your service, and any sub-folder existing in the service api path. diff --git a/dummy-data/octoprint/api/job b/dummy-data/octoprint/api/job new file mode 100644 index 0000000..c1ec6ed --- /dev/null +++ b/dummy-data/octoprint/api/job @@ -0,0 +1,30 @@ +{ + "job": { + "averagePrintTime": 669.3131185749999, + "estimatedPrintTime": 314.87566979223726, + "filament": { + "tool0": { + "length": 134.81171000000032, + "volume": 0.0 + } + }, + "file": { + "date": 1665547748, + "display": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "name": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "origin": "local", + "path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode", + "size": 129581 + }, + "lastPrintTime": 669.3131185749999, + "user": "friendlyngeeks" + }, + "progress": { + "completion": 27.456185706237797, + "filepos": 35578, + "printTime": 460, + "printTimeLeft": 4612, + "printTimeLeftOrigin": "linear" + }, + "state": "Printing" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_offline-error.json b/dummy-data/octoprint/api/status_printer_offline-error.json new file mode 100644 index 0000000..10fa163 --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_offline-error.json @@ -0,0 +1,26 @@ +{ + "error": "SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)", + "job": { + "averagePrintTime": null, + "estimatedPrintTime": null, + "filament": null, + "file": { + "date": null, + "display": null, + "name": null, + "origin": null, + "path": null, + "size": null + }, + "lastPrintTime": null, + "user": null + }, + "progress": { + "completion": null, + "filepos": null, + "printTime": null, + "printTimeLeft": null, + "printTimeLeftOrigin": null + }, + "state": "Offline after error" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_offline.json b/dummy-data/octoprint/api/status_printer_offline.json new file mode 100644 index 0000000..c733409 --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_offline.json @@ -0,0 +1,26 @@ +{ + "job": { + "estimatedPrintTime": null, + "filament": { + "length": null, + "volume": null + }, + "file": { + "date": null, + "name": null, + "origin": null, + "path": null, + "size": null + }, + "lastPrintTime": null, + "user": null + }, + "progress": { + "completion": null, + "filepos": null, + "printTime": null, + "printTimeLeft": null, + "printTimeOrigin": null + }, + "state": "Offline" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_operational.json b/dummy-data/octoprint/api/status_printer_operational.json new file mode 100644 index 0000000..993d798 --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_operational.json @@ -0,0 +1,26 @@ +{ + "job": { + "estimatedPrintTime": null, + "filament": { + "length": null, + "volume": null + }, + "file": { + "date": null, + "name": null, + "origin": null, + "path": null, + "size": null + }, + "lastPrintTime": null, + "user": null + }, + "progress": { + "completion": null, + "filepos": null, + "printTime": null, + "printTimeLeft": null, + "printTimeOrigin": null + }, + "state": "Operational" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_printing.json b/dummy-data/octoprint/api/status_printer_printing.json new file mode 100644 index 0000000..09cf3cf --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_printing.json @@ -0,0 +1,30 @@ +{ + "job": { + "averagePrintTime": 669.3131185749999, + "estimatedPrintTime": 314.87566979223726, + "filament": { + "tool0": { + "length": 134.81171000000032, + "volume": 0.0 + } + }, + "file": { + "date": 1665547748, + "display": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "name": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "origin": "local", + "path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode", + "size": 129581 + }, + "lastPrintTime": 669.3131185749999, + "user": "friendlyngeeks" + }, + "progress": { + "completion": 0.1551153332664511, + "filepos": 201, + "printTime": 0, + "printTimeLeft": 668, + "printTimeLeftOrigin": "average" + }, + "state": "Printing" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_printing_1of2.json b/dummy-data/octoprint/api/status_printer_printing_1of2.json new file mode 100644 index 0000000..09cf3cf --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_printing_1of2.json @@ -0,0 +1,30 @@ +{ + "job": { + "averagePrintTime": 669.3131185749999, + "estimatedPrintTime": 314.87566979223726, + "filament": { + "tool0": { + "length": 134.81171000000032, + "volume": 0.0 + } + }, + "file": { + "date": 1665547748, + "display": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "name": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "origin": "local", + "path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode", + "size": 129581 + }, + "lastPrintTime": 669.3131185749999, + "user": "friendlyngeeks" + }, + "progress": { + "completion": 0.1551153332664511, + "filepos": 201, + "printTime": 0, + "printTimeLeft": 668, + "printTimeLeftOrigin": "average" + }, + "state": "Printing" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printer_printing_2of2.json b/dummy-data/octoprint/api/status_printer_printing_2of2.json new file mode 100644 index 0000000..2acf861 --- /dev/null +++ b/dummy-data/octoprint/api/status_printer_printing_2of2.json @@ -0,0 +1,30 @@ +{ + "job": { + "averagePrintTime": 669.3131185749999, + "estimatedPrintTime": 314.87566979223726, + "filament": { + "tool0": { + "length": 134.81171000000032, + "volume": 0.0 + } + }, + "file": { + "date": 1665547748, + "display": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "name": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "origin": "local", + "path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode", + "size": 129581 + }, + "lastPrintTime": 669.3131185749999, + "user": "friendlyngeeks" + }, + "progress": { + "completion": 27.456185706237797, + "filepos": 35578, + "printTime": 476, + "printTimeLeft": 1612, + "printTimeLeftOrigin": "linear" + }, + "state": "Printing" +} \ No newline at end of file diff --git a/dummy-data/octoprint/api/status_printing_completion.json b/dummy-data/octoprint/api/status_printing_completion.json new file mode 100644 index 0000000..55728ba --- /dev/null +++ b/dummy-data/octoprint/api/status_printing_completion.json @@ -0,0 +1,30 @@ +{ + "job": { + "averagePrintTime": 698.814525153, + "estimatedPrintTime": 314.87566979223726, + "filament": { + "tool0": { + "length": 134.81171000000032, + "volume": 0.0 + } + }, + "file": { + "date": 1665547748, + "display": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "name": "CE3PRO_3mmX3mm Brass insert V2.gcode", + "origin": "local", + "path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode", + "size": 129581 + }, + "lastPrintTime": 728.315931731, + "user": "friendlyngeeks" + }, + "progress": { + "completion": 100.0, + "filepos": 129581, + "printTime": 728, + "printTimeLeft": 0, + "printTimeLeftOrigin": null + }, + "state": "Operational" +} \ No newline at end of file diff --git a/dummy-data/speedtesttracker/api/speedtest/latest b/dummy-data/speedtesttracker/api/speedtest/latest new file mode 100644 index 0000000..c8e3c1e --- /dev/null +++ b/dummy-data/speedtesttracker/api/speedtest/latest @@ -0,0 +1,7 @@ +{ + "data": { + "download": 42.452234, + "upload": 34.3948, + "ping": 12.9873 + } +} \ No newline at end of file -- cgit v1.2.3