Merge pull request #3717 from node-red/tour-help

List welcome tours in help sidebar
This commit is contained in:
Nick O'Leary
2022-06-28 20:54:44 +01:00
committed by GitHub
10 changed files with 438 additions and 12 deletions

View File

@@ -20,10 +20,8 @@ RED.sidebar.help = (function() {
var helpSection;
var panels;
var panelRatio;
var helpTopics = [];
var treeList;
var tocPanel;
var helpIndex = {};
function resizeStack() {
var h = $(content).parent().height() - toolbar.outerHeight();
@@ -97,7 +95,10 @@ RED.sidebar.help = (function() {
var pendingContentLoad;
treeList.on('treelistselect', function(e,item) {
pendingContentLoad = item;
if (item.nodeType) {
if (item.tour) {
RED.tourGuide.run(item.tour);
}
else if (item.nodeType) {
showNodeTypeHelp(item.nodeType);
} else if (item.content) {
helpSection.empty();
@@ -189,7 +190,6 @@ RED.sidebar.help = (function() {
}
function refreshHelpIndex() {
helpTopics = [];
var modules = RED.nodes.registry.getModuleList();
var moduleNames = Object.keys(modules);
moduleNames.sort();
@@ -198,15 +198,32 @@ RED.sidebar.help = (function() {
label: RED._("sidebar.help.nodeHelp"),
children: [],
expanded: true
}
};
var tours = RED.tourGuide.list().map(function (item) {
return {
icon: "fa fa-play-circle-o",
label: item.label,
tour: item.path,
};
});
var helpData = [
{
id: 'changelog',
label: "Node-RED v"+RED.settings.version,
content: getChangelog
label: "Node-RED",
children: [
{
id: 'changelog',
label: RED._("sidebar.help.changeLog"),
content: getChangelog
},
{
label: RED._("tourGuide.welcomeTours"),
children: tours
}
]
},
nodeHelp
]
];
var subflows = RED.nodes.registry.getNodeTypes().filter(function(t) {return /subflow/.test(t)});
if (subflows.length > 0) {
nodeHelp.children.push({

View File

@@ -433,9 +433,30 @@ RED.tourGuide = (function() {
})
}
function listTour() {
return [
{
id: "2_3",
label: "3.0.0-beta.3",
path: "./tours/welcome.js"
},
{
id: "2_2",
label: "2.2.0",
path: "./tours/2.2/welcome.js"
},
{
id: "2_1",
label: "2.1.0",
path: "./tours/2.1/welcome.js"
}
];
}
return {
load: loadTour,
run: run,
list: listTour,
reset: function() {
RED.settings.set("editor.tours.welcome",'');
}