summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-attendedsysupgrade
diff options
context:
space:
mode:
authorPaul Spooren <paul@spooren.de>2017-08-11 20:58:35 +0200
committerPaul Spooren <paul@spooren.de>2017-08-11 20:58:35 +0200
commit2f53e30806d397805223b39e751463f8bc973da2 (patch)
treecbcd68a0680b7adda787a3ffbe55674e119ada8d /applications/luci-app-attendedsysupgrade
parent8bc19716615e264474113af433ccc9bd9f3380ca (diff)
luci-app-attendedsysupgrade: show updated packages
since the update server now checks packages for updates the web view will show all changed package versions. this PR is also important to support future package transformations of the server Signed-off-by: Paul Spooren <paul@spooren.de>
Diffstat (limited to 'applications/luci-app-attendedsysupgrade')
-rw-r--r--applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm26
1 files changed, 15 insertions, 11 deletions
diff --git a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm
index 4f8bf7cc9a..759949dbe5 100644
--- a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm
+++ b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm
@@ -1,12 +1,11 @@
<%+header%>
<h2 name="content"><%:Attended Sysupgrade%></h2>
-<div class="container">
- <div style="display: none" id="update_info" class="alert-message info">
- </div>
- <div style="display: none" id="update_error" class="alert-message danger">
- </div>
+<div class="container">
+ <div style="display: none" id="update_info" class="alert-message info"></div>
+ <div style="display: none" id="update_error" class="alert-message danger"></div>
</div>
<input class="cbi-button" value="search for updates" onclick="update_request()" type="button" id="update_button">
+<div style="display: none" id="packages" class="alert-message success"></div>
<script type="text/javascript">
@@ -22,7 +21,6 @@ function server_request(request_dict, path, callback) {
request_dict.distro = data.release.distribution;
request_dict.target = data.release.target.split("\/")[0];
request_dict.subtarget = data.release.target.split("\/")[1];
- request_dict.packages = data.packagelist;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-type", "application/json");
@@ -37,7 +35,6 @@ function server_request(request_dict, path, callback) {
// requests ubus via rpcd
function ubus_request(command, argument, params, callback) {
- // perform login if ubus_rpc_session is empty
var request_data = '{ "jsonrpc": "2.0", "id": ' + ubus_counter + ', "method": "call", "params": [ "'+ data["ubus_rpc_session"] +'", "' + command + '", "' + argument + '", ' + params + ' ] }'
ubus_counter++
var xmlhttp = new XMLHttpRequest();
@@ -107,6 +104,7 @@ function update_request() {
console.log("update_request")
request_dict = {}
request_dict.version = data.release.version;
+ request_dict.packages = data.packagelist;
server_request(request_dict, "update-request", update_request_callback)
}
@@ -161,11 +159,16 @@ function back_online_callback(response_object) {
function update_request_200(response_content) {
info_output = ""
if(response_content.version != undefined) {
- info_output += "new update available. from " + data.release.version + " to " + response_content.version
+ info_output += "<h3>new update available</h3>"
+ info_output += data.release.version + " to " + response_content.version
latest_version = response_content.version;
}
- if(response_content.packages != undefined) {
- info_output += "package updates available"
+ if(response_content.updates != undefined) {
+ info_output += "<h3>package updates available</h3>"
+ for (update in response_content.updates) {
+ info_output += "<b>" + update + "</b>: " + response_content.updates[update][1] + " to " + response_content.updates[update][0] + "</br>"
+ }
+ data.packages = response_content.packages
}
update_info(info_output)
document.getElementById("update_button").value = "request image";
@@ -178,6 +181,7 @@ function image_request() {
request_dict = {}
request_dict.version = latest_version;
request_dict.board = data.board_name
+ request_dict.packages = data.packages;
server_request(request_dict, "image-request", image_request_handler)
}
@@ -211,7 +215,7 @@ function image_request_handler(response) {
// ready to download
response_content = JSON.parse(response.responseText)
update_info("image created")
- document.getElementById("update_button").value = "download and flash"
+ document.getElementById("update_button").value = "sysupgrade"
document.getElementById("update_button").onclick = function() {download_image(response_content.url); }
}
}