Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
bd75a6d8ea
commit
d6892cde7f
7 files changed
+42
-65
No files matched your search
@@ -25,7 +25,6 @@ import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Key
|
||||
import androidx.compose.material.icons.filled.RestartAlt
|
||||
import androidx.compose.material.icons.filled.Science
|
||||
import androidx.compose.material.icons.filled.Storage
|
||||
import androidx.compose.material3.Button
|
||||
@@ -564,15 +563,6 @@ private fun ServerCard(
|
||||
Spacer(modifier = Modifier.width(spacing.xs))
|
||||
Text(stringResource(R.string.mcp_servers_action_test), maxLines = 1)
|
||||
}
|
||||
FilledTonalButton(
|
||||
onClick = { viewModel.restartServer(server.name) },
|
||||
modifier = Modifier.weight(1f),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 10.dp),
|
||||
) {
|
||||
Icon(Icons.Filled.RestartAlt, contentDescription = null, modifier = Modifier.size(16.dp))
|
||||
Spacer(modifier = Modifier.width(spacing.xs))
|
||||
Text(stringResource(R.string.mcp_servers_action_restart), maxLines = 1)
|
||||
}
|
||||
IconButton(onClick = { viewModel.deleteServer(server.name) }) {
|
||||
Icon(Icons.Filled.Delete, contentDescription = stringResource(R.string.action_delete))
|
||||
}
|
||||
|
||||
@@ -162,26 +162,6 @@ class McpServersViewModel :
|
||||
}
|
||||
}
|
||||
|
||||
fun restartServer(name: String) {
|
||||
viewModelScope.launch {
|
||||
_uiState.update { it.copy(toastMessage = "Restarting server '$name'…") }
|
||||
val result =
|
||||
withContext(Dispatchers.IO) {
|
||||
safeApiCall { ApiClient.hermesApi.restartMcpServer(name) }
|
||||
}
|
||||
when (result) {
|
||||
is NetworkResult.Success -> {
|
||||
_uiState.update { it.copy(toastMessage = "Server '$name' restarted") }
|
||||
loadServers()
|
||||
}
|
||||
|
||||
is NetworkResult.Failure -> {
|
||||
_uiState.update { it.copy(toastMessage = "Failed to restart server: ${result.error.message}") }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Add server form ──────────────────────────────────────
|
||||
|
||||
fun toggleAddForm() {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.m57.hermescontrol.ui.profiles
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.m57.hermescontrol.data.local.AuthManager
|
||||
import com.m57.hermescontrol.data.model.CloneProfileRequest
|
||||
import com.m57.hermescontrol.data.model.CreateProfileRequest
|
||||
import com.m57.hermescontrol.data.model.HubSkill
|
||||
import com.m57.hermescontrol.data.model.ModelProvider
|
||||
@@ -242,9 +241,11 @@ class ProfilesViewModel(
|
||||
val result =
|
||||
withContext(ioDispatcher) {
|
||||
safeApiCall {
|
||||
ApiClient.hermesApi.cloneProfile(
|
||||
sourceProfileName,
|
||||
CloneProfileRequest(newProfileName),
|
||||
ApiClient.hermesApi.createProfile(
|
||||
CreateProfileRequest(
|
||||
name = newProfileName,
|
||||
clone_from = sourceProfileName,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user