Make the run summary's artifacts gallery a collapsed section
The run summary led with the artifacts gallery, but it was always open, so a long run's grid pushed the run's own facts below the fold. The gallery now sits in one collapsed-by-default section in the same place, with a header that describes itself while collapsed. - RunDetailScreen.kt: RunSummaryTab renders the gallery through the shared LazyListScope.collapsibleSection, keyed "artifacts" and seeded with rememberSectionExpansion(run.id), so a run opened fresh starts collapsed and the operator's choice persists per run across tab switches and config changes. Order is unchanged: the section still leads the summary and the facts item follows it. Expanding composes the unchanged ArtifactGallery; collapsing composes nothing. - ArtifactGroups.kt: new pure runArtifactsHeader(steps, executing) builds the self-describing header - singular/plural title, recorded count and "· partial capture" when any visit excluded or omitted files; empty runs reuse the shared artifactsEmptyMessage. Its count equals runArtifactGroups' tile total, so the header and the expanded gallery cannot disagree. - ArtifactGroupsTest.kt: four header tests covering count, singular vs plural, the partial-capture notes and the empty case, plus a count-matches-gallery assertion. - android/README.md: records the change and its verification evidence. Android only; no new dependency, no run started from the app, device work on the operator's Pixel 10 Pro Fold (58281FDCG000JF). Verified: 269/0/0/0 unit tests, clean assembleDebug and published APK LAN URL 200.
This commit is contained in:
@@ -54,3 +54,27 @@ fun artifactsEmptyMessage(executing: Boolean): String =
|
||||
} else {
|
||||
"No artifacts recorded for this run."
|
||||
}
|
||||
|
||||
/**
|
||||
* The run summary's Artifacts section header, complete on its own while the
|
||||
* section is collapsed: the title, how many artifacts the run recorded (the
|
||||
* title takes its singular form for exactly one) and "partial capture" when any
|
||||
* visit excluded or omitted files. It mirrors the per-visit [artifactsSummary]
|
||||
* vocabulary at run level and reuses the shared [artifactsEmptyMessage] for the
|
||||
* empty case, so a run with nothing recorded still gets a self-describing
|
||||
* collapsed header. The recorded count is exactly the number of tiles
|
||||
* [runArtifactGroups] yields, so the header and the expanded gallery can never
|
||||
* disagree. Pure.
|
||||
*/
|
||||
fun runArtifactsHeader(steps: List<RunStep>, executing: Boolean): String {
|
||||
val recorded = steps.sumOf { it.artifacts.orEmpty().size }
|
||||
if (recorded == 0) return artifactsEmptyMessage(executing)
|
||||
val partial = steps.any { it.artifactsSkipped > 0 || it.artifactsTruncated > 0 }
|
||||
return buildString {
|
||||
append(if (recorded == 1) "Artifact" else "Artifacts")
|
||||
append(" · ")
|
||||
append(recorded)
|
||||
append(" recorded")
|
||||
if (partial) append(" · partial capture")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ import net.awan.pipelines.data.protocol.SessionEvidence
|
||||
import net.awan.pipelines.ui.AppViewModel
|
||||
import net.awan.pipelines.ui.ArtifactGroup
|
||||
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.ColoredChip
|
||||
import net.awan.pipelines.ui.components.DetailTabBody
|
||||
@@ -84,6 +83,7 @@ import net.awan.pipelines.ui.graph.graphColors
|
||||
import net.awan.pipelines.ui.graph.outcomeColor
|
||||
import net.awan.pipelines.ui.graph.rememberArtifactSelection
|
||||
import net.awan.pipelines.ui.runArtifactGroups
|
||||
import net.awan.pipelines.ui.runArtifactsHeader
|
||||
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
|
||||
@@ -338,6 +338,7 @@ private fun ConfirmDialog(
|
||||
* id/version, current stage, workspace, content hash, start/finish/duration and
|
||||
* the failure diagnostic.
|
||||
*/
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun RunSummaryTab(
|
||||
run: RunDetail,
|
||||
@@ -351,23 +352,35 @@ private fun RunSummaryTab(
|
||||
) {
|
||||
val text = pipelinesText()
|
||||
val state = runStateOf(run.status)
|
||||
// The artifacts section starts collapsed and its expand/collapse choice is
|
||||
// remembered/saved per run id, so a different run reseeds it and a run opened
|
||||
// fresh starts collapsed. Both the header and the gallery read the same
|
||||
// snapshot, so they can never disagree.
|
||||
val artifactsExpansion = rememberSectionExpansion(run.id)
|
||||
val artifactsHeader = remember(run.steps, run.executing) {
|
||||
runArtifactsHeader(run.steps, run.executing)
|
||||
}
|
||||
DetailTabBody(wide, modifier) { columnModifier ->
|
||||
LazyColumn(
|
||||
modifier = columnModifier,
|
||||
contentPadding = PaddingValues(vertical = SPACING_L),
|
||||
) {
|
||||
// The artifacts gallery leads the summary: the captured screenshots
|
||||
// are the first thing the operator sees, with the run's own facts
|
||||
// below it.
|
||||
item(key = "run-artifacts") {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L, vertical = SPACING_S),
|
||||
verticalArrangement = Arrangement.spacedBy(SPACING_S),
|
||||
) {
|
||||
Text("Artifacts", style = text.sectionHeader)
|
||||
if (artifactGroups.isEmpty()) {
|
||||
Text(artifactsEmptyMessage(run.executing), style = text.meta)
|
||||
} else {
|
||||
// The artifacts gallery still leads the summary, but inside one
|
||||
// collapsed section: its header alone carries the run's capture
|
||||
// wording until the operator expands it, and expanding reveals the
|
||||
// unchanged gallery (nothing when no artifacts were recorded).
|
||||
collapsibleSection(
|
||||
title = artifactsHeader,
|
||||
key = SUMMARY_ARTIFACTS_KEY,
|
||||
expanded = artifactsExpansion.isExpanded(SUMMARY_ARTIFACTS_KEY),
|
||||
onToggle = { artifactsExpansion.toggle(SUMMARY_ARTIFACTS_KEY) },
|
||||
) {
|
||||
if (artifactGroups.isNotEmpty()) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = SPACING_L, vertical = SPACING_S),
|
||||
) {
|
||||
ArtifactGallery(
|
||||
groups = artifactGroups,
|
||||
configuredServerUrl = configuredServerUrl,
|
||||
@@ -748,4 +761,9 @@ private fun EvidenceDetails(evidence: SessionEvidence, modifier: Modifier = Modi
|
||||
}
|
||||
}
|
||||
|
||||
// The run summary's artifacts section key: stable so its expand/collapse choice
|
||||
// is remembered consistently (it is namespaced under the summary tab's saved
|
||||
// state and reseeded by run id).
|
||||
private const val SUMMARY_ARTIFACTS_KEY = "artifacts"
|
||||
|
||||
private const val POLL_INTERVAL_MILLIS = 1_000L
|
||||
|
||||
Reference in New Issue
Block a user