Skip to content

Commit

Permalink
POC to select default FS on files panel
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-github committed Jul 1, 2024
1 parent 5452a06 commit f20ac35
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/components/Panels/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ import { Menu as PanelMenu } from "./"
let currentFS = ""
const currentPath = {}
const filesListCache = {}
let currentFSNeedInit = true

/*
* Local const
*
*/
const FilesPanel = () => {
const { panels, uisettings } = useUiContext()
if (currentFS == "") {
currentFS = useUiContextFn.getValue("default_filesystem")
if (typeof currentFS === "undefined") currentFS = ""
}
const id = "filesPanel"
const [filePath, setFilePath] = useState(currentPath[currentFS])
const [isLoading, setIsLoading] = useState(false)
Expand All @@ -66,8 +71,10 @@ const FilesPanel = () => {
const { modals, toasts } = useUiContext()
const fileref = useRef()
const dropRef = useRef()
const progressBar = {}

const progressBar = {}
console.log("currentFS", currentFS)

console.log(currentFS)
const onCancel = () => {
useUiContextFn.haptic()
processor.stopCatchResponse()
Expand Down Expand Up @@ -544,6 +551,12 @@ const FilesPanel = () => {
if (fs) {
currentFS = fs.value
onSelectFS(null, !useUiContextFn.getValue("autoload"))
currentFSNeedInit = false
}
} else {
if (currentFSNeedInit) {
currentFSNeedInit = false
onSelectFS(null, !useUiContextFn.getValue("autoload"))
}
}
setupFileInput()
Expand Down
16 changes: 15 additions & 1 deletion src/targets/Printer3D/Marlin/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,21 @@
"value": true
}
]
}
},
{
"id": "default_filesystem",
"type": "select",
"label": "S223",
"value": "flashfs",
"options": [
{ "value": "FLASH", "label": "S137", "depend": [{ "id": "flashfs", "value": true }] },
{ "value": "SD", "label": "S190" , "depend": [{ "id": "sd", "value": true }, { "connection_id": "SDConnection", "value": "=='none'"}] },
{ "value": "SDEXT", "label": "S191", "depend": [{ "id": "sdext", "value": true }] },
{ "value": "TFTSD", "label": "S188", "depend": [{ "id": "tftsd", "value": true }] },
{ "value": "TFTUSB", "label": "S189", "depend": [{ "id": "tftusb", "value": true }] },
{ "value": "DIRECTSD", "label": "S190", "depend": [{ "id": "sd", "value": true }, { "connection_id": "SDConnection", "value": "!='none'"}] }
]
}
],
"extruders": [
{
Expand Down
1 change: 1 addition & 0 deletions src/targets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
"S220": "Makerbase",
"S221": "Bigtreetech",
"S222": "Error loading file:",
"S223": "Default filesystem",
"btn+X": "X+",
"btn-X": "X-",
"btnHX": "Home X",
Expand Down

0 comments on commit f20ac35

Please sign in to comment.