Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/feeder refactoring #68

Open
wants to merge 60 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
bb5968f
Merge pull request #51 from texx00/beta
texx00 Sep 18, 2021
a0e7803
Merge branch 'alpha'
texx00 Sep 18, 2021
b7446ab
Update issue templates
texx00 Jan 6, 2022
1f0f718
Merge pull request #61 from texx00/alpha
texx00 Jan 15, 2022
e0eb34d
Bump follow-redirects from 1.14.6 to 1.14.7 in /frontend
dependabot[bot] Jan 15, 2022
9947427
Refactoring python code with black
texx00 Jan 15, 2022
5f15c05
Major queue manager refactoring
texx00 Jan 17, 2022
8346e39
Merge pull request #67 from texx00/dependabot/npm_and_yarn/frontend/f…
texx00 Jan 20, 2022
11c48b9
Bump nanoid from 3.1.30 to 3.2.0 in /frontend
dependabot[bot] Jan 22, 2022
e94836b
Started to divide feeder in multiple objects
texx00 Jan 23, 2022
08fee0b
Merge branch 'enhancement/feeder_refactoring' of https://github.com/t…
texx00 Jan 24, 2022
ac5489c
Adding readline and buffer control
texx00 Jan 30, 2022
f8106a4
Merge pull request #69 from texx00/dependabot/npm_and_yarn/frontend/n…
texx00 Jan 30, 2022
f58e0a5
Added grbl firmware class and fixed some problems with mutexes
texx00 Feb 1, 2022
7930382
Preparing firmwares tests. For some reason they are not working as ex…
texx00 Feb 1, 2022
0848c8c
Merge branch 'enhancement/feeder_refactoring' of https://github.com/t…
texx00 Feb 1, 2022
086f169
Fixing firmware tests
texx00 Feb 2, 2022
3da6820
Refactoring hardware related folders
texx00 Feb 3, 2022
9af3880
Started feeder
texx00 Feb 3, 2022
ad93080
Finished the feeder refactoring.
texx00 Feb 6, 2022
a67403c
Bug fixes for queue and controls with virtual device. Still need to t…
texx00 Feb 20, 2022
46dc9a7
Bump follow-redirects from 1.14.6 to 1.14.8 in /frontend (#70)
dependabot[bot] Feb 20, 2022
2589cc4
Bump url-parse from 1.5.3 to 1.5.7 in /frontend (#71)
dependabot[bot] Feb 20, 2022
39afdeb
Fixing tests.
texx00 Feb 20, 2022
fcbb09d
Bump url-parse from 1.5.3 to 1.5.10 in /frontend (#72)
dependabot[bot] Mar 24, 2022
1307d0c
Bump pillow from 9.0.0 to 9.0.1 (#73)
dependabot[bot] Mar 24, 2022
23ba9b0
Fixed server getting stuck at sending pages after startup
texx00 Mar 24, 2022
f6b1ae9
Cleanup
texx00 Mar 24, 2022
26bf100
Updating pytest workflow to check where and why it stops
texx00 Mar 31, 2022
d310330
Fixing possible infinite recursion in the queue manager
texx00 Mar 31, 2022
cc8ec0c
Testing if the pytest problem has to do with the logger
texx00 Mar 31, 2022
19ee8a4
Testing without last button test
texx00 Mar 31, 2022
f5909e2
Removing single command from buttons to check if it giving the error
texx00 Mar 31, 2022
e8f8eed
Removing action from start next
texx00 Mar 31, 2022
6ace0a9
Restored actions
texx00 Mar 31, 2022
7bf2d0d
Fixes for the docker build
texx00 Mar 31, 2022
3c07915
Marlin firmware minor fixes... Still some problems with the stop func…
texx00 Mar 31, 2022
80e229c
Serial readline refactor to parse a full line
texx00 Mar 31, 2022
3820466
Fixed drawing stop bug for marlin
texx00 Mar 31, 2022
20583dd
Fixed some issues with the device_serial class. Now should be much mo…
texx00 Apr 2, 2022
84ba469
Still problems with the stop function between drawings
texx00 Apr 2, 2022
d0c7dcf
Bump minimist from 1.2.5 to 1.2.6 in /frontend (#74)
dependabot[bot] Apr 2, 2022
23e353e
Major changes to the serial class. Now it is using the callbacks from…
texx00 Apr 10, 2022
c693e6e
Looks like the issue with the stop is fixed. Still some troubles with…
texx00 Apr 10, 2022
4979584
Fixing some comments
texx00 Apr 10, 2022
255dd99
Fixing issue with emulation: the software was not starting correctly.…
texx00 Apr 10, 2022
c60c1a6
Fixing endless loop in serial device for tests
texx00 Apr 10, 2022
8901129
Flask upgrade now is stuck and do not stop automatically. Need to fin…
texx00 Apr 15, 2022
7bbd06b
Adding git attributes
texx00 Apr 15, 2022
3ecf74f
Merge branch 'alpha' into enhancement/feeder_refactoring
texx00 Apr 15, 2022
20bf144
Setting all threads to be daemon. Now the software should be killable…
texx00 Apr 15, 2022
0005cca
Bump minimist from 1.2.5 to 1.2.6 in /frontend (#76)
dependabot[bot] Apr 19, 2022
5b6154c
Bump eventsource from 1.1.0 to 1.1.1 in /frontend (#78)
dependabot[bot] Jul 4, 2022
e672dfd
Bump async from 2.6.3 to 2.6.4 in /frontend (#77)
dependabot[bot] Jul 4, 2022
1295580
Adding a download 'diagnostic data' button
texx00 Jul 6, 2022
f2a19ce
Now Marlin is working better. The resend command is working but still…
texx00 Jul 16, 2022
8b9b88a
Somehow better than before but with Marlin... Sometimes it get stuck …
texx00 Jul 16, 2022
b7f28d9
Bump terser from 4.8.0 to 4.8.1 in /frontend (#80)
dependabot[bot] Nov 17, 2022
901440c
Bump mako from 1.1.6 to 1.2.2 (#81)
dependabot[bot] Nov 17, 2022
bf4faf5
Bump socket.io-parser from 3.3.2 to 3.3.3 in /frontend (#82)
dependabot[bot] Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ If applicable, add screenshots to help explain your problem.
- server OS: [Windows, Raspbian OS]
- server hardware [PC, Raspberry Pi 3B+, ....]
- serial device firmware [Marling, Grbl, ...] + version
- Version [use `git rev-parse --short HEAD`]
- Version hash [can be seen from the settings page in the web interface]
- Branch [if different than the main stable branch]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
flask db upgrade
- name: Test with pytest
run: |
python -m pytest server/tests
python -m pytest -s -v server/tests
2 changes: 1 addition & 1 deletion docs/old_troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $> source env/bin/activate
(env) $> python3 -m pip install pyserial
```

## "Serial not available. Will use fake device"
## "Serial not available. Will use virtual device"

The previous message may appear on the command line while running the program.
This is a normal behaviour on the first run because it is necessary to select the serial device to connect from the UI.
Expand Down
1 change: 1 addition & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Please specify:
* firmware (Marlin, Grbl, ...)
* The issue
* add a copy of the terminal result you get during the installation and when after running the software in orded to analyze better the problem
* if the UI is working, you can download a diagnostic zip file that can be uploaded together with the issue. This can be done with the button located at the bottom of the settings page.
108 changes: 54 additions & 54 deletions frontend/src/structure/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { showLEDs, systemIsLinux, updateDockerComposeLatest } from './tabs/setti
import { settingsRebootSystem, settingsShutdownSystem } from '../sockets/sEmits';

const mapStateToProps = (state) => {
return {
return {
showBack: showBack(state),
isLinux: systemIsLinux(state),
showLEDs: showLEDs(state),
Expand All @@ -22,34 +22,34 @@ const mapStateToProps = (state) => {
}

const mapDispatchToProps = (dispatch) => {
return {
return {
handleTab: (name) => dispatch(setTab(name)),
handleTabBack: () => dispatch(tabBack())
}
}

class TopBar extends Component{
class TopBar extends Component {

renderBack(){
renderBack() {
if (this.props.showBack)
return <Nav.Link key={20} className="text-bold" onClick={()=>{this.props.handleTabBack()}}><ChevronCompactLeft/>Back</Nav.Link>
return <Nav.Link key={20} className="text-bold" onClick={() => { this.props.handleTabBack() }}><ChevronCompactLeft />Back</Nav.Link>
else return "";
}

renderSettingsButton(){
renderSettingsButton() {
let notificationCounter = 0;
let renderedCounter = "";
if (!this.props.dockerComposeUpdateAvailable)
notificationCounter++;
if (notificationCounter>0){
renderedCounter = <span class="badge badge-danger ml-2">{notificationCounter}</span>
if (notificationCounter > 0) {
renderedCounter = <span className="badge badge-danger ml-2">{notificationCounter}</span>
}
if (this.props.isLinux)
return <Dropdown as={ButtonGroup}>
<IconButton className="btn btn-dark mr-0"
onClick={()=>{this.props.handleTab("settings")}}
<IconButton className="btn btn-dark mr-0"
onClick={() => { this.props.handleTab("settings") }}
icon={Sliders}>
Settings{renderedCounter}
Settings{renderedCounter}
</IconButton>

<Dropdown.Toggle split className="btn btn-dark ml-0" id="dropdown-split-basic" />
Expand All @@ -60,59 +60,59 @@ class TopBar extends Component{
onClick={() => settingsRebootSystem()}>Reboot</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
else return <IconButton className="btn btn-dark"
onClick={()=>{this.props.handleTab("settings")}}
icon={Sliders}>
Settings{renderedCounter}
</IconButton>
else return <IconButton className="btn btn-dark"
onClick={() => { this.props.handleTab("settings") }}
icon={Sliders}>
Settings{renderedCounter}
</IconButton>
}

renderLEDsTab(){
renderLEDsTab() {
if (this.props.showLEDs.value)
return <Nav.Link className={"h5" + (this.props.selectedTab === "leds" ? " highlight-tab" : "")}
key={5}
onClick={()=>{this.props.handleTab("leds")}}>
LEDs
key={5}
onClick={() => { this.props.handleTab("leds") }}>
LEDs
</Nav.Link>
else return "";
}

render(){
render() {
return <div>

<Navbar bg="primary" collapseOnSelect expand="lg" sticky="top" className="center">
<Navbar.Brand href="#home" onClick={()=>{this.props.handleTab("home")}}>
<h1 className="logo">Sandypi</h1>
</Navbar.Brand>
<Navbar.Toggle aria-controls="topbar-nav" />
<Navbar.Collapse id="topbar-nav" className="max-width">
<Nav className="mr-auto">
<Nav.Link className={"h5" + (this.props.selectedTab === "home" ? " highlight-tab" : "")}
key={1}
onClick={()=>{this.props.handleTab("home")}}>
Home
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "drawings" ? " highlight-tab" : "")}
key={2}
onClick={()=>{this.props.handleTab("drawings")}}>
Drawings
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "playlists" ? " highlight-tab" : "")}
key={3}
onClick={()=>{this.props.handleTab("playlists")}}>
Playlists
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "manual" ? " highlight-tab" : "")}
key={4}
onClick={()=>{this.props.handleTab("manual")}}>
Manual control
</Nav.Link>
{this.renderLEDsTab()}
{this.renderBack()}
</Nav>
<QueueControls/>
{this.renderSettingsButton()}
</Navbar.Collapse>
<Navbar.Brand href="#home" onClick={() => { this.props.handleTab("home") }}>
<h1 className="logo">Sandypi</h1>
</Navbar.Brand>
<Navbar.Toggle aria-controls="topbar-nav" />
<Navbar.Collapse id="topbar-nav" className="max-width">
<Nav className="mr-auto">
<Nav.Link className={"h5" + (this.props.selectedTab === "home" ? " highlight-tab" : "")}
key={1}
onClick={() => { this.props.handleTab("home") }}>
Home
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "drawings" ? " highlight-tab" : "")}
key={2}
onClick={() => { this.props.handleTab("drawings") }}>
Drawings
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "playlists" ? " highlight-tab" : "")}
key={3}
onClick={() => { this.props.handleTab("playlists") }}>
Playlists
</Nav.Link>
<Nav.Link className={"h5" + (this.props.selectedTab === "manual" ? " highlight-tab" : "")}
key={4}
onClick={() => { this.props.handleTab("manual") }}>
Manual control
</Nav.Link>
{this.renderLEDsTab()}
{this.renderBack()}
</Nav>
<QueueControls />
{this.renderSettingsButton()}
</Navbar.Collapse>
</Navbar>
</div>
}
Expand Down
47 changes: 24 additions & 23 deletions frontend/src/structure/tabs/playlists/Playlists.slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const playlistsSlice = createSlice({
let elements = action.payload.elements;
const playlistId = action.payload.playlistId;
let pls = state.playlists.map((pl) => {
pl = {...pl};
if (pl.id === playlistId){
pl = { ...pl };
if (pl.id === playlistId) {
let maxId = 1;
if (Array.isArray(pl.elements))
// looking for the highest element id to add a higher value to the elements that are being added (this avoid the creation of a new element when the element with id is sent back from the server)
maxId = Math.max(pl.elements.map(el => {return el.id}), 1) + 1;
for (let e in elements){
// looking for the highest element id to add a higher value to the elements that are being added (this avoid the creation of a new element when the element with id is sent back from the server)
maxId = Math.max(pl.elements.map(el => { return el.id }), 1) + 1;
for (let e in elements) {
elements[e].id = maxId++;
}
pl.elements = [...pl.elements];
Expand All @@ -33,34 +33,35 @@ const playlistsSlice = createSlice({
}
return pl;
});
return {...state, playlists: pls, mandatoryRefresh: true, playlistAddedNewElement: true };
return { ...state, playlists: pls, mandatoryRefresh: true, playlistAddedNewElement: true };
},
deletePlaylist: (state, action) => {
return { ...state, playlists: state.playlists.filter((item) => {
return item.id !== action.payload;
})}
return {
...state, playlists: state.playlists.filter((item) => {
return item.id !== action.payload;
})
}
},
resetPlaylistDeletedFlag: (state, action) => {
return {...state, playlistDeleted: false };
return { ...state, playlistDeleted: false };
},
resetMandatoryRefresh: (state, action) => {
return {...state, mandatoryRefresh: false};
return { ...state, mandatoryRefresh: false };
},
setPlaylists: (state, action) => {
let playlistDeleted = true; // to check if the playlist has been deleted from someone else
let pls = action.payload.map((pl)=>{
if (pl.id === state.playlistId){
let pls = action.payload.map((pl) => {
if (pl.id === state.playlistId) {
playlistDeleted = false;
}
pl.elements = JSON.parse(pl.elements);
return pl;
});
return {
...state,
playlists: pls,
playlistDeleted: playlistDeleted,
return {
...state,
playlists: pls,
playlistDeleted: playlistDeleted,
mandatoryRefresh: true
};
};
},
setSinglePlaylistId: (state, action) => {
return { ...state, playlistId: action.payload, mandatoryRefresh: true, showNewPlaylist: false };
Expand All @@ -70,11 +71,11 @@ const playlistsSlice = createSlice({
let version = 0;
let isNew = true;
let res = state.playlists.map((pl) => {
if (pl.id === playlist.id){
if (pl.id === playlist.id) {
version = pl.version;
isNew = false;
return playlist;
}else{
} else {
return pl;
}
});
Expand All @@ -87,9 +88,9 @@ const playlistsSlice = createSlice({
res.push(playlist)
// check if it is necessary to refresh the playlist view
let mustRefresh = (playlist.id === state.playlistId) && ((playlist.version > version) || state.playlistAddedNewElement);
return { ...state, playlists: res, playlistDeleted: false, mandatoryRefresh: mustRefresh, playlistAddedNewElement: false};
return { ...state, playlists: res, playlistDeleted: false, mandatoryRefresh: mustRefresh, playlistAddedNewElement: false };
},
setShowNewPlaylist(state, action){
setShowNewPlaylist(state, action) {
return { ...state, showNewPlaylist: action.payload }
}
}
Expand Down
28 changes: 14 additions & 14 deletions frontend/src/structure/tabs/queue/Queue.slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,49 @@ const queueSlice = createSlice({
repeat: false,
shuffle: false,
interval: 0,
status: {eta: -1}
status: { eta: -1 }
},
reducers: {
setInterval(state, action){
setInterval(state, action) {
return {
...state,
...state,
interval: action.payload
}
},
setQueueElements(state, action){
setQueueElements(state, action) {
return {
...state,
elements: action.payload
}
},
setQueueStatus(state, action){
setQueueStatus(state, action) {
let res = action.payload;
res.current_element = res.current_element === "None" ? undefined : JSON.parse(res.current_element);
return {
elements: res.elements,
elements: res.elements,
currentElement: res.current_element,
interval: res.interval,
status: res.status,
repeat: res.repeat,
shuffle: res.shuffle
interval: res.interval,
status: res.status,
repeat: res.repeat,
shuffle: res.shuffle
}
},
toggleQueueShuffle(state, action){
toggleQueueShuffle(state, action) {
return {
...state,
shuffle: !state.shuffle
}
},
toggleQueueRepeat(state, action){
toggleQueueRepeat(state, action) {
return {
...state,
...state,
repeat: !state.repeat
}
}
}
});

export const{
export const {
setInterval,
setQueueElements,
setQueueStatus,
Expand Down
Loading