Skip to content

Commit

Permalink
refactor: Improve resource and service handling in controller Next me…
Browse files Browse the repository at this point in the history
…thod.
  • Loading branch information
tolgaOzen committed Dec 26, 2024
1 parent 860b166 commit 6fcd260
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/aws/groups/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ func (c *Controller) Next() tea.Model {
return NewServiceList(c)
}
} else {
// Handle case where resource is defined
if c.State.resource != nil {
return NewCreatePolicy(c)
}

// Handle case where service is defined
if c.State.service != nil {
return NewResourceList(c)
}
// If no policy option is selected
return NewPolicyOptionList(c)
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/aws/roles/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,15 @@ func (c *Controller) Next() tea.Model {
return NewServiceList(c)
}
} else {
// Handle case where resource is defined
if c.State.resource != nil {
return NewCreatePolicy(c)
}

// Handle case where service is defined
if c.State.service != nil {
return NewResourceList(c)
}
// If no policy option is selected
return NewPolicyOptionList(c)
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/aws/users/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,15 @@ func (c *Controller) Next() tea.Model {
return NewServiceList(c)
}
} else {
// Handle case where resource is defined
if c.State.resource != nil {
return NewCreatePolicy(c)
}

// Handle case where service is defined
if c.State.service != nil {
return NewResourceList(c)
}
// If no policy option is selected
return NewPolicyOptionList(c)
}
Expand Down

0 comments on commit 6fcd260

Please sign in to comment.