diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-25 19:42:06 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-25 19:42:06 +0200 |
commit | 855208c59d782710e07f65c5f558f81c7c9beda1 (patch) | |
tree | db5fef99e90b6522c046903d044eb927359df850 | |
parent | e17cd94be707d6dff6873fc8562dfda43810dcf9 (diff) |
luci-mod-system: flash.js: disable mtdblock downloads on mtd-less systems
Ref: https://github.com/openwrt/luci/commit/3c40a7450a9b7d340cdc9e233818c63a8092fec2#commitcomment-35233073
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js | 28 |
1 files changed, 15 insertions, 13 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 bea587625d..08c97650ea 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 @@ -508,20 +508,22 @@ return L.view.extend({ o.onclick = L.bind(this.handleRestore, this); - o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Save mtdblock contents'), _('Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )')); - ss = o.subsection; - - o = ss.option(form.ListValue, 'mtdselect', _('Choose mtdblock')); - procmtd.split(/\n/).forEach(function(ln) { - var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/); - if (match) - o.value(match[1], match[2]); - }); + if (procmtd.length) { + o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Save mtdblock contents'), _('Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )')); + ss = o.subsection; + + o = ss.option(form.ListValue, 'mtdselect', _('Choose mtdblock')); + procmtd.split(/\n/).forEach(function(ln) { + var match = ln.match(/^mtd(\d+): .+ "(.+?)"$/); + if (match) + o.value(match[1], match[2]); + }); - o = ss.option(form.Button, 'mtddownload', _('Download mtdblock')); - o.inputstyle = 'action important'; - o.inputtitle = _('Save mtdblock'); - o.onclick = L.bind(this.handleBlock, this, hostname); + o = ss.option(form.Button, 'mtddownload', _('Download mtdblock')); + o.inputstyle = 'action important'; + o.inputtitle = _('Save mtdblock'); + o.onclick = L.bind(this.handleBlock, this, hostname); + } o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Flash new firmware image'), |