luci-app-attendedsysupgrade: reorder and reword error instructions
authorEric Fahlgren <[email protected]>
Tue, 23 Sep 2025 14:35:36 +0000 (07:35 -0700)
committerPaul Donald <[email protected]>
Wed, 29 Oct 2025 01:33:57 +0000 (02:33 +0100)
Many users have been posting incomplete error information to the
forum and in git issues.  They'll not report important information
that is above the paragraph indicating where to report it, only
the partial information below it.

Remedy this by putting the reporting instructions first, and make
explicit that everything below is needed.  Add a new button that
creates a report appropriate for a forum post and saves it to the
clipboard.

Signed-off-by: Eric Fahlgren <[email protected]>
(cherry picked from commit e2f02198f9010152022ad15ffe2635fc490bf96a)

applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js

index eef35d4fdaf4bbc2d0dade332d89204755f1ebac..36ea8fd36e30691361ed7e2da545268927a7e41b 100644 (file)
@@ -257,12 +257,75 @@ return view.extend({
                        ...firmware
                };
                let body = [
-                       E('p', {}, _('Server response: %s').format(response.detail)),
+                       E('p', {}, [
+                               _('First check '),
+                               E(
+                                       'a',
+                                       { href: 'https://forum.openwrt.org/t/luci-attended-sysupgrade-support-thread/230552' },
+                                       _('this forum thread')
+                               ),
+                               _('.  If you don\'t find a solution there, report all of the information below.')
+                       ]),
+
                        E(
-                               'a',
-                               { href: 'https://forum.openwrt.org/t/luci-attended-sysupgrade-support-thread/230552' },
-                               _('Please report the error message and request')
+                               'button',
+                               {
+                                       class: 'btn cbi-button cbi-button-positive important',
+                                       click: ui.createHandlerFn(this, function () {
+                                               // No translations in here as it's intended for the forum.
+                                               var text =
+                                                       'Server response: %s'.format(response.detail)
+                                                       + '\n\n'
+                                                       + '`--version-to %s --device %s:%s`'.format(
+                                                               request_data.version,
+                                                               request_data.target,
+                                                               request_data.profile,
+                                                         )
+                                                       + '\n\n'
+                                                       + '[details="Request Data"]\n'
+                                                       + '```\n'
+                                                       + JSON.stringify({ ...request_data }, null, 4) + '\n'
+                                                       + '```\n'
+                                                       + '[/details]\n'
+                                               ;
+                                               if (response.stdout) {
+                                                       text = text +
+                                                               '[details="STDOUT"]\n'
+                                                               + '```\n'
+                                                               + response.stdout + '\n'
+                                                               + '```\n'
+                                                               + '[/details]\n'
+                                                       ;
+                                               }
+                                               if (response.stderr) {
+                                                       text = text +
+                                                               '[details="STDERR"]\n'
+                                                               + '```\n'
+                                                               + response.stderr + '\n'
+                                                               + '```\n'
+                                                               + '[/details]\n'
+                                                       ;
+                                               }
+
+                                               navigator.clipboard.writeText(text);
+
+                                               ui.showModal(_('Data copied!'), [
+                                                       E('p', {}, [
+                                                               _('Paste the contents of the clipboard to '),
+                                                               E(
+                                                                       'a',
+                                                                       { href: 'https://forum.openwrt.org/t/luci-attended-sysupgrade-support-thread/230552' },
+                                                                       _('this forum thread')
+                                                               ),
+                                                       ]),
+                                                       E('div', { class: 'btn', click: ui.hideModal }, _('Close')),
+                                               ]);
+                                       }),
+                               },
+                               _('Copy error data to clipboard')
                        ),
+
+                       E('p', {}, _('Server response: %s').format(response.detail)),
                        E('p', {}, _('Request Data:')),
                        E('pre', {}, JSON.stringify({ ...request_data }, null, 4)),
                ];