Commit f643800a authored by Dietmar Maurer's avatar Dietmar Maurer

add button to display package versions

Provide same info as 'pveversion -v' on GUI.
parent 8c1d3a4e
......@@ -2,6 +2,67 @@ Ext.define('PVE.node.Summary', {
extend: 'Ext.panel.Panel',
alias: 'widget.pveNodeSummary',
showVersions: function() {
var me = this;
// Note: we use simply text/html here, because ExtJS grid has problems
// with cut&paste
var nodename = me.pveSelNode.data.node;
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('Package versions'),
width: 600,
height: 400,
layout: 'fit',
modal: true,
items: [ view ]
});
PVE.Utils.API2Request({
waitMsgTarget: me,
url: "/nodes/" + nodename + "/apt/versions",
method: 'GET',
failure: function(response, opts) {
win.close();
Ext.Msg.alert('Error', response.htmlStatus);
},
success: function(response, opts) {
win.show();
var text = '';
Ext.Array.each(response.result.data, function(rec) {
var version = "not correctly installed";
var pkg = rec.Package;
if (rec.OldVersion && rec.CurrentState === 'Installed') {
version = rec.OldVersion;
}
if (rec.RunningKernel) {
text += pkg + ': ' + version + ' (running kernel: ' +
rec.RunningKernel + ')\n';
} else if (rec.ManagerVersion) {
text += pkg + ': ' + version + ' (running version: ' +
rec.ManagerVersion + ')\n';
} else {
text += pkg + ': ' + version + '\n';
}
});
view.update(Ext.htmlEncode(text));
}
});
},
initComponent: function() {
var me = this;
......@@ -25,6 +86,13 @@ Ext.define('PVE.node.Summary', {
var rrdurl = "/api2/png/nodes/" + nodename + "/rrd";
var version_btn = new Ext.Button({
text: gettext('Package versions'),
handler: function(){
PVE.Utils.checked_command(function() { me.showVersions(); });
}
});
Ext.apply(me, {
autoScroll: true,
bodyStyle: 'padding:10px',
......@@ -32,7 +100,7 @@ Ext.define('PVE.node.Summary', {
width: 800,
style: 'padding-top:10px'
},
tbar: [ '->', { xtype: 'pveRRDTypeSelector' } ],
tbar: [version_btn, '->', { xtype: 'pveRRDTypeSelector' } ],
items: [
statusview,
{
......
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