The engine module ships front-end presentation: css/cards.css, orchestra.libraries.yml and templates/orchestra-card-row.html.twig. That is a layering violation. orchestra is the engine and must be usable headless (the engine plus the server API, with no theme assets at all), and a site running only the engine has no use for a card component.
It got there for a real reason: #3613841: Make the personal task and request views usable in place of the pages they mirror needed the card row and its styles in both orchestra_ui (the requester's list) and orchestra_inbox_views (the personal task lists), and the engine was their only common ancestor. The fix is a common ancestor that is not the engine.
Proposed
A small orchestra_presentation submodule depending only on orchestra, holding no routes, no permissions and no services: the shared Twig partials, their CSS and the libraries that pair them. orchestra_ui, orchestra_views and orchestra_inbox_views each depend on it, so a site running the Views integration without the UI still gets styled rows and no pages, which is the case that rules out putting the component in orchestra_ui.
Named for the layer rather than for one component, because the partials below are meant to land in it too, and orchestra_cards would stop fitting the moment they do.
What moves
css/cards.css,templates/orchestra-card-row.html.twigandorchestra.libraries.yml(its only entry is thecardslibrary) out of the engine.- The library id
orchestra/cardsbecomesorchestra_presentation/cards, in 9 places: the row template's ownattach_library(),orchestra_inbox.libraries.yml,orchestra_ui.libraries.yml,MyInstancesController, the three Views field plugins (InstanceState,WorkItemState,InstanceStatus) and two docblocks. - The Twig namespace
@orchestra/orchestra-card-row.html.twigbecomes@orchestra_presentation/...in the two shipped row templates (views-view-fields--my-tasks.html.twig,views-view-fields--my-workflow-instances.html.twig).
Nothing user-visible changes: a theme overriding orchestra-card-row.html.twig still overrides it by template name. Only a site or theme referencing the library id directly needs the new name, which is free before 1.0.
Then, in the same module
Two pieces of markup exist twice today and belong here as partials both sides include:
- the labeled column (
orchestra-card__colplus its label and value spans), emitted by the row template, byorchestra_ui'sCardColumnsTraitin PHP, and byorchestra-instance.html.twig; - the status pair, which encodes a decision that must not drift: the workflow-authored status leads and the engine state sits under it as the marker.
Extracting those retires CardColumnsTrait's markup duty, so the card row, the run's page and any Views row share one source.
Out of scope
The duplicated state-label map (InstanceFilterForm::stateOptions() versus orchestra_views' State field) is data, not presentation, so it belongs in the engine and gets its own issue. Splitting orchestra_ui into a front end and an admin console is a separate design question.
Issue fork orchestra-3613906
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #5
mably commented