]>
git.proxmox.com Git - proxmox-backup.git/blob - www/Subscription.js
1 Ext
.define('PBS.SubscriptionKeyEdit', {
2 extend
: 'Proxmox.window.Edit',
4 title
: gettext('Upload Subscription Key'),
8 onlineHelp
: 'get_help',
15 fieldLabel
: gettext('Subscription Key'),
19 Ext
.define('PBS.Subscription', {
20 extend
: 'Proxmox.grid.ObjectGrid',
21 xtype
: 'pbsSubscription',
23 title
: gettext('Subscription'),
26 onlineHelp
: 'get_help',
27 tools
: [PBS
.Utils
.get_help_tool("get_help")],
30 enableTextSelection
: true,
33 showReport: function() {
36 var getReportFileName = function() {
37 var now
= Ext
.Date
.format(new Date(), 'D-d-F-Y-G-i');
38 return `${me.nodename}-pbs-report-${now}.txt`;
41 var view
= Ext
.createWidget('component', {
42 itemId
: 'system-report-view',
46 'font-family': 'monospace',
52 reportWindow
= Ext
.create('Ext.window.Window', {
53 title
: gettext('System Report'),
61 text
: gettext('Download'),
63 let fileContent
= Ext
.htmlDecode(reportWindow
.getComponent('system-report-view').html
);
64 let fileName
= getReportFileName();
66 let dataUrl
= `data:text/plain;charset=utf-8,${encodeURIComponent(fileContent)}`;
68 Proxmox
.Utils
.downloadAsFile(dataUrl
, fileName
);
75 Proxmox
.Utils
.API2Request({
76 url
: '/api2/extjs/nodes/' + me
.nodename
+ '/report',
79 success: function(response
) {
80 var report
= Ext
.htmlEncode(response
.result
.data
);
87 initComponent: function() {
90 let reload
= () => me
.rstore
.load();
91 let baseurl
= '/nodes/localhost/subscription';
95 header
: gettext('Type'),
98 header
: gettext('Subscription Key'),
101 header
: gettext('Status'),
102 renderer
: (value
) => {
103 value
= Ext
.String
.capitalize(value
);
104 let message
= me
.getObjectValue('message');
106 return value
+ ": " + message
;
115 header
: gettext('Server ID'),
118 header
: gettext('Last checked'),
119 renderer
: Proxmox
.Utils
.render_timestamp
,
122 header
: gettext('Next due date'),
125 header
: gettext('Signed/Offline'),
126 renderer
: (value
) => {
128 return gettext('Yes');
130 return gettext('No');
137 url
: `/api2/json${baseurl}`,
141 text
: gettext('Upload Subscription Key'),
142 iconCls
: 'fa fa-ticket',
143 handler: function() {
144 Ext
.create('PBS.SubscriptionKeyEdit', {
145 url
: '/api2/extjs/' + baseurl
,
148 destroy
: () => reload(),
154 text
: gettext('Check'),
155 iconCls
: 'fa fa-check-square-o',
156 handler: function() {
157 Proxmox
.Utils
.API2Request({
158 params
: { force
: 1 },
167 text
: gettext('Remove Subscription'),
168 xtype
: 'proxmoxStdRemoveButton',
169 confirmMsg
: gettext('Are you sure you want to remove the subscription key?'),
174 iconCls
: 'fa fa-trash-o',
178 text
: gettext('System Report'),
179 iconCls
: 'fa fa-stethoscope',
180 handler: function() {
181 Proxmox
.Utils
.checked_command(function() { me
.showReport(); });