Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const (
)

const (
AppNameSortBy SortBy = "appNameSort"
AppNameSortBy SortBy = "appNameSort"
LastDeployedSortBy = "lastDeployedSort"
)

func (impl AppListingRepositoryQueryBuilder) BuildAppListingQuery(appListingFilter AppListingFilter) string {
Expand Down
14 changes: 14 additions & 0 deletions pkg/app/AppListingViewBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ func (impl *AppListingViewBuilderImpl) BuildView(fetchAppListingRequest FetchApp
return appContainersResponses[i].AppName > appContainersResponses[j].AppName
})
}
} else if helper.LastDeployedSortBy == fetchAppListingRequest.SortBy {
if fetchAppListingRequest.SortOrder == helper.Asc {
sort.Slice(appContainersResponses, func(i, j int) bool {
deployedTime1 := appContainersResponses[i].AppEnvironmentContainer[0].LastDeployedTime
deployedTime2 := appContainersResponses[j].AppEnvironmentContainer[0].LastDeployedTime
return deployedTime1 > deployedTime2
})
} else if fetchAppListingRequest.SortOrder == helper.Desc {
sort.Slice(appContainersResponses, func(i, j int) bool {
deployedTime1 := appContainersResponses[i].AppEnvironmentContainer[0].LastDeployedTime
deployedTime2 := appContainersResponses[j].AppEnvironmentContainer[0].LastDeployedTime
return deployedTime1 < deployedTime2
})
}
}
}
return appContainersResponses, nil
Expand Down