Skip to content

Commit c857509

Browse files
committed
feat(dev-planner): add loading state indication when processing issue text #352
- Implement showLoadingState() function to display a loading message - Update switchToPlanView() to remove redundant code - Add JLabel and JPanel for loading indication- Improve user experience by providing feedback during processing
1 parent 8a30054 commit c857509

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/planner/AutoDevPlannerToolWindow.kt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.intellij.ui.dsl.builder.panel
1717
import com.intellij.util.ui.JBUI
1818
import com.intellij.util.ui.UIUtil
1919
import java.awt.BorderLayout
20+
import javax.swing.JLabel
2021
import javax.swing.JPanel
2122

2223
class AutoDevPlannerToolWindow(val project: Project) : SimpleToolWindowPanel(true, true), Disposable {
@@ -77,7 +78,7 @@ class AutoDevPlannerToolWindow(val project: Project) : SimpleToolWindowPanel(tru
7778
title = "Enter Issue Description",
7879
onSubmit = { issueText ->
7980
if (issueText.isNotBlank()) {
80-
switchToPlanView()
81+
showLoadingState(issueText)
8182
}
8283
},
8384
onCancel = {
@@ -134,7 +135,6 @@ class AutoDevPlannerToolWindow(val project: Project) : SimpleToolWindowPanel(tru
134135
fun switchToPlanView(newContent: String? = null) {
135136
if (newContent != null && newContent != content) {
136137
content = newContent
137-
138138
val parsedItems = MarkdownPlanParser.parse(newContent).toMutableList()
139139
planLangSketch.updatePlan(parsedItems)
140140
}
@@ -148,6 +148,27 @@ class AutoDevPlannerToolWindow(val project: Project) : SimpleToolWindowPanel(tru
148148
isIssueInputMode = false
149149
}
150150

151+
private fun showLoadingState(issueText: String) {
152+
content = issueText
153+
val parsedItems = MarkdownPlanParser.parse(issueText).toMutableList()
154+
planLangSketch.updatePlan(parsedItems)
155+
156+
contentPanel.removeAll()
157+
contentPanel.add(planPanel, BorderLayout.CENTER)
158+
159+
val loadingPanel = JPanel(BorderLayout()).apply {
160+
add(JLabel("Processing your request..."), BorderLayout.NORTH)
161+
background = JBUI.CurrentTheme.ToolWindow.background()
162+
}
163+
contentPanel.add(loadingPanel, BorderLayout.NORTH)
164+
165+
contentPanel.revalidate()
166+
contentPanel.repaint()
167+
168+
isEditorMode = false
169+
isIssueInputMode = false
170+
}
171+
151172
override fun dispose() {
152173
markdownEditor = null
153174
}

0 commit comments

Comments
 (0)