Working Gitlab search

This commit is contained in:
downthecrop 2025-09-08 12:12:57 -07:00
parent cf6bb51d2c
commit eee924e915
6 changed files with 26 additions and 30 deletions

View file

@ -36,11 +36,10 @@ object GitLabPluginFetcher {
// Parse JSON response
val gson = Gson()
val treeItems = gson.fromJson(response, Array::class.java)
val treeItems = gson.fromJson(response, Array<JsonObject>::class.java)
// Filter for directories (trees)
for (item in treeItems) {
val jsonObject = item as JsonObject
for (jsonObject in treeItems) {
if (jsonObject["type"].asString == "tree") {
val folderId = jsonObject["id"].asString
val folderPath = jsonObject["path"].asString

View file

@ -4,6 +4,7 @@ import KondoKit.ImageCanvas
import KondoKit.SpriteToBufferedImage
import KondoKit.plugin.Companion.WIDGET_COLOR
import KondoKit.plugin.Companion.secondaryColor
import KondoKit.plugin.StateManager.focusedView
import plugin.api.API
import java.awt.*
import java.awt.datatransfer.DataFlavor
@ -11,10 +12,11 @@ import java.awt.event.*
import javax.swing.*
open class SearchField(
private val onSearch: (String) -> Unit,
protected val onSearch: (String) -> Unit,
private val placeholderText: String = "Search...",
private val fieldWidth: Int = 230,
private val fieldHeight: Int = 30
private val fieldHeight: Int = 30,
private val viewName: String? = null
) : Canvas() {
private var cursorVisible: Boolean = true
@ -101,8 +103,11 @@ open class SearchField(
Timer(500) { _ ->
cursorVisible = !cursorVisible
SwingUtilities.invokeLater {
repaint()
// Only repaint if the view is active or if viewName is not specified
if (viewName == null || focusedView == viewName) {
SwingUtilities.invokeLater {
repaint()
}
}
}.start()
}