diff --git a/esphome/dashboard/static/esphome.js b/esphome/dashboard/static/esphome.js
index 568537a3c9..39a060feb7 100644
--- a/esphome/dashboard/static/esphome.js
+++ b/esphome/dashboard/static/esphome.js
@@ -406,16 +406,27 @@ const logsModal = new LogModalElem({
});
logsModal.setup();
+const retryUploadButton = document.querySelector('.retry-upload');
+const editAfterUploadButton = document.querySelector('.edit-after-upload');
+const downloadAfterUploadButton = document.querySelector('.download-after-upload');
const uploadModal = new LogModalElem({
name: 'upload',
onPrepare: (modalElem, config) => {
+ retryUploadButton.setAttribute('data-node', uploadModal.activeConfig);
+ retryUploadButton.classList.add('hide');
+ editAfterUploadButton.setAttribute('data-node', uploadModal.activeConfig);
+ downloadAfterUploadButton.classList.remove('hide');
+ downloadAfterUploadButton.classList.add('disabled');
modalElem.querySelector(".stop-logs").innerHTML = "Stop";
},
onProcessExit: (modalElem, code) => {
if (code === 0) {
M.toast({html: "Program exited successfully."});
+ downloadAfterUploadButton.classList.remove('disabled');
} else {
M.toast({html: `Program failed with code ${code}`});
+ downloadAfterUploadButton.classList.add('hide');
+ retryUploadButton.classList.remove('hide');
}
modalElem.querySelector(".stop-logs").innerHTML = "Close";
},
@@ -425,6 +436,14 @@ const uploadModal = new LogModalElem({
dismissible: false,
});
uploadModal.setup();
+downloadAfterUploadButton.addEventListener('click', () => {
+ const link = document.createElement("a");
+ link.download = name;
+ link.href = `./download.bin?configuration=${encodeURIComponent(uploadModal.activeConfig)}`;
+ document.body.appendChild(link);
+ link.click();
+ link.remove();
+});
const validateModal = new LogModalElem({
name: 'validate',
diff --git a/esphome/dashboard/templates/index.html b/esphome/dashboard/templates/index.html
index b7df4509cc..a39d56d116 100644
--- a/esphome/dashboard/templates/index.html
+++ b/esphome/dashboard/templates/index.html
@@ -121,6 +121,9 @@
class="tooltipped" data-position="left" data-tooltip="Flash using esphomeflasher" rel="noreferrer">
help_outline
+ Download Binary
+ Edit
+ Retry
Stop