Skip to content

Commit

Permalink
Enhances goMaker
Browse files Browse the repository at this point in the history
  • Loading branch information
tjayrush committed Nov 6, 2024
1 parent a8ee8ba commit 44bddaa
Showing 1 changed file with 54 additions and 13 deletions.
67 changes: 54 additions & 13 deletions src/dev_tools/goMaker/types/types_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,20 @@ func (s *Structure) ItemName() string {

func (s *Structure) ItemType() string {
pkg, typ := s.parseType("itemType")
if strings.HasPrefix(pkg, "types") {
return FirstUpper(typ)
}
return FirstLower(pkg) + "." + FirstUpper(typ)
}

func (s *Structure) InputType() string {
if s.Class == "Manifest" {
return "coreTypes.Manifest"
pkg, typ := s.parseType("inputType")
if typ == "" {
return s.ItemType()
} else if strings.HasPrefix(pkg, "types") {
return FirstUpper(typ)
}
return s.ItemType()
return FirstLower(pkg) + "." + FirstUpper(typ)
}

func (s *Structure) EmbedName() string {
Expand Down Expand Up @@ -299,6 +305,14 @@ func (s *Structure) NeedsFetch() bool {
return !strings.Contains(s.Attributes, "noFetch")
}

func (s *Structure) NeedsType() bool {
return !strings.Contains(s.Attributes, "noType")
}

func (s *Structure) NeedsPaging() bool {
return !strings.Contains(s.Attributes, "noPaging")
}

func (s *Structure) IsEditable() bool {
return strings.Contains(s.Attributes, "editable")
}
Expand Down Expand Up @@ -330,6 +344,37 @@ func (s *Structure) SortsInstance() string {
return ret
}

func (s *Structure) UiHotKey() string {
keys := map[string]string{
"project": "1",
"history": "2",
"monitors": "3",
"names": "4",
"abis": "5",
"indexes": "6",
"manifests": "7",
"status": "8",
"settings": "9",
"daemons": "0",
"session": "u",
"config": "v",
"wizard": "w",
}
return keys[s.UiRouteName()]
}

func (s *Structure) IsHistory() bool {
return s.UiRouteName() == "history"
}

func (s *Structure) IsProject() bool {
return s.UiRouteName() == "project"
}

func (s *Structure) IsWizard() bool {
return s.UiRouteName() == "wizard"
}

func (s *Structure) UiRouteNum() uint64 {
parts := strings.Split(s.UiRoute, "-")
return base.MustParseUint64(parts[0])
Expand All @@ -340,22 +385,18 @@ func (s *Structure) UiRouteName() string {
return parts[1]
}

func (s *Structure) UiRouteStr() string {
ret := s.UiRouteName()
func (s *Structure) UiRouteRoute() string {
ret := Lower(s.UiRouteName())
if ret == "project" {
return ""
}
return ret
}

func (s *Structure) IsHistory() bool {
return s.UiRouteName() == "history"
func (s *Structure) UiRouteLabel() string {
return FirstUpper(s.UiRouteName())
}

func (s *Structure) IsProject() bool {
return s.UiRouteName() == "project"
}

func (s *Structure) IsWizard() bool {
return s.UiRouteName() == "wizard"
func (s *Structure) UiRouteLower() string {
return Lower(s.UiRouteName())
}

0 comments on commit 44bddaa

Please sign in to comment.