pve-manager/www/manager6/dc/Support.js
Emmanuel Kasper 80e51f7ee6 Add a toplevel pointer to the PVE admin guide
Since the Admin Guide is now delivered with each standard
PVE installation, link it from the support tab

Initial idea was to include the chapters list in the panel itself
but a simple link renders better because:
* linking to toplevel allows to show that pdf and epub are also
available
* the chapter list is long and would need scrolling on laptop displays
* since a click opens the documentation in another tab, table of content
and content would be in two different tabs, which is not intuitive
2016-06-14 12:20:46 +02:00

88 lines
2.4 KiB
JavaScript

Ext.define('PVE.dc.Support', {
extend: 'Ext.panel.Panel',
alias: 'widget.pveDcSupport',
pveGuidePath: '/pve-docs/index.html',
invalidHtml: '<h1>No valid subscription</h1>' + PVE.Utils.noSubKeyHtml,
communityHtml: 'Please use the public community <a target="_blank" href="http://forum.proxmox.com">forum</a> for any questions.',
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.',
bugzillaHtml: '<h1>Bug Tracking</h1>Our bug tracking system is available <a target="_blank" href="https://bugzilla.proxmox.com">here</a>.',
docuHtml: function() {
var me = this;
var guideUrl = window.location.origin + me.pveGuidePath;
var text = Ext.String.format('<h1>Documentation</h1>'
+ 'The official Proxmox VE Administration Guide'
+ ' is included with this installation and can be browsed at '
+ '<a target="_blank" href="{0}">{0}</a>', guideUrl);
return text;
},
updateActive: function(data) {
var me = this;
var html = '<h1>' + data.productname + '</h1>' + me.activeHtml;
html += '<br><br>' + me.docuHtml();
html += '<br><br>' + me.bugzillaHtml;
me.update(html);
},
updateCommunity: function(data) {
var me = this;
var html = '<h1>' + data.productname + '</h1>' + me.communityHtml;
html += '<br><br>' + me.docuHtml();
html += '<br><br>' + me.bugzillaHtml;
me.update(html);
},
updateInactive: function(data) {
var me = this;
me.update(me.invalidHtml);
},
initComponent: function() {
var me = this;
var reload = function() {
PVE.Utils.API2Request({
url: '/nodes/localhost/subscription',
method: 'GET',
waitMsgTarget: me,
failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
me.update('Unable to load subscription status' + ": " + response.htmlStatus);
},
success: function(response, opts) {
var data = response.result.data;
if (data.status === 'Active') {
if (data.level === 'c') {
me.updateCommunity(data);
} else {
me.updateActive(data);
}
} else {
me.updateInactive(data);
}
}
});
};
Ext.apply(me, {
autoScroll: true,
bodyStyle: 'padding:10px',
listeners: {
activate: reload
}
});
me.callParent();
}
});