c54cb3d642c0a3ce1515214ad0270969ba63b5c4
[pve-manager.git] / www / manager / dc / Support.js
1 Ext.define('PVE.dc.Support', {
2 extend: 'Ext.panel.Panel',
3 alias: 'widget.pveDcSupport',
4
5 invalidHtml: '<h1>No valid subscription</h1>You do not have a valid subscription for this server. Please visit <a target="_blank" href="http://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
6
7 communityHtml: 'Please use the public community <a target="_blank" href="http://forum.proxmox.com">forum</a> for any questions.',
8
9 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="http://forum.proxmox.com">forum</a> to get additional information.',
10
11 bugzillaHtml: '<h1>Bug Tracking</h1>Our bug tracking system is available <a target="_blank" href="https://bugzilla.proxmox.com">here</a>.',
12
13 docuHtml: '<h1>Documentation</h1>Complete documentation, tutorials, videos and more is available at our <a target="_blank" href="http://pve.proxmox.com/wiki/Documentation">wiki</a>.',
14
15 updateActive: function(data) {
16 var me = this;
17
18 var html = '<h1>' + data.productname + '</h1>' + me.activeHtml;
19 html += '<br><br>' + me.docuHtml;
20 html += '<br><br>' + me.bugzillaHtml;
21
22 me.update(html);
23 },
24
25 updateCommunity: function(data) {
26 var me = this;
27
28 var html = '<h1>' + data.productname + '</h1>' + me.communityHtml;
29 html += '<br><br>' + me.docuHtml;
30 html += '<br><br>' + me.bugzillaHtml;
31
32 me.update(html);
33 },
34
35 updateInactive: function(data) {
36 var me = this;
37 me.update(me.invalidHtml);
38 },
39
40 initComponent: function() {
41 var me = this;
42
43 var reload = function() {
44 PVE.Utils.API2Request({
45 url: '/nodes/localhost/subscription',
46 method: 'GET',
47 waitMsgTarget: me,
48 failure: function(response, opts) {
49 Ext.Msg.alert('Error', response.htmlStatus);
50 me.update("Unable to load subscription status: " + response.htmlStatus);
51 },
52 success: function(response, opts) {
53 var data = response.result.data;
54
55 if (data.status === 'Active') {
56 if (data.level === 'c') {
57 me.updateCommunity(data);
58 } else {
59 me.updateActive(data);
60 }
61 } else {
62 me.updateInactive(data);
63 }
64 }
65 });
66 };
67
68 Ext.apply(me, {
69 autoScroll: true,
70 bodyStyle: 'padding:10px',
71 listeners: {
72 show: reload
73 }
74 });
75
76 me.callParent();
77 }
78 });