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 scrumDemoProjectName = 'Scrum project';
export const onboardingTourStorageKey = 'openProject-onboardingTour'; export const onboardingTourStorageKey = 'openProject-onboardingTour';
export type OnboardingTourNames = 'prepareBacklogs'|'backlogs'|'taskboard'|'homescreen'|'main'; export type OnboardingTourNames = 'prepareBacklogs'|'backlogs'|'taskboard'|'homescreen'|'main';
export type ProjectName = 'demo'|'scrum';
export function waitForElement(element:string, container:string, execFunction:Function) { export function waitForElement(element:string, container:string, execFunction:Function) {
// Wait for the element to be ready // Wait for the element to be ready

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

@ -4,14 +4,15 @@ import {
demoProjectsLinks, demoProjectsLinks,
OnboardingTourNames, OnboardingTourNames,
onboardingTourStorageKey, onboardingTourStorageKey,
ProjectName,
waitForElement, waitForElement,
} from 'core-app/core/setup/globals/onboarding/helpers'; } from 'core-app/core/setup/globals/onboarding/helpers';
import { debugLog } from 'core-app/shared/helpers/debug_output'; 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}`); debugLog(`Loading and triggering onboarding tour ${name}`);
await import(/* webpackChunkName: "onboarding-tour" */ './onboarding_tour').then((tour) => { 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 ------------------------------- // ------------------------------- Tutorial WP page -------------------------------
if (currentTourPart === 'startMainTourFromBacklogs' || url.searchParams.get('start_onboarding_tour')) { 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 ------------------------------- // ------------------------------- Prepare Backlogs page -------------------------------
if (url.searchParams.get('start_scrum_onboarding_tour')) { if (url.searchParams.get('start_scrum_onboarding_tour')) {
if (jQuery('.backlogs-menu-item').length > 0) { if (jQuery('.backlogs-menu-item').length > 0) {
void triggerTour('prepareBacklogs'); void triggerTour('prepareBacklogs', 'scrum');
} else { } else {
void triggerTour('taskboard'); void triggerTour('taskboard', 'scrum');
} }
} }
// ------------------------------- Tutorial Backlogs page ------------------------------- // ------------------------------- Tutorial Backlogs page -------------------------------
if (currentTourPart === 'prepareTaskBoardTour') { if (currentTourPart === 'prepareTaskBoardTour') {
void triggerTour('backlogs'); void triggerTour('backlogs', 'scrum');
} }
// ------------------------------- Tutorial Task Board page ------------------------------- // ------------------------------- Tutorial Task Board page -------------------------------
if (currentTourPart === 'startTaskBoardTour') { 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'; import { OnboardingStep } from 'core-app/core/setup/globals/onboarding/onboarding_tour';
export function boardTourSteps(edition:'basic'|'enterprise'):OnboardingStep[] { export function boardTourSteps(edition:'basic'|'enterprise', project:ProjectName):OnboardingStep[] {
const boardName = edition === 'basic' ? 'Basic board' : 'Kanban'; let boardName:string;
if (edition === 'basic') {
boardName = project === 'demo' ? 'Basic board' : 'Task board';
} else {
boardName = 'Kanban';
}
const listExplanation = edition === 'basic' ? 'basic' : 'kanban'; const listExplanation = edition === 'basic' ? 'basic' : 'kanban';
return [ return [

Loading…
Cancel
Save