This commit is contained in:
Martin Ptáček
2023-05-29 20:57:19 +02:00
parent dad40bc4d9
commit 0f92e96758
7 changed files with 36 additions and 22 deletions

View File

@@ -76,6 +76,10 @@ dependencies {
// custom - work manager // custom - work manager
implementation 'androidx.work:work-runtime-ktx:2.7.1' 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.core:core-ktx:1.10.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'

View File

@@ -14,7 +14,7 @@
android:theme="@style/Theme.PrometheusAndroidExporter" android:theme="@style/Theme.PrometheusAndroidExporter"
tools:targetApi="31"> tools:targetApi="31">
<activity <activity
android:name=".MainActivity" android:name=".compose.MainActivity"
android:exported="true" android:exported="true"
android:theme="@style/Theme.PrometheusAndroidExporter"> android:theme="@style/Theme.PrometheusAndroidExporter">
<intent-filter> <intent-filter>

View File

@@ -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.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
@@ -14,7 +14,6 @@ import androidx.compose.material.Button
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.IconButton import androidx.compose.material.IconButton
import androidx.compose.material.ProgressIndicatorDefaults
import androidx.compose.material.Switch import androidx.compose.material.Switch
import androidx.compose.material.Tab import androidx.compose.material.Tab
import androidx.compose.material.TabRow import androidx.compose.material.TabRow
@@ -68,11 +67,25 @@ fun HomePage(
) )
// depending on whether the configuration file is present // depending on whether the configuration file is present
when(uiState.configFileState){ // when(uiState.configFileState){
ConfigFileState.ERROR -> ConfigFileErrorPage(promViewModel = promViewModel) // ConfigFileState.ERROR -> ConfigFileErrorPage(promViewModel = promViewModel)
ConfigFileState.SUCCESS -> ConfigFileSuccessPage(promViewModel = promViewModel) // ConfigFileState.SUCCESS -> ConfigFileSuccessPage(promViewModel = promViewModel)
ConfigFileState.LOADING -> LoadingPage() // ConfigFileState.LOADING -> LoadingPage()
ConfigFileState.MISSING -> TabPage(promViewModel, navController) // 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(){ private fun LoadingPage(){
Column ( Column (
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxHeight()
) { ) {
Spacer(modifier = Modifier.height(50.dp)) Spacer(modifier = Modifier.height(50.dp))
Text(text = "Checking for configuration file") Text(text = "Checking for configuration file")

View 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 android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
@@ -61,7 +61,7 @@ class MainActivity : ComponentActivity() {
promViewModel = promViewModel promViewModel = promViewModel
) )
} }
composable("license") { LicensePage(navController = navController)} composable("license") { LicensePage(navController = navController) }
} }
} }
} }

View File

@@ -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.content.Context
import android.util.Log import android.util.Log

View File

@@ -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.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding 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.Icons
import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
private val TAG = "SETTINGS_PAGE" private val TAG = "SETTINGS_PAGE"

View File

@@ -19,10 +19,12 @@ pushprox:
# Settings specific to backfilling metrics using prometheus remote write # Settings specific to backfilling metrics using prometheus remote write
# #
# Please note that remote_write may be limited by a receiving backend on # 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: remote_write:
scrape_interval: # default is 30 seconds # scrape interval in seconds
scrape_interval: 30 # default
enabled: false # default enabled: false # default
remote_write_endpoint: # default # where to post metrics
remote_write_endpoint: # string, no default value provided