Skip to content

Commit 4d95443

Browse files
committed
feat: enhance content workflow and UI for session management
- Added sorting of result display names and matches in the `ContentWorkflowResults` function to ensure consistent order of files. - Implemented auto-refresh for open tabs in the session detail page, allowing for real-time updates of workflow results. - Improved UI structure and formatting for better readability and user experience in the session detail page. These changes enhance the functionality and usability of the content workflow and session management interface.
1 parent ac6522e commit 4d95443

File tree

2 files changed

+352
-313
lines changed
  • components

2 files changed

+352
-313
lines changed

components/backend/handlers/content.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"os/exec"
1212
"path/filepath"
13+
"sort"
1314
"strings"
1415
"time"
1516

@@ -675,7 +676,15 @@ func ContentWorkflowResults(c *gin.Context) {
675676
workspaceBase := filepath.Join(StateBaseDir, "sessions", sessionName, "workspace")
676677
results := []ResultFile{}
677678

678-
for displayName, pattern := range ambientConfig.Results {
679+
// Sort keys to ensure consistent order (maps are unordered in Go)
680+
displayNames := make([]string, 0, len(ambientConfig.Results))
681+
for displayName := range ambientConfig.Results {
682+
displayNames = append(displayNames, displayName)
683+
}
684+
sort.Strings(displayNames)
685+
686+
for _, displayName := range displayNames {
687+
pattern := ambientConfig.Results[displayName]
679688
matches := findMatchingFiles(workspaceBase, pattern)
680689

681690
if len(matches) == 0 {
@@ -685,6 +694,9 @@ func ContentWorkflowResults(c *gin.Context) {
685694
Exists: false,
686695
})
687696
} else {
697+
// Sort matches for consistent order
698+
sort.Strings(matches)
699+
688700
for _, matchedPath := range matches {
689701
relPath, _ := filepath.Rel(workspaceBase, matchedPath)
690702
content, readErr := os.ReadFile(matchedPath)

0 commit comments

Comments
 (0)