mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-19 01:32:11 +00:00
utils: add onlineHelpTool
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c083fb770d
commit
139d9b7a5b
27
js/Utils.js
27
js/Utils.js
@ -8,6 +8,33 @@ Ext.define('PMG.Utils', {
|
||||
|
||||
// this singleton contains miscellaneous utilities
|
||||
|
||||
// use in panels with object spread (...) operator, for example:
|
||||
// ...PMG.Utils.onlineHelpTool('sysadmin_certificate_management'),
|
||||
onlineHelpTool: function(blockid) {
|
||||
let info = Proxmox.Utils.get_help_info(blockid);
|
||||
if (info === undefined) {
|
||||
info = Proxmox.Utils.get_help_info('pmg_documentation_index');
|
||||
if (info === undefined) {
|
||||
throw "get_help_info failed"; // should not happen
|
||||
}
|
||||
}
|
||||
|
||||
let docsURI = window.location.origin + info.link;
|
||||
let title = info.title || gettext('Help');
|
||||
if (info.subtitle) {
|
||||
title += ' - ' + info.subtitle;
|
||||
}
|
||||
return {
|
||||
tools: [
|
||||
{
|
||||
type: 'help',
|
||||
tooltip: title,
|
||||
handler: () => window.open(docsURI),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
senderText: gettext('Sender'),
|
||||
receiverText: gettext('Receiver'),
|
||||
scoreText: gettext('Score'),
|
||||
|
Loading…
Reference in New Issue
Block a user