fix: plugin status toggling & fix tests compilation
This commit is contained in:
1 parent
6152ee42b2
commit
f355814842
2 files changed
+13
-4
No files matched your search
@@ -57,7 +57,11 @@ class PluginsViewModel : ViewModel() {
|
|||||||
state.copy(
|
state.copy(
|
||||||
plugins =
|
plugins =
|
||||||
state.plugins.map {
|
state.plugins.map {
|
||||||
if (it.name == plugin.name) it.copy(enabled = targetEnabled) else it
|
if (it.name == plugin.name) {
|
||||||
|
it.copy(runtimeStatus = if (targetEnabled) "enabled" else "disabled")
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -150,7 +154,11 @@ class PluginsViewModel : ViewModel() {
|
|||||||
state.copy(
|
state.copy(
|
||||||
plugins =
|
plugins =
|
||||||
state.plugins.map {
|
state.plugins.map {
|
||||||
if (it.name == name) it.copy(enabled = originalEnabled) else it
|
if (it.name == name) {
|
||||||
|
it.copy(runtimeStatus = if (originalEnabled) "enabled" else "disabled")
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toastMessage = errorMsg,
|
toastMessage = errorMsg,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.m57.hermescontrol.data.model.KanbanTask
|
|||||||
import com.m57.hermescontrol.data.model.LogResponse
|
import com.m57.hermescontrol.data.model.LogResponse
|
||||||
import com.m57.hermescontrol.data.model.MessagingPlatform
|
import com.m57.hermescontrol.data.model.MessagingPlatform
|
||||||
import com.m57.hermescontrol.data.model.PluginInfo
|
import com.m57.hermescontrol.data.model.PluginInfo
|
||||||
|
import com.m57.hermescontrol.data.model.PluginsHubResponse
|
||||||
import com.m57.hermescontrol.data.model.Skill
|
import com.m57.hermescontrol.data.model.Skill
|
||||||
import com.m57.hermescontrol.data.model.StatusResponse
|
import com.m57.hermescontrol.data.model.StatusResponse
|
||||||
import com.m57.hermescontrol.data.model.SystemStatsResponse
|
import com.m57.hermescontrol.data.model.SystemStatsResponse
|
||||||
@@ -793,8 +794,8 @@ class E2eIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testPluginsManagement_success() =
|
fun testPluginsManagement_success() =
|
||||||
runTest {
|
runTest {
|
||||||
val plugin = PluginInfo("plugin-1", "Desc", "1.0", false, true)
|
val plugin = PluginInfo("plugin-1", "Desc", "1.0", null, "disabled")
|
||||||
coEvery { mockApiService.getPlugins() } returns Response.success(listOf(plugin))
|
coEvery { mockApiService.getPlugins() } returns Response.success(PluginsHubResponse(listOf(plugin)))
|
||||||
coEvery { mockApiService.enablePlugin("plugin-1") } returns Response.success(Unit)
|
coEvery { mockApiService.enablePlugin("plugin-1") } returns Response.success(Unit)
|
||||||
|
|
||||||
val viewModel = PluginsViewModel()
|
val viewModel = PluginsViewModel()
|
||||||
|
|||||||
Reference in new issue
Block a user