mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Do not show projects-wecome dialog until welcome tour completes
Fixes #3193
This commit is contained in:
parent
f030694ef4
commit
48d0ee3b6d
@ -201,6 +201,7 @@ var RED = (function() {
|
||||
RED.projects.refresh(function(activeProject) {
|
||||
loadFlows(function() {
|
||||
RED.sidebar.info.refresh()
|
||||
var showProjectWelcome = false;
|
||||
if (!activeProject) {
|
||||
// Projects enabled but no active project
|
||||
RED.menu.setDisabled('menu-item-projects-open',true);
|
||||
@ -208,10 +209,10 @@ var RED = (function() {
|
||||
if (activeProject === false) {
|
||||
// User previously decline the migration to projects.
|
||||
} else { // null/undefined
|
||||
RED.projects.showStartup();
|
||||
showProjectWelcome = true;
|
||||
}
|
||||
}
|
||||
completeLoad();
|
||||
completeLoad(showProjectWelcome);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@ -267,7 +268,7 @@ var RED = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
function completeLoad() {
|
||||
function completeLoad(showProjectWelcome) {
|
||||
var persistentNotifications = {};
|
||||
RED.comms.subscribe("notification/#",function(topic,msg) {
|
||||
var parts = topic.split("/");
|
||||
@ -535,18 +536,24 @@ var RED = (function() {
|
||||
|
||||
setTimeout(function() {
|
||||
loader.end();
|
||||
checkFirstRun();
|
||||
checkFirstRun(function() {
|
||||
if (showProjectWelcome) {
|
||||
RED.projects.showStartup();
|
||||
}
|
||||
});
|
||||
},100);
|
||||
}
|
||||
|
||||
function checkFirstRun() {
|
||||
function checkFirstRun(done) {
|
||||
if (RED.settings.theme("tours") === false) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
if (!RED.settings.get("editor.view.view-show-welcome-tours", true)) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
RED.actions.invoke("core:show-welcome-tour", RED.settings.get("editor.tours.welcome"));
|
||||
RED.actions.invoke("core:show-welcome-tour", RED.settings.get("editor.tours.welcome"), done);
|
||||
}
|
||||
|
||||
function buildMainMenu() {
|
||||
|
@ -2387,6 +2387,7 @@ RED.projects = (function() {
|
||||
return {
|
||||
init: init,
|
||||
showStartup: function() {
|
||||
console.warn("showStartup")
|
||||
if (!RED.user.hasPermission("projects.write")) {
|
||||
RED.notify(RED._("user.errors.notAuthorized"),"error");
|
||||
return;
|
||||
|
@ -393,10 +393,12 @@ RED.sidebar.help = (function() {
|
||||
treeList.treeList("select","changelog");
|
||||
show();
|
||||
}
|
||||
function showWelcomeTour(lastSeenVersion) {
|
||||
function showWelcomeTour(lastSeenVersion, done) {
|
||||
done = done || function() {};
|
||||
RED.tourGuide.load("./tours/welcome.js", function(err, tour) {
|
||||
if (err) {
|
||||
console.warn("Failed to load welcome tour",err);
|
||||
done()
|
||||
return;
|
||||
}
|
||||
var currentVersionParts = RED.settings.version.split(".");
|
||||
@ -405,6 +407,7 @@ RED.sidebar.help = (function() {
|
||||
// Only display the tour if its MAJ.MIN versions the current version
|
||||
// This means if we update MAJ/MIN without updating the tour, the old tour won't get shown
|
||||
if (tourVersionParts[0] !== currentVersionParts[0] || tourVersionParts[1] !== currentVersionParts[1]) {
|
||||
done()
|
||||
return;
|
||||
}
|
||||
|
||||
@ -412,26 +415,31 @@ RED.sidebar.help = (function() {
|
||||
// Previously displayed a welcome tour.
|
||||
if (lastSeenVersion === RED.settings.version) {
|
||||
// Exact match - don't show the tour
|
||||
done()
|
||||
return;
|
||||
}
|
||||
var lastSeenParts = lastSeenVersion.split(".");
|
||||
if (currentVersionParts[0] < lastSeenParts[0] || (currentVersionParts[0] === lastSeenParts[0] && currentVersionParts[1] < lastSeenParts[1])) {
|
||||
// Running an *older* version than last displayed tour.
|
||||
done()
|
||||
return;
|
||||
}
|
||||
if (currentVersionParts[0] === lastSeenParts[0] && currentVersionParts[1] === lastSeenParts[1]) {
|
||||
if (lastSeenParts.length === 3 && currentVersionParts.length === 3) {
|
||||
// Matching non-beta MAJ.MIN - don't repeat tour
|
||||
done()
|
||||
return;
|
||||
}
|
||||
if (currentVersionParts.length === 4 && (lastSeenParts.length === 3 || currentVersionParts[3] < lastSeenParts[3])) {
|
||||
// Running an *older* beta than last displayed tour.
|
||||
done()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
RED.tourGuide.run("./tours/welcome.js", function(err) {
|
||||
RED.settings.set("editor.tours.welcome", RED.settings.version)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -73,13 +73,13 @@
|
||||
.red-ui-projects-dialog-screen-start {
|
||||
.red-ui-projects-dialog-screen-start-hero {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
font-size: 1.4em;
|
||||
padding: 10px;
|
||||
min-height: 60px;
|
||||
min-height: 40px;
|
||||
color: $primary-text-color;
|
||||
}
|
||||
.red-ui-projects-dialog-screen-start-body {
|
||||
min-height: 400px;
|
||||
min-height: 300px;
|
||||
line-height: 1.6em;
|
||||
p {
|
||||
font-size: 1.1em;
|
||||
@ -92,7 +92,7 @@
|
||||
}
|
||||
button.red-ui-button.red-ui-projects-dialog-button {
|
||||
width: calc(50% - 80px);
|
||||
margin: 20px;
|
||||
margin: 10px 20px;
|
||||
height: auto;
|
||||
line-height: 2em;
|
||||
padding: 10px;
|
||||
|
Loading…
Reference in New Issue
Block a user