From 2c6bf0041726919aa859b2926a5211f598763a2b Mon Sep 17 00:00:00 2001 From: Blarc Date: Mon, 15 Jul 2024 14:39:58 +0200 Subject: [PATCH] fix(clients): input is not validated when card is changed --- .../plugin/settings/clients/LLMClientTable.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt index 6a1c316..f3a3eea 100644 --- a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt +++ b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt @@ -156,12 +156,6 @@ class LLMClientTable { } } - // Register validators of the currently active cards - val dialogPanel = cardLayout.findComponentById(llmClient.getClientName()) as DialogPanel - dialogPanel.registerValidators(myDisposable) { - isOKActionEnabled = ContainerUtil.and(it.values) { info: ValidationInfo -> info.okEnabled } - } - val cardsList = JBList(llmClientConfigurations).apply { val descriptor = object : ListItemDescriptorAdapter() { override fun getTextFor(value: LLMClientConfiguration) = value.getClientName() @@ -175,6 +169,12 @@ class LLMClientTable { addListSelectionListener { llmClient = selectedValue cardLayout.show(cardPanel, llmClient.getClientName()) + + // Register validators of the currently active cards + val dialogPanel = cardLayout.findComponentById(llmClient.getClientName()) as DialogPanel + dialogPanel.registerValidators(myDisposable) { + isOKActionEnabled = ContainerUtil.and(it.values) { info: ValidationInfo -> info.okEnabled } + } } setSelectedValue(llmClient, true) }