-
Notifications
You must be signed in to change notification settings - Fork 116
Description
#1631 Adds support for a template-defining metadata file, _template.json, stored at the root of the template folder. After #1631, we'll use this template file to find all templates in a remote template repo, allowing us to create a menu of choices in shiny create, e.g.
❯ shiny create --github posit-dev/py-shiny-templates@template-json
ℹ Using GitHub repository posit-dev/py-shiny-templates@template-json.
? Which template would you like to use?: (Use arrow keys)
» A Basic app
Basic reactive plot
Navigating multiple panels
Reactive plot in sidebar
Basic dashboard
Restaurant tips dashboard
SQL database explorer
Location distance calculator
Model scoring
Streaming database updates
Streaming file updates
Streaming folder updates
NBA player career comparisons
Article on regularization in ML
Stock price tracker
Survey form
Survey wizard form
[Cancel]As seen in the example above, it would be helpful to have submenus, e.g.
❯ shiny create --github posit-dev/py-shiny-templates@template-json
ℹ Using GitHub repository posit-dev/py-shiny-templates@template-json.
? Which template would you like to use?: (Use arrow keys)
» Basic apps...
Dashboards...
Streaming updates...
Data entry...
[Cancel]As a first approximation, we could organize the templates into subfolders, so that instead of this (considering only streaming/data-entry apps):
.
├── monitor-database
│ └── _template.json
├── monitor-file
│ └── _template.json
├── monitor-folder
│ └── _template.json
├── survey
│ └── _template.json
└── survey-wizard
└── _template.json
we'd have this
.
├── data-entry
│ ├── survey
│ │ └── _template.json
│ └── survey-wizard
│ └── _template.json
└── streaming
├── monitor-database
│ └── _template.json
├── monitor-file
│ └── _template.json
└── monitor-folder
└── _template.json
At the root of data-entry/ and streaming/, we could include an additional _template.json with type: "submenu", e.g.
{
"type": "submenu",
"id": "streaming-apps",
"title": "Streaming updates"
}
In shiny create, we'd have to change how we discover templates, but in walking the templates directory, we could find these type: "submenu" templates and render them as submenus.
This approach is compatible with the _template.json used in #1631 as well as the --github {owner}/{repo}:{path} syntax and importantly could be added later without breaking syntax introduced in #1631.