diff options
author | Kristian Skramstad <kristian+github@83.no> | 2024-05-12 20:41:31 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-05-14 14:37:51 +0200 |
commit | 08b8b1d0e3bd541d18b66f52b903371dfe38ca95 (patch) | |
tree | a453faa90f2b191042297fed4e8d7762294f7224 /modules/luci-mod-system/htdocs/luci-static/resources/view | |
parent | 05c6a0887f88dd65b8176686f3aee5bd05d8771a (diff) |
luci-mod-system: flash.js: add mtdblock name to filename
When you download a partition, the name is hostname+mtdX.bin
and that can be confusing if you go back and try to remember
what mtdX was if you have 10+ partitions.
So let us add the partition name to the filename like:
hostname.mtdX.boot.bin
hostname.mtdX.firmware.bin
Note: If there is a better, easier and simpler way to do the
same thing, please let me know.
Signed-off-by: Kristian Skramstad <kristian+github@83.no>
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources/view')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js index 8661181781..6c67859f12 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -170,15 +170,17 @@ return view.extend({ }, handleBlock: function(hostname, ev) { - var mtdblock = dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select').value; + var mtdblock = dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select'); + var mtdnumber = mtdblock.value; + var mtdname = mtdblock.selectedOptions[0].text; var form = E('form', { 'method': 'post', 'action': L.env.cgi_base + '/cgi-download', 'enctype': 'application/x-www-form-urlencoded' }, [ E('input', { 'type': 'hidden', 'name': 'sessionid', 'value': rpc.getSessionID() }), - E('input', { 'type': 'hidden', 'name': 'path', 'value': '/dev/mtdblock%d'.format(mtdblock) }), - E('input', { 'type': 'hidden', 'name': 'filename', 'value': '%s.mtd%d.bin'.format(hostname, mtdblock) }) + E('input', { 'type': 'hidden', 'name': 'path', 'value': '/dev/mtdblock%d'.format(mtdnumber) }), + E('input', { 'type': 'hidden', 'name': 'filename', 'value': '%s.mtd%d.%s.bin'.format(hostname, mtdnumber, mtdname) }) ]); ev.currentTarget.parentNode.appendChild(form); |