From dea7844396f4cdcf4a2c27741bf73ae399f2bb49 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Tue, 2 Apr 2024 11:41:45 +0200 Subject: [PATCH 1/3] File input font matches the file item --- ui/arduino2/main.css | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/arduino2/main.css b/ui/arduino2/main.css index da59b1a..6d5754c 100644 --- a/ui/arduino2/main.css +++ b/ui/arduino2/main.css @@ -552,4 +552,5 @@ button.small .icon { border-radius: none; height: 100%; background: rgba(255, 255, 255, 0.5); + font-family: inherit; } From 092e5ab48816dc43e3ad134fa4b6bd84b1fa668b Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Tue, 2 Apr 2024 12:29:39 +0200 Subject: [PATCH 2/3] Alert about overwriting files on upload and download --- ui/arduino2/store.js | 51 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/ui/arduino2/store.js b/ui/arduino2/store.js index 2fe82dd..097c91e 100644 --- a/ui/arduino2/store.js +++ b/ui/arduino2/store.js @@ -752,6 +752,31 @@ async function store(state, emitter) { log('upload-files') state.isTransferring = true emitter.emit('render') + + // Check which files will be overwritten on the board + const willOverwrite = await checkOverwrite({ + source: 'board', + fileNames: state.selectedFiles.map(f => f.fileName), + parentPath: serial.getFullPath( + state.boardNavigationRoot, + state.boardNavigationPath, + '' + ), + }) + + if (willOverwrite.length > 0) { + let message = `You are about to overwrite the following files/folders on your board:\n\n` + willOverwrite.forEach(f => message += `${f.fileName}\n`) + message += `\n` + message += `Are you sure you want to proceed?` + const confirmAction = confirm(message, 'Cancel', 'Yes') + if (!confirmAction) { + state.isTransferring = false + emitter.emit('render') + return + } + } + for (let i in state.selectedFiles) { const file = state.selectedFiles[i] const srcPath = disk.getFullPath( @@ -793,6 +818,30 @@ async function store(state, emitter) { state.isTransferring = true emitter.emit('render') + // Check which files will be overwritten on the board + const willOverwrite = await checkOverwrite({ + source: 'disk', + fileNames: state.selectedFiles.map(f => f.fileName), + parentPath: disk.getFullPath( + state.diskNavigationRoot, + state.diskNavigationPath, + '' + ), + }) + + if (willOverwrite.length > 0) { + let message = `You are about to overwrite the following files/folders on your disk:\n\n` + willOverwrite.forEach(f => message += `${f.fileName}\n`) + message += `\n` + message += `Are you sure you want to proceed?` + const confirmAction = confirm(message, 'Cancel', 'Yes') + if (!confirmAction) { + state.isTransferring = false + emitter.emit('render') + return + } + } + for (let i in state.selectedFiles) { const file = state.selectedFiles[i] const srcPath = serial.getFullPath( @@ -971,7 +1020,7 @@ async function checkOverwrite({ fileNames = [], parentPath, source }) { let files = [] let overwrite = [] if (source === 'board') { - files = getBoardFiles(parentPath) + files = await getBoardFiles(parentPath) } else { files = await getDiskFiles(parentPath) } From 62101a7fd894febfdd5ed76bfee69d4a47095b76 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Tue, 2 Apr 2024 14:43:20 +0200 Subject: [PATCH 3/3] Fix wrong comment --- ui/arduino2/store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/arduino2/store.js b/ui/arduino2/store.js index 097c91e..f4a9d9e 100644 --- a/ui/arduino2/store.js +++ b/ui/arduino2/store.js @@ -818,7 +818,7 @@ async function store(state, emitter) { state.isTransferring = true emitter.emit('render') - // Check which files will be overwritten on the board + // Check which files will be overwritten on the disk const willOverwrite = await checkOverwrite({ source: 'disk', fileNames: state.selectedFiles.map(f => f.fileName),