refactor(sessions): show job name in automation groups and preserve action labels
This commit is contained in:
1 parent
acc9c7ce9a
commit
1135f05011
4 files changed
+42
-11
No files matched your search
@@ -6,6 +6,7 @@ internal data class AutomationSessionGroup(
|
||||
val key: String,
|
||||
val jobId: String?,
|
||||
val sessions: List<SessionInfo>,
|
||||
val title: String? = null,
|
||||
)
|
||||
|
||||
// cron.scheduler mints durable run IDs as cron_{job_id}_{YYYYMMDD_HHMMSS}.
|
||||
@@ -20,9 +21,18 @@ internal fun automationGroups(sessions: List<SessionInfo>): List<AutomationSessi
|
||||
if (session.source == "cron") CRON_RUN_ID.matchEntire(session.id)?.groupValues?.get(1) else null
|
||||
jobId?.let { "job:$it" } ?: "session:${session.id}"
|
||||
}.map { (key, runs) ->
|
||||
val jobId = key.takeIf { it.startsWith("job:") }?.removePrefix("job:")
|
||||
val title =
|
||||
runs
|
||||
.mapNotNull { it.title?.takeIf(String::isNotBlank) }
|
||||
.firstOrNull()
|
||||
?.substringBeforeLast(" · ")
|
||||
?.trim()
|
||||
?.takeIf(String::isNotBlank)
|
||||
AutomationSessionGroup(
|
||||
key = key,
|
||||
jobId = key.takeIf { it.startsWith("job:") }?.removePrefix("job:"),
|
||||
jobId = jobId,
|
||||
title = title,
|
||||
sessions = runs,
|
||||
)
|
||||
}
|
||||
@@ -617,7 +617,7 @@ fun SessionsScreen(
|
||||
modifier = Modifier.size(18.dp),
|
||||
)
|
||||
Spacer(modifier = Modifier.width(spacing.xs))
|
||||
Text(stringResource(R.string.sessions_empty_cleanup_all_history))
|
||||
Text(stringResource(R.string.sessions_empty_cleanup_desc))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -823,7 +823,7 @@ fun SessionsScreen(
|
||||
modifier = Modifier.size(20.dp),
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.sessions_action_prune_all_history),
|
||||
text = stringResource(R.string.sessions_action_prune),
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = statusColors.warning,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
@@ -946,12 +946,13 @@ fun SessionsScreen(
|
||||
Column {
|
||||
Text(
|
||||
text =
|
||||
group.jobId?.let {
|
||||
stringResource(
|
||||
R.string.sessions_section_automation_job,
|
||||
it,
|
||||
)
|
||||
} ?: stringResource(
|
||||
group.title
|
||||
?: group.jobId?.let {
|
||||
stringResource(
|
||||
R.string.sessions_section_automation_job,
|
||||
it,
|
||||
)
|
||||
} ?: stringResource(
|
||||
R.string.sessions_section_automation_unknown,
|
||||
),
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
|
||||
Reference in new issue
Block a user