ui: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-10-27 12:27:38 +01:00
parent 72c0e102ff
commit d28e688666

View File

@ -20,7 +20,6 @@ Ext.define('PBS.Subscription', {
xtype: 'pbsSubscription', xtype: 'pbsSubscription',
title: gettext('Subscription'), title: gettext('Subscription'),
border: true, border: true,
onlineHelp: 'getting_help', onlineHelp: 'getting_help',
@ -30,24 +29,12 @@ Ext.define('PBS.Subscription', {
}, },
initComponent: function() { initComponent: function() {
var me = this; let me = this;
var reload = function() { let reload = () => me.rstore.load();
me.rstore.load(); let baseurl = '/nodes/localhost/subscription';
};
var baseurl = '/nodes/localhost/subscription'; let rows = {
var render_status = function(value) {
var message = me.getObjectValue('message');
if (message) {
return value + ": " + message;
}
return value;
};
var rows = {
productname: { productname: {
header: gettext('Type'), header: gettext('Type'),
}, },
@ -56,7 +43,14 @@ Ext.define('PBS.Subscription', {
}, },
status: { status: {
header: gettext('Status'), header: gettext('Status'),
renderer: render_status, renderer: (value) => {
value = Ext.String.capitalize(value);
let message = me.getObjectValue('message');
if (message) {
return value + ": " + message;
}
return value;
},
}, },
message: { message: {
visible: false, visible: false,
@ -64,9 +58,6 @@ Ext.define('PBS.Subscription', {
serverid: { serverid: {
header: gettext('Server ID'), header: gettext('Server ID'),
}, },
sockets: {
header: gettext('Sockets'),
},
checktime: { checktime: {
header: gettext('Last checked'), header: gettext('Last checked'),
renderer: Proxmox.Utils.render_timestamp, renderer: Proxmox.Utils.render_timestamp,
@ -77,13 +68,13 @@ Ext.define('PBS.Subscription', {
}; };
Ext.apply(me, { Ext.apply(me, {
url: '/api2/json' + baseurl, url: `/api2/json${baseurl}`,
cwidth1: 170, cwidth1: 170,
tbar: [ tbar: [
{ {
text: gettext('Upload Subscription Key'), text: gettext('Upload Subscription Key'),
handler: function() { handler: function() {
var win = Ext.create('PBS.SubscriptionKeyEdit', { let win = Ext.create('PBS.SubscriptionKeyEdit', {
url: '/api2/extjs/' + baseurl, url: '/api2/extjs/' + baseurl,
}); });
win.show(); win.show();