MCPcopy Create free account
hub / github.com/github/gh-aw / parseProjectViews

Function parseProjectViews

pkg/workflow/project_config_parsing.go:7–73  ·  view source on GitHub ↗

parseProjectViews parses the "views" list from a project config map. Only views with both name and layout fields are included; invalid ones are skipped.

(configMap map[string]any, debugLog *logger.Logger)

Source from the content-addressed store, hash-verified

5// parseProjectViews parses the "views" list from a project config map.
6// Only views with both name and layout fields are included; invalid ones are skipped.
7func parseProjectViews(configMap map[string]any, debugLog *logger.Logger) []ProjectView {
8 viewsData, exists := configMap["views"]
9 if !exists {
10 return nil
11 }
12 viewsList, ok := viewsData.([]any)
13 if !ok {
14 return nil
15 }
16
17 var views []ProjectView
18 for i, viewItem := range viewsList {
19 viewMap, ok := viewItem.(map[string]any)
20 if !ok {
21 continue
22 }
23 view := ProjectView{}
24
25 // Parse name (required)
26 if name, exists := viewMap["name"]; exists {
27 if nameStr, ok := name.(string); ok {
28 view.Name = nameStr
29 }
30 }
31
32 // Parse layout (required)
33 if layout, exists := viewMap["layout"]; exists {
34 if layoutStr, ok := layout.(string); ok {
35 view.Layout = layoutStr
36 }
37 }
38
39 // Parse filter (optional)
40 if filter, exists := viewMap["filter"]; exists {
41 if filterStr, ok := filter.(string); ok {
42 view.Filter = filterStr
43 }
44 }
45
46 // Parse visible-fields (optional)
47 if visibleFields, exists := viewMap["visible-fields"]; exists {
48 if fieldsList, ok := visibleFields.([]any); ok {
49 for _, field := range fieldsList {
50 if fieldInt, ok := field.(int); ok {
51 view.VisibleFields = append(view.VisibleFields, fieldInt)
52 }
53 }
54 }
55 }
56
57 // Parse description (optional)
58 if description, exists := viewMap["description"]; exists {
59 if descStr, ok := description.(string); ok {
60 view.Description = descStr
61 }
62 }
63
64 // Only add view if it has required fields

Calls 1

PrintfMethod · 0.45