Skip to content

Commit

Permalink
fix: add ECR tagged inputs for DescribeRepository (#2)
Browse files Browse the repository at this point in the history
* fix: ecr-tagged and add max results to 1000

* style: remove newline after textinput

* docs: get ARGS for makefile

* style: altscreen when Run tui

* ci: no trigger goreleaswer for pull_requests
  • Loading branch information
jaehong21 authored Sep 18, 2024
1 parent 2b5ef97 commit 51113a8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: goreleaser

on:
pull_request:
push:
tags:
- "*"
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ build:
@echo "Build complete"

dev: build
@echo "Running ${PROJECT_NAME}..."
${TARGET_PATH}/${PROJECT_NAME}.${GOOS}.${GOARCH}
@echo "Running ${PROJECT_NAME} with arguments: $(ARGS)..."
${TARGET_PATH}/${PROJECT_NAME}.${GOOS}.${GOARCH} $(ARGS)

clean:
@echo "Cleaning up..."
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var rootCmd = &cobra.Command{
newConfig := config.Initialize()
config.SetAwsProfile(awsProfile)

// p := tea.NewProgram(tui.New(newConfig), tea.WithAltScreen())
p := tea.NewProgram(tui.New(newConfig))
p := tea.NewProgram(tui.New(newConfig), tea.WithAltScreen())
// p := tea.NewProgram(tui.New(newConfig))
if _, err := p.Run(); err != nil {
log.Fatal(err)
}
Expand Down
16 changes: 9 additions & 7 deletions internal/aws/ecr/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ func DescribeRepositories() ([]types.Repository, error) {
if err := setupClient(); err != nil {
return nil, err
}
repositories, err := client.DescribeRepositories(context.TODO(), &ecr.DescribeRepositoriesInput{})

maxResults := int32(1000)
repositories, err := client.DescribeRepositories(context.TODO(), &ecr.DescribeRepositoriesInput{
MaxResults: &maxResults,
})
if err != nil {
return nil, err
}
Expand All @@ -36,18 +40,16 @@ func DescribeImages(repositoryName *string) ([]types.ImageDetail, error) {
}
images, err := client.DescribeImages(context.TODO(), &ecr.DescribeImagesInput{
RepositoryName: repositoryName,
Filter: &types.DescribeImagesFilter{
TagStatus: types.TagStatusTagged,
},
})
if err != nil {
return nil, err
}

var result []types.ImageDetail
for _, image := range images.ImageDetails {
// list images with tag only
if len(image.ImageTags) > 0 {
result = append(result, image)
}
}
result = append(result, images.ImageDetails...)

// sort by ImagePushedAt
sort.Slice(result, func(i, j int) bool {
Expand Down
3 changes: 2 additions & 1 deletion tui/aws/ecr/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func (m Model) View() string {
var s string

s += "\n" + m.textinput.View() + "\n"
s += "\n" + m.textinput.View()

s += m.loadingRender()
s += m.tableRender()
Expand Down Expand Up @@ -77,6 +77,7 @@ func (m Model) footerRender() string {
s += " " + TabSelectedStyle.Render("<image>")
}

s += "\n" + " " + HelpStyle.Render("Max items: 1000")
s += "\n\n"

return s
Expand Down

0 comments on commit 51113a8

Please sign in to comment.