Commit d3ce3535 authored by Dietmar Maurer's avatar Dietmar Maurer

improve changelog viewer

parent 59c8caa9
...@@ -10,7 +10,7 @@ use PVE::Tools qw(extract_param); ...@@ -10,7 +10,7 @@ use PVE::Tools qw(extract_param);
use PVE::Cluster; use PVE::Cluster;
use PVE::SafeSyslog; use PVE::SafeSyslog;
use PVE::INotify; use PVE::INotify;
use PVE::Exception qw(raise_param_exc); use PVE::Exception;
use PVE::RESTHandler; use PVE::RESTHandler;
use PVE::RPCEnvironment; use PVE::RPCEnvironment;
...@@ -136,7 +136,7 @@ my $update_pve_pkgstatus = sub { ...@@ -136,7 +136,7 @@ my $update_pve_pkgstatus = sub {
my $current_ver = $p->{CurrentVer}; my $current_ver = $p->{CurrentVer};
my $candidate_ver = $policy->candidate($p); my $candidate_ver = $policy->candidate($p);
if ($pkgname eq 'apt' || $current_ver->{VerStr} ne $candidate_ver->{VerStr}) { if ($current_ver->{VerStr} ne $candidate_ver->{VerStr}) {
my $info = $pkgrecords->lookup($pkgname); my $info = $pkgrecords->lookup($pkgname);
my $res = &$assemble_pkginfo($pkgname, $info, $current_ver, $candidate_ver); my $res = &$assemble_pkginfo($pkgname, $info, $current_ver, $candidate_ver);
push @$pkglist, $res; push @$pkglist, $res;
...@@ -365,7 +365,7 @@ __PACKAGE__->register_method({ ...@@ -365,7 +365,7 @@ __PACKAGE__->register_method({
if ($response->is_success) { if ($response->is_success) {
$data = $response->decoded_content; $data = $response->decoded_content;
} else { } else {
die $response->status_line; PVE::Exception::raise($response->message, code => $response->code);
} }
return $data; return $data;
......
...@@ -93,40 +93,43 @@ Ext.define('PVE.node.APT', { ...@@ -93,40 +93,43 @@ Ext.define('PVE.node.APT', {
return; return;
} }
var view = Ext.createWidget('component', {
autoScroll: true,
style: {
'background-color': 'white',
'white-space': 'pre',
'font-family': 'monospace',
padding: '5px'
}
});
var win = Ext.create('Ext.window.Window', { var win = Ext.create('Ext.window.Window', {
title: gettext('Changelog') + ": " + rec.data.Package, title: gettext('Changelog') + ": " + rec.data.Package,
width: 800, width: 800,
height: 400, height: 400,
layout: 'fit', layout: 'fit',
modal: true, modal: true,
items: { items: [ view ]
xtype: 'component', });
autoScroll: true,
style: { PVE.Utils.API2Request({
'background-color': 'white', waitMsgTarget: me,
'white-space': 'pre', url: "/nodes/" + nodename + "/apt/changelog",
padding: '10px' params: {
}, name: rec.data.Package,
loader: { version: rec.data.Version
url: "/api2/json/nodes/" + nodename + "/apt/changelog", },
params: { method: 'GET',
name: rec.data.Package, failure: function(response, opts) {
version: rec.data.Version win.close();
}, Ext.Msg.alert('Error', response.htmlStatus);
ajaxOptions: { method: 'GET' }, },
renderer: function(loader, response, active) { success: function(response, opts) {
var result = Ext.decode(response.responseText); win.show();
if (result && result.data) { view.update(Ext.htmlEncode(response.result.data));
loader.getTarget().update(Ext.htmlEncode(result.data));
} else {
console.dir(response);
}
},
autoLoad: true
}
} }
}); });
win.show();
}; };
var changelog_btn = new PVE.button.Button({ var changelog_btn = new PVE.button.Button({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment