mirror of
https://github.com/mii443/prometheus-android-exporter.git
synced 2025-12-03 11:08:21 +00:00
refactor
This commit is contained in:
@@ -76,6 +76,10 @@ dependencies {
|
||||
// custom - work manager
|
||||
implementation 'androidx.work:work-runtime-ktx:2.7.1'
|
||||
|
||||
// custom - yaml configuration parsing
|
||||
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.1")
|
||||
|
||||
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.10.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
android:theme="@style/Theme.PrometheusAndroidExporter"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".compose.MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.PrometheusAndroidExporter">
|
||||
<intent-filter>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.compose
|
||||
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.material.Button
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.ProgressIndicatorDefaults
|
||||
import androidx.compose.material.Switch
|
||||
import androidx.compose.material.Tab
|
||||
import androidx.compose.material.TabRow
|
||||
@@ -68,11 +67,25 @@ fun HomePage(
|
||||
)
|
||||
|
||||
// depending on whether the configuration file is present
|
||||
when(uiState.configFileState){
|
||||
ConfigFileState.ERROR -> ConfigFileErrorPage(promViewModel = promViewModel)
|
||||
ConfigFileState.SUCCESS -> ConfigFileSuccessPage(promViewModel = promViewModel)
|
||||
ConfigFileState.LOADING -> LoadingPage()
|
||||
ConfigFileState.MISSING -> TabPage(promViewModel, navController)
|
||||
// when(uiState.configFileState){
|
||||
// ConfigFileState.ERROR -> ConfigFileErrorPage(promViewModel = promViewModel)
|
||||
// ConfigFileState.SUCCESS -> ConfigFileSuccessPage(promViewModel = promViewModel)
|
||||
// ConfigFileState.LOADING -> LoadingPage()
|
||||
// ConfigFileState.MISSING -> TabPage(promViewModel, navController)
|
||||
// }
|
||||
Column(
|
||||
modifier = Modifier.fillMaxHeight().weight(1f)
|
||||
) {
|
||||
Text("something")
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = { print("TODO") },
|
||||
modifier = Modifier
|
||||
.height(40.dp)
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
Text(text = "Start")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +279,7 @@ private fun RemoteWritePage(
|
||||
private fun LoadingPage(){
|
||||
Column (
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
modifier = Modifier.fillMaxHeight()
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(50.dp))
|
||||
Text(text = "Checking for configuration file")
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.compose
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
@@ -61,7 +61,7 @@ class MainActivity : ComponentActivity() {
|
||||
promViewModel = promViewModel
|
||||
)
|
||||
}
|
||||
composable("license") { LicensePage(navController = navController)}
|
||||
composable("license") { LicensePage(navController = navController) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.compose
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter
|
||||
package com.birdthedeveloper.prometheus.android.prometheus.android.exporter.compose
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@@ -15,12 +13,9 @@ import androidx.compose.material.TopAppBar
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavHostController
|
||||
|
||||
private val TAG = "SETTINGS_PAGE"
|
||||
@@ -19,10 +19,12 @@ pushprox:
|
||||
# Settings specific to backfilling metrics using prometheus remote write
|
||||
#
|
||||
# Please note that remote_write may be limited by a receiving backend on
|
||||
# how old the backfilled metrics can be.
|
||||
# how old the backfilled time series can be.
|
||||
remote_write:
|
||||
|
||||
scrape_interval: # default is 30 seconds
|
||||
# scrape interval in seconds
|
||||
scrape_interval: 30 # default
|
||||
enabled: false # default
|
||||
|
||||
remote_write_endpoint: # default
|
||||
# where to post metrics
|
||||
remote_write_endpoint: # string, no default value provided
|
||||
|
||||
Reference in New Issue
Block a user