Feat/198- Enable sharable predefined templates for hardware#212
Feat/198- Enable sharable predefined templates for hardware#212DavidWalshe93 wants to merge 4 commits intoTimmoth:mainfrom
Conversation
|
This is more or less exactly what I was hoping to see. Pretty cool to see it come together so quickly! The only comments I have are basically just aesthetic ones, I could be happy with all, any, or none of these being in, the current PR is already good enough to be used. In the copy-as-template menu
Template ListIt would be nice to have another option in the Tools menu for seeing whats available across all potential device categories The template selection dropdownUntil one clicks on the Live feedbackIn the various hardware menus / other places where a template can be applied, it'd be nice to get live feedback as to what each template's effect would be. It'd be nice to have the same html elements that display for concrete devices so that when one pages through the possible templates they can see what the differences between them are. |
|
Thank @0xNF for the great feedback you provided above, i think each point helps polish out this feature in terms of user ergonomics and UX 💯 I would like to have someone on the core team review my existing additions to ensure this is the correct path for this feature add before iterating on it further. If @Timmoth / @Chester-alt review and they align with the way this has been added/implemented, il try and add in your feedback to this pr (or a subsequent pr) 😊 |
I am a little unclear on what you mean on this one? Can you please provide examples where a template would/may not be an official vendor supplied unit name? |
|
Very cool stuff! It's quite a large PR so may take me some time to review properly, initially it looks really good! I'll just spit out a few points here:
|
|
Will try and get this feedback seen to in the coming days 👍 thanks for the feedback 💯 |
|
I can help by adding in a couple more templates (RaspberryPI 3, RaspberryPi 4, Raspberry Pi 5, and some other Unifi APs). Once this is committed, I can either do another PR, or share with @DavidWalshe93. |
|
Just fyi, Il be AFK until the weekend to resume work on this one, sorry for the delay 🙈 |

Related to 198
Summary
Implements the hardware template system proposed in #198. Users can now create resources from pre-filled templates (via CLI
--templateflag or Web UI dropdown), validate community-contributed template YAML files, and export existing resources as templates from the Web UI with a single click.Changes
BundledHardwareTemplateStorereads/caches YAML templates fromtemplates/{kind}/,AddResourceFromTemplateUseCase<T>creates resources from templates,TemplateValidatorchecks templates against per-kind schemas,ResourceTemplateSerializerexports resources as template YAMLrpk templates list [--kind],rpk templates show Kind/Model,rpk templates validate <path>; alladdcommands now accept--template/-tHardwareTemplateSelectorComponentdropdown (alphabetically sorted) on the add-resource form;CopyAsTemplateButton(gold-yellow) on every hardware card prompts for official model name then copies template YAML to clipboarddocs/Hardware-Templates.mdcovering usage, YAML format per kind, validation, and full contribution workflow (including Copy as Template from Web UI)How to test
just build— verify the solution compiles cleanlyjust validate-templates— all 60 templates should pass validationjust test-cli— CLI tests pass (template list/show/validate/add workflows)just test-e2e— browser E2E tests pass (note: a small number of pre-existing flaky failures on the hardware tree navigation may appear — unrelated to this branch)Notes for reviewers
BundledHardwareTemplateStoresorts templates alphabetically by model name (case-insensitive) so the dropdown andtemplates listoutput are deterministic.ResourceTemplateSerializerstrips instance-specific fields (tags, labels, notes, runsOn) before serializing, so exported templates are clean.justfilerecipevalidate-templatesruns the validator across all template directories — useful as a CI gate for template contributions.