]>
git.proxmox.com Git - proxmox-backup.git/blob - www/Subscription.js
0780c4d411742bc1b3810d6f8f291dfbc5e5cd5e
1 Ext
.define('PBS.SubscriptionKeyEdit', {
2 extend
: 'Proxmox.window.Edit',
4 title
: gettext('Upload Subscription Key'),
8 onlineHelp
: 'get_help',
11 xtype
: 'proxmoxtextfield',
16 fieldLabel
: gettext('Subscription Key'),
20 Ext
.define('PBS.Subscription', {
21 extend
: 'Proxmox.grid.ObjectGrid',
22 xtype
: 'pbsSubscription',
24 title
: gettext('Subscription'),
27 onlineHelp
: 'get_help',
28 tools
: [PBS
.Utils
.get_help_tool("get_help")],
31 enableTextSelection
: true,
34 showReport: function() {
37 var getReportFileName = function() {
38 var now
= Ext
.Date
.format(new Date(), 'D-d-F-Y-G-i');
39 return `${me.nodename}-pbs-report-${now}.txt`;
42 var view
= Ext
.createWidget('component', {
43 itemId
: 'system-report-view',
47 'font-family': 'monospace',
53 reportWindow
= Ext
.create('Ext.window.Window', {
54 title
: gettext('System Report'),
62 text
: gettext('Download'),
64 let fileContent
= Ext
.htmlDecode(reportWindow
.getComponent('system-report-view').html
);
65 let fileName
= getReportFileName();
67 let dataUrl
= `data:text/plain;charset=utf-8,${encodeURIComponent(fileContent)}`;
69 Proxmox
.Utils
.downloadAsFile(dataUrl
, fileName
);
76 Proxmox
.Utils
.API2Request({
77 url
: '/api2/extjs/nodes/' + me
.nodename
+ '/report',
80 success: function(response
) {
81 var report
= Ext
.htmlEncode(response
.result
.data
);
88 initComponent: function() {
91 let reload
= () => me
.rstore
.load();
92 let baseurl
= '/nodes/localhost/subscription';
96 header
: gettext('Type'),
99 header
: gettext('Subscription Key'),
102 header
: gettext('Status'),
103 renderer
: (value
) => {
104 value
= Ext
.String
.capitalize(value
);
105 let message
= me
.getObjectValue('message');
107 return value
+ ": " + message
;
116 header
: gettext('Server ID'),
119 header
: gettext('Last checked'),
120 renderer
: Proxmox
.Utils
.render_timestamp
,
123 header
: gettext('Next due date'),
126 header
: gettext('Signed/Offline'),
127 renderer
: (value
) => {
129 return gettext('Yes');
131 return gettext('No');
138 url
: `/api2/json${baseurl}`,
142 text
: gettext('Upload Subscription Key'),
143 iconCls
: 'fa fa-ticket',
144 handler: function() {
145 Ext
.create('PBS.SubscriptionKeyEdit', {
146 url
: '/api2/extjs/' + baseurl
,
149 destroy
: () => reload(),
155 text
: gettext('Check'),
156 iconCls
: 'fa fa-check-square-o',
157 handler: function() {
158 Proxmox
.Utils
.API2Request({
159 params
: { force
: 1 },
168 text
: gettext('Remove Subscription'),
169 xtype
: 'proxmoxStdRemoveButton',
170 confirmMsg
: gettext('Are you sure you want to remove the subscription key?'),
175 iconCls
: 'fa fa-trash-o',
179 text
: gettext('System Report'),
180 iconCls
: 'fa fa-stethoscope',
181 handler: function() {
182 Proxmox
.Utils
.checked_command(function() { me
.showReport(); });