mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
This PR integrates the onboarding tour with the admin configuration, i.e. the onboarding tour now uses the content configuration from the server. Additionally I made some changes to the admin page to improve UX: - Show a simple of preview of the onboarding tour, which live updates as the config is edited - Added separate schema validation (outside of Monaco) to - ensure that the preview always gets a valid config - ensure that the user cannot save an invalid schema (and break the tour for other users) - make errors in the config more visible - Added a "Reset" button to restore the original (hardcoded) onboarding tour so that the user can always go back to a valid config. It also fixes some issues overlooked in the previous PR (such as schema issues). Note for the schema validation: I also could have added validation logic when loading the config for the real tour, but that would add a couple of dependencies to the "normal" pages that shouldn't be necessary. Preventing an invalid config from getting in in the first place seems better. Note on the preview: In order to make the preview work I moved some logic into the tour context, do that those values can be overwritten easily for the preview. Specifically this affects the dynamic query generation, which we don't want to do for the preview.
166 lines
5.4 KiB
JSON
166 lines
5.4 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"$id": "onboardingtour.schema.json#",
|
|
"title": "Onboarding tour configuration",
|
|
"description": "Configuration for a onboarding tour.",
|
|
"allowComments": true,
|
|
"type": "object",
|
|
"properties": {
|
|
"tasks": {
|
|
"type": "array",
|
|
"items": {
|
|
"title": "Onboarding task",
|
|
"description": "An onboarding task",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"title": {
|
|
"description": "Title of this task",
|
|
"type": "string"
|
|
},
|
|
"icon": {
|
|
"enum": ["Search", "Cody", "Extension", "Check"]
|
|
},
|
|
"steps": {
|
|
"description": "Steps that need to be completed by the user",
|
|
"type": "array",
|
|
"items": {
|
|
"title": "Onboarding step",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"description": "Unique step ID",
|
|
"type": "string"
|
|
},
|
|
"label": {
|
|
"description": "Label of the step shown to the user",
|
|
"type": "string"
|
|
},
|
|
"tooltip": {
|
|
"description": "More information about this step",
|
|
"type": "string"
|
|
},
|
|
"action": {
|
|
"oneOf": [
|
|
{
|
|
"title": "Video step",
|
|
"description": "Video step",
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"const": "video"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["type", "value"]
|
|
},
|
|
{
|
|
"title": "Link step",
|
|
"description": "Link step",
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"enum": ["link", "new-tab-link"]
|
|
},
|
|
"variant": {
|
|
"const": "button-primary"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["type", "value"]
|
|
},
|
|
{
|
|
"title": "Restart step",
|
|
"description": "Restart step",
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"const": "restart"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": ["type", "value"]
|
|
},
|
|
{
|
|
"title": "Search step",
|
|
"description": "Search query step",
|
|
"type": "object",
|
|
"properties": {
|
|
"type": {
|
|
"const": "search-query"
|
|
},
|
|
"query": {
|
|
"description": "The query template to use.",
|
|
"type": "string"
|
|
},
|
|
"snippets": {
|
|
"description": "Possible code snippets for this query. Can also be a language -> code snippets map.",
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"patternProperties": {
|
|
"^.*$": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": ["type", "query"]
|
|
}
|
|
]
|
|
},
|
|
"info": {
|
|
"type": "string"
|
|
},
|
|
"completeAfterEvents": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"required": ["id", "label", "action"],
|
|
"additionalProperties": false
|
|
},
|
|
"minItems": 1
|
|
},
|
|
"requiredSteps": {
|
|
"description": "Set this property if only a subset of steps are required for this task to complete.",
|
|
"type": "number"
|
|
}
|
|
},
|
|
"required": ["steps"]
|
|
}
|
|
},
|
|
"defaultSnippets": {
|
|
"type": "object",
|
|
"patternProperties": {
|
|
"^.*$": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": ["tasks"],
|
|
"additionalProperties": false
|
|
}
|