]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/node/APT.js
1 Ext
.define('PVE.node.APT', {
2 extend
: 'Ext.grid.GridPanel',
4 alias
: ['widget.pveNodeAPT'],
6 initComponent : function() {
9 var nodename
= me
.pveSelNode
.data
.node
;
11 throw "no node name specified";
14 var store
= Ext
.create('Ext.data.Store', {
19 url
: "/api2/json/nodes/" + nodename
+ "/apt/update"
29 var groupingFeature
= Ext
.create('Ext.grid.feature.Grouping', {
30 groupHeaderTpl
: '{[ "Origin: " + values.name ]} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
31 enableGroupingMenu
: false
34 var rowBodyFeature
= Ext
.create('Ext.grid.feature.RowBody', {
35 getAdditionalData: function (data
, rowIndex
, record
, orig
) {
36 var headerCt
= this.view
.headerCt
;
37 var colspan
= headerCt
.getColumnCount();
38 // Usually you would style the my-body-class in CSS file
40 rowBody
: '<div style="padding: 1em">' + Ext
.String
.htmlEncode(data
.Description
) + '</div>',
41 rowBodyColspan
: colspan
46 var reload = function() {
50 me
.loadCount
= 1; // avoid duplicate load mask
51 PVE
.Utils
.monStoreErrors(me
, store
);
53 var apt_command = function(cmd
){
54 PVE
.Utils
.API2Request({
55 url
: "/nodes/" + nodename
+ "/apt/" + cmd
,
57 failure: function(response
, opts
) {
58 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
60 success: function(response
, opts
) {
61 var upid
= response
.result
.data
;
63 var win
= Ext
.create('PVE.window.TaskViewer', {
67 me
.mon(win
, 'close', reload
);
72 var sm
= Ext
.create('Ext.selection.RowModel', {});
74 var update_btn
= new Ext
.Button({
75 text
: gettext('Refresh'),
77 PVE
.Utils
.checked_command(function() { apt_command('update'); });
81 var upgrade_btn
= Ext
.create('PVE.button.ConsoleButton', {
82 disabled
: !(PVE
.UserName
&& PVE
.UserName
=== 'root@pam'),
83 text
: gettext('Upgrade'),
84 consoleType
: 'upgrade',
88 var show_changelog = function(rec
) {
89 if (!rec
|| !rec
.data
|| !(rec
.data
.ChangeLogUrl
&& rec
.data
.Package
)) {
93 var view
= Ext
.createWidget('component', {
96 'background-color': 'white',
98 'font-family': 'monospace',
103 var win
= Ext
.create('Ext.window.Window', {
104 title
: gettext('Changelog') + ": " + rec
.data
.Package
,
112 PVE
.Utils
.API2Request({
114 url
: "/nodes/" + nodename
+ "/apt/changelog",
116 name
: rec
.data
.Package
,
117 version
: rec
.data
.Version
120 failure: function(response
, opts
) {
122 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
124 success: function(response
, opts
) {
126 view
.update(Ext
.htmlEncode(response
.result
.data
));
132 var changelog_btn
= new PVE
.button
.Button({
133 text
: gettext('Changelog'),
136 enableFn: function(rec
) {
137 if (!rec
|| !rec
.data
|| !(rec
.data
.ChangeLogUrl
&& rec
.data
.Package
)) {
142 handler: function(b
, e
, rec
) {
153 emptyText
: '<div style="display:table; width:100%; height:100%;"><div style="display:table-cell; vertical-align: middle; text-align:center;"><b>' + gettext('No updates available.') + '</div></div>'
155 tbar
: [ update_btn
, upgrade_btn
, changelog_btn
],
156 features
: [ groupingFeature
, rowBodyFeature
],
159 header
: gettext('Package'),
165 text
: gettext('Version'),
168 header
: gettext('current'),
171 dataIndex
: 'OldVersion'
174 header
: gettext('new'),
182 header
: gettext('Description'),
190 itemdblclick: function(v
, rec
) {
200 Ext
.define('apt-pkglist', {
201 extend
: 'Ext.data.Model',
202 fields
: [ 'Package', 'Title', 'Description', 'Section', 'Arch',
203 'Priority', 'Version', 'OldVersion', 'ChangeLogUrl', 'Origin' ],
204 idProperty
: 'Package'