Fetch up to 100 results... and fix the layout when filtering

This commit is contained in:
downthecrop 2025-09-18 22:56:39 -07:00
parent 5dd299ecdd
commit 3fae644550
2 changed files with 23 additions and 22 deletions

View file

@ -29,7 +29,7 @@ object GitLabPluginFetcher {
try {
debugLog("Starting to fetch GitLab plugins...")
val plugins = mutableListOf<GitLabPlugin>()
val apiUrl = "https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/repository/tree?ref=${GITLAB_BRANCH}"
val apiUrl = "https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/repository/tree?ref=${GITLAB_BRANCH}&per_page=100"
debugLog("API URL: $apiUrl")
// Create URL connection
@ -54,10 +54,10 @@ object GitLabPluginFetcher {
val treeItems = gson.fromJson(response, Array<JsonObject>::class.java)
debugLog("Parsed ${treeItems.size} items from JSON")
// Filter for directories (trees)
// Filter for directories (trees) with mode "040000"
var directoryCount = 0
for (jsonObject in treeItems) {
if (jsonObject["type"].asString == "tree") {
if (jsonObject["type"].asString == "tree" && jsonObject["mode"].asString == "040000") {
directoryCount++
val folderId = jsonObject["id"].asString
val folderPath = jsonObject["path"].asString

View file

@ -262,26 +262,27 @@ object ReflectiveEditorView : View {
System.out.println("Matching plugin statuses: ${matchingPluginStatuses.size}")
// Add a separator
val separator = JPanel()
separator.background = VIEW_BACKGROUND_COLOR
separator.preferredSize = Dimension(Int.MAX_VALUE, 1)
separator.maximumSize = Dimension(Int.MAX_VALUE, 1)
panel.add(Box.createVerticalStrut(10))
panel.add(separator)
panel.add(Box.createVerticalStrut(5))
// Add a header for available plugins
// Always add the label even if there are no matching plugins to maintain proper layout
val headerPanel = JPanel(FlowLayout(FlowLayout.LEFT))
headerPanel.background = VIEW_BACKGROUND_COLOR
val headerLabel = JLabel(if (matchingPluginStatuses.isNotEmpty()) "Available Plugins" else "")
headerLabel.foreground = secondaryColor
headerLabel.font = Font("RuneScape Small", Font.BOLD, 16)
headerPanel.add(headerLabel)
panel.add(headerPanel)
panel.add(Box.createVerticalStrut(5))
if (matchingPluginStatuses.isNotEmpty()) {
// Add a separator
val separator = JPanel()
separator.background = VIEW_BACKGROUND_COLOR
separator.preferredSize = Dimension(Int.MAX_VALUE, 1)
separator.maximumSize = Dimension(Int.MAX_VALUE, 1)
panel.add(Box.createVerticalStrut(10))
panel.add(separator)
panel.add(Box.createVerticalStrut(5))
// Add a header for available plugins
val headerPanel = JPanel(FlowLayout(FlowLayout.LEFT))
headerPanel.background = VIEW_BACKGROUND_COLOR
val headerLabel = JLabel("Available Plugins")
headerLabel.foreground = secondaryColor
headerLabel.font = Font("RuneScape Small", Font.BOLD, 16)
headerPanel.add(headerLabel)
panel.add(headerPanel)
panel.add(Box.createVerticalStrut(5))
// Add download all button if there are multiple plugins
if (matchingPluginStatuses.size > 1) {
val downloadAllPanel = JPanel(FlowLayout(FlowLayout.LEFT))