2019-01-22 10:48:00 +00:00
|
|
|
Ext.define('PBS.SubscriptionKeyEdit', {
|
|
|
|
extend: 'Proxmox.window.Edit',
|
2019-12-18 18:21:59 +00:00
|
|
|
|
2019-01-22 10:48:00 +00:00
|
|
|
title: gettext('Upload Subscription Key'),
|
|
|
|
width: 300,
|
|
|
|
autoLoad: true,
|
|
|
|
|
|
|
|
onlineHelp: 'getting_help',
|
|
|
|
|
|
|
|
items: {
|
|
|
|
xtype: 'textfield',
|
|
|
|
name: 'key',
|
|
|
|
value: '',
|
2020-09-25 16:40:03 +00:00
|
|
|
fieldLabel: gettext('Subscription Key'),
|
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.Subscription', {
|
|
|
|
extend: 'Proxmox.grid.ObjectGrid',
|
|
|
|
xtype: 'pbsSubscription',
|
|
|
|
|
|
|
|
title: gettext('Subscription'),
|
|
|
|
|
2019-04-11 10:18:04 +00:00
|
|
|
border: true,
|
2019-01-22 10:48:00 +00:00
|
|
|
|
|
|
|
onlineHelp: 'getting_help',
|
|
|
|
|
|
|
|
viewConfig: {
|
2020-09-25 16:40:03 +00:00
|
|
|
enableTextSelection: true,
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
|
2020-09-25 16:40:03 +00:00
|
|
|
initComponent: function() {
|
2019-01-22 10:48:00 +00:00
|
|
|
var me = this;
|
|
|
|
|
|
|
|
var reload = function() {
|
|
|
|
me.rstore.load();
|
|
|
|
};
|
|
|
|
|
2020-07-21 11:41:06 +00:00
|
|
|
var baseurl = '/nodes/localhost/subscription';
|
2019-01-22 10:48:00 +00:00
|
|
|
|
|
|
|
var render_status = function(value) {
|
|
|
|
var message = me.getObjectValue('message');
|
|
|
|
|
|
|
|
if (message) {
|
|
|
|
return value + ": " + message;
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
};
|
|
|
|
|
|
|
|
var rows = {
|
|
|
|
productname: {
|
2020-09-25 16:40:03 +00:00
|
|
|
header: gettext('Type'),
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
key: {
|
2020-09-25 16:40:03 +00:00
|
|
|
header: gettext('Subscription Key'),
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
status: {
|
|
|
|
header: gettext('Status'),
|
2020-09-25 16:40:03 +00:00
|
|
|
renderer: render_status,
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
message: {
|
2020-09-25 16:40:03 +00:00
|
|
|
visible: false,
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
serverid: {
|
2020-09-25 16:40:03 +00:00
|
|
|
header: gettext('Server ID'),
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
sockets: {
|
2020-09-25 16:40:03 +00:00
|
|
|
header: gettext('Sockets'),
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
checktime: {
|
|
|
|
header: gettext('Last checked'),
|
2020-09-25 16:40:03 +00:00
|
|
|
renderer: Proxmox.Utils.render_timestamp,
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
nextduedate: {
|
2020-09-25 16:40:03 +00:00
|
|
|
header: gettext('Next due date'),
|
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Ext.apply(me, {
|
|
|
|
url: '/api2/json' + baseurl,
|
|
|
|
cwidth1: 170,
|
2019-12-18 18:21:59 +00:00
|
|
|
tbar: [
|
2019-01-22 10:48:00 +00:00
|
|
|
{
|
|
|
|
text: gettext('Upload Subscription Key'),
|
|
|
|
handler: function() {
|
|
|
|
var win = Ext.create('PBS.SubscriptionKeyEdit', {
|
2020-09-25 16:40:03 +00:00
|
|
|
url: '/api2/extjs/' + baseurl,
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|
|
|
|
win.show();
|
|
|
|
win.on('destroy', reload);
|
2020-09-25 16:40:03 +00:00
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Check'),
|
|
|
|
handler: function() {
|
|
|
|
Proxmox.Utils.API2Request({
|
|
|
|
params: { force: 1 },
|
|
|
|
url: baseurl,
|
|
|
|
method: 'POST',
|
|
|
|
waitMsgTarget: me,
|
|
|
|
failure: function(response, opts) {
|
|
|
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
|
|
|
},
|
2020-09-25 16:40:03 +00:00
|
|
|
callback: reload,
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|
2020-09-25 16:40:03 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
],
|
2020-09-25 16:40:03 +00:00
|
|
|
rows: rows,
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
me.callParent();
|
|
|
|
|
|
|
|
reload();
|
2020-09-25 16:40:03 +00:00
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|