-
Notifications
You must be signed in to change notification settings - Fork 1k
chore: add tasks-docker first in starter templates list #20169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: add tasks-docker first in starter templates list #20169
Conversation
const sortVisibleTemplates = (templates: TemplateExample[]) => { | ||
// The docker template should be the first template in the list, | ||
// as it's the easiest way to get started with Coder. | ||
const dockerTemplateId = "docker"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the docker template was being moved to the front of the list in the frontend. We simply swapped that for the tasks-docker template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I'm understanding the product goal: are we okay with dropping the old Docker template entirely, or would we still want it to be second in the list? We still have the Docker template as the second one for the empty templates component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker template is just no longer the very first template displayed. It's still in the list we're sorting it's just ordered based on its name rather than being manually pulled to the front.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Product wise I think these are meant to be different lists. The EmptyTemplates component is only ever seen when your deployment has no templates pushed, whereas the starter-templates page is more likely to be encountered by a typical developer looking to make a quick template.
But also I'm okay with simply making the docker template second here too.
//go:embed templates/kubernetes-devcontainer | ||
//go:embed templates/nomad-docker | ||
//go:embed templates/scratch | ||
//go:embed templates/tasks-docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently embed the starter template in the binary. This is where we add the tasks-docker template to the list (the examples/templates/tasks-docker directory contains its contents copied from https://github.com/coder/registry/tree/main/registry/coder-labs/templates/tasks-docker).
6974c83
to
b865e8a
Compare
USAGE: coder templates init [flags] [directory] Get started with a templated template. OPTIONS: --id aws-devcontainer|aws-linux|aws-windows|azure-linux|digitalocean-linux|docker|docker-devcontainer|docker-envbuilder|gcp-devcontainer|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|kubernetes-devcontainer|nomad-docker|scratch Specify a given example template by ID. ——— Run `coder --help` for a list of global options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall. The StarterTemplate
page has some Emotion styling still, but I have a PR that removes that, so it's not a big deal to take care of that here
|
||
 | ||
|
||
This is a fantastic starting point for working with AI agents with Coder Tasks. Try prompts such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I feel like "fantastic" feels too qualitative and feels kinda like AI output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I copied this source directly from the existing template in the registry, It should probably stay the same until we integrate registry into the core product, but I agree it feels like an AI wrote this.
const sortVisibleTemplates = (templates: TemplateExample[]) => { | ||
// The docker template should be the first template in the list, | ||
// as it's the easiest way to get started with Coder. | ||
const dockerTemplateId = "docker"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I'm understanding the product goal: are we okay with dropping the old Docker template entirely, or would we still want it to be second in the list? We still have the Docker template as the second one for the empty templates component
import { docs } from "utils/docs"; | ||
|
||
// Those are from https://github.com/coder/coder/tree/main/examples/templates | ||
const featuredExampleIds = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing wrong with this file, but it looks like it'd be pretty easy to swap in Tailwind here.
If we get rid of the styles
object, we should be able to add className="max-w-[50%] h-80 overflow-hidden opacity-85 [&_img]:max-w-full"
to the div, and that should be equivalent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm down to look at doing this together 😎
why are we unpinning the regular |
The ticket ask was to pin the Tasks on Docker Template first. I can update the PR to keep the Docker template pinned in the second slot. From the code I sort of thought the idea was to have one pinned template at a time and the rest organized by name. I think maybe the better solution though is to have the set of "featured templates" apply to the starter-templates page as well as the EmptyTemplates component. |
agreed. having a simple template front and center that doesn't require spending a bunch of cloud provider money is a great way to ease into the product. |
@bcpeinhardt Agree with your approach and thoughts here. Having the Tasks On Docker first makes for a super easy entry point to Tasks, but it wasn't the intention to have the Docker template fall to the wayside. Having it be the 2nd in the list is what I was hoping for! I like the idea of a "featured templates" section! |
Addresses review feedback to keep the regular 'docker' template as the second featured template after 'tasks-docker'. Sorting order is now: 1. tasks-docker (easiest entry point) 2. docker (keeps original docker template featured) 3. All others sorted alphabetically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…-starter-templates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sort algorithm feels like too much now imo. I really liked your idea of just breaking things up into a "featured" section and everything else.
even if we don't do that yet, in utils/starterTemplates.ts there's a function that this templates
value we end up with is coming from, and that does some processing already. I think we could update that function to pull this logic out of React and consolidate things.
if (a.id === tasksDockerTemplateId) { | ||
return -1; | ||
} | ||
if (b.id === tasksDockerTemplateId) { | ||
return 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically an unstable sort because you're not handling a.id === b.id
. there shouldn't ever be duplicates, but it's worth thinking about the ramifications.
if (a.id === dockerTemplateId) { | ||
return -1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also worry that it's super unclear why this sort works the way it does. I kinda wish templates
just didn't include the docker or tasks-docker templates at all so that it could have a normal sort, and that things sorted "manually" were just in an obvious order, rather than having a complicated looking algorithm that takes up more lines of code than hardcoding the order would.
this pattern was already too clever for it's own good, but with this additional case now it's even more so.
This PR:
EmptyTemplates
)closes #19718
Screen.Recording.2025-10-03.at.4.24.43.PM.mov