Migrate the list and detail screens onto the geometry tokens

Replace the hardcoded paddings, spacings, sizes and offsets in the four
list/detail screens and the shared components they are built from with
references to the token file from the previous item, via WindowInsets or
layout where those derive the value. Every replacement is value-equal, so
the screens render identically at both window widths.

Name the glyph sizes that cannot derive from layout as four new ICON_*
tokens in ui/theme/Dimens.kt (14/18/20/24dp) and shrink the DimensTest
allow-list from 30 to 24 entries: 14.dp, 18.dp and 20.dp leave because
their last call site migrated, and the already-unused 32.dp, 11.sp and
13.sp entries are dropped. All adb/emulator work targeted emulator-5554
only; android/ only; no new dependency, server/Go/installer/Docker file
touched, and no run started from the app.

Verified: :app:assembleDebug + the full unit suite (30 result XMLs, 259
tests, 0 failures/0 errors/0 skipped), the shrunk allow-list still fails a
forced raw-literal probe, and before/after screenshots of every converted
screen at narrow and wide widths match near-zero.
This commit is contained in:
2026-10-16 12:43:19 +01:00
parent 8e49a0c6f9
commit 3765fdfdf6
16 changed files with 253 additions and 117 deletions
+78
View File
@@ -2336,6 +2336,84 @@ Evidence (macOS, JDK 17 from Homebrew `openjdk@17`,
Not verified in this pass: whether `:app:lintDebug` stays at its two Not verified in this pass: whether `:app:lintDebug` stays at its two
pre-existing `NewApi` errors (it was not run). pre-existing `NewApi` errors (it was not run).
## The list and detail screens on the geometry tokens (16 Oct 2026)
`android/` only. Every replacement is value-equal, so the screens render exactly
as before. No new dependency, no server/Go/installer/Docker file touched, no run
started from the app, and every `adb`/emulator command targeted `emulator-5554`
only (never `emulator-5556` or the attached Pixel).
- **Scope.** The four list/detail screens
(`ui/screens/PipelineListScreen.kt`, `RunHistoryScreen.kt`,
`PipelineDetailScreen.kt`, `RunDetailScreen.kt`) and the shared components
they are built from (`ListRow`, `States`, `Sections`, `PaneIdentity`,
`ConnectionBanner`, `FilterMenu`, `CodeBlock`, `RunStatus`, `DetailTabs`). The
navigation chrome (`SlidingPaneStack`, `PipelinesApp`) and the workflow-graph
package keep their literals.
- **Spacing.** Every 4/8/12/16/24dp padding, gap and arrangement on those files
now references the previous item's `SPACING_XS/S/M/L/XL` tokens (and
`SPACING_XXS` for the 2dp chip gaps); no value changed. The 10dp dense row
padding, the 2dp progress hairline and the `0.dp` elevations stay as reasoned
allow-list entries because they are not on the spacing scale.
- **Glyph sizes.** Four new tokens in `ui/theme/Dimens.kt` name the icon sizes
that cannot derive from layout: `ICON_STATUS_DP` (14dp), `ICON_INLINE_DP`
(18dp), `ICON_LIST_DP` (20dp) and `ICON_RAIL_DP` (24dp), used by `RunStatus`,
`CodeBlock`, `RunHistoryScreen`, `RunDetailScreen`, `PipelineDetailScreen` and
`DetailTabs`.
- **The allow-list shrinks.** `ui/theme/DimensTest.kt`'s allow-list drops from
**30 to 24 entries**: `14.dp`, `18.dp` and `20.dp` are gone because their last
call site migrated, and the already-unused `32.dp`, `11.sp` and `13.sp` entries
were removed. The remaining entries are the structural hairlines/zeros
(0/2/3/6dp), the not-yet-migrated graph/app-shell values, the container sizes
and the `sp` type values owned by `Typography.kt`.
Evidence (macOS, JDK 17 from Homebrew `openjdk@17`,
`ANDROID_HOME=~/Library/Android/sdk`, Gradle 9.7.1, `--offline`):
- `gradle :app:assembleDebug :app:testDebugUnitTest --rerun-tasks --console=plain`
→ `BUILD SUCCESSFUL`; `--rerun-tasks` re-ran all 30 result XMLs to **259 tests,
0 failures, 0 errors, 0 skipped**. `app/build/outputs/apk/debug/app-debug.apk`
is 17,995,009 bytes, sha256 `d40d7b78…`.
- **Allow-list shrinks.** `git show HEAD:…DimensTest.kt` counts 30 entries; the
working tree counts 24 (`14.dp`, `18.dp`, `20.dp`, `32.dp`, `11.sp`, `13.sp`
gone, the rest re-reasoned).
- **Enforcement proof.** Appending `private val PROBE_RAW_LITERAL = 123.dp` to
`ui/components/ListRow.kt` made
`gradle :app:testDebugUnitTest --tests net.awan.pipelines.ui.theme.DimensTest`
`FAILED` with `raw dimension literals outside
net/awan/pipelines/ui/theme/Dimens.kt:
[net/awan/pipelines/ui/components/ListRow.kt:113: 123.dp]`; removing the line
made the same task pass. The probe was reverted.
- **Before/after screenshots on `emulator-5554` only** (fold AVD, 2076x2152 /
390dpi, dark mode; narrow 1080x2340 and wide 2000x3400 via `wm size`; never
`emulator-5556` or the attached Pixel), against the live server at
`ws://10.0.2.2:8080/connect`, each frame captured and validated with
`scripts/capture_png.sh -s emulator-5554`. The **before** APK was built from
HEAD `8e49a0c` (sha256 `e50bb381…`) with the working changes stashed; the
**after** APK from the working tree (sha256 `d40d7b78…`). Every converted
screen was captured at both widths (Pipelines list, Runs list, pipeline
detail, run detail): `geom-<screen>-<width>-before.png` / `-after.png` in
`~/.local/share/pipelines/data/artifacts/122/1/`. `captures/imgdiff.py`
reports a mean channel difference of 0.01–0.04 for both detail screens,
0.02–0.04 for the Pipelines list and 0.04–0.12 for the Runs list, all
confined to the status-bar clock, the live relative-time/badge text and
thumbnails that load asynchronously; the layout itself is unchanged.
- `adb -s emulator-5554 logcat -d` held 0 `FATAL EXCEPTION` / 0
`E AndroidRuntime` lines; `animator_duration_scale` was left at 1; no run was
started from the app.
- **APK publish.** `app-debug.apk` copied to
`~/.local/share/pipelines/data/artifacts/122/1/pipelines-debug-wip-8e49a0c.apk`
(`8e49a0c` = `git rev-parse --short HEAD`; the working tree is uncommitted WIP
on top of it), sha256 `d40d7b78…`. `curl -I
http://10.0.0.249:8080/artifacts/122/1/pipelines-debug-wip-8e49a0c.apk`
returned `HTTP/1.1 200 OK`, `Content-Type:
application/vnd.android.package-archive`, `Content-Length: 17995009`, and a
streamed `GET | shasum -a 256` returned the same `d40d7b78…`.
Not verified in this pass: `:app:lintDebug` (not run); the Runs-list and
run-detail before/after pairs are not byte-identical because their live
relative-time text and artifact thumbnails load asynchronously.
## An app-owned run-status palette (16 Oct 2026) ## An app-owned run-status palette (16 Oct 2026)
Run status had the wrong hue for its two most important states because it was Run status had the wrong hue for its two most important states because it was
@@ -23,6 +23,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.ICON_INLINE_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
@@ -66,9 +70,9 @@ fun CodeBlock(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(start = 16.dp, end = 4.dp, top = 4.dp, bottom = 4.dp), .padding(start = SPACING_L, end = SPACING_XS, top = SPACING_XS, bottom = SPACING_XS),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text( Text(
text = label, text = label,
@@ -80,7 +84,7 @@ fun CodeBlock(
Icon( Icon(
imageVector = Icons.Default.ContentCopy, imageVector = Icons.Default.ContentCopy,
contentDescription = "Copy $label", contentDescription = "Copy $label",
modifier = Modifier.size(18.dp), modifier = Modifier.size(ICON_INLINE_DP),
) )
} }
} }
@@ -95,7 +99,7 @@ fun CodeBlock(
Text( Text(
text = text, text = text,
style = styles.mono, style = styles.mono,
modifier = body.padding(start = 16.dp, end = 16.dp, bottom = 16.dp), modifier = body.padding(start = SPACING_L, end = SPACING_L, bottom = SPACING_L),
) )
} }
} }
@@ -15,8 +15,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import net.awan.pipelines.data.transport.ConnectionState import net.awan.pipelines.data.transport.ConnectionState
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
/** /**
* A small, shared connection banner shown above every screen so a disconnected * A small, shared connection banner shown above every screen so a disconnected
@@ -81,9 +83,9 @@ private fun Banner(
// applied a second time. // applied a second time.
modifier = Modifier modifier = Modifier
.windowInsetsPadding(paneSafeArea().only(WindowInsetsSides.Top)) .windowInsetsPadding(paneSafeArea().only(WindowInsetsSides.Top))
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = SPACING_L, vertical = SPACING_S),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_M),
) { ) {
Text( Text(
text = text, text = text,
@@ -46,6 +46,11 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.DETAIL_MAX_WIDTH_DP import net.awan.pipelines.ui.theme.DETAIL_MAX_WIDTH_DP
import net.awan.pipelines.ui.theme.ICON_RAIL_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.WIDE_RAIL_WIDTH_DP import net.awan.pipelines.ui.theme.WIDE_RAIL_WIDTH_DP
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
@@ -133,15 +138,15 @@ fun DetailTabs(
modifier = Modifier modifier = Modifier
.width(WIDE_RAIL_WIDTH_DP.dp) .width(WIDE_RAIL_WIDTH_DP.dp)
.fillMaxHeight() .fillMaxHeight()
.padding(vertical = 8.dp), .padding(vertical = SPACING_S),
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.fillMaxWidth() .fillMaxWidth()
.selectableGroup() .selectableGroup()
.padding(top = 8.dp, bottom = 8.dp), .padding(top = SPACING_S, bottom = SPACING_S),
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
tabs.forEachIndexed { index, tab -> tabs.forEachIndexed { index, tab ->
RailTab( RailTab(
@@ -192,16 +197,16 @@ private fun RailTab(tab: DetailTab, selected: Boolean, onClick: () -> Unit) {
.background( .background(
if (selected) MaterialTheme.colorScheme.secondaryContainer else Color.Transparent, if (selected) MaterialTheme.colorScheme.secondaryContainer else Color.Transparent,
) )
.padding(horizontal = 16.dp, vertical = 12.dp), .padding(horizontal = SPACING_L, vertical = SPACING_M),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_M),
) { ) {
Icon( Icon(
imageVector = tab.icon, imageVector = tab.icon,
// The label names the tab, so the glyph is decorative. // The label names the tab, so the glyph is decorative.
contentDescription = null, contentDescription = null,
tint = contentColor, tint = contentColor,
modifier = Modifier.size(24.dp), modifier = Modifier.size(ICON_RAIL_DP),
) )
Text( Text(
text = tab.title, text = tab.title,
@@ -39,6 +39,10 @@ import androidx.compose.ui.semantics.toggleableState
import androidx.compose.ui.state.ToggleableState import androidx.compose.ui.state.ToggleableState
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
@@ -111,7 +115,7 @@ fun FilterMenu(
modifier = Modifier.heightIn(max = maxMenuHeight), modifier = Modifier.heightIn(max = maxMenuHeight),
) { ) {
Row( Row(
modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 4.dp), modifier = Modifier.fillMaxWidth().padding(start = SPACING_L, end = SPACING_XS),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
) { ) {
@@ -173,6 +177,6 @@ fun FilterSectionHeader(label: String) {
text = label, text = label,
style = pipelinesText().label, style = pipelinesText().label,
color = MaterialTheme.colorScheme.primary, color = MaterialTheme.colorScheme.primary,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_M, vertical = SPACING_S),
) )
} }
@@ -20,6 +20,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_XXS
/** /**
* One row of the shared real list used by the wide pipelines/runs panes (and the * One row of the shared real list used by the wide pipelines/runs panes (and the
@@ -67,14 +70,14 @@ fun ListRow(
) { ) {
Column { Column {
Row( Row(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_M),
) { ) {
leading?.invoke() leading?.invoke()
Column( Column(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(2.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XXS),
) { ) {
content() content()
} }
@@ -11,7 +11,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
@@ -29,9 +31,9 @@ fun PaneIdentity(title: String, subtitle: String? = null, modifier: Modifier = M
val text = pipelinesText() val text = pipelinesText()
Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Box(modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Column( Column(
modifier = Modifier.padding(horizontal = 8.dp, vertical = 12.dp), modifier = Modifier.padding(horizontal = SPACING_S, vertical = SPACING_M),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
Text( Text(
text = title, text = title,
@@ -26,7 +26,10 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import net.awan.pipelines.ui.theme.ICON_STATUS_DP
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.SPACING_XXS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
@@ -136,15 +139,15 @@ internal fun ColoredChip(
modifier = modifier modifier = modifier
.clip(RoundedCornerShape(50)) .clip(RoundedCornerShape(50))
.background(animatedColor.copy(alpha = 0.16f)) .background(animatedColor.copy(alpha = 0.16f))
.padding(horizontal = 8.dp, vertical = 2.dp), .padding(horizontal = SPACING_S, vertical = SPACING_XXS),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
Icon( Icon(
imageVector = icon, imageVector = icon,
contentDescription = contentDescription, contentDescription = contentDescription,
tint = animatedColor, tint = animatedColor,
modifier = Modifier.size(14.dp), modifier = Modifier.size(ICON_STATUS_DP),
) )
Text( Text(
text = label, text = label,
@@ -33,6 +33,8 @@ import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role import androidx.compose.ui.semantics.role
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
@@ -82,9 +84,9 @@ fun SectionHeader(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 10.dp), .padding(horizontal = SPACING_L, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text( Text(
text = title, text = title,
@@ -17,7 +17,10 @@ import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_XL
import net.awan.pipelines.ui.theme.SPACING_XS
@Composable @Composable
fun LoadingState(message: String = "Loading…", modifier: Modifier = Modifier) { fun LoadingState(message: String = "Loading…", modifier: Modifier = Modifier) {
@@ -27,14 +30,14 @@ fun LoadingState(message: String = "Loading…", modifier: Modifier = Modifier)
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
CircularProgressIndicator() CircularProgressIndicator()
Text(message, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = 12.dp)) Text(message, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(top = SPACING_M))
} }
} }
@Composable @Composable
fun ErrorState(message: String, onRetry: (() -> Unit)? = null, modifier: Modifier = Modifier) { fun ErrorState(message: String, onRetry: (() -> Unit)? = null, modifier: Modifier = Modifier) {
Column( Column(
modifier = modifier.fillMaxSize().padding(24.dp), modifier = modifier.fillMaxSize().padding(SPACING_XL),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
@@ -45,7 +48,7 @@ fun ErrorState(message: String, onRetry: (() -> Unit)? = null, modifier: Modifie
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
) )
if (onRetry != null) { if (onRetry != null) {
Button(onClick = onRetry, modifier = Modifier.padding(top = 16.dp)) { Text("Retry") } Button(onClick = onRetry, modifier = Modifier.padding(top = SPACING_L)) { Text("Retry") }
} }
} }
} }
@@ -63,7 +66,7 @@ fun EmptyState(
onAction: (() -> Unit)? = null, onAction: (() -> Unit)? = null,
) { ) {
Column( Column(
modifier = modifier.fillMaxSize().padding(24.dp), modifier = modifier.fillMaxSize().padding(SPACING_XL),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
@@ -74,7 +77,7 @@ fun EmptyState(
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
) )
if (actionLabel != null && onAction != null) { if (actionLabel != null && onAction != null) {
Button(onClick = onAction, modifier = Modifier.padding(top = 16.dp)) { Button(onClick = onAction, modifier = Modifier.padding(top = SPACING_L)) {
Text(actionLabel) Text(actionLabel)
} }
} }
@@ -178,7 +181,7 @@ fun KeyValueRow(
monospace: Boolean = false, monospace: Boolean = false,
) { ) {
if (value.isBlank()) return if (value.isBlank()) return
Column(modifier = modifier.fillMaxWidth().padding(vertical = 4.dp)) { Column(modifier = modifier.fillMaxWidth().padding(vertical = SPACING_XS)) {
Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary) Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.primary)
Text( Text(
value, value,
@@ -41,7 +41,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import net.awan.pipelines.data.ErrorMessages import net.awan.pipelines.data.ErrorMessages
import net.awan.pipelines.data.protocol.PipelineDetail import net.awan.pipelines.data.protocol.PipelineDetail
@@ -56,10 +55,10 @@ import net.awan.pipelines.ui.components.LoadPhase
import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.LoadingState
import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.PaneIdentity
import net.awan.pipelines.ui.components.StateCrossfade import net.awan.pipelines.ui.components.StateCrossfade
import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.collapsibleSection import net.awan.pipelines.ui.components.collapsibleSection
import net.awan.pipelines.ui.components.copyText import net.awan.pipelines.ui.components.copyText
import net.awan.pipelines.ui.components.detailLoadPhase import net.awan.pipelines.ui.components.detailLoadPhase
import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.pipelineDetailTabs import net.awan.pipelines.ui.components.pipelineDetailTabs
import net.awan.pipelines.ui.components.rememberPaneContent import net.awan.pipelines.ui.components.rememberPaneContent
import net.awan.pipelines.ui.components.rememberSectionExpansion import net.awan.pipelines.ui.components.rememberSectionExpansion
@@ -67,6 +66,11 @@ import net.awan.pipelines.ui.graph.StageFieldRow
import net.awan.pipelines.ui.graph.WorkflowGraph import net.awan.pipelines.ui.graph.WorkflowGraph
import net.awan.pipelines.ui.graph.effectiveStageType import net.awan.pipelines.ui.graph.effectiveStageType
import net.awan.pipelines.ui.graph.stageDefinitionFields import net.awan.pipelines.ui.graph.stageDefinitionFields
import net.awan.pipelines.ui.theme.ICON_INLINE_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@@ -193,12 +197,12 @@ private fun PipelineSummaryTab(detail: PipelineDetail, wide: Boolean, modifier:
DetailTabBody(wide, modifier) { columnModifier -> DetailTabBody(wide, modifier) { columnModifier ->
LazyColumn( LazyColumn(
modifier = columnModifier, modifier = columnModifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
item(key = "pipeline-summary") { item(key = "pipeline-summary") {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
Text(detail.name, style = text.screenTitle) Text(detail.name, style = text.screenTitle)
Text( Text(
@@ -223,14 +227,14 @@ private fun PipelineSummaryTab(detail: PipelineDetail, wide: Boolean, modifier:
Text( Text(
"No versions recorded.", "No versions recorded.",
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} else { } else {
// The version list is bounded and small, so it renders in the // The version list is bounded and small, so it renders in the
// section's single animated body item; the rows are not lazy. // section's single animated body item; the rows are not lazy.
Column(modifier = Modifier.fillMaxWidth()) { Column(modifier = Modifier.fillMaxWidth()) {
detail.versions.forEach { v -> detail.versions.forEach { v ->
VersionRow(v, Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) VersionRow(v, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS))
} }
} }
} }
@@ -249,12 +253,12 @@ private fun PipelineGraphTab(
val text = pipelinesText() val text = pipelinesText()
LazyColumn( LazyColumn(
modifier = modifier, modifier = modifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
item(key = "pipeline-graph") { item(key = "pipeline-graph") {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text( Text(
"Pinch to zoom, drag to pan, tap a stage for details. Edges are labelled with their outcome; error* is the implicit fallback.", "Pinch to zoom, drag to pan, tap a stage for details. Edges are labelled with their outcome; error* is the implicit fallback.",
@@ -295,13 +299,13 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
LazyColumn( LazyColumn(
modifier = modifier.fillMaxSize(), modifier = modifier.fillMaxSize(),
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
item(key = "source-actions") { item(key = "source-actions") {
Row( Row(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
OutlinedButton(onClick = { showRaw = !showRaw }) { OutlinedButton(onClick = { showRaw = !showRaw }) {
Text(if (showRaw) "Rendered" else "Raw") Text(if (showRaw) "Rendered" else "Raw")
@@ -310,9 +314,9 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
Icon( Icon(
imageVector = Icons.Default.ContentCopy, imageVector = Icons.Default.ContentCopy,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp), modifier = Modifier.size(ICON_INLINE_DP),
) )
Spacer(Modifier.width(8.dp)) Spacer(Modifier.width(SPACING_S))
Text("Copy definition") Text("Copy definition")
} }
} }
@@ -323,7 +327,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
CodeBlock( CodeBlock(
"Definition source", "Definition source",
detail.source, detail.source,
Modifier.padding(horizontal = 16.dp, vertical = 4.dp), Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS),
maxHeight = null, maxHeight = null,
) )
} }
@@ -331,7 +335,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
Text( Text(
"This definition has no stages.", "This definition has no stages.",
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
else -> sections.forEach { (stage, fields) -> else -> sections.forEach { (stage, fields) ->
@@ -345,8 +349,8 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = SPACING_L, vertical = SPACING_S),
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
fields.forEach { field -> StageFieldRow(field) } fields.forEach { field -> StageFieldRow(field) }
} }
@@ -360,7 +364,7 @@ private fun PipelineSourceTab(detail: PipelineDetail, modifier: Modifier) {
private fun VersionRow(v: VersionSummary, modifier: Modifier = Modifier) { private fun VersionRow(v: VersionSummary, modifier: Modifier = Modifier) {
val text = pipelinesText() val text = pipelinesText()
Card(modifier.fillMaxWidth()) { Card(modifier.fillMaxWidth()) {
Row(Modifier.padding(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp)) { Row(Modifier.padding(SPACING_M), horizontalArrangement = Arrangement.spacedBy(SPACING_M)) {
Text("v${v.version}", style = text.cardTitle) Text("v${v.version}", style = text.cardTitle)
Text("${v.stages} stages", style = text.meta) Text("${v.stages} stages", style = text.meta)
Text(v.createdAt, style = text.meta) Text(v.createdAt, style = text.meta)
@@ -384,7 +388,7 @@ private fun StartRunDialog(
onDismissRequest = { if (!submitting) onDismiss() }, onDismissRequest = { if (!submitting) onDismiss() },
title = { Text("Start run: ${detail.name} v${detail.version}") }, title = { Text("Start run: ${detail.name} v${detail.version}") },
text = { text = {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { Column(verticalArrangement = Arrangement.spacedBy(SPACING_S)) {
OutlinedTextField( OutlinedTextField(
value = prompt, value = prompt,
onValueChange = { prompt = it }, onValueChange = { prompt = it },
@@ -33,7 +33,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import java.time.OffsetDateTime import java.time.OffsetDateTime
import net.awan.pipelines.data.protocol.PipelineSummary import net.awan.pipelines.data.protocol.PipelineSummary
@@ -54,6 +53,8 @@ import net.awan.pipelines.ui.components.StateCrossfade
import net.awan.pipelines.ui.components.animateListItem import net.awan.pipelines.ui.components.animateListItem
import net.awan.pipelines.ui.components.listLoadPhase import net.awan.pipelines.ui.components.listLoadPhase
import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@@ -154,7 +155,7 @@ fun PipelineListScreen(
label = { Text("Search pipelines") }, label = { Text("Search pipelines") },
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) }, leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
singleLine = true, singleLine = true,
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
val all = state.data ?: emptyList() val all = state.data ?: emptyList()
val items = remember(all, query, sort, latestRuns, filters, runsKnown) { val items = remember(all, query, sort, latestRuns, filters, runsKnown) {
@@ -200,7 +201,7 @@ fun PipelineListScreen(
) )
LoadPhase.Content -> LazyColumn( LoadPhase.Content -> LazyColumn(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(vertical = 8.dp), contentPadding = PaddingValues(vertical = SPACING_S),
) { ) {
items(items, key = { it.id }) { pipeline -> items(items, key = { it.id }) { pipeline ->
PipelineRow( PipelineRow(
@@ -219,7 +220,7 @@ fun PipelineListScreen(
Text( Text(
text = state.error!!, text = state.error!!,
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
modifier = Modifier.padding(16.dp), modifier = Modifier.padding(SPACING_L),
) )
} }
} }
@@ -323,7 +324,7 @@ private fun PipelineRow(
} else { } else {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
RunStatusChip(badge.state) RunStatusChip(badge.state)
Text( Text(
@@ -52,6 +52,7 @@ import net.awan.pipelines.data.protocol.SessionEvidence
import net.awan.pipelines.ui.AppViewModel import net.awan.pipelines.ui.AppViewModel
import net.awan.pipelines.ui.ArtifactGroup import net.awan.pipelines.ui.ArtifactGroup
import net.awan.pipelines.ui.LoadState import net.awan.pipelines.ui.LoadState
import net.awan.pipelines.ui.artifactsEmptyMessage
import net.awan.pipelines.ui.components.CodeBlock import net.awan.pipelines.ui.components.CodeBlock
import net.awan.pipelines.ui.components.ColoredChip import net.awan.pipelines.ui.components.ColoredChip
import net.awan.pipelines.ui.components.DetailTabBody import net.awan.pipelines.ui.components.DetailTabBody
@@ -61,13 +62,13 @@ import net.awan.pipelines.ui.components.KeyValueRow
import net.awan.pipelines.ui.components.LoadPhase import net.awan.pipelines.ui.components.LoadPhase
import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.LoadingState
import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.PaneIdentity
import net.awan.pipelines.ui.components.StateCrossfade
import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.RunStatusIcon import net.awan.pipelines.ui.components.RunStatusIcon
import net.awan.pipelines.ui.components.StateCrossfade
import net.awan.pipelines.ui.components.StatusChip import net.awan.pipelines.ui.components.StatusChip
import net.awan.pipelines.ui.components.collapsibleSection
import net.awan.pipelines.ui.components.clampTabIndex import net.awan.pipelines.ui.components.clampTabIndex
import net.awan.pipelines.ui.components.collapsibleSection
import net.awan.pipelines.ui.components.detailLoadPhase import net.awan.pipelines.ui.components.detailLoadPhase
import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.rememberPaneContent import net.awan.pipelines.ui.components.rememberPaneContent
import net.awan.pipelines.ui.components.rememberSectionExpansion import net.awan.pipelines.ui.components.rememberSectionExpansion
import net.awan.pipelines.ui.components.runDetailTabs import net.awan.pipelines.ui.components.runDetailTabs
@@ -75,7 +76,6 @@ import net.awan.pipelines.ui.components.runStateIcon
import net.awan.pipelines.ui.components.runStateOf import net.awan.pipelines.ui.components.runStateOf
import net.awan.pipelines.ui.displayText import net.awan.pipelines.ui.displayText
import net.awan.pipelines.ui.formatDuration import net.awan.pipelines.ui.formatDuration
import net.awan.pipelines.ui.artifactsEmptyMessage
import net.awan.pipelines.ui.graph.ArtifactGallery import net.awan.pipelines.ui.graph.ArtifactGallery
import net.awan.pipelines.ui.graph.ArtifactSelection import net.awan.pipelines.ui.graph.ArtifactSelection
import net.awan.pipelines.ui.graph.ArtifactSelectionScaffold import net.awan.pipelines.ui.graph.ArtifactSelectionScaffold
@@ -84,6 +84,13 @@ import net.awan.pipelines.ui.graph.graphColors
import net.awan.pipelines.ui.graph.outcomeColor import net.awan.pipelines.ui.graph.outcomeColor
import net.awan.pipelines.ui.graph.rememberArtifactSelection import net.awan.pipelines.ui.graph.rememberArtifactSelection
import net.awan.pipelines.ui.runArtifactGroups import net.awan.pipelines.ui.runArtifactGroups
import net.awan.pipelines.ui.theme.ICON_INLINE_DP
import net.awan.pipelines.ui.theme.ICON_STATUS_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XS
import net.awan.pipelines.ui.theme.SPACING_XXS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
import net.awan.pipelines.ui.visitCount import net.awan.pipelines.ui.visitCount
@@ -347,15 +354,15 @@ private fun RunSummaryTab(
DetailTabBody(wide, modifier) { columnModifier -> DetailTabBody(wide, modifier) { columnModifier ->
LazyColumn( LazyColumn(
modifier = columnModifier, modifier = columnModifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
// The artifacts gallery leads the summary: the captured screenshots // The artifacts gallery leads the summary: the captured screenshots
// are the first thing the operator sees, with the run's own facts // are the first thing the operator sees, with the run's own facts
// below it. // below it.
item(key = "run-artifacts") { item(key = "run-artifacts") {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = SPACING_S),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text("Artifacts", style = text.sectionHeader) Text("Artifacts", style = text.sectionHeader)
if (artifactGroups.isEmpty()) { if (artifactGroups.isEmpty()) {
@@ -373,13 +380,13 @@ private fun RunSummaryTab(
} }
item(key = "run-summary") { item(key = "run-summary") {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) { ) {
Text(run.name, style = text.screenTitle) Text(run.name, style = text.screenTitle)
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
StatusChip(label = run.status.ifBlank { state.label }, state = state) StatusChip(label = run.status.ifBlank { state.label }, state = state)
if (run.outcome.isNotBlank()) Text("outcome ${run.outcome}", style = text.meta) if (run.outcome.isNotBlank()) Text("outcome ${run.outcome}", style = text.meta)
@@ -403,7 +410,7 @@ private fun RunSummaryTab(
KeyValueRow("Finished", run.finishedAt) KeyValueRow("Finished", run.finishedAt)
KeyValueRow("Duration", formatDuration(run.createdAt, run.finishedAt) ?: "") KeyValueRow("Duration", formatDuration(run.createdAt, run.finishedAt) ?: "")
KeyValueRow("Retry of", if (run.retryOf > 0) "run ${run.retryOf}" else "") KeyValueRow("Retry of", if (run.retryOf > 0) "run ${run.retryOf}" else "")
CodeBlock("Diagnostic", run.diagnostic, Modifier.padding(top = 8.dp)) CodeBlock("Diagnostic", run.diagnostic, Modifier.padding(top = SPACING_S))
} }
} }
} }
@@ -432,12 +439,12 @@ private fun RunGraphTab(
val timeline = remember(run.steps) { runTimeline(run.steps) } val timeline = remember(run.steps) { runTimeline(run.steps) }
LazyColumn( LazyColumn(
modifier = modifier, modifier = modifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
item(key = "run-graph") { item(key = "run-graph") {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
if (run.graph.stages.isEmpty()) { if (run.graph.stages.isEmpty()) {
Text("This server did not include the run graph.", style = text.meta) Text("This server did not include the run graph.", style = text.meta)
@@ -480,14 +487,14 @@ private fun RunFieldSectionsTab(
DetailTabBody(wide, modifier) { columnModifier -> DetailTabBody(wide, modifier) { columnModifier ->
LazyColumn( LazyColumn(
modifier = columnModifier, modifier = columnModifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
if (entries.isEmpty()) { if (entries.isEmpty()) {
item(key = "$keyPrefix-empty") { item(key = "$keyPrefix-empty") {
Text( Text(
emptyMessage, emptyMessage,
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
} else { } else {
@@ -503,7 +510,7 @@ private fun RunFieldSectionsTab(
CodeBlock( CodeBlock(
label = label, label = label,
text = value.displayText(), text = value.displayText(),
modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS),
) )
} }
} }
@@ -531,12 +538,12 @@ private fun RunEvidenceTab(
DetailTabBody(wide, modifier) { columnModifier -> DetailTabBody(wide, modifier) { columnModifier ->
LazyColumn( LazyColumn(
modifier = columnModifier, modifier = columnModifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
item(key = "evidence-reload") { item(key = "evidence-reload") {
Row( Row(
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
OutlinedButton(onClick = onLoadEvidence, enabled = !evidenceState.loading) { OutlinedButton(onClick = onLoadEvidence, enabled = !evidenceState.loading) {
Text(if (evidenceState.loading) "Loading…" else "Reload session evidence") Text(if (evidenceState.loading) "Loading…" else "Reload session evidence")
@@ -548,7 +555,7 @@ private fun RunEvidenceTab(
Text( Text(
"Loading session evidence…", "Loading session evidence…",
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
evidenceState.error != null -> item(key = "evidence-error") { evidenceState.error != null -> item(key = "evidence-error") {
@@ -556,14 +563,14 @@ private fun RunEvidenceTab(
evidenceState.error!!, evidenceState.error!!,
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
evidenceState.loaded && evidence.isEmpty() -> item(key = "evidence-empty") { evidenceState.loaded && evidence.isEmpty() -> item(key = "evidence-empty") {
Text( Text(
"No session evidence recorded.", "No session evidence recorded.",
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
else -> evidence.forEach { record -> else -> evidence.forEach { record ->
@@ -574,7 +581,7 @@ private fun RunEvidenceTab(
expanded = expansion.isExpanded(sectionKey), expanded = expansion.isExpanded(sectionKey),
onToggle = { expansion.toggle(sectionKey) }, onToggle = { expansion.toggle(sectionKey) },
) { ) {
EvidenceDetails(record, Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) EvidenceDetails(record, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_XS))
} }
} }
} }
@@ -634,14 +641,14 @@ private fun RunTimelineTab(
DetailTabBody(wide, modifier) { columnModifier -> DetailTabBody(wide, modifier) { columnModifier ->
LazyColumn( LazyColumn(
modifier = columnModifier, modifier = columnModifier,
contentPadding = PaddingValues(vertical = 16.dp), contentPadding = PaddingValues(vertical = SPACING_L),
) { ) {
if (timeline.entries.isEmpty()) { if (timeline.entries.isEmpty()) {
item(key = "timeline-empty") { item(key = "timeline-empty") {
Text( Text(
"No visits recorded.", "No visits recorded.",
style = text.meta, style = text.meta,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
} else { } else {
@@ -681,20 +688,20 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(horizontal = 16.dp, vertical = 10.dp), .padding(horizontal = SPACING_L, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_M),
) { ) {
RunStatusIcon( RunStatusIcon(
state = state, state = state,
contentDescription = "Visit ${entry.visit} ${entry.stageKey}: ${state.label}", contentDescription = "Visit ${entry.visit} ${entry.stageKey}: ${state.label}",
modifier = Modifier.size(18.dp), modifier = Modifier.size(ICON_INLINE_DP),
tint = outcomeTint, tint = outcomeTint,
) )
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(SPACING_XXS)) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text( Text(
"${entry.stageKey} · visit ${entry.visit}", "${entry.stageKey} · visit ${entry.visit}",
@@ -709,7 +716,7 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) {
imageVector = Icons.Default.AttachFile, imageVector = Icons.Default.AttachFile,
contentDescription = "Visit ${entry.visit} has recorded artifacts", contentDescription = "Visit ${entry.visit} has recorded artifacts",
tint = MaterialTheme.colorScheme.onSurfaceVariant, tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(14.dp), modifier = Modifier.size(ICON_STATUS_DP),
) )
} }
if (entry.duration != null) { if (entry.duration != null) {
@@ -732,7 +739,7 @@ private fun TimelineRow(entry: TimelineEntry, onClick: () -> Unit) {
@Composable @Composable
private fun EvidenceDetails(evidence: SessionEvidence, modifier: Modifier = Modifier) { private fun EvidenceDetails(evidence: SessionEvidence, modifier: Modifier = Modifier) {
val text = pipelinesText() val text = pipelinesText()
Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(4.dp)) { Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(SPACING_XS)) {
if (evidence.sessionId.isNotBlank()) Text("session ${evidence.sessionId}", style = text.mono) if (evidence.sessionId.isNotBlank()) Text("session ${evidence.sessionId}", style = text.mono)
if (evidence.backend.isNotBlank()) Text("backend ${evidence.backend}", style = text.meta) if (evidence.backend.isNotBlank()) Text("backend ${evidence.backend}", style = text.meta)
if (evidence.directory.isNotBlank()) Text("directory ${evidence.directory}", style = text.meta) if (evidence.directory.isNotBlank()) Text("directory ${evidence.directory}", style = text.meta)
@@ -47,9 +47,6 @@ import java.time.format.DateTimeFormatter
import net.awan.pipelines.data.protocol.RunSummary import net.awan.pipelines.data.protocol.RunSummary
import net.awan.pipelines.data.protocol.UsageStats import net.awan.pipelines.data.protocol.UsageStats
import net.awan.pipelines.ui.AppViewModel import net.awan.pipelines.ui.AppViewModel
import net.awan.pipelines.ui.components.RunState
import net.awan.pipelines.ui.components.RunStatusChip
import net.awan.pipelines.ui.components.RunStatusIcon
import net.awan.pipelines.ui.components.EmptyState import net.awan.pipelines.ui.components.EmptyState
import net.awan.pipelines.ui.components.ErrorState import net.awan.pipelines.ui.components.ErrorState
import net.awan.pipelines.ui.components.FilterCheckItem import net.awan.pipelines.ui.components.FilterCheckItem
@@ -59,6 +56,9 @@ import net.awan.pipelines.ui.components.ListRow
import net.awan.pipelines.ui.components.LoadPhase import net.awan.pipelines.ui.components.LoadPhase
import net.awan.pipelines.ui.components.LoadingState import net.awan.pipelines.ui.components.LoadingState
import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.PaneIdentity
import net.awan.pipelines.ui.components.RunState
import net.awan.pipelines.ui.components.RunStatusChip
import net.awan.pipelines.ui.components.RunStatusIcon
import net.awan.pipelines.ui.components.SortMenu import net.awan.pipelines.ui.components.SortMenu
import net.awan.pipelines.ui.components.StateCrossfade import net.awan.pipelines.ui.components.StateCrossfade
import net.awan.pipelines.ui.components.animateListItem import net.awan.pipelines.ui.components.animateListItem
@@ -67,7 +67,13 @@ import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.runStateColor import net.awan.pipelines.ui.components.runStateColor
import net.awan.pipelines.ui.components.runStateOf import net.awan.pipelines.ui.components.runStateOf
import net.awan.pipelines.ui.formatDuration import net.awan.pipelines.ui.formatDuration
import net.awan.pipelines.ui.theme.ICON_LIST_DP
import net.awan.pipelines.ui.theme.ICON_STATUS_DP
import net.awan.pipelines.ui.theme.PipelinesTextStyles import net.awan.pipelines.ui.theme.PipelinesTextStyles
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.SPACING_XXS
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
import net.awan.pipelines.ui.visitCount import net.awan.pipelines.ui.visitCount
@@ -261,11 +267,11 @@ private fun RunHistoryContent(
LazyColumn( LazyColumn(
modifier = modifier.fillMaxSize(), modifier = modifier.fillMaxSize(),
contentPadding = PaddingValues(bottom = 16.dp), contentPadding = PaddingValues(bottom = SPACING_L),
) { ) {
if (usage != null) { if (usage != null) {
item(key = "usage") { item(key = "usage") {
UsageMetrics(usage, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) UsageMetrics(usage, Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S))
} }
} }
if (scoped.isEmpty()) { if (scoped.isEmpty()) {
@@ -307,7 +313,7 @@ private fun RunHistoryContent(
error, error,
color = MaterialTheme.colorScheme.error, color = MaterialTheme.colorScheme.error,
style = pipelinesText().body, style = pipelinesText().body,
modifier = animateListItem(Modifier.padding(16.dp)), modifier = animateListItem(Modifier.padding(SPACING_L)),
) )
} }
} }
@@ -323,7 +329,7 @@ private fun DayHeader(label: String) {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.background)
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = SPACING_L, vertical = SPACING_S),
) )
} }
@@ -336,7 +342,7 @@ private fun DayHeader(label: String) {
private fun UsageMetrics(usage: UsageStats, modifier: Modifier = Modifier) { private fun UsageMetrics(usage: UsageStats, modifier: Modifier = Modifier) {
val text = pipelinesText() val text = pipelinesText()
Card(modifier.fillMaxWidth()) { Card(modifier.fillMaxWidth()) {
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) { Column(Modifier.padding(SPACING_L), verticalArrangement = Arrangement.spacedBy(SPACING_M)) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
@@ -348,8 +354,8 @@ private fun UsageMetrics(usage: UsageStats, modifier: Modifier = Modifier) {
} }
} }
FlowRow( FlowRow(
horizontalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_L),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Metric("Succeeded", usage.succeeded.toString(), runStateColor(RunState.Succeeded), text) Metric("Succeeded", usage.succeeded.toString(), runStateColor(RunState.Succeeded), text)
Metric("Failed", usage.failed.toString(), runStateColor(RunState.Failed), text) Metric("Failed", usage.failed.toString(), runStateColor(RunState.Failed), text)
@@ -392,13 +398,13 @@ private fun RunRow(
RunStatusIcon( RunStatusIcon(
state = state, state = state,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(20.dp), modifier = Modifier.size(ICON_LIST_DP),
) )
}, },
) { ) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
Text( Text(
run.name, run.name,
@@ -412,13 +418,13 @@ private fun RunRow(
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(SPACING_S),
) { ) {
RunStatusChip(state) RunStatusChip(state)
if (run.executing) { if (run.executing) {
// The summary carries no total step count, so progress is shown // The summary carries no total step count, so progress is shown
// honestly as an indeterminate indicator plus completed visits. // honestly as an indeterminate indicator plus completed visits.
CircularProgressIndicator(modifier = Modifier.size(14.dp), strokeWidth = 2.dp) CircularProgressIndicator(modifier = Modifier.size(ICON_STATUS_DP), strokeWidth = 2.dp)
} }
Text(progressText(run), style = text.meta, maxLines = 1, overflow = TextOverflow.Ellipsis) Text(progressText(run), style = text.meta, maxLines = 1, overflow = TextOverflow.Ellipsis)
} }
@@ -450,7 +456,7 @@ private fun VersionChip(version: String) {
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(50)) .clip(RoundedCornerShape(50))
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f)) .background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
.padding(horizontal = 8.dp, vertical = 2.dp), .padding(horizontal = SPACING_S, vertical = SPACING_XXS),
) )
} }
@@ -41,6 +41,23 @@ internal val SPACING_XL = 24.dp
/** Eight steps of the shared 4dp spacing scale; the largest padding in the UI. */ /** Eight steps of the shared 4dp spacing scale; the largest padding in the UI. */
internal val SPACING_XXL = 32.dp internal val SPACING_XXL = 32.dp
// ---- Icon glyph sizes ------------------------------------------------------
// A glyph is not a gap, so icon sizes sit outside the spacing scale and are
// named here rather than re-derived: the status/loading glyph, the inline action
// glyph, a list row's leading glyph and the wide detail rail's tab glyph.
/** Status and loading glyph size (run-status icon, indeterminate indicator). */
internal val ICON_STATUS_DP = 14.dp
/** Inline action glyph size (copy/back-adjacent icons inside a row). */
internal val ICON_INLINE_DP = 18.dp
/** List leading glyph size (a run row's status icon). */
internal val ICON_LIST_DP = 20.dp
/** Wide detail-rail tab glyph size. */
internal val ICON_RAIL_DP = 24.dp
// ---- Pane geometry (ui/components/SlidingPaneStack.kt) --------------------- // ---- Pane geometry (ui/components/SlidingPaneStack.kt) ---------------------
// The sliding pane stack derives every offset and width from these plus the // The sliding pane stack derives every offset and width from these plus the
// measured host width and the system insets; no screen hardcodes a peek or pane // measured host width and the system insets; no screen hardcodes a peek or pane
@@ -26,7 +26,7 @@ class DimensTest {
private val allowList: Map<String, String> = mapOf( private val allowList: Map<String, String> = mapOf(
// Structural / hairline values that are not design dimensions. // Structural / hairline values that are not design dimensions.
"0.dp" to "Structural zero: no inset, clamped-to-zero, or an empty-guard comparison.", "0.dp" to "Structural zero: no inset, clamped-to-zero, or an empty-guard comparison.",
"2.dp" to "Progress/divider hairline strokes and 2dp icon/line gaps; half the 4dp base step.", "2.dp" to "Progress/divider hairline strokes (progress indicators, graph hairlines); half the 4dp base step.",
"3.dp" to "Tonal and border hairline (elevation/border), not a layout dimension.", "3.dp" to "Tonal and border hairline (elevation/border), not a layout dimension.",
"6.dp" to "Pill shadow elevation only; not layout geometry.", "6.dp" to "Pill shadow elevation only; not layout geometry.",
@@ -35,14 +35,11 @@ class DimensTest {
"8.dp" to "Two 4dp steps (SPACING_S): standard stack/row gap and icon inset.", "8.dp" to "Two 4dp steps (SPACING_S): standard stack/row gap and icon inset.",
"12.dp" to "Three 4dp steps (SPACING_M): standard inter-item arrangement gap.", "12.dp" to "Three 4dp steps (SPACING_M): standard inter-item arrangement gap.",
"16.dp" to "Four 4dp steps (SPACING_L): standard screen, card and app-bar padding.", "16.dp" to "Four 4dp steps (SPACING_L): standard screen, card and app-bar padding.",
"24.dp" to "Six 4dp steps (SPACING_XL): empty/error padding and the 24dp progress glyph.", "24.dp" to "Artifact progress glyph and artifact-viewer padding (ui/graph); not yet migrated.",
"32.dp" to "Eight 4dp steps (SPACING_XXL): workflow-graph content padding.",
"10.dp" to "Dense row padding finer than the 4dp scale (10dp vertical); kept verbatim.", "10.dp" to "Dense row padding finer than the 4dp scale (10dp vertical); kept verbatim.",
// Component glyph sizes. // Component glyph sizes still outside the token file (the list/detail
"14.dp" to "Status/loading icon glyph size (14dp).", // screens' 14/18/20/24dp glyphs moved onto Dimens' ICON_* tokens).
"18.dp" to "Inline icon glyph size (18dp).",
"20.dp" to "List icon glyph size and code-block inner padding (20dp).",
"48.dp" to "Minimum touch target and graph minimum visible span (48dp).", "48.dp" to "Minimum touch target and graph minimum visible span (48dp).",
// Workflow-graph pixel geometry now lives in ui/theme/Dimens.kt as the // Workflow-graph pixel geometry now lives in ui/theme/Dimens.kt as the
@@ -54,9 +51,7 @@ class DimensTest {
"320.dp" to "Code block maximum height (CODE_BLOCK_MAX_HEIGHT).", "320.dp" to "Code block maximum height (CODE_BLOCK_MAX_HEIGHT).",
// Typography (sp), which is owned by Typography.kt, not the dimension file. // Typography (sp), which is owned by Typography.kt, not the dimension file.
"11.sp" to "Workflow-graph edge-label font size.",
"12.sp" to "labelMedium/bodySmall size; Material typography role.", "12.sp" to "labelMedium/bodySmall size; Material typography role.",
"13.sp" to "Workflow-graph node-label font size.",
"14.sp" to "bodyMedium size; Material typography role.", "14.sp" to "bodyMedium size; Material typography role.",
"15.sp" to "titleSmall size; Material typography role.", "15.sp" to "titleSmall size; Material typography role.",
"16.sp" to "bodyLarge/titleMedium size; Material typography role.", "16.sp" to "bodyLarge/titleMedium size; Material typography role.",