Host Screen View Model

class HostScreenViewModel(hostId: String) : EquinoxViewModel, HostManager

The HostScreenViewModel class is the support class used by the com.tecknobit.brownie.ui.screens.host.presenter.HostScreen screen

Author

N7ghtm4r3 - Tecknobit

See also

Retriever
EquinoxViewModel

Constructors

Link copied to clipboard
constructor(hostId: String)

Properties

Link copied to clipboard
Link copied to clipboard
val refreshingServices: 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

servicesQuery the query used to filter the services

Link copied to clipboard
val servicesState: PaginationState<Int, HostService>

servicesState the state used to handle the pagination of the services

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
val statusFilters: SnapshotStateList<ServiceStatus>

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 applyFilters(onApply: () -> Unit)

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

Link copied to clipboard
open override fun canRetrieverStart(): Boolean
Link copied to clipboard
fun clearFilters(onClear: () -> Unit)

Method to clear the current set filters

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
fun handleServiceStatus(service: HostService, onStatusChange: (ServiceStatus) -> Unit)

Method used to handle the status of the service such running or stopped

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

Method used to reboot a host

Link copied to clipboard
fun rebootService(service: HostService, onStatusChange: () -> Unit)

Method used to reboot a service

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 host overview data

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