Add manual overview refresh actions

This commit is contained in:
OpenClaw committed 2026-03-07 21:53:52 +08:00
1 parent 6f7a4399e5
commit ad1cae7f18
4 files changed
+49

No files matched your search

@@ -326,12 +326,19 @@ private fun OpenClawRoot(appState: OpenClawAppState) {
status = appState.repository.status,
availableAgents = appState.repository.availableAgents,
currentTheme = appState.themeMode,
isRefreshing = appState.isSyncing,
onSelectAgent = { agent ->
coroutineScope.launch {
appState.updateDefaultAgent(agent)
}
},
onSelectTheme = appState::updateTheme,
onRefreshOverview = {
coroutineScope.launch {
appState.clearSyncError()
appState.syncRemoteIfNeeded()
}
},
onDisconnect = appState::disconnect,
)
@@ -341,12 +348,19 @@ private fun OpenClawRoot(appState: OpenClawAppState) {
status = appState.repository.status,
availableAgents = appState.repository.availableAgents,
currentTheme = appState.themeMode,
isRefreshing = appState.isSyncing,
onSelectAgent = { agent ->
coroutineScope.launch {
appState.updateDefaultAgent(agent)
}
},
onSelectTheme = appState::updateTheme,
onRefreshOverview = {
coroutineScope.launch {
appState.clearSyncError()
appState.syncRemoteIfNeeded()
}
},
onDisconnect = appState::disconnect,
)
}
@@ -66,6 +66,32 @@ fun SessionListScreen(
)
}
item {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (isLoading) {
CircularProgressIndicator(modifier = Modifier.padding(end = 4.dp))
Text(
text = "同步中",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.weight(1f),
)
} else {
Text(
text = "",
modifier = Modifier.weight(1f),
)
}
TextButton(onClick = onRetry, enabled = !isLoading) {
Text("刷新")
}
}
}
if (isLoading) {
item {
Card(modifier = Modifier.fillMaxWidth()) {
@@ -28,8 +28,10 @@ fun SettingsScreen(
status: ServerStatus,
availableAgents: List<String>,
currentTheme: AppThemeMode,
isRefreshing: Boolean,
onSelectAgent: (String) -> Unit,
onSelectTheme: (AppThemeMode) -> Unit,
onRefreshOverview: () -> Unit,
onDisconnect: () -> Unit,
) {
LazyColumn(
@@ -138,6 +140,12 @@ fun SettingsScreen(
)
}
item {
Button(onClick = onRefreshOverview, modifier = Modifier.fillMaxWidth(), enabled = !isRefreshing) {
Text(if (isRefreshing) "同步中…" else "立即同步")
}
}
item {
Button(onClick = onDisconnect, modifier = Modifier.fillMaxWidth()) {
Text("退出登录并重新连接")