Skip to content

Commit

Permalink
fix(clients): input is not validated when card is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Blarc committed Jul 15, 2024
1 parent 508211e commit 2c6bf00
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<LLMClientConfiguration>() {
override fun getTextFor(value: LLMClientConfiguration) = value.getClientName()
Expand All @@ -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)
}
Expand Down

0 comments on commit 2c6bf00

Please sign in to comment.