Show different boards depending on the project and whether an EE token is available

pull/10367/head
Henriette Darge 3 years ago
parent d3d4e6c861
commit 93c870bcc1
  1. 1
      frontend/src/app/core/setup/globals/onboarding/helpers.ts
  2. 11
      frontend/src/app/core/setup/globals/onboarding/onboarding_tour.ts
  3. 16
      frontend/src/app/core/setup/globals/onboarding/onboarding_tour_trigger.ts
  4. 15
      frontend/src/app/core/setup/globals/onboarding/tours/boards_tour.ts

@ -2,6 +2,7 @@ export const demoProjectName = 'Demo project';
export const scrumDemoProjectName = 'Scrum project';
export const onboardingTourStorageKey = 'openProject-onboardingTour';
export type OnboardingTourNames = 'prepareBacklogs'|'backlogs'|'taskboard'|'homescreen'|'main';
export type ProjectName = 'demo'|'scrum';
export function waitForElement(element:string, container:string, execFunction:Function) {
// Wait for the element to be ready

@ -4,6 +4,7 @@ import {
OnboardingTourNames,
onboardingTourStorageKey,
preventClickHandler,
ProjectName,
waitForElement,
} from 'core-app/core/setup/globals/onboarding/helpers';
import { boardTourSteps } from 'core-app/core/setup/globals/onboarding/tours/boards_tour';
@ -73,7 +74,7 @@ function moduleVisible(name:string):boolean {
return document.getElementsByClassName(`${name}-view-menu-item`).length > 0;
}
function mainTour() {
function mainTour(project:ProjectName = 'demo') {
initializeTour('mainTourFinished');
const boardsDemoDataAvailable = jQuery('meta[name=boards_demo_data_available]').attr('content') === 'true';
@ -88,7 +89,7 @@ function mainTour() {
// ... and available seed data of boards.
// Then add boards to the tour, otherwise skip it.
if (boardsDemoDataAvailable && moduleVisible('board')) {
steps = steps.concat(boardTourSteps('enterprise'));
steps = steps.concat(boardTourSteps('enterprise', project));
}
// ... same for team planners
@ -96,7 +97,7 @@ function mainTour() {
steps = steps.concat(teamPlannerTourSteps());
}
} else if (boardsDemoDataAvailable && moduleVisible('board')) {
steps = steps.concat(boardTourSteps('basic'));
steps = steps.concat(boardTourSteps('basic', project));
}
steps = steps.concat(menuTourSteps());
@ -105,7 +106,7 @@ function mainTour() {
});
}
export function start(name:OnboardingTourNames):void {
export function start(name:OnboardingTourNames, project?:ProjectName):void {
switch (name) {
case 'prepareBacklogs':
initializeTour('prepareTaskBoardTour');
@ -124,7 +125,7 @@ export function start(name:OnboardingTourNames):void {
startTour(homescreenOnboardingTourSteps());
break;
case 'main':
mainTour();
mainTour(project);
break;
default:
break;

@ -4,14 +4,15 @@ import {
demoProjectsLinks,
OnboardingTourNames,
onboardingTourStorageKey,
ProjectName,
waitForElement,
} from 'core-app/core/setup/globals/onboarding/helpers';
import { debugLog } from 'core-app/shared/helpers/debug_output';
async function triggerTour(name:OnboardingTourNames):Promise<void> {
async function triggerTour(name:OnboardingTourNames, project?:ProjectName):Promise<void> {
debugLog(`Loading and triggering onboarding tour ${name}`);
await import(/* webpackChunkName: "onboarding-tour" */ './onboarding_tour').then((tour) => {
tour.start(name);
tour.start(name, project);
});
}
@ -56,26 +57,27 @@ export function detectOnboardingTour():void {
// ------------------------------- Tutorial WP page -------------------------------
if (currentTourPart === 'startMainTourFromBacklogs' || url.searchParams.get('start_onboarding_tour')) {
void triggerTour('main');
const projectName:ProjectName = currentTourPart === 'startMainTourFromBacklogs' ? 'scrum' : 'demo';
void triggerTour('main', projectName);
}
// ------------------------------- Prepare Backlogs page -------------------------------
if (url.searchParams.get('start_scrum_onboarding_tour')) {
if (jQuery('.backlogs-menu-item').length > 0) {
void triggerTour('prepareBacklogs');
void triggerTour('prepareBacklogs', 'scrum');
} else {
void triggerTour('taskboard');
void triggerTour('taskboard', 'scrum');
}
}
// ------------------------------- Tutorial Backlogs page -------------------------------
if (currentTourPart === 'prepareTaskBoardTour') {
void triggerTour('backlogs');
void triggerTour('backlogs', 'scrum');
}
// ------------------------------- Tutorial Task Board page -------------------------------
if (currentTourPart === 'startTaskBoardTour') {
void triggerTour('taskboard');
void triggerTour('taskboard', 'scrum');
}
}
}

@ -1,8 +1,17 @@
import { waitForElement } from 'core-app/core/setup/globals/onboarding/helpers';
import {
ProjectName,
waitForElement,
} from 'core-app/core/setup/globals/onboarding/helpers';
import { OnboardingStep } from 'core-app/core/setup/globals/onboarding/onboarding_tour';
export function boardTourSteps(edition:'basic'|'enterprise'):OnboardingStep[] {
const boardName = edition === 'basic' ? 'Basic board' : 'Kanban';
export function boardTourSteps(edition:'basic'|'enterprise', project:ProjectName):OnboardingStep[] {
let boardName:string;
if (edition === 'basic') {
boardName = project === 'demo' ? 'Basic board' : 'Task board';
} else {
boardName = 'Kanban';
}
const listExplanation = edition === 'basic' ? 'basic' : 'kanban';
return [

Loading…
Cancel
Save