Hosts Screen View Model

class HostsScreenViewModel : EquinoxViewModel, HostManager

The HostsScreenViewModel class is the support class used by the com.tecknobit.brownie.ui.screens.hosts.presenter.HostsScreen screen

Author

N7ghtm4r3 - Tecknobit

See also

Retriever
EquinoxViewModel

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val hostsState: PaginationState<Int, SavedHost.SavedHostImpl>

hostsState the state used to handle the pagination of the hosts

Link copied to clipboard

inputSearch is the input inserted by the user to filter the hosts result

Link copied to clipboard
val refreshingHosts: SharedFlow<Boolean>
Link copied to clipboard
open override var requestsScope: CoroutineScope

requestsScope the CoroutineScope used to make the requests to the backend

Link copied to clipboard
lateinit var sessionFlowState: SessionFlowState

sessionFlowState the state used to manage the session lifecycle in the screen

Link copied to clipboard
Link copied to clipboard

statusFilters the list of the statuses used to filter the hosts result

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
fun applyStatusFilters(onSuccess: () -> Unit)

Method used to apply the selected statuses and refresh the current hostsState list

Link copied to clipboard
open override fun canRetrieverStart(): Boolean
Link copied to clipboard
open override fun continueToRetrieve(currentContext: KClass<*>): Boolean
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?
Link copied to clipboard
open fun handleHostStatus(host: SavedHost, onStatusChange: (HostStatus) -> Unit)

Method used to handle the status of the host such online or offline

Link copied to clipboard
open fun rebootHost(host: SavedHost, onStatusChange: () -> Unit)

Method used to reboot a host

Link copied to clipboard
open override fun restartRetriever()
Link copied to clipboard
open fun restartRetrieverIf(condition: Boolean)
Link copied to clipboard
open override fun retrieve(currentContext: KClass<*>, routine: suspend () -> Unit, repeatRoutine: Boolean, refreshDelay: Long)
Link copied to clipboard

Method used to retrieve the current hosts statuses and refresh the hostsState items

Link copied to clipboard
open fun setActiveContext(currentContext: KClass<*>)
Link copied to clipboard
open override fun showFailure(error: JsonObject)

Method used to display an eventual occurred error

Link copied to clipboard
fun showSnackbarMessage(message: String, actionLabel: String?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
fun showSnackbarMessage(response: JsonObject, actionLabel: String?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
fun showSnackbarMessage(message: StringResource, actionLabel: StringResource?, onDismiss: () -> Unit?, onActionPerformed: () -> Unit?, withDismissAction: Boolean, duration: SnackbarDuration)
Link copied to clipboard
open override fun suspendRetriever()
Link copied to clipboard
open fun suspendRetrieverIf(condition: Boolean)
Link copied to clipboard
open fun unregisterHost(host: SavedHost, onSuccess: () -> Unit)

Method used to unregister a host from the session