summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2019-03-18 16:41:23 +0100
committerPaul Spooren <mail@aparcar.org>2019-03-18 16:52:31 +0100
commit1dcf802257be82aea862db882258f8d0f5d49f16 (patch)
tree99601604ef828a30f2e581e1e0adfdb469daa6b5 /applications/luci-app-attendedsysupgrade/root/www/luci-static/resources
parentc318a10c14eba2eab616ab875a23722ef7655185 (diff)
luci-app-attendedsysupgrade: add 409 error code
HTTP Error code is send by the upgrade server in case of package conflicts, like when requesting to install both `odhcpd` and `odhcpd-ipv6only`. Also put a <p> around download links to make them look more appealing. Signed-off-by: Paul Spooren <mail@aparcar.org>
Diffstat (limited to 'applications/luci-app-attendedsysupgrade/root/www/luci-static/resources')
-rw-r--r--applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js27
1 files changed, 18 insertions, 9 deletions
diff --git a/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js b/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js
index a5fb0a1cb8..2cf5cc6e1b 100644
--- a/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js
+++ b/applications/luci-app-attendedsysupgrade/root/www/luci-static/resources/attendedsysupgrade.js
@@ -157,12 +157,15 @@ function ubus_call(command, argument, params, variable) {
request.send(request_json);
}
-function set_status(type, message, loading) {
+function set_status(type, message, loading, show_log) {
$("#status_box").className = "alert-message " + type;
var loading_image = '';
if (loading) {
loading_image = '<img src="/luci-static/resources/icons/loading.gif" alt="Loading" style="vertical-align:middle"> ';
}
+ if (show_log && data.log) {
+ message += ' <p><a target="_blank" href="' + data.url + data.log + '">Build log</a></p>'
+ }
$("#status_box").innerHTML = loading_image + message;
show("#status_box")
}
@@ -238,13 +241,13 @@ function upgrade_request() {
function upgrade_request_callback(request) {
// ready to download
- var request_json = JSON.parse(request);
- data.files = request_json.files;
- data.sysupgrade = request_json.sysupgrade;
+ var request_json = JSON.parse(request)
+ data.files = request_json.files
+ data.sysupgrade = request_json.sysupgrade
+ data.log = request_json.log
- var info_output = 'Firmware created: <a href="' + data.url + data.files + data.sysupgrade + '"><b>' + data.sysupgrade + '</b></a>'
- info_output += ' <a target="_blank" href="' + data.url + request_json.log + '">Build log</a>'
- set_status("info", info_output);
+ var info_output = '<h3>Firmware created</h3><p>Created file: <a href="' + data.url + data.files + data.sysupgrade + '">' + data.sysupgrade + '</p></a>'
+ set_status("success", info_output, false, true);
show("#keep_container");
var upgrade_button = $("#upgrade_button")
@@ -378,6 +381,12 @@ function server_request(path, callback) {
request_json = JSON.parse(request_text)
set_status("danger", request_json.error)
+ } else if (request.status === 409) {
+ // bad request
+ request_json = JSON.parse(request_text)
+ data.log = request_json.log
+ set_status("danger", "Incompatible package selection. See build log for details", false, true)
+
} else if (request.status === 412) {
// this is a bit generic
set_status("danger", "Unsupported device, release, target, subtraget or board")
@@ -394,9 +403,9 @@ function server_request(path, callback) {
var error_box_content = "<b>Internal server error</b><br />"
error_box_content += request_json.error
if (request_json.log != undefined) {
- data.log_url = request_json.log
+ data.log = request_json.log
}
- set_status("danger", error_box_content)
+ set_status("danger", error_box_content, false, true)
} else if (request.status === 501) {
set_status("danger", "No sysupgrade file produced, may not supported by model.")