Add a Templates gallery and detail view to the app
The server's template catalog (the list_templates command) had no surface in the app. This adds a Templates destination to the shared SlidingPaneStack: a measured card gallery (name, short description, stage count and its own glyph; one column narrow, a fitting grid wide) and a detail pane that reuses the pipeline detail's Summary/Graph/Source tabs, plus a create-from-template action that submits a create-only draft. Stage counts come from a source the server parsed (validate); a source that does not parse is still viewable as raw markdown. Added: Templates.kt (TemplateEntry/TemplateCard, the grid-column and stage-count mapping), components/GalleryGrid.kt (the shared measured-gallery fitting, extracted from the artifact gallery), graph/SourceView.kt (PipelineSourceView, the one rendered-definition view, extracted from PipelineDetailScreen), screens/TemplateGalleryScreen.kt, screens/TemplateDetailScreen.kt, TemplatesTest.kt. Changed: PipelinesApp.kt (the Templates destination), AppViewModel.kt (refreshTemplates/createFromTemplate), data/PipelinesRepository.kt (listTemplates/validateSource/createPipeline), graph/Artifacts.kt (use the shared galleryGrid), PipelineDetailScreen.kt (use the shared PipelineSourceView), ArtifactGalleryTest.kt (exercise galleryGrid). Doc/state check before committing: - android/README.md (the app's topic doc): updated. Added a Features bullet for the Templates destination and a dated "Templates: a gallery and a detail view" section, matching the per-feature convention every prior android change uses. - Packaged templates: not touched. The server's templates are Go-side and the brief forbids touching the Pipelines server; this change only renders the catalog the server already exposes. - Packaged authoring skill references (internal/author/skill/references/): not updated. They document the Pipelines harness, not the Android app, and this change adds no harness runtime behaviour. - Root README and docs/: not updated. They document the CLI/TUI/server, which are unchanged; the Android app is documented in android/README.md. No conflict was present: no unmerged paths and no unfinished merge, rebase or cherry-pick, so nothing needed resolving. Deliberately left uncommitted (other work this run did not touch, not staged): the worktree's other WIP - components/ListScroll.kt and screens/PaneStats.kt with their tests, and the uncommitted edits to components/SlidingPaneStack.kt, components/States.kt, theme/Dimens.kt and components/LoadPhaseTest.kt - plus the untracked .ui-review-*/ capture artifacts.
This commit is contained in:
@@ -104,6 +104,22 @@ stops it.
|
||||
|
||||
- Pipeline list (search/refresh, empty/error/loading states), pipeline details
|
||||
(version list, content hash, source) and the workflow graph.
|
||||
- A **Templates** destination (its own top-level pill between Pipelines and Runs,
|
||||
with its own gallery glyph rather than the Pipelines workflow tree): a measured
|
||||
gallery of cards, one per server template, each showing the template's name, its
|
||||
short description and its stage count — `stage count unavailable` when the source
|
||||
does not parse, never a claimed zero — with a single column on a narrow window
|
||||
and as many equal-width cards as fit on a wide one, from the shared
|
||||
`galleryGrid` fitting (the same rule the artifacts gallery uses) at the
|
||||
`WIDE_RAIL_WIDTH_DP`/`SPACING_S` tokens, so the gallery widens by adding columns
|
||||
instead of stretching cards. Tapping a card opens a detail pane that reuses the
|
||||
pipeline detail's Summary / Graph / Source tabs (the stage list, the
|
||||
`WorkflowGraph` and the shared `PipelineSourceView`), so the shape is readable
|
||||
before choosing it; a source the server could not parse is still fully viewable
|
||||
as raw markdown. A "create from this template" action submits the source as a
|
||||
create-only draft pipeline (the app's equivalent of `pipelines new --template
|
||||
KEY`) and never starts a run. Empty, loading and error states reuse the shared
|
||||
state components.
|
||||
- Workflow graph composable: content-sized stage nodes laid out in one row in
|
||||
declaration order, with `#failure`/`#success` terminals sharing a lower row and
|
||||
arrows entering their top borders (an `error -> #failure` route leaves its
|
||||
@@ -3922,3 +3938,75 @@ Not verified in this pass: the on-device narrow/wide renders (a section opening
|
||||
over the stage and returning, and the wide panel beside the stage pane) and any
|
||||
screenshot of the former inline case — the brief keeps implementation
|
||||
verification to the build and the unit tests, and visual review owns the device.
|
||||
|
||||
## Templates: a gallery and a detail view (17 Oct 2026)
|
||||
|
||||
The server's template catalog (`list_templates`, which `pipelines templates` and
|
||||
`pipelines template <key> --source` already print) is now a first-class surface in
|
||||
the app; before this change the app showed nothing for it. `android/` only:
|
||||
nothing in the Pipelines server, its Go source, the Docker/compose files or the
|
||||
installer was touched, no dependency was added (the destination glyph is the
|
||||
already-declared material-icons-extended `Widgets`) and no run is started from the
|
||||
app.
|
||||
|
||||
- **The destination.** `PipelinesApp`'s destination list gains a `Templates`
|
||||
entry between `Pipelines` and `Runs` (`TemplatesIcon`, `Icons.Filled.Widgets`,
|
||||
deliberately not the Pipelines workflow tree), and `TemplatesDestination` uses
|
||||
the same shared `SlidingPaneStack` the other destinations use: pane 0 the
|
||||
gallery, pane 1 the selected template's detail, with the selected key in
|
||||
`rememberSaveable` so the open template survives rotation and process death.
|
||||
- **The gallery.** `TemplateGalleryScreen` shows one card per template from
|
||||
`vm.templates` (loaded by a new `AppViewModel.refreshTemplates`, backed by
|
||||
`PipelinesRepository.listTemplates`): the name, the short description and the
|
||||
stage count, with the card's own leading glyph. `templateGridColumns` decides
|
||||
the layout — a single column on a narrow window, and on a wide one as many
|
||||
`WIDE_RAIL_WIDTH_DP`-shaped cards as fit `SPACING_S` apart via the shared
|
||||
`galleryGrid` fitting — so no new geometry constant is introduced.
|
||||
- **Stage counts come from a parsed source, not a guess.** `list_templates`
|
||||
carries only the source, so `refreshTemplates` parses each template's source on
|
||||
the server (`validateSource`, the `validate` command) once and caches the graph
|
||||
per key+source. A template whose source does not parse keeps a null graph: its
|
||||
card reads `stage count unavailable` (never `0 stages`), its Graph tab says the
|
||||
source could not be parsed, and its Source tab shows the raw markdown — the
|
||||
template stays fully viewable.
|
||||
- **The detail view reuses the pipeline-detail idiom.** `TemplateDetailScreen`
|
||||
uses the same `DetailTabs` (`pipelineDetailTabs`: Summary / Graph / Source) and
|
||||
the same tab body/width handling as `PipelineDetailScreen`: Summary lists the
|
||||
stages, Graph renders the `WorkflowGraph` (with an explicit note when the source
|
||||
did not parse), and Source renders the definition through the shared
|
||||
`PipelineSourceView`.
|
||||
- **One rendered-definition view, not two.** `PipelineSourceTab` moved out of
|
||||
`PipelineDetailScreen` into `ui/graph/SourceView.kt` as `PipelineSourceView`, so
|
||||
the pipeline detail and the template detail render a definition through exactly
|
||||
one composable (per-stage collapsible sections, the Raw toggle, the copy action).
|
||||
- **One gallery fitting, not two.** The artifact gallery's private
|
||||
`ArtifactGrid`/`artifactGrid` fitting moved to the shared
|
||||
`ui/components/GalleryGrid.kt` (`GalleryGrid`/`galleryGrid`), so the templates
|
||||
gallery and the artifacts gallery share one measured-column rule and the
|
||||
artefact gallery tests now exercise the shared function.
|
||||
- **Create from a template.** A top-bar action on the detail opens a dialog that
|
||||
submits the template's source as a create-only draft pipeline
|
||||
(`AppViewModel.createFromTemplate` → `PipelinesRepository.createPipeline`, the
|
||||
`submit` command with `create_only`): the app's equivalent of the CLI's
|
||||
`pipelines new --template KEY` (that path writes a local draft file; the app has
|
||||
no filesystem, so it stores the draft on the server, where it appears in the
|
||||
Pipelines list). An existing name is never overwritten and no run is started.
|
||||
- **States.** Empty, loading and error states reuse the shared `StateCrossfade`
|
||||
state components; a covered pane shows only its compact identity.
|
||||
|
||||
Verification (this run's review stage, macOS, cached Gradle, `--no-daemon`): the
|
||||
offline build and unit tests pass at **35 suites / 309 tests / 0 failures / 0
|
||||
errors**, including the new `TemplatesTest` (the card/stage-count mapping, the
|
||||
`stage count unavailable` label for an unparsed source, and the narrow-column /
|
||||
wide-grid decision) and the relocated artifact-gallery cases now running against
|
||||
the shared `galleryGrid`. The app's create path was checked against the repo's own
|
||||
Go test for the server submit-with-`create_only` behaviour.
|
||||
|
||||
Visual review (this run, operator's Pixel 9 Pro XL, adb `47241FDAS00DLK`, built
|
||||
from this tree and installed over the existing package) confirmed the gallery
|
||||
renders 5 cards — a single column at the phone's ~448dp width and a 4-column
|
||||
measured grid at `wm size 2000x2244` — and that each card opens a Summary / Graph
|
||||
/ Source detail with the create dialog, consistent with the app's Material 3
|
||||
language. The empty, loading, error and unparseable-source states were built from
|
||||
the app's shared state components but could not be produced live without mutating
|
||||
the operator's server.
|
||||
|
||||
Reference in New Issue
Block a user