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