andreisperid / E-TKT

open source embossed label maker
https://andreisperid.github.io/E-TKT/
MIT License
402 stars 19 forks source link

Move state handling into the webserver #16

Closed sabeechen closed 1 year ago

sabeechen commented 1 year ago

The main goal of this PR is to fix issue #12, which it accomplishes by making the webserver report its current state (busy, command, etc) through a simple JSON API, so the browser is no longer responsible for determining when the printer is working. This also allowed me to do some refactoring and simplification where it made sense in the context of my changes. In particular I've:

To the best of my ability this makes no change to the appearance or effective styling of the web interface. One benefit of this PR is that if the page is refreshed while printing its printing status will still be reflected after the refresh, ie preventing you from submitting a label until the previous one finishes. In such a case it won't show the proper label text, but I intend to address that in follow-up PR's as it requires more substantial refactoring to be done cleanly.

sabeechen commented 1 year ago

Apologies there were some upstream changes I neglected to merge into this PR previously, this one should be good to review.

andreisperid commented 1 year ago

Hey @sabeechen, great improvements, I've been testing and it seems super stable... Thank you very much!

I just noticed that while the music is playing the web app progress is 99%, it was a simple fix (32c6777b2d946535ac10cd0f4a1ddee7f458fe8f).

PS: I guess my auto format just changed a lot of formatting underneath, but it is just line 225.

sabeechen commented 1 year ago

What are you using to auto-format? I'll make sure I use the same mechanism.

andreisperid commented 1 year ago

I'm using prettier for VS Code with the standard settings. What about you?

sabeechen commented 1 year ago

Wasn't using anything (just trying to match style), but I'll start using prettier. I just want to use the same thing you're expecting.