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);
use PVE::Cluster;
use PVE::SafeSyslog;
use PVE::INotify;
use PVE::Exception qw(raise_param_exc);
use PVE::Exception;
use PVE::RESTHandler;
use PVE::RPCEnvironment;
......@@ -136,7 +136,7 @@ my $update_pve_pkgstatus = sub {
my $current_ver = $p->{CurrentVer};
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 $res = &$assemble_pkginfo($pkgname, $info, $current_ver, $candidate_ver);
push @$pkglist, $res;
......@@ -365,7 +365,7 @@ __PACKAGE__->register_method({
if ($response->is_success) {
$data = $response->decoded_content;
} else {
die $response->status_line;
PVE::Exception::raise($response->message, code => $response->code);
}
return $data;
......
......@@ -93,40 +93,43 @@ Ext.define('PVE.node.APT', {
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', {
title: gettext('Changelog') + ": " + rec.data.Package,
width: 800,
height: 400,
layout: 'fit',
modal: true,
items: {
xtype: 'component',
autoScroll: true,
style: {
'background-color': 'white',
'white-space': 'pre',
padding: '10px'
},
loader: {
url: "/api2/json/nodes/" + nodename + "/apt/changelog",
items: [ view ]
});
PVE.Utils.API2Request({
waitMsgTarget: me,
url: "/nodes/" + nodename + "/apt/changelog",
params: {
name: rec.data.Package,
version: rec.data.Version
},
ajaxOptions: { method: 'GET' },
renderer: function(loader, response, active) {
var result = Ext.decode(response.responseText);
if (result && result.data) {
loader.getTarget().update(Ext.htmlEncode(result.data));
} else {
console.dir(response);
}
method: 'GET',
failure: function(response, opts) {
win.close();
Ext.Msg.alert('Error', response.htmlStatus);
},
autoLoad: true
}
success: function(response, opts) {
win.show();
view.update(Ext.htmlEncode(response.result.data));
}
});
win.show();
};
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