Files
windmill/frontend/src/lib/tutorials/config.ts
T
Tristan TR e96da54001 fix: New tutorials (#7427)
* Put back banner a new tutorial is available for a user that completed all his tutorials and never skipped all

* Create onboarding tutorial for operators in tutorial config file

* Add router and steps for onboarding tutorial for operators

* Improve onboarding tutorial for operators

* Improve the tutorial UX

* Refactor

* Remove cursor from last step of operator onboarding tutorial

* Improve filtering per role

* Add Runs page tutorial

* Improve Runs page tutorial

* Add failed run

* Simplify Runs tutorial with job clicks into one unique step

* Finish overall structure of Runs tutorial

* Improve wordings

* Prevent breaking animations by clicking on Next or Previous

* Add success and failure logo to step title

* Improve wording

* Create util function for moving cursor

* Nits

* Improve wordings

* Differentiate successfull and failed jobs steps

* Remove delete flows if operator to prevent permission errors

* Add comment
2025-12-23 18:19:30 +00:00

160 lines
4.6 KiB
TypeScript

import type { ComponentType } from 'svelte'
import { Workflow, GraduationCap, Wrench, PlayCircle, Link2, History } from 'lucide-svelte'
import { base } from '$lib/base'
import type { Role } from './roleUtils'
export interface TutorialConfig {
id: string
icon: ComponentType
title: string
description: string
onClick: () => void
index?: number // Bitmask index in the database (for progress tracking)
active?: boolean // Whether this tutorial is active and should be displayed (default: true)
comingSoon?: boolean
roles?: Role[] // Roles that can access this tutorial (if not specified, available to everyone)
order?: number
}
export interface TabConfig {
label: string
tutorials: TutorialConfig[]
roles?: Role[] // Roles that can access this tab category (if not specified, available to everyone)
progressBar?: boolean // Whether to display the progress bar for this tab (default: true)
active?: boolean // Whether this tab category is active and should be displayed (default: true)
}
export type TabId = 'quickstart' | 'app_editor'
/**
* Get tutorial index from config by tutorial ID.
* Throws an error if the tutorial or its index is not found.
*/
export function getTutorialIndex(id: string): number {
for (const tab of Object.values(TUTORIALS_CONFIG)) {
const tutorial = tab.tutorials.find((t) => t.id === id)
if (tutorial?.index !== undefined) return tutorial.index
}
throw new Error(`Tutorial index not found for id: ${id}. Make sure the tutorial has an index defined in config.`)
}
// Available roles : developer, admin, operator
export const TUTORIALS_CONFIG: Record<TabId, TabConfig> = {
quickstart: {
label: 'Quickstart',
roles: ['admin', 'developer', 'operator'],
progressBar: true,
active: true,
tutorials: [
{
id: 'workspace-onboarding',
icon: GraduationCap,
title: 'Workspace onboarding',
description: 'Discover the basics of Windmill with a quick tour of the workspace.',
onClick: () => {
window.location.href = `${base}/?tutorial=workspace-onboarding`
},
index: 1,
active: true,
comingSoon: false,
roles: ['developer', 'admin'],
order: 1
},
{
id: 'flow-live-tutorial',
icon: Workflow,
title: 'Build a flow',
description: 'Learn how to build workflows in Windmill with our interactive tutorial.',
onClick: () => {
window.location.href = `${base}/flows/add?tutorial=flow-live-tutorial&nodraft=true`
},
index: 2,
active: true,
comingSoon: false,
roles: ['developer', 'admin'],
order: 2
},
{
id: 'troubleshoot-flow',
icon: Wrench,
title: 'Fix a broken flow',
description: 'Learn how to monitor and debug your script and flow executions.',
onClick: () => {
window.location.href = `${base}/flows/add?tutorial=troubleshoot-flow&nodraft=true`
},
index: 3,
active: true,
comingSoon: false,
roles: ['admin','developer'],
order: 3
},
{
id: 'runs-tutorial',
icon: History,
title: 'Discover your monitoring dashboard',
description: 'Learn how to monitor, filter, and manage your script and flow executions.',
onClick: () => {
window.location.href = `${base}/runs?tutorial=runs-tutorial`
},
index: 7,
active: true,
comingSoon: false,
roles: ['admin', 'developer','operator'],
order: 4
},
{
id: 'workspace-onboarding-operator',
icon: GraduationCap,
title: 'Workspace onboarding',
description: 'Discover the basics of Windmill with a quick tour of the workspace.',
onClick: () => {
window.location.href = `${base}/?tutorial=workspace-onboarding-operator`
},
index: 6,
active: true,
comingSoon: false,
roles: ['operator'],
order: 1
},
]
},
app_editor: {
label: 'App Editor',
roles: ['developer', 'admin'],
progressBar: false,
active: true,
tutorials: [
{
id: 'backgroundrunnables',
icon: PlayCircle,
title: 'Background runnables',
description: 'Learn how to create and use background runnables in your apps.',
onClick: () => {
window.location.href = `${base}/apps/add?tutorial=backgroundrunnables&nodraft=true`
},
index: 4,
active: true,
comingSoon: false,
roles: ['developer','admin'],
order: 4
},
{
id: 'connection',
icon: Link2,
title: 'Connection',
description: 'Learn how to connect component inputs to outputs in your apps.',
onClick: () => {
window.location.href = `${base}/apps/add?tutorial=connection&nodraft=true`
},
index: 5,
active: true,
comingSoon: false,
roles: ['developer', 'admin'],
order: 5
}
]
}
} as const