Apache Solr open-source search software
SOLR-17672: Enable spotless for Kotlin files (#3450)
Christos Malliaridiscc887f5d6cc4
diff --git a/.editorconfig b/.editorconfigindex c4f902eacfb..e127b9a9e5d 100644--- a/.editorconfig+++ b/.editorconfig@@ -348,6 +348,20 @@ ij_java_wrap_first_method_in_call_chain = falseij_java_wrap_long_lines = trueij_java_wrap_semicolon_after_call_chain = false+[{*.kt,*.kts}]+indent_size = 4+ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL++# Disable wildcard imports entirely+ij_kotlin_name_count_to_use_star_import = 2147483647+ij_kotlin_name_count_to_use_star_import_for_members = 2147483647+ij_kotlin_packages_to_use_import_on_demand = unset++ktlint_code_style = intellij_idea+ktlint_function_naming_ignore_when_annotated_with = Composable+compose_allowed_composition_locals = LocalExtendedColorScheme, LocalExtendedTypography+ij_kotlin_imports_layout=*,^+[*.adoc]indent_size = 4ij_asciidoc_blank_lines_after_header = 1diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 77ac6f38bb1..8f37037ec0e 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -77,7 +77,7 @@ compose = "1.8.2"cutterslade-analyze = "1.10.0"cybozulabs-langdetect = "1.1-20120112"decompose = "3.3.0"-diffplug-spotless = "6.5.2"+diffplug-spotless = "7.2.1"dropwizard-metrics = "4.2.26"eclipse-ecj = "3.39.0"eclipse-jetty = "12.0.19"@@ -150,6 +150,8 @@ kotlinx-browser = "0.3"kotlinx-coroutines = "1.10.1"kotlinx-datetime = "0.7.1"kotlinx-serialization = "1.9.0"+# @keep used by spotless+ktlint = "1.7.1"ktor = "3.2.2"langchain4j = "0.35.0"# @keep Link checker version used in ref-guide@@ -165,6 +167,7 @@ netty = "4.1.114.Final"# @keep for version alignmentnetty-tcnative = "2.0.66.Final"nimbusds-josejwt = "9.48"+nlopez-compose = "0.4.26"nodegradle-node = "7.0.1"# @keep Node JS version used in node.gradle (LTS)nodejs = "16.20.2"@@ -469,6 +472,7 @@ netty-transport-classes-epoll = { module = "io.netty:netty-transport-classes-epo# @keep transitive dependency for version alignmentnetty-transport-native-epoll = { module = "io.netty:netty-transport-native-epoll", version.ref = "netty" }nimbusds-josejwt = { module = "com.nimbusds:nimbus-jose-jwt", version.ref = "nimbusds-josejwt" }+nlopez-compose-ktlintrules = { module = "io.nlopez.compose.rules:ktlint", version.ref = "nlopez-compose" }openjdk-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "openjdk-jmh" }openjdk-jmh-generatorannprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "openjdk-jmh" }opentelemetry-api = { module = "io.opentelemetry:opentelemetry-api", version.ref = "opentelemetry" }diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradleindex 52b95c410cc..a081eb10304 100644--- a/gradle/validation/spotless.gradle+++ b/gradle/validation/spotless.gradle@@ -87,6 +87,21 @@ configure(allprojects) { prj ->}}+ // Configure spotless for kotlin sources+ plugins.withId("org.jetbrains.kotlin.multiplatform") {+ prj.apply plugin: libs.plugins.diffplug.spotless.get().pluginId++ spotless {+ kotlin {+ // Apply to all Kotlin and Kotlin DSL files+ target "**/*.kt", "**/*.kts"++ ktlint(libs.versions.ktlint.get())+ .customRuleSets([libs.nlopez.compose.ktlintrules.get().toString()])+ }+ }+ }+// Emit a custom message about how to fix formatting errors.tasks.matching { task -> task.name == "spotlessJavaCheck" }.configureEach {it.runToFixMessage.set("\nIMPORTANT: run the top-level './gradlew tidy' to format code automatically (see help/formatting.txt for more info).")diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/auth/store/BasicAuthStoreProvider.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/auth/store/BasicAuthStoreProvider.ktindex d61f23c359e..511f998e897 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/auth/store/BasicAuthStoreProvider.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/auth/store/BasicAuthStoreProvider.kt@@ -22,6 +22,7 @@ import com.arkivanov.mvikotlin.core.store.SimpleBootstrapperimport com.arkivanov.mvikotlin.core.store.Storeimport com.arkivanov.mvikotlin.core.store.StoreFactoryimport com.arkivanov.mvikotlin.extensions.coroutines.CoroutineExecutor+import kotlin.coroutines.CoroutineContextimport kotlinx.coroutines.CoroutineExceptionHandlerimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContext@@ -31,8 +32,7 @@ import org.apache.solr.ui.components.auth.store.BasicAuthStore.Stateimport org.apache.solr.ui.domain.AuthMethodimport org.apache.solr.ui.errors.InvalidCredentialsExceptionimport org.apache.solr.ui.errors.UnauthorizedException-import org.apache.solr.ui.errors.parseError-import kotlin.coroutines.CoroutineContext+import org.apache.solr.ui.utils.parseErrorclass BasicAuthStoreProvider(private val storeFactory: StoreFactory,diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/EnvironmentComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/EnvironmentComponent.ktindex 99d6ee0183d..1942b746b1f 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/EnvironmentComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/EnvironmentComponent.kt@@ -37,4 +37,4 @@ interface EnvironmentComponent {val jvm: JvmData = JvmData(),val javaProperties: List<JavaProperty> = emptyList(),)-}\ No newline at end of file+}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/JvmMemoryRaw.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/JvmMemoryRaw.ktindex d739e1bafb9..f0721546e09 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/JvmMemoryRaw.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/JvmMemoryRaw.kt@@ -28,4 +28,4 @@ data class JvmMemoryRaw(val used: Int = 0,@SerialName("used%")val usedPercentage: Double = 0.0,-)\ No newline at end of file+)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SecurityConfig.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SecurityConfig.ktindex 00871a8f080..57e7055bb41 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SecurityConfig.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SecurityConfig.kt@@ -22,4 +22,4 @@ import kotlinx.serialization.Serializable@Serializabledata class SecurityConfig(val tls: Boolean = false,-)\ No newline at end of file+)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemInformation.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemInformation.ktindex 905c750719d..0a209be732f 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemInformation.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemInformation.kt@@ -39,4 +39,4 @@ data class SystemInformation(val totalSwapSpaceSize: Long = 0,val maxFileDescriptorCount: Long = 0,val openFileDescriptorCount: Long = 0,-)\ No newline at end of file+)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemMode.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemMode.ktindex aa854e95da7..5605347efad 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemMode.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/data/SystemMode.kt@@ -23,8 +23,10 @@ import kotlinx.serialization.Serializable@Serializableenum class SystemMode {Unknown,+@SerialName("solrcloud")SolrCloud,+@SerialName("std")Standalone,}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/DefaultEnvironmentComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/DefaultEnvironmentComponent.ktindex 5b9c5551950..0be5982d4b2 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/DefaultEnvironmentComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/DefaultEnvironmentComponent.kt@@ -36,7 +36,8 @@ class DefaultEnvironmentComponent(componentContext: AppComponentContext,storeFactory: StoreFactory,httpClient: HttpClient,-) : EnvironmentComponent, AppComponentContext by componentContext {+) : EnvironmentComponent,+ AppComponentContext by componentContext {private val mainScope = coroutineScope(SupervisorJob() + mainContext)private val ioScope = coroutineScope(SupervisorJob() + ioContext)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/HttpEnvironmentStoreClient.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/HttpEnvironmentStoreClient.ktindex 1673c48c8ff..063fbf81ce0 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/HttpEnvironmentStoreClient.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/integration/HttpEnvironmentStoreClient.kt@@ -54,7 +54,6 @@ class HttpEnvironmentStoreClient(return when {response.status.isSuccess() -> {-// Map the response data to a list of JavaProperty for better readabilityval javaProperties = response.body<JavaPropertiesResponse>().propertiesdiff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStore.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStore.ktindex 4c6ae252d6b..7f8c87da0c1 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStore.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStore.kt@@ -42,7 +42,7 @@ internal interface EnvironmentStore : Store<Intent, State, Nothing> {/*** Intent for requesting system data.*/- data object FetchSystemData: Intent+ data object FetchSystemData : Intent}/**diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProvider.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProvider.ktindex 699e98b9c3c..1f62238020f 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProvider.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProvider.kt@@ -79,8 +79,7 @@ internal class EnvironmentStoreProvider(data class JavaPropertiesUpdated(val properties: List<JavaProperty>) : Message}- private inner class ExecutorImpl :- CoroutineExecutor<Intent, Action, State, Message, Nothing>(mainContext) {+ private inner class ExecutorImpl : CoroutineExecutor<Intent, Action, State, Message, Nothing>(mainContext) {override fun executeAction(action: Action) = when (action) {Action.FetchInitialSystemData -> {@@ -104,7 +103,8 @@ internal class EnvironmentStoreProvider(* If successful, a [Message.SystemDataUpdated] with the new properties is dispatched.*/private fun fetchSystemData() {- scope.launch { // TODO Add coroutine exception handler+ scope.launch {+ // TODO Add coroutine exception handlerwithContext(ioContext) {client.getSystemData()}.onSuccess {@@ -120,7 +120,8 @@ internal class EnvironmentStoreProvider(* If successful, a [Message.JavaPropertiesUpdated] with the new properties is dispatched.*/private fun fetchJavaProperties() {- scope.launch { // TODO Add coroutine exception handler+ scope.launch {+ // TODO Add coroutine exception handlerwithContext(ioContext) {client.getJavaProperties()}.onSuccess {diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/logging/integration/DefaultLoggingComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/logging/integration/DefaultLoggingComponent.ktindex 3e7f381f8a2..cb86c9623a6 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/logging/integration/DefaultLoggingComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/logging/integration/DefaultLoggingComponent.kt@@ -24,4 +24,5 @@ import org.apache.solr.ui.utils.AppComponentContextclass DefaultLoggingComponent(componentContext: AppComponentContext,storeFactory: StoreFactory,-) : LoggingComponent, AppComponentContext by componentContext+) : LoggingComponent,+ AppComponentContext by componentContextdiff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/main/integration/DefaultMainComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/main/integration/DefaultMainComponent.ktindex cc0e7baf7b5..eb0dd42c549 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/main/integration/DefaultMainComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/main/integration/DefaultMainComponent.kt@@ -42,7 +42,8 @@ class DefaultMainComponent internal constructor(private val environmentComponent: (AppComponentContext) -> EnvironmentComponent,private val loggingComponent: (AppComponentContext) -> LoggingComponent,private val output: (Output) -> Unit,-) : MainComponent, AppComponentContext by componentContext {+) : MainComponent,+ AppComponentContext by componentContext {private val navigation = StackNavigation<Configuration>()private val stack = childStack(@@ -80,8 +81,7 @@ class DefaultMainComponent internal constructor(},)- override fun onNavigate(menuItem: MainMenu) =- navigation.bringToFront(menuItem.toConfiguration())+ override fun onNavigate(menuItem: MainMenu) = navigation.bringToFront(menuItem.toConfiguration())override fun onNavigateBack() {TODO("Not yet implemented")@@ -194,7 +194,7 @@ class DefaultMainComponent internal constructor(data object ThreadDump : Configuration}- private fun MainMenu.toConfiguration(): Configuration = when(this) {+ private fun MainMenu.toConfiguration(): Configuration = when (this) {MainMenu.Dashboard -> Configuration.DashboardMainMenu.Metrics -> Configuration.MetricsMainMenu.Cluster -> Configuration.Clusterdiff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/root/RootComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/root/RootComponent.ktindex f1db9652c17..be742610ad8 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/root/RootComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/root/RootComponent.kt@@ -35,10 +35,10 @@ interface RootComponent {sealed interface Child {- data class Start(val component: StartComponent): Child+ data class Start(val component: StartComponent) : Child- data class Main(val component: MainComponent): Child+ data class Main(val component: MainComponent) : Child- data class Authentication(val component: AuthenticationComponent): Child+ data class Authentication(val component: AuthenticationComponent) : Child}}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponent.ktindex 2b2e1b80def..f90b955afad 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponent.kt@@ -39,7 +39,8 @@ class DefaultStartComponent(storeFactory: StoreFactory,httpClient: HttpClient,output: (StartComponent.Output) -> Unit,-) : StartComponent, AppComponentContext by componentContext {+) : StartComponent,+ AppComponentContext by componentContext {private val mainScope = coroutineScope(SupervisorJob() + mainContext)private val ioScope = coroutineScope(SupervisorJob() + ioContext)@@ -63,7 +64,7 @@ class DefaultStartComponent(StartComponent.Output.OnAuthRequired(url = label.url,methods = label.methods,- )+ ),)is StartStore.Label.Connected ->output(StartComponent.Output.OnConnected(url = label.url))diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStore.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStore.ktindex 2753b63f9d8..b1d39632ade 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStore.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStore.kt@@ -39,12 +39,12 @@ internal interface StartStore : Store<Intent, State, Label> {/*** Intent for updating the current Solr URL.*/- data class UpdateSolrUrl(val url: String): Intent+ data class UpdateSolrUrl(val url: String) : Intent/*** Intent for initiating a new connection to a Solr instance.*/- data object Connect: Intent+ data object Connect : Intent}sealed interface Label {@@ -55,7 +55,7 @@ internal interface StartStore : Store<Intent, State, Label> {** @property url URL of the Solr instance.*/- data class Connected(val url: Url): Label+ data class Connected(val url: Url) : Label/*** Label that is published when a Solr server was found, but authentication is required.@@ -63,7 +63,7 @@ internal interface StartStore : Store<Intent, State, Label> {* @property url URL of the Solr instance that requires authentication.* @property methods The supported authentication methods.*/- data class AuthRequired(val url: Url, val methods: List<AuthMethod>): Label+ data class AuthRequired(val url: Url, val methods: List<AuthMethod>) : Label}/**diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStoreProvider.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStoreProvider.ktindex d03bdeceafc..74709cdfa21 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStoreProvider.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/components/start/store/StartStoreProvider.kt@@ -27,16 +27,14 @@ import io.ktor.http.Urlimport io.ktor.http.parseUrlimport kotlin.coroutines.CoroutineContextimport kotlinx.coroutines.CoroutineExceptionHandler-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.SupervisorJobimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport org.apache.solr.ui.components.start.store.StartStore.Intentimport org.apache.solr.ui.components.start.store.StartStore.Labelimport org.apache.solr.ui.components.start.store.StartStore.Stateimport org.apache.solr.ui.errors.UnauthorizedException-import org.apache.solr.ui.errors.parseErrorimport org.apache.solr.ui.utils.DEFAULT_SOLR_URL+import org.apache.solr.ui.utils.parseError/*** Store provider that [provide]s instances of [StartStore].@@ -93,10 +91,12 @@ internal class StartStoreProvider(cause = Error("Invalid URL"),)- scope.launch(context = CoroutineExceptionHandler { _, throwable ->- // error returned here is platform-specific and needs further parsing- dispatch(Message.ConnectionFailed(error = parseError(throwable)))- }) {+ scope.launch(+ context = CoroutineExceptionHandler { _, throwable ->+ // error returned here is platform-specific and needs further parsing+ dispatch(Message.ConnectionFailed(error = parseError(throwable)))+ },+ ) {withContext(ioContext) {client.connect(url)}.onSuccess {@@ -133,7 +133,7 @@ internal class StartStoreProvider(Label.AuthRequired(url = url,methods = error.methods,- )+ ),)}}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/HostNotFoundException.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/HostNotFoundException.ktindex b1730edd14a..d19950503e9 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/HostNotFoundException.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/HostNotFoundException.kt@@ -22,4 +22,4 @@ package org.apache.solr.ui.errors** @property cause The root cause that caused this exception.*/-class HostNotFoundException(cause: Throwable? = null): Throwable(cause)+class HostNotFoundException(cause: Throwable? = null) : Throwable(cause)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsError.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsException.ktsimilarity index 100%rename from solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsError.ktrename to solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsException.ktdiff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnauthorizedException.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnauthorizedException.ktindex 2fe95269773..b5fe970625d 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnauthorizedException.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnauthorizedException.kt@@ -33,4 +33,4 @@ class UnauthorizedException(val url: Url? = null,val methods: List<AuthMethod> = emptyList(),message: String? = null,-): Exception(message)+) : Exception(message)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnknownResponseException.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnknownResponseException.ktindex c86adc1c097..d08e1eae15e 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnknownResponseException.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/UnknownResponseException.kt@@ -26,4 +26,4 @@ import io.ktor.client.statement.HttpResponse** @property response The response that could not be handled.*/-class UnknownResponseException(val response: HttpResponse): Exception()+class UnknownResponseException(val response: HttpResponse) : Exception()diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/AppComponentContext.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/AppComponentContext.ktindex e477ab745c7..3403a82dd00 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/AppComponentContext.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/AppComponentContext.kt@@ -23,4 +23,6 @@ import com.arkivanov.decompose.GenericComponentContext* The application component context that provides basic functionality to all components, including* a lifecycle, state preservation, navigation handling and coroutine contexts.*/-interface AppComponentContext : GenericComponentContext<AppComponentContext>, CoroutineContextOwner+interface AppComponentContext :+ GenericComponentContext<AppComponentContext>,+ CoroutineContextOwnerdiff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/CoroutineScopeExt.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/CoroutineScopeExt.ktindex ed9f8d1a15a..9296fe90d7b 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/CoroutineScopeExt.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/CoroutineScopeExt.kt@@ -20,13 +20,13 @@ package org.apache.solr.ui.utilsimport com.arkivanov.essenty.lifecycle.Lifecycleimport com.arkivanov.essenty.lifecycle.LifecycleOwnerimport com.arkivanov.essenty.lifecycle.doOnDestroy+import kotlin.coroutines.CoroutineContextimport kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.cancelimport kotlinx.coroutines.flow.SharingStartedimport kotlinx.coroutines.flow.StateFlowimport kotlinx.coroutines.flow.mapimport kotlinx.coroutines.flow.stateIn-import kotlin.coroutines.CoroutineContext/*** Function for creating a coroutine scope for a [lifecycle] that cancels automatically@@ -51,9 +51,7 @@ fun CoroutineScope(context: CoroutineContext, lifecycle: Lifecycle): CoroutineSc** @return Returns a lifecycle-aware coroutine scope.*/-fun LifecycleOwner.coroutineScope(context: CoroutineContext): CoroutineScope =- CoroutineScope(context, lifecycle)-+fun LifecycleOwner.coroutineScope(context: CoroutineContext): CoroutineScope = CoroutineScope(context, lifecycle)/*** StateFlow mapping function that maps one stateflow to another stateflow applying@@ -65,10 +63,10 @@ fun LifecycleOwner.coroutineScope(context: CoroutineContext): CoroutineScope =* @param M the mapped / resulting state*/fun <T, M> StateFlow<T>.map(- coroutineScope : CoroutineScope,- mapper : (value : T) -> M-) : StateFlow<M> = map { mapper(it) }.stateIn(+ coroutineScope: CoroutineScope,+ mapper: (value: T) -> M,+): StateFlow<M> = map { mapper(it) }.stateIn(coroutineScope,SharingStarted.Eagerly,- mapper(value)+ mapper(value),)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/parseError.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.ktsimilarity index 96%rename from solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/parseError.ktrename to solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.ktindex f3af77cd4df..0c86ee4fd77 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/parseError.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.kt@@ -15,7 +15,7 @@* limitations under the License.*/-package org.apache.solr.ui.errors+package org.apache.solr.ui.utils/*** Parsing function for mapping platform-specific errors.diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/HttpClientUtils.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/HttpClientUtils.ktindex 8bae61996e3..e8b409a9138 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/HttpClientUtils.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/HttpClientUtils.kt@@ -46,7 +46,7 @@ fun getDefaultClient(Json {ignoreUnknownKeys = trueallowSpecialFloatingPointValues = true- }+ },)}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrButton.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrButton.ktindex f1c036a61d2..4b49e806d2f 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrButton.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrButton.kt@@ -41,7 +41,7 @@ fun SolrButton(border: BorderStroke? = null,contentPadding: PaddingValues = ButtonDefaults.ContentPadding,interactionSource: MutableInteractionSource? = null,- content: @Composable RowScope.() -> Unit+ content: @Composable RowScope.() -> Unit,) = Button(onClick = onClick,modifier = modifier,diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrTextButton.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrTextButton.ktindex 4725132bb30..03165af56ce 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrTextButton.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/components/SolrTextButton.kt@@ -41,7 +41,7 @@ fun SolrTextButton(border: BorderStroke? = null,contentPadding: PaddingValues = ButtonDefaults.TextButtonContentPadding,interactionSource: MutableInteractionSource? = null,- content: @Composable RowScope.() -> Unit+ content: @Composable RowScope.() -> Unit,) = TextButton(onClick = onClick,modifier = modifier,diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/CommandLineArgumentsCard.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/CommandLineArgumentsCard.ktindex 2e02e38b694..870d882fafb 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/CommandLineArgumentsCard.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/CommandLineArgumentsCard.kt@@ -41,11 +41,11 @@ import org.apache.solr.ui.views.theme.SolrTheme*/@Composableinternal fun CommandLineArgumentsCard(- modifier: Modifier = Modifier,arguments: List<String>,+ modifier: Modifier = Modifier,) = SolrCard(modifier = modifier,- verticalArrangement = Arrangement.spacedBy(16.dp)+ verticalArrangement = Arrangement.spacedBy(16.dp),) {Text(text = "Command Line Arguments",@@ -54,15 +54,15 @@ internal fun CommandLineArgumentsCard()Column(modifier = Modifier.fillMaxWidth()- .border(BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant))+ .border(BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant)),) {arguments.forEachIndexed { index, argument ->Text(modifier = Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.surfaceColorAtElevation(- if(index % 2 == 0) 1.dp else 0.dp,- )+ if (index % 2 == 0) 1.dp else 0.dp,+ ),).padding(horizontal = 8.dp, vertical = 4.dp),text = argument,style = SolrTheme.typography.codeLarge,diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/JavaPropertiesCard.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/JavaPropertiesCard.ktindex a6de782cd73..243f582e6bf 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/JavaPropertiesCard.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/JavaPropertiesCard.kt@@ -47,7 +47,7 @@ internal fun JavaPropertiesCard(modifier: Modifier = Modifier,) = SolrCard(modifier = modifier,- verticalArrangement = Arrangement.spacedBy(16.dp)+ verticalArrangement = Arrangement.spacedBy(16.dp),) {Text(text = "Java Properties",@@ -56,7 +56,7 @@ internal fun JavaPropertiesCard()Column(modifier = Modifier.fillMaxWidth()- .border(BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant))+ .border(BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant)),) {properties.forEachIndexed { index, property ->JavaPropertyEntry(@@ -84,7 +84,7 @@ private fun JavaPropertyEntry(modifier = modifier.background(MaterialTheme.colorScheme.surfaceColorAtElevation(if (isOdd) 1.dp else 0.dp,- )+ ),).padding(horizontal = 8.dp, vertical = 4.dp),) {Text(diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/VersionsCard.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/VersionsCard.ktindex cec7a52dcc0..7d4f795988b 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/VersionsCard.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/environment/VersionsCard.kt@@ -45,7 +45,7 @@ internal fun VersionsCard(modifier: Modifier = Modifier,) = SolrCard(modifier = modifier,- verticalArrangement = Arrangement.spacedBy(16.dp)+ verticalArrangement = Arrangement.spacedBy(16.dp),) {Text(text = "Versions",diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/icons/SolrLogo.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/icons/SolrLogo.ktindex a2a540d0e46..62aff93233a 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/icons/SolrLogo.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/icons/SolrLogo.kt@@ -41,8 +41,11 @@ fun SolrLogo() = Image(modifier = modifier,painter = painterResource(- if (useDarkTheme) Res.drawable.solr_logo_dark- else Res.drawable.solr_logo_light+ if (useDarkTheme) {+ Res.drawable.solr_logo_dark+ } else {+ Res.drawable.solr_logo_light+ },),- contentDescription = stringResource(Res.string.cd_solr_logo)+ contentDescription = stringResource(Res.string.cd_solr_logo),)diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/main/MainContent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/main/MainContent.ktindex aaaee7e315c..a905700d2b6 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/main/MainContent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/main/MainContent.kt@@ -62,7 +62,7 @@ fun MainContent(stack = component.childStack,modifier = Modifier.weight(1f),) {- when(val child = it.instance) {+ when (val child = it.instance) {is MainComponent.Child.Environment -> EnvironmentContent(component = child.component,modifier = Modifier.fillMaxWidth()diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/Footer.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/Footer.ktindex 5d903d76a84..3453f76b9fe 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/Footer.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/Footer.kt@@ -26,8 +26,6 @@ import androidx.compose.foundation.layout.FlowRowimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.padding-import androidx.compose.ui.platform.LocalUriHandler-import androidx.compose.ui.platform.UriHandlerimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.automirrored.rounded.MenuBookimport androidx.compose.material.icons.rounded.BugReport@@ -46,6 +44,8 @@ import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.platform.LocalUriHandler+import androidx.compose.ui.platform.UriHandlerimport androidx.compose.ui.unit.Dpimport androidx.compose.ui.unit.dpimport org.apache.solr.ui.generated.resources.Res@@ -73,7 +73,6 @@ fun Footer(HorizontalDivider()BoxWithConstraints {-val showIconsOnly = maxWidth < collapseWidthFlowRow(@@ -85,42 +84,42 @@ fun Footer(imageVector = Icons.AutoMirrored.Rounded.MenuBook,stringRes = Res.string.documentation,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://solr.apache.org/guide/solr/latest/index.html") }+ onClick = { uriHandler.openUri("https://solr.apache.org/guide/solr/latest/index.html") },)FooterAction(imageVector = Icons.Rounded.Code,stringRes = Res.string.solr_query_syntax,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://solr.apache.org/guide/solr/latest/query-guide/query-syntax-and-parsers.html") }+ onClick = { uriHandler.openUri("https://solr.apache.org/guide/solr/latest/query-guide/query-syntax-and-parsers.html") },)FooterAction(imageVector = Icons.Rounded.BugReport,stringRes = Res.string.issue_tracker,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://issues.apache.org/jira/projects/SOLR") }+ onClick = { uriHandler.openUri("https://issues.apache.org/jira/projects/SOLR") },)FooterAction(imageVector = Icons.Rounded.Groups,stringRes = Res.string.community,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://solr.apache.org/community.html") }+ onClick = { uriHandler.openUri("https://solr.apache.org/community.html") },)FooterAction(imageVector = Icons.Rounded.ImageNotSupported, // TODO Add Slack LogostringRes = Res.string.slack,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://the-asf.slack.com/messages/CEKUCUNE9") }+ onClick = { uriHandler.openUri("https://the-asf.slack.com/messages/CEKUCUNE9") },)FooterAction(imageVector = Icons.Rounded.Support,stringRes = Res.string.support,iconOnly = showIconsOnly,- onClick = { uriHandler.openUri("https://solr.apache.org/community.html#support") }+ onClick = { uriHandler.openUri("https://solr.apache.org/community.html#support") },)}}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/NavigationSideBar.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/NavigationSideBar.ktindex 449d55e849c..e0de0b4d55d 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/NavigationSideBar.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/navigation/NavigationSideBar.kt@@ -70,15 +70,15 @@ import org.jetbrains.compose.resources.stringResource** @param onNavigate Navigation handler function.* @param onLogout Logout handler function.- * @param selectedItem The currently selected navigation item.* @param modifier Modifier to apply to the root composable.+ * @param selectedItem The currently selected navigation item.*/@Composablefun NavigationSideBar(onNavigate: (MainMenu) -> Unit,onLogout: () -> Unit,- selectedItem: MainMenu? = null,modifier: Modifier = Modifier,+ selectedItem: MainMenu? = null,) = Row(modifier = modifier) {val scrollState = rememberScrollState(48 * (selectedItem?.ordinal ?: 0))@@ -121,13 +121,16 @@ private fun MenuElement(modifier: Modifier = Modifier,selected: Boolean = false,enabled: Boolean = true,- onClick: () -> Unit,+ onClick: () -> Unit = {},) {val alpha = if (enabled) 1f else 0.38fTab(modifier = modifier.background(- if (selected) MaterialTheme.colorScheme.primaryContainer.copy(alpha = alpha)- else Color.Unspecified,+ if (selected) {+ MaterialTheme.colorScheme.primaryContainer.copy(alpha = alpha)+ } else {+ Color.Unspecified+ },),selected = selected,enabled = enabled,diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/root/RootContent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/root/RootContent.ktindex 2d7b4b751cd..e75960b36b0 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/root/RootContent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/root/RootContent.kt@@ -41,12 +41,11 @@ fun RootContent(modifier: Modifier = Modifier,) {Column(modifier = modifier.fillMaxSize()) {-Children(stack = component.childStack,modifier = Modifier.weight(1f),) {- when(val child = it.instance) {+ when (val child = it.instance) {is RootComponent.Child.Start -> StartContent(component = child.component,modifier = Modifier.fillMaxSize(),diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/start/StartContent.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/start/StartContent.ktindex cd624d37a68..ad08effaa21 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/start/StartContent.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/start/StartContent.kt@@ -39,8 +39,8 @@ import androidx.compose.ui.unit.dpimport org.apache.solr.ui.components.start.StartComponentimport org.apache.solr.ui.generated.resources.Resimport org.apache.solr.ui.generated.resources.action_connect-import org.apache.solr.ui.generated.resources.connectingimport org.apache.solr.ui.generated.resources.cd_solr_logo+import org.apache.solr.ui.generated.resources.connectingimport org.apache.solr.ui.generated.resources.desc_to_get_startedimport org.apache.solr.ui.generated.resources.solr_sunimport org.apache.solr.ui.generated.resources.title_welcome_to_solr@@ -75,7 +75,7 @@ fun StartContent(.scale(1.5f),alpha = .3f,painter = painterResource(Res.drawable.solr_sun),- contentDescription = stringResource(Res.string.cd_solr_logo)+ contentDescription = stringResource(Res.string.cd_solr_logo),)Column(@@ -111,7 +111,7 @@ fun StartContent(color = MaterialTheme.colorScheme.error,)}- }+ },// TODO Update colors if necessary)@@ -123,14 +123,19 @@ fun StartContent() {Text(text = stringResource(- if (model.isConnecting) Res.string.connecting- else Res.string.action_connect+ if (model.isConnecting) {+ Res.string.connecting+ } else {+ Res.string.action_connect+ },),)}- if (model.isConnecting) SolrLinearProgressIndicator(- modifier = Modifier.fillMaxWidth().testTag("loading_indicator"),- )+ if (model.isConnecting) {+ SolrLinearProgressIndicator(+ modifier = Modifier.fillMaxWidth().testTag("loading_indicator"),+ )+ }}}}diff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Theme.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Theme.ktindex 04c5fa9804a..bdd40de59da 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Theme.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Theme.kt@@ -49,7 +49,7 @@ object SolrTheme {@Composablefun SolrTheme(useDarkTheme: Boolean = isSystemInDarkTheme(),- content: @Composable () -> Unit+ content: @Composable () -> Unit,) {val colorScheme = when {useDarkTheme -> darkSchemediff --git a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Typography.kt b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Typography.ktindex a1bccf0127b..2f22ba77a7f 100644--- a/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Typography.kt+++ b/solr/ui/src/commonMain/kotlin/org/apache/solr/ui/views/theme/Typography.kt@@ -39,28 +39,26 @@ import androidx.compose.ui.unit.sp* Custom typography that styles headlines and titles with a different font.*/@Composable-fun SolrTypography(): Typography {- return Typography(- headlineLarge = MaterialTheme.typography.headlineLarge.copy(- fontWeight = FontWeight.Light,- fontSize = 32.sp,- lineHeight = 40.sp,- letterSpacing= 0.sp,- ),- headlineMedium = MaterialTheme.typography.headlineMedium.copy(- fontWeight = FontWeight.Light,- fontSize = 28.sp,- lineHeight = 36.sp,- letterSpacing= 0.sp,- ),- headlineSmall = MaterialTheme.typography.headlineSmall.copy(- fontWeight = FontWeight.Light,- fontSize = 24.sp,- lineHeight = 32.sp,- letterSpacing= 0.sp,- )- )-}+fun SolrTypography(): Typography = Typography(+ headlineLarge = MaterialTheme.typography.headlineLarge.copy(+ fontWeight = FontWeight.Light,+ fontSize = 32.sp,+ lineHeight = 40.sp,+ letterSpacing = 0.sp,+ ),+ headlineMedium = MaterialTheme.typography.headlineMedium.copy(+ fontWeight = FontWeight.Light,+ fontSize = 28.sp,+ lineHeight = 36.sp,+ letterSpacing = 0.sp,+ ),+ headlineSmall = MaterialTheme.typography.headlineSmall.copy(+ fontWeight = FontWeight.Light,+ fontSize = 24.sp,+ lineHeight = 32.sp,+ letterSpacing = 0.sp,+ ),+)// Customize the extended typography@Composablediff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.ktindex 795714ad0b3..50bdd0141f8 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.kt@@ -27,5 +27,5 @@ val isErrorSemantics = SemanticsMatcher(description = "Node contains error",matcher = { node ->node.config[SemanticsProperties.Error].isNotEmpty()- }+ },)diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/TestUtils.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/TestUtils.ktindex 6dbec6112d5..a157216b185 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/TestUtils.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/TestUtils.kt@@ -28,17 +28,15 @@ import kotlinx.coroutines.test.TestScope** @param handlers The handlers to attach to the mock engine that will handle the requests* in the same order.- *+ **/fun TestScope.createMockEngine(vararg handlers: MockRequestHandler,reuseHandlers: Boolean = true,-): MockEngine {- return MockEngine(- MockEngineConfig().apply {- dispatcher = StandardTestDispatcher(testScheduler)- handlers.forEach(::addHandler)- this.reuseHandlers = reuseHandlers- }- )-}+): MockEngine = MockEngine(+ MockEngineConfig().apply {+ dispatcher = StandardTestDispatcher(testScheduler)+ handlers.forEach(::addHandler)+ this.reuseHandlers = reuseHandlers+ },+)diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/auth/integration/DefaultBasicAuthComponentTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/auth/integration/DefaultBasicAuthComponentTest.ktindex 9c306cb9f70..c4b07bfacc5 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/auth/integration/DefaultBasicAuthComponentTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/auth/integration/DefaultBasicAuthComponentTest.kt@@ -29,6 +29,12 @@ import io.ktor.client.engine.mock.respondimport io.ktor.client.request.HttpRequestDataimport io.ktor.http.HttpStatusCodeimport io.ktor.utils.io.core.toByteArray+import kotlin.io.encoding.Base64+import kotlin.io.encoding.ExperimentalEncodingApi+import kotlin.test.Test+import kotlin.test.assertContains+import kotlin.test.assertEquals+import kotlin.test.assertIsimport kotlinx.coroutines.ExperimentalCoroutinesApiimport kotlinx.coroutines.test.StandardTestDispatcherimport kotlinx.coroutines.test.TestCoroutineScheduler@@ -43,12 +49,6 @@ import org.apache.solr.ui.domain.AuthMethodimport org.apache.solr.ui.errors.InvalidCredentialsExceptionimport org.apache.solr.ui.utils.AppComponentContextimport org.apache.solr.ui.utils.DefaultAppComponentContext-import kotlin.io.encoding.Base64-import kotlin.io.encoding.ExperimentalEncodingApi-import kotlin.test.Test-import kotlin.test.assertContains-import kotlin.test.assertEquals-import kotlin.test.assertIs@OptIn(ExperimentalCoroutinesApi::class)class DefaultBasicAuthComponentTest {diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProviderTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProviderTest.ktindex 688ed3a458f..690a7b4546d 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProviderTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/environment/store/EnvironmentStoreProviderTest.kt@@ -43,16 +43,16 @@ class EnvironmentStoreProviderTest {storeFactory = DefaultStoreFactory(),client = client,mainContext = coroutineContext,- ioContext = backgroundScope.coroutineContext+ ioContext = backgroundScope.coroutineContext,).provide()// Collect the state updates and wait for the expected state// If the expected state is never published, test will run into a timeoutstore.stateFlow.first { state ->state.javaProperties == expectedJavaProperties &&- state.system == expectedSystemData.system &&- state.jvm == expectedSystemData.jvm &&- state.solrHome == expectedSystemData.solrHome+ state.system == expectedSystemData.system &&+ state.jvm == expectedSystemData.jvm &&+ state.solrHome == expectedSystemData.solrHome}}@@ -71,13 +71,17 @@ class EnvironmentStoreProviderTest {}// A second request should be sent in this scenario, so we// respond with different data- else Result.success(expectedJavaProperties)+ else {+ Result.success(expectedJavaProperties)+ }},onGetSystemData = {if (initialRequest2) {initialRequest2 = falseResult.success(SystemData(solrHome = "some/path"))- } else Result.success(expectedSystemData)+ } else {+ Result.success(expectedSystemData)+ }},)@@ -95,9 +99,9 @@ class EnvironmentStoreProviderTest {// Collect the state updates and wait for the expected statestore.stateFlow.first { state ->state.javaProperties == expectedJavaProperties &&- state.system == expectedSystemData.system &&- state.jvm == expectedSystemData.jvm &&- state.solrHome == expectedSystemData.solrHome+ state.system == expectedSystemData.system &&+ state.jvm == expectedSystemData.jvm &&+ state.solrHome == expectedSystemData.solrHome}}}diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponentIntegrationTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponentIntegrationTest.ktindex 07d125b02da..028fc01de2b 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponentIntegrationTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/components/start/integration/DefaultStartComponentIntegrationTest.kt@@ -31,6 +31,13 @@ import io.ktor.client.request.HttpRequestDataimport io.ktor.http.HttpStatusCodeimport io.ktor.http.URLBuilderimport io.ktor.http.path+import kotlin.test.AfterTest+import kotlin.test.BeforeTest+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertIs+import kotlin.test.assertNotNull+import kotlin.test.assertNullimport kotlinx.coroutines.ExperimentalCoroutinesApiimport kotlinx.coroutines.test.StandardTestDispatcherimport kotlinx.coroutines.test.TestCoroutineScheduler@@ -46,13 +53,6 @@ import org.apache.solr.ui.generated.resources.error_invalid_urlimport org.apache.solr.ui.utils.AppComponentContextimport org.apache.solr.ui.utils.DEFAULT_SOLR_URLimport org.apache.solr.ui.utils.DefaultAppComponentContext-import kotlin.test.AfterTest-import kotlin.test.BeforeTest-import kotlin.test.Test-import kotlin.test.assertEquals-import kotlin.test.assertIs-import kotlin.test.assertNotNull-import kotlin.test.assertNull@OptIn(ExperimentalCoroutinesApi::class)class DefaultStartComponentIntegrationTest {diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/auth/BasicAuthContentTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/auth/BasicAuthContentTest.ktindex 113bb794232..403b97350ea 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/auth/BasicAuthContentTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/auth/BasicAuthContentTest.kt@@ -24,11 +24,11 @@ import androidx.compose.ui.test.assertIsDisplayedimport androidx.compose.ui.test.assertIsNotEnabledimport androidx.compose.ui.test.onNodeWithTagimport androidx.compose.ui.test.runComposeUiTest+import kotlin.test.Test+import kotlin.test.assertEqualsimport org.apache.solr.ui.components.auth.BasicAuthComponentimport org.apache.solr.ui.components.auth.BasicAuthComponent.Modelimport org.apache.solr.ui.isErrorSemantics-import kotlin.test.Test-import kotlin.test.assertEquals@OptIn(ExperimentalTestApi::class)class BasicAuthContentTest {diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/components/SolrCardTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/components/SolrCardTest.ktindex 301c34ec743..53fb3c99cdb 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/components/SolrCardTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/components/SolrCardTest.kt@@ -34,7 +34,7 @@ class SolrCardTest {SolrCard {Text(text = "My Text",- modifier = Modifier.testTag("text")+ modifier = Modifier.testTag("text"),)}}diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/environment/EnvironmentContentTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/environment/EnvironmentContentTest.ktindex 8a017113c50..a118bca5084 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/environment/EnvironmentContentTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/environment/EnvironmentContentTest.kt@@ -59,7 +59,7 @@ private object TestEnvironmentComponent : EnvironmentComponent {"key 5" to "value 5","key 6" to "value 6","key 7" to "value 7",- )- )+ ),+ ),)}diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/StartContentTest.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/StartContentTest.ktindex 54bb84bc61f..6f1afa7f6a2 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/StartContentTest.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/StartContentTest.kt@@ -43,11 +43,14 @@ class StartContentTest {StartContent(createComponent())}- assertEquals("", onNodeWithTag("solr_url_input")- .assertExists()- .fetchSemanticsNode()- .config[SemanticsProperties.EditableText]- .text)+ assertEquals(+ "",+ onNodeWithTag("solr_url_input")+ .assertExists()+ .fetchSemanticsNode()+ .config[SemanticsProperties.EditableText]+ .text,+ )}@Testdiff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/TestStartComponent.kt b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/TestStartComponent.ktindex 21228c50883..dfe0ef1307e 100644--- a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/TestStartComponent.kt+++ b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/views/start/TestStartComponent.kt@@ -22,7 +22,7 @@ import kotlinx.coroutines.flow.StateFlowimport org.apache.solr.ui.components.start.StartComponentimport org.apache.solr.ui.components.start.StartComponent.Model-class TestStartComponent(model: Model = Model()): StartComponent {+class TestStartComponent(model: Model = Model()) : StartComponent {override val model: StateFlow<Model> = MutableStateFlow(model)@@ -36,4 +36,4 @@ class TestStartComponent(model: Model = Model()): StartComponent {override fun onConnect() {onConnectClicked = true}-}\ No newline at end of file+}diff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Main.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Main.ktindex fa8449bd325..0dc602790f1 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Main.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Main.kt@@ -33,10 +33,11 @@ import java.awt.Dimensionimport kotlinx.coroutines.Dispatchersimport org.apache.solr.ui.components.root.RootComponentimport org.apache.solr.ui.components.root.integration.SimpleRootComponent-import org.apache.solr.ui.views.root.RootContent-import org.apache.solr.ui.views.theme.SolrThemeimport org.apache.solr.ui.utils.DefaultAppComponentContextimport org.apache.solr.ui.utils.getDefaultClient+import org.apache.solr.ui.utils.runOnUiThread+import org.apache.solr.ui.views.root.RootContent+import org.apache.solr.ui.views.theme.SolrTheme/*** Entry point of the Compose application for all JVM-based (desktop) targets.@@ -74,7 +75,7 @@ fun main() {Window(onCloseRequest = ::exitApplication,state = windowState,- title = "Solr Admin UI"+ title = "Solr Admin UI",) {window.minimumSize = Dimension(720, 560)diff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/PreviewContainer.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/PreviewContainer.ktindex ff54a61c919..afe31f5ea7d 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/PreviewContainer.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/PreviewContainer.kt@@ -29,13 +29,14 @@ import org.apache.solr.ui.views.theme.SolrTheme* This preview container can be used for applying the basic app theme on existing components.*/@Composable-fun PreviewContainer(content: @Composable () -> Unit) {- SolrTheme(useDarkTheme = false) {- Surface(modifier = Modifier.fillMaxSize()) {- Surface(- modifier = Modifier.padding(16.dp),- content = content,- )- }+fun PreviewContainer(+ modifier: Modifier = Modifier.fillMaxSize(),+ content: @Composable () -> Unit,+) = SolrTheme(useDarkTheme = false) {+ Surface(modifier = modifier) {+ Surface(+ modifier = Modifier.padding(16.dp),+ content = content,+ )}}diff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/navigation/PreviewNavigationSideBar.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/navigation/PreviewNavigationSideBar.ktindex 90b8d8f07b4..ca892422f81 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/navigation/PreviewNavigationSideBar.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/navigation/PreviewNavigationSideBar.kt@@ -24,7 +24,7 @@ import org.apache.solr.ui.views.navigation.NavigationSideBar@Preview@Composable-fun PreviewNavigationSideBar() = PreviewContainer {+private fun PreviewNavigationSideBar() = PreviewContainer {NavigationSideBar(onNavigate = {},onLogout = {},diff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/start/PreviewStartContent.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/start/PreviewStartContent.ktindex 47cb62f6dca..c5c2384acf1 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/start/PreviewStartContent.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/preview/start/PreviewStartContent.kt@@ -29,24 +29,23 @@ import org.apache.solr.ui.views.start.StartContent@Preview@Composable-fun PreviewStartContent() = PreviewContainer {+private fun PreviewStartContent() = PreviewContainer {StartContent(component = PreviewStartComponent)}@Preview@Composable-fun PreviewStartContentWithError() = PreviewContainer {+private fun PreviewStartContentWithError() = PreviewContainer {StartContent(component = PreviewStartComponentWithError)}-@Preview@Composable-fun PreviewStartContentWithConnecting() = PreviewContainer {+private fun PreviewStartContentWithConnecting() = PreviewContainer {StartContent(component = PreviewStartComponentWithConnecting)}-private object PreviewStartComponent: StartComponent {+private object PreviewStartComponent : StartComponent {override val model: StateFlow<StartComponent.Model> =MutableStateFlow(StartComponent.Model())@@ -54,24 +53,23 @@ private object PreviewStartComponent: StartComponent {override fun onConnect() = Unit}-private object PreviewStartComponentWithError: StartComponent {+private object PreviewStartComponentWithError : StartComponent {override val model: StateFlow<StartComponent.Model> = MutableStateFlow(StartComponent.Model(url = "some-invalid-url!",error = Res.string.error_invalid_url,- )+ ),)override fun onSolrUrlChange(url: String) = Unitoverride fun onConnect() = Unit}--private object PreviewStartComponentWithConnecting: StartComponent {+private object PreviewStartComponentWithConnecting : StartComponent {override val model: StateFlow<StartComponent.Model> = MutableStateFlow(StartComponent.Model(isConnecting = true,- )+ ),)override fun onSolrUrlChange(url: String) = Unitdiff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/errors/parseError.desktop.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.desktop.ktsimilarity index 78%rename from solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/errors/parseError.desktop.ktrename to solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.desktop.ktindex 586dcbd2d85..08304c6f08e 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/errors/parseError.desktop.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.desktop.kt@@ -15,13 +15,12 @@* limitations under the License.*/-package org.apache.solr.ui.errors+package org.apache.solr.ui.utilsimport java.net.ConnectException+import org.apache.solr.ui.errors.HostNotFoundException-actual fun parseError(error: Throwable): Throwable {- return when (error) {- is ConnectException -> HostNotFoundException(error)- else -> error- }-}\ No newline at end of file+actual fun parseError(error: Throwable): Throwable = when (error) {+ is ConnectException -> HostNotFoundException(error)+ else -> error+}diff --git a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Utils.kt b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/Utils.ktsimilarity index 97%rename from solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Utils.ktrename to solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/Utils.ktindex 5e8d1193f32..7aa77e9810b 100644--- a/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Utils.kt+++ b/solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/Utils.kt@@ -15,7 +15,7 @@* limitations under the License.*/-package org.apache.solr.ui+package org.apache.solr.ui.utilsimport javax.swing.SwingUtilitiesdiff --git a/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.kt b/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.ktindex 2bb836c657e..c3bd336105f 100644--- a/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.kt+++ b/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.kt@@ -32,10 +32,10 @@ import kotlinx.browser.windowimport kotlinx.coroutines.Dispatchersimport org.apache.solr.ui.components.root.RootComponentimport org.apache.solr.ui.components.root.integration.SimpleRootComponent-import org.apache.solr.ui.views.root.RootContent-import org.apache.solr.ui.views.theme.SolrThemeimport org.apache.solr.ui.utils.DefaultAppComponentContextimport org.apache.solr.ui.utils.getDefaultClient+import org.apache.solr.ui.views.root.RootContent+import org.apache.solr.ui.views.theme.SolrTheme/*** Entry point of the Compose application for all wasmJs (browser) targets.diff --git a/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/errors/parseError.kt b/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.ktsimilarity index 92%rename from solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/errors/parseError.ktrename to solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.ktindex 241340f4c51..21db75e14f2 100644--- a/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/errors/parseError.kt+++ b/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.kt@@ -15,7 +15,9 @@* limitations under the License.*/-package org.apache.solr.ui.errors+package org.apache.solr.ui.utils++import org.apache.solr.ui.errors.HostNotFoundExceptionactual fun parseError(error: Throwable): Throwable {// In JavaScript the errors do not have any type to distinguish them, so we strongly