]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/Support.js
ui: eslint: fix trailing spaces
[pve-manager.git] / www / manager6 / dc / Support.js
1 Ext.define('PVE.dc.Support', {
2 extend: 'Ext.panel.Panel',
3 alias: 'widget.pveDcSupport',
4 pveGuidePath: '/pve-docs/index.html',
5 onlineHelp: 'getting_help',
6
7 invalidHtml: '<h1>No valid subscription</h1>' + PVE.Utils.noSubKeyHtml,
8
9 communityHtml: 'Please use the public community <a target="_blank" href="https://forum.proxmox.com">forum</a> for any questions.',
10
11 activeHtml: 'Please use our <a target="_blank" href="https://my.proxmox.com">support portal</a> for any questions. You can also use the public community <a target="_blank" href="https://forum.proxmox.com">forum</a> to get additional information.',
12
13 bugzillaHtml: '<h1>Bug Tracking</h1>Our bug tracking system is available <a target="_blank" href="https://bugzilla.proxmox.com">here</a>.',
14
15 docuHtml: function() {
16 var me = this;
17 var guideUrl = window.location.origin + me.pveGuidePath;
18 var text = Ext.String.format('<h1>Documentation</h1>'
19 + 'The official Proxmox VE Administration Guide'
20 + ' is included with this installation and can be browsed at '
21 + '<a target="_blank" href="{0}">{0}</a>', guideUrl);
22 return text;
23 },
24
25 updateActive: function(data) {
26 var me = this;
27
28 var html = '<h1>' + data.productname + '</h1>' + me.activeHtml;
29 html += '<br><br>' + me.docuHtml();
30 html += '<br><br>' + me.bugzillaHtml;
31
32 me.update(html);
33 },
34
35 updateCommunity: function(data) {
36 var me = this;
37
38 var html = '<h1>' + data.productname + '</h1>' + me.communityHtml;
39 html += '<br><br>' + me.docuHtml();
40 html += '<br><br>' + me.bugzillaHtml;
41
42 me.update(html);
43 },
44
45 updateInactive: function(data) {
46 var me = this;
47 me.update(me.invalidHtml);
48 },
49
50 initComponent: function() {
51 var me = this;
52
53 var reload = function() {
54 Proxmox.Utils.API2Request({
55 url: '/nodes/localhost/subscription',
56 method: 'GET',
57 waitMsgTarget: me,
58 failure: function(response, opts) {
59 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
60 me.update('Unable to load subscription status' + ": " + response.htmlStatus);
61 },
62 success: function(response, opts) {
63 var data = response.result.data;
64
65 if (data.status === 'Active') {
66 if (data.level === 'c') {
67 me.updateCommunity(data);
68 } else {
69 me.updateActive(data);
70 }
71 } else {
72 me.updateInactive(data);
73 }
74 }
75 });
76 };
77
78 Ext.apply(me, {
79 autoScroll: true,
80 bodyStyle: 'padding:10px',
81 listeners: {
82 activate: reload
83 }
84 });
85
86 me.callParent();
87 }
88 });