mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-28 12:11:05 +00:00
Add help button for PVE
This help button is meant to be added on InputPanels, where a link to an online documentation chapter or subschapter is available. Clicking on the help button will open the help in a new browser tab. Original idea similar to the pfSense GUI.
This commit is contained in:
parent
cc1a91be71
commit
ecbca6c4c0
@ -8,6 +8,7 @@ JSSRC= \
|
||||
button/Button.js \
|
||||
button/ConsoleButton.js \
|
||||
button/Split.js \
|
||||
button/HelpButton.js \
|
||||
qemu/SendKeyMenu.js \
|
||||
qemu/CmdMenu.js \
|
||||
qemu/TemplateMenu.js \
|
||||
|
30
www/manager6/button/HelpButton.js
Normal file
30
www/manager6/button/HelpButton.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* help button pointing to an online documentation
|
||||
for components contained in a modal window
|
||||
*/
|
||||
Ext.define('PVE.button.Help', {
|
||||
extend: 'Ext.button.Button',
|
||||
alias: 'widget.pveHelpButton',
|
||||
text: gettext('Help'),
|
||||
iconCls: 'fa fa-question-circle',
|
||||
hidden: true,
|
||||
controller: {
|
||||
xclass: 'Ext.app.ViewController',
|
||||
listen: {
|
||||
global: {
|
||||
pveShowHelp: 'onPveShowHelp',
|
||||
pveHideHelp: 'onPveHideHelp'
|
||||
}
|
||||
},
|
||||
onPveShowHelp: function(helpLink) {
|
||||
this.getView().setHandler(function() {
|
||||
var docsURI = window.location.origin +
|
||||
'/pve-docs/' + helpLink;
|
||||
window.open(docsURI);
|
||||
});
|
||||
this.getView().show();
|
||||
},
|
||||
onPveHideHelp: function() {
|
||||
this.getView().hide();
|
||||
}
|
||||
}
|
||||
});
|
@ -1,9 +1,21 @@
|
||||
Ext.define('PVE.panel.InputPanel', {
|
||||
extend: 'Ext.panel.Panel',
|
||||
alias: ['widget.inputpanel'],
|
||||
|
||||
listeners: {
|
||||
activate: function() {
|
||||
// notify owning container that it should display a help button
|
||||
this.onlineHelp && Ext.GlobalEvents.fireEvent('pveShowHelp', this.onlineHelp);
|
||||
},
|
||||
deactivate: function() {
|
||||
this.onlineHelp && Ext.GlobalEvents.fireEvent('pveHideHelp', this.onlineHelp);
|
||||
},
|
||||
},
|
||||
border: false,
|
||||
|
||||
// override this with an URL to a relevant chapter of the pve manual
|
||||
// setting this will display a help button in our parent panel
|
||||
onlineHelp: undefined,
|
||||
|
||||
// overwrite this to modify submit data
|
||||
onGetValues: function(values) {
|
||||
return values;
|
||||
|
Loading…
Reference in New Issue
Block a user