From 69ba166aee2b79678e14fdbab8e62a90c3e239df Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 23:01:43 -0600 Subject: [PATCH] My simple caveman brain can't keep the orderBy vs orderHow straight. They are both strings so the compiler can't catch us/help us when these get reversed. We could make this separate type defs to help with that. Looks like orderBy should be first in the arg list...so that's what i'm trying to go with. --- deploy/clowdapp.yaml | 2 +- internal/api/connectors/inventory/inventory.go | 10 +++++----- .../controllers/private/highlevelConnectionStatus.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deploy/clowdapp.yaml b/deploy/clowdapp.yaml index f2ee14b7..a496791d 100644 --- a/deploy/clowdapp.yaml +++ b/deploy/clowdapp.yaml @@ -167,7 +167,7 @@ objects: - name: INVENTORY_CONNECTOR_PORT value: ${INVENTORY_CONNECTOR_PORT} - name: INVENTORY_CONNECTOR_ORDERED_HOW - value: "display_name" + value: "ASC" - name: INVENTORY_CONNECTOR_ORDERED_BY value: "display_name" diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 0ce4baee..6656a02f 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -121,8 +121,8 @@ func NewInventoryClient(cfg *viper.Viper) InventoryConnector { func (this *inventoryConnectorImpl) getHostDetails( ctx context.Context, IDs []string, - orderHow string, orderBy string, + orderHow string, limit int, offset int, ) (details []HostOut, err error) { @@ -147,8 +147,8 @@ func (this *inventoryConnectorImpl) getHostDetails( func (this *inventoryConnectorImpl) getSystemProfileDetails( ctx context.Context, IDs []string, - orderHow string, orderBy string, + orderHow string, limit int, offset int, ) (details map[string]HostSystemProfileOut, err error) { @@ -173,9 +173,9 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( return formatedResults, nil } -func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context, IDs []string, order_how string, order_by string, limit int, offset int) (details []HostDetails, err error) { +func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context, IDs []string, order_by string, order_how string, limit int, offset int) (details []HostDetails, err error) { - hostResults, err := this.getHostDetails(ctx, IDs, order_how, order_by, limit, offset) + hostResults, err := this.getHostDetails(ctx, IDs, order_by, order_how, limit, offset) if err != nil { return nil, err @@ -185,7 +185,7 @@ func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context return nil, nil } - systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_how, order_by, limit, offset) + systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_by, order_how, limit, offset) if err != nil { return nil, err diff --git a/internal/api/controllers/private/highlevelConnectionStatus.go b/internal/api/controllers/private/highlevelConnectionStatus.go index 89e4ffb5..f6c0f5b7 100644 --- a/internal/api/controllers/private/highlevelConnectionStatus.go +++ b/internal/api/controllers/private/highlevelConnectionStatus.go @@ -36,8 +36,8 @@ func (this *controllers) ApiInternalHighlevelConnectionStatus(ctx echo.Context) hostConnectorDetails, err := this.inventoryConnectorClient.GetHostConnectionDetails( ctx.Request().Context(), input.Hosts, - this.config.GetString("inventory.connector.ordered.how"), this.config.GetString("inventory.connector.ordered.by"), + this.config.GetString("inventory.connector.ordered.how"), this.config.GetInt("inventory.connector.limit"), this.config.GetInt("inventory.connector.offset"), )