mirror of
https://github.com/mii443/prometheus-android-exporter.git
synced 2025-12-03 11:08:21 +00:00
sync commit
This commit is contained in:
@@ -212,3 +212,13 @@ private fun PushProxPage(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO asap: 4 screens: loading, file error, file loaded, file missing - already implemented
|
||||
|
||||
@Composable
|
||||
private fun LoadingPage(){
|
||||
val progress : Float by remember { mutableStateOf(0.0f) }
|
||||
//TODO finish this thing
|
||||
}
|
||||
//TODO
|
||||
//https://foso.github.io/Jetpack-Compose-Playground/material/circularprogressindicator/
|
||||
@@ -30,22 +30,11 @@ import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.StringWriter
|
||||
|
||||
//TODO
|
||||
//https://www.geeksforgeeks.org/how-to-launch-an-application-automatically-on-system-boot-up-in-android/
|
||||
|
||||
// reference android app architecture
|
||||
//https://github.dev/google-developer-training/basic-android-kotlin-compose-training-unscramble
|
||||
|
||||
|
||||
// reference for sharing the view model accross whole application
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
private val collectorRegistry: CollectorRegistry = CollectorRegistry()
|
||||
private lateinit var metricsEngine: MetricsEngine
|
||||
private lateinit var customExporter: AndroidCustomExporter
|
||||
|
||||
private var pushProxStarted : Boolean = false
|
||||
private lateinit var pushProxClient : PushProxClient
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -81,21 +70,13 @@ class MainActivity : ComponentActivity() {
|
||||
promViewModel = promViewModel,
|
||||
)
|
||||
}
|
||||
composable("homepage") { HomePage(navController = navController, promViewModel = promViewModel) }
|
||||
composable("homepage") {
|
||||
HomePage(
|
||||
navController = navController,
|
||||
promViewModel = promViewModel
|
||||
)
|
||||
}
|
||||
composable("license") { LicensePage(navController = navController)}
|
||||
}
|
||||
}}
|
||||
|
||||
// private fun initialize (){
|
||||
// metricsEngine = MetricsEngine(this.applicationContext)
|
||||
// customExporter = AndroidCustomExporter(metricsEngine).register(collectorRegistry)
|
||||
// }
|
||||
//
|
||||
// private suspend fun reallyCollectMetrics() : String {
|
||||
// delay(500)
|
||||
// val writer = StringWriter()
|
||||
// TextFormat.write004(writer, collectorRegistry.metricFamilySamples())
|
||||
// return writer.toString()
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import java.io.StringWriter
|
||||
|
||||
enum class ConfigFileState {
|
||||
LOADING,
|
||||
ERROR, // file not found or was not parsed
|
||||
MISSING,
|
||||
SUCCESS
|
||||
}
|
||||
|
||||
data class PromUiState(
|
||||
val tabIndex : Int = 0,
|
||||
val serverTurnedOn : Boolean = false,
|
||||
@@ -18,6 +25,7 @@ data class PromUiState(
|
||||
val serverPort : Int? = null, // if null, use default port
|
||||
val fqdn : String = "",
|
||||
val pushProxURL : String = "",
|
||||
val configFileState : ConfigFileState = ConfigFileState.LOADING,
|
||||
)
|
||||
|
||||
private val TAG : String = "PROMVIEWMODEL"
|
||||
|
||||
Reference in New Issue
Block a user