feat: pin files to top of gcode files list #1684
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add the possibility to pin gcode file to the files view and file panel in dashboard
The pin/unpin action can be done through right click, and the icon of the file change to a pin icon to show that a file is currently pinned (while avoiding too much space).
The saved files list is store in the Moonraker DB under
gcodefiles.pinnedFiles
.However, I'm not sure of the implementation design.
My idea is to add a property
isPinned
to theFileStateGcodefile[]
that the panel get, and sort the files according to this property in thesortFiles
function inplugins/helpers
.I placed the actions/mutations in the
store/gui/
as thegcodefiles
db index was already accessible from there, and I also modified the gettergetGcodeFiles
to add the property to the FileStateGcodefile objects it returns, as well as thegetDeleteFile
action to remove the file from the pinnedFiles list (to avoid that if you delete a pinned file, then upload a file with the same name, it is automatically pinned).Related Tickets & Documents
Fixes #1257
Mobile & Desktop Screenshots/Recordings