Skip to content
Open
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
14 changes: 10 additions & 4 deletions pkg/argoApplication/ArgoApplicationService.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/api/errors"
"net/http"
"strings"
)

type ArgoApplicationService interface {
Expand Down Expand Up @@ -160,6 +161,11 @@ func (impl *ArgoApplicationServiceImpl) ListApplications(clusterIds []int) ([]*b

func getApplicationListDtos(resp *k8s.ClusterResourceListMap, clusterName string, clusterId int) []*bean.ArgoApplicationListDto {
appLists := make([]*bean.ArgoApplicationListDto, 0)
// BuildK8sObjectListTableData (common-lib) lower-cases the Table column names when it builds the
// row maps, so the keys are "sync status" / "health status", not the "Sync Status" / "Health Status"
// printer-column names. Lower-case the lookup keys too, otherwise both statuses are always empty.
syncStatusKey := strings.ToLower(k8sCommonBean.K8sResourceColumnDefinitionSyncStatus)
healthStatusKey := strings.ToLower(k8sCommonBean.K8sResourceColumnDefinitionHealthStatus)
if resp != nil {
appLists = make([]*bean.ArgoApplicationListDto, len(resp.Data))
for i, rowData := range resp.Data {
Expand All @@ -175,13 +181,13 @@ func getApplicationListDtos(resp *k8s.ClusterResourceListMap, clusterName string
appListDto.Name = nameStr
}
}
if rowData[k8sCommonBean.K8sResourceColumnDefinitionSyncStatus] != nil {
if syncStatusStr, ok := rowData[k8sCommonBean.K8sResourceColumnDefinitionSyncStatus].(string); ok {
if rowData[syncStatusKey] != nil {
if syncStatusStr, ok := rowData[syncStatusKey].(string); ok {
appListDto.SyncStatus = syncStatusStr
}
}
if rowData[k8sCommonBean.K8sResourceColumnDefinitionHealthStatus] != nil {
if healthStatusStr, ok := rowData[k8sCommonBean.K8sResourceColumnDefinitionHealthStatus].(string); ok {
if rowData[healthStatusKey] != nil {
if healthStatusStr, ok := rowData[healthStatusKey].(string); ok {
appListDto.HealthStatus = healthStatusStr
}
}
Expand Down