This is an automated email from the ASF dual-hosted git repository.
malliaridis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new cc887f5d6cc SOLR-17672: Enable spotless for Kotlin files (#3450)
cc887f5d6cc is described below
commit cc887f5d6cc44ea84e1c192f99b5ea09e1bfdac0
Author: Christos Malliaridis <[email protected]>
AuthorDate: Sun Aug 17 12:48:53 2025 +0300
SOLR-17672: Enable spotless for Kotlin files (#3450)
* Add spotless for kotlin and kotlin DSL (multiplatform)
* Format source code
* Add explicit import layout rule
Add explicit import layout rule with alphabetical ordering and alias
imports at the end.
---
.editorconfig | 14 ++++++++
gradle/libs.versions.toml | 6 +++-
gradle/validation/spotless.gradle | 15 ++++++++
.../auth/store/BasicAuthStoreProvider.kt | 4 +--
.../components/environment/EnvironmentComponent.kt | 2 +-
.../ui/components/environment/data/JvmMemoryRaw.kt | 2 +-
.../components/environment/data/SecurityConfig.kt | 2 +-
.../environment/data/SystemInformation.kt | 2 +-
.../ui/components/environment/data/SystemMode.kt | 2 ++
.../integration/DefaultEnvironmentComponent.kt | 3 +-
.../integration/HttpEnvironmentStoreClient.kt | 1 -
.../environment/store/EnvironmentStore.kt | 2 +-
.../environment/store/EnvironmentStoreProvider.kt | 9 ++---
.../logging/integration/DefaultLoggingComponent.kt | 3 +-
.../main/integration/DefaultMainComponent.kt | 8 ++---
.../solr/ui/components/root/RootComponent.kt | 6 ++--
.../start/integration/DefaultStartComponent.kt | 5 +--
.../solr/ui/components/start/store/StartStore.kt | 8 ++---
.../components/start/store/StartStoreProvider.kt | 16 ++++-----
.../apache/solr/ui/errors/HostNotFoundException.kt | 2 +-
...ialsError.kt => InvalidCredentialsException.kt} | 0
.../apache/solr/ui/errors/UnauthorizedException.kt | 2 +-
.../solr/ui/errors/UnknownResponseException.kt | 2 +-
.../apache/solr/ui/utils/AppComponentContext.kt | 4 ++-
.../org/apache/solr/ui/utils/CoroutineScopeExt.kt | 14 ++++----
.../{errors/parseError.kt => utils/ErrorUtils.kt} | 2 +-
.../org/apache/solr/ui/utils/HttpClientUtils.kt | 2 +-
.../apache/solr/ui/views/components/SolrButton.kt | 2 +-
.../solr/ui/views/components/SolrTextButton.kt | 2 +-
.../views/environment/CommandLineArgumentsCard.kt | 10 +++---
.../ui/views/environment/JavaPropertiesCard.kt | 6 ++--
.../solr/ui/views/environment/VersionsCard.kt | 2 +-
.../org/apache/solr/ui/views/icons/SolrLogo.kt | 9 +++--
.../org/apache/solr/ui/views/main/MainContent.kt | 2 +-
.../org/apache/solr/ui/views/navigation/Footer.kt | 17 +++++----
.../solr/ui/views/navigation/NavigationSideBar.kt | 13 ++++---
.../org/apache/solr/ui/views/root/RootContent.kt | 3 +-
.../org/apache/solr/ui/views/start/StartContent.kt | 21 ++++++-----
.../kotlin/org/apache/solr/ui/views/theme/Theme.kt | 2 +-
.../org/apache/solr/ui/views/theme/Typography.kt | 42 +++++++++++-----------
.../kotlin/org/apache/solr/ui/Semantics.kt | 2 +-
.../kotlin/org/apache/solr/ui/TestUtils.kt | 18 +++++-----
.../integration/DefaultBasicAuthComponentTest.kt | 12 +++----
.../store/EnvironmentStoreProviderTest.kt | 22 +++++++-----
.../DefaultStartComponentIntegrationTest.kt | 14 ++++----
.../solr/ui/views/auth/BasicAuthContentTest.kt | 4 +--
.../solr/ui/views/components/SolrCardTest.kt | 2 +-
.../ui/views/environment/EnvironmentContentTest.kt | 4 +--
.../apache/solr/ui/views/start/StartContentTest.kt | 13 ++++---
.../solr/ui/views/start/TestStartComponent.kt | 4 +--
.../desktopMain/kotlin/org/apache/solr/ui/Main.kt | 7 ++--
.../org/apache/solr/ui/preview/PreviewContainer.kt | 17 ++++-----
.../preview/navigation/PreviewNavigationSideBar.kt | 2 +-
.../solr/ui/preview/start/PreviewStartContent.kt | 18 +++++-----
.../ErrorUtils.desktop.kt} | 13 ++++---
.../kotlin/org/apache/solr/ui/{ => utils}/Utils.kt | 2 +-
.../wasmJsMain/kotlin/org/apache/solr/ui/Main.kt | 4 +--
.../{errors/parseError.kt => utils/ErrorUtils.kt} | 4 ++-
58 files changed, 241 insertions(+), 190 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index c4f902eacfb..e127b9a9e5d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -348,6 +348,20 @@ ij_java_wrap_first_method_in_call_chain = false
ij_java_wrap_long_lines = true
ij_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 = 4
ij_asciidoc_blank_lines_after_header = 1
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 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 alignment
netty-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 alignment
netty-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.gradle
index 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.kt
index 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.SimpleBootstrapper
import com.arkivanov.mvikotlin.core.store.Store
import com.arkivanov.mvikotlin.core.store.StoreFactory
import com.arkivanov.mvikotlin.extensions.coroutines.CoroutineExecutor
+import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -31,8 +32,7 @@ import
org.apache.solr.ui.components.auth.store.BasicAuthStore.State
import org.apache.solr.ui.domain.AuthMethod
import org.apache.solr.ui.errors.InvalidCredentialsException
import org.apache.solr.ui.errors.UnauthorizedException
-import org.apache.solr.ui.errors.parseError
-import kotlin.coroutines.CoroutineContext
+import org.apache.solr.ui.utils.parseError
class 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.kt
index 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.kt
index 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.kt
index 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
@Serializable
data 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.kt
index 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.kt
index 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
@Serializable
enum 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.kt
index 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.kt
index 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
readability
val javaProperties = response.body<JavaPropertiesResponse>()
.properties
diff --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.kt
index 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.kt
index 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 handler
withContext(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 handler
withContext(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.kt
index 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.AppComponentContext
class DefaultLoggingComponent(
componentContext: AppComponentContext,
storeFactory: StoreFactory,
-) : LoggingComponent, AppComponentContext by componentContext
+) : LoggingComponent,
+ AppComponentContext by componentContext
diff --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.kt
index 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.Dashboard
MainMenu.Metrics -> Configuration.Metrics
MainMenu.Cluster -> Configuration.Cluster
diff --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.kt
index 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.kt
index 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.kt
index 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.kt
index 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.Url
import io.ktor.http.parseUrl
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineExceptionHandler
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.apache.solr.ui.components.start.store.StartStore.Intent
import org.apache.solr.ui.components.start.store.StartStore.Label
import org.apache.solr.ui.components.start.store.StartStore.State
import org.apache.solr.ui.errors.UnauthorizedException
-import org.apache.solr.ui.errors.parseError
import 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.kt
index 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.kt
similarity index 100%
rename from
solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsError.kt
rename to
solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/InvalidCredentialsException.kt
diff --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.kt
index 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.kt
index 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.kt
index 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>,
+ CoroutineContextOwner
diff --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.kt
index 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.utils
import com.arkivanov.essenty.lifecycle.Lifecycle
import com.arkivanov.essenty.lifecycle.LifecycleOwner
import com.arkivanov.essenty.lifecycle.doOnDestroy
+import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import 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.kt
similarity index 96%
rename from
solr/ui/src/commonMain/kotlin/org/apache/solr/ui/errors/parseError.kt
rename to solr/ui/src/commonMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.kt
index 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.kt
index 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 = true
allowSpecialFloatingPointValues = 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.kt
index 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.kt
index 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.kt
index 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
*/
@Composable
internal 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.kt
index 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.kt
index 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.kt
index 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.kt
index 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.kt
index 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.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
-import androidx.compose.ui.platform.LocalUriHandler
-import androidx.compose.ui.platform.UriHandler
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.MenuBook
import androidx.compose.material.icons.rounded.BugReport
@@ -46,6 +44,8 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.platform.UriHandler
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.apache.solr.ui.generated.resources.Res
@@ -73,7 +73,6 @@ fun Footer(
HorizontalDivider()
BoxWithConstraints {
-
val showIconsOnly = maxWidth < collapseWidth
FlowRow(
@@ -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 Logo
stringRes = 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.kt
index 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.
*/
@Composable
fun 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.38f
Tab(
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.kt
index 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.kt
index 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.dp
import org.apache.solr.ui.components.start.StartComponent
import org.apache.solr.ui.generated.resources.Res
import org.apache.solr.ui.generated.resources.action_connect
-import org.apache.solr.ui.generated.resources.connecting
import org.apache.solr.ui.generated.resources.cd_solr_logo
+import org.apache.solr.ui.generated.resources.connecting
import org.apache.solr.ui.generated.resources.desc_to_get_started
import org.apache.solr.ui.generated.resources.solr_sun
import 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.kt
index 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 {
@Composable
fun SolrTheme(
useDarkTheme: Boolean = isSystemInDarkTheme(),
- content: @Composable () -> Unit
+ content: @Composable () -> Unit,
) {
val colorScheme = when {
useDarkTheme -> darkScheme
diff --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.kt
index 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
@Composable
diff --git a/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.kt
b/solr/ui/src/commonTest/kotlin/org/apache/solr/ui/Semantics.kt
index 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.kt
index 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.kt
index 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.respond
import io.ktor.client.request.HttpRequestData
import io.ktor.http.HttpStatusCode
import 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.assertIs
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineScheduler
@@ -43,12 +49,6 @@ import org.apache.solr.ui.domain.AuthMethod
import org.apache.solr.ui.errors.InvalidCredentialsException
import org.apache.solr.ui.utils.AppComponentContext
import 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.kt
index 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
timeout
store.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 = false
Result.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 state
store.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.kt
index 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.HttpRequestData
import io.ktor.http.HttpStatusCode
import io.ktor.http.URLBuilder
import 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.assertNull
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestCoroutineScheduler
@@ -46,13 +53,6 @@ import
org.apache.solr.ui.generated.resources.error_invalid_url
import org.apache.solr.ui.utils.AppComponentContext
import org.apache.solr.ui.utils.DEFAULT_SOLR_URL
import 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.kt
index 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.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.runComposeUiTest
+import kotlin.test.Test
+import kotlin.test.assertEquals
import org.apache.solr.ui.components.auth.BasicAuthComponent
import org.apache.solr.ui.components.auth.BasicAuthComponent.Model
import 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.kt
index 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.kt
index 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.kt
index 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,
+ )
}
@Test
diff --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.kt
index 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.StateFlow
import org.apache.solr.ui.components.start.StartComponent
import 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.kt
index 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.Dimension
import kotlinx.coroutines.Dispatchers
import org.apache.solr.ui.components.root.RootComponent
import org.apache.solr.ui.components.root.integration.SimpleRootComponent
-import org.apache.solr.ui.views.root.RootContent
-import org.apache.solr.ui.views.theme.SolrTheme
import org.apache.solr.ui.utils.DefaultAppComponentContext
import 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.kt
index 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.kt
index 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.kt
index 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) = Unit
override 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) = Unit
diff --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.kt
similarity index 78%
rename from
solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/errors/parseError.desktop.kt
rename to
solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.desktop.kt
index 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.utils
import 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.kt
similarity index 97%
rename from solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/Utils.kt
rename to solr/ui/src/desktopMain/kotlin/org/apache/solr/ui/utils/Utils.kt
index 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.utils
import javax.swing.SwingUtilities
diff --git a/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.kt
b/solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/Main.kt
index 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.window
import kotlinx.coroutines.Dispatchers
import org.apache.solr.ui.components.root.RootComponent
import org.apache.solr.ui.components.root.integration.SimpleRootComponent
-import org.apache.solr.ui.views.root.RootContent
-import org.apache.solr.ui.views.theme.SolrTheme
import org.apache.solr.ui.utils.DefaultAppComponentContext
import 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.kt
similarity index 92%
rename from
solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/errors/parseError.kt
rename to solr/ui/src/wasmJsMain/kotlin/org/apache/solr/ui/utils/ErrorUtils.kt
index 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.HostNotFoundException
actual fun parseError(error: Throwable): Throwable {
// In JavaScript the errors do not have any type to distinguish them, so
we strongly