[mcpServer] Update according to the design doc

Don't use banner and move configuration info to the same line

GitOrigin-RevId: 3785b7a4d6ff0ffcc2ad66dc2765e536a57e0269
This commit is contained in:
Maxim.Kolmakov
2025-07-07 13:58:45 +00:00
committed by intellij-monorepo-bot
parent 3617f17095
commit 2815bd46c3
2 changed files with 15 additions and 17 deletions
@@ -41,7 +41,7 @@ copy.mcp.server.configuration=Copy Config
copy.mcp.server.sse.configuration=Copy SSE Config
mcp.server.client.restart.info=Autoconfiguration complete. The following clients were configured: {0}. \n Client(s) might require restart to take effect.
mcp.server.client.restart.info.settings=Configuration complete. Restart the client if changes don't apply.
mcp.server.client.autoconfig.error=Autoconfiguration can't be completed.
mcp.server.client.autoconfig.error=<span style='color: #db5c5c;'>Autoconfiguration can't be completed.</span>
mcp.client.autoconfigured=Client(s) was autoconfigured
mcp.client.error.autoconfigured=Error during client(s) configuration
mcp.server.error.autoconfigured.info=The following clients were not configured: {0}
@@ -15,11 +15,8 @@ import com.intellij.openapi.ui.DialogPanel
import com.intellij.openapi.ui.MessageDialogBuilder
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.ui.EditorNotificationPanel
import com.intellij.ui.InlineBanner
import com.intellij.ui.components.JBOptionButton
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.dsl.gridLayout.UnscaledGaps
import com.intellij.ui.layout.ComponentPredicate
import com.intellij.ui.layout.ValueComponentPredicate
import com.intellij.ui.layout.and
@@ -88,23 +85,10 @@ class McpServerSettingsConfigurable : SearchableConfigurable {
val json = mcpClient.json
row {
text(mcpClient.name.displayName)
icon(McpserverIcons.Expui.StatusDisabled).gap(RightGap.SMALL).visibleIf(isConfigured.not())
comment(McpServerBundle.message("mcp.server.not.configured")).visibleIf(isConfigured.not())
icon(McpserverIcons.Expui.StatusEnabled).gap(RightGap.SMALL).visibleIf(isConfigured.and(isPortCorrect))
comment(McpServerBundle.message("mcp.server.configured")).visibleIf(isConfigured.and(isPortCorrect))
icon(AllIcons.General.Error).gap(RightGap.SMALL).visibleIf(isConfigured.and(isPortCorrect.not()))
comment(McpServerBundle.message("mcp.server.configured.port.invalid")).visibleIf(isConfigured.and(isPortCorrect.not()))
}.topGap(TopGap.SMALL)
val autoconfiguredPressed = ValueComponentPredicate(false)
val errorDuringConfiguration = ValueComponentPredicate(false)
val configExists = ValueComponentPredicate(mcpClient.configPath.exists() && mcpClient.configPath.isRegularFile())
row {
cell(InlineBanner(McpServerBundle.message("mcp.server.client.restart.info.settings"), EditorNotificationPanel.Status.Success)).customize(UnscaledGaps(12))
}.visibleIf(autoconfiguredPressed).topGap(TopGap.SMALL).bottomGap(BottomGap.SMALL)
row {
icon(AllIcons.General.Error)
comment(McpServerBundle.message("mcp.server.client.autoconfig.error"))
}.visibleIf(errorDuringConfiguration)
row {
cell(JBOptionButton(object : AbstractAction(McpServerBundle.message("autoconfigure.mcp.server")) {
override fun actionPerformed(e: ActionEvent?) {
@@ -132,6 +116,20 @@ class McpServerSettingsConfigurable : SearchableConfigurable {
if (e != null) showCopiedBallon(e)
}
})))
icon(McpserverIcons.Expui.StatusEnabled).gap(RightGap.SMALL).visibleIf(isConfigured.and(isPortCorrect).and(autoconfiguredPressed.not()))
text(McpServerBundle.message("mcp.server.configured")).visibleIf(isConfigured.and(isPortCorrect).and(autoconfiguredPressed.not()))
icon(McpserverIcons.Expui.StatusEnabled).gap(RightGap.SMALL).visibleIf(autoconfiguredPressed)
text(McpServerBundle.message("mcp.server.client.restart.info.settings")).visibleIf(autoconfiguredPressed)
icon(McpserverIcons.Expui.StatusDisabled).gap(RightGap.SMALL).visibleIf(isConfigured.not())
comment(McpServerBundle.message("mcp.server.not.configured")).visibleIf(isConfigured.not())
icon(AllIcons.General.Error).gap(RightGap.SMALL).visibleIf(isConfigured.and(isPortCorrect.not()))
comment(McpServerBundle.message("mcp.server.configured.port.invalid")).visibleIf(isConfigured.and(isPortCorrect.not()))
icon(AllIcons.General.Error).gap(RightGap.SMALL).visibleIf(errorDuringConfiguration)
comment(McpServerBundle.message("mcp.server.client.autoconfig.error")).visibleIf(errorDuringConfiguration)
}
}
}