This commit is contained in:
@@ -586,8 +586,17 @@ func CreateTableReport(logger *slog.Logger, Database db.Database, ctx context.Co
|
||||
query = fmt.Sprintf(`%s WHERE %s`, query, templateExclusionFilter())
|
||||
}
|
||||
orderBy := snapshotOrderBy(columns)
|
||||
orderDir := "DESC"
|
||||
isHourly := strings.HasPrefix(tableName, "inventory_hourly_")
|
||||
isDailySummaryTable := strings.HasPrefix(tableName, "inventory_daily_summary_")
|
||||
isMonthlySummaryTable := strings.HasPrefix(tableName, "inventory_monthly_summary_")
|
||||
if hasColumn(columns, "CreationTime") && (isHourly || isDailySummaryTable || isMonthlySummaryTable) {
|
||||
// Sort inventory rows by creation time ascending so newest VMs appear last.
|
||||
orderBy = "CreationTime"
|
||||
orderDir = "ASC"
|
||||
}
|
||||
if orderBy != "" {
|
||||
query = fmt.Sprintf(`%s ORDER BY "%s" DESC`, query, orderBy)
|
||||
query = fmt.Sprintf(`%s ORDER BY "%s" %s`, query, orderBy, orderDir)
|
||||
}
|
||||
|
||||
rows, err := dbConn.QueryxContext(ctx, query)
|
||||
|
||||
@@ -7,9 +7,10 @@ import (
|
||||
)
|
||||
|
||||
// UpdateCleanup removes orphaned update records.
|
||||
// @Summary Cleanup updates
|
||||
// @Description Removes update records that are no longer associated with a VM.
|
||||
// @Summary Cleanup updates (deprecated)
|
||||
// @Description Deprecated: Removes update records that are no longer associated with a VM.
|
||||
// @Tags maintenance
|
||||
// @Deprecated
|
||||
// @Produce text/plain
|
||||
// @Success 200 {string} string "Cleanup completed"
|
||||
// @Failure 500 {string} string "Server error"
|
||||
|
||||
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
// VcCleanup removes inventory entries for a vCenter instance.
|
||||
// @Summary Cleanup vCenter inventory
|
||||
// @Description Removes all inventory entries associated with a vCenter URL.
|
||||
// @Summary Cleanup vCenter inventory (deprecated)
|
||||
// @Description Deprecated: Removes all inventory entries associated with a vCenter URL.
|
||||
// @Tags maintenance
|
||||
// @Deprecated
|
||||
// @Produce json
|
||||
// @Param vc_url query string true "vCenter URL"
|
||||
// @Success 200 {object} map[string]string "Cleanup completed"
|
||||
|
||||
@@ -15,9 +15,10 @@ import (
|
||||
)
|
||||
|
||||
// VmCreateEvent records a VM creation CloudEvent.
|
||||
// @Summary Record VM create event
|
||||
// @Description Parses a VM create CloudEvent and stores the event data.
|
||||
// @Summary Record VM create event (deprecated)
|
||||
// @Description Deprecated: Parses a VM create CloudEvent and stores the event data.
|
||||
// @Tags events
|
||||
// @Deprecated
|
||||
// @Accept json
|
||||
// @Produce text/plain
|
||||
// @Param event body models.CloudEventReceived true "CloudEvent payload"
|
||||
|
||||
@@ -13,9 +13,10 @@ import (
|
||||
)
|
||||
|
||||
// VmDeleteEvent records a VM deletion CloudEvent in the inventory.
|
||||
// @Summary Record VM delete event
|
||||
// @Description Parses a VM delete CloudEvent and marks the VM as deleted in inventory.
|
||||
// @Summary Record VM delete event (deprecated)
|
||||
// @Description Deprecated: Parses a VM delete CloudEvent and marks the VM as deleted in inventory.
|
||||
// @Tags events
|
||||
// @Deprecated
|
||||
// @Accept json
|
||||
// @Produce text/plain
|
||||
// @Param event body models.CloudEventReceived true "CloudEvent payload"
|
||||
|
||||
@@ -20,9 +20,10 @@ import (
|
||||
)
|
||||
|
||||
// VmModifyEvent records a VM modification CloudEvent.
|
||||
// @Summary Record VM modify event
|
||||
// @Description Parses a VM modify CloudEvent and creates an update record when relevant changes are detected.
|
||||
// @Summary Record VM modify event (deprecated)
|
||||
// @Description Deprecated: Parses a VM modify CloudEvent and creates an update record when relevant changes are detected.
|
||||
// @Tags events
|
||||
// @Deprecated
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param event body models.CloudEventReceived true "CloudEvent payload"
|
||||
|
||||
@@ -15,9 +15,10 @@ import (
|
||||
)
|
||||
|
||||
// VmMoveEvent records a VM move CloudEvent as an update.
|
||||
// @Summary Record VM move event
|
||||
// @Description Parses a VM move CloudEvent and creates an update record.
|
||||
// @Summary Record VM move event (deprecated)
|
||||
// @Description Deprecated: Parses a VM move CloudEvent and creates an update record.
|
||||
// @Tags events
|
||||
// @Deprecated
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param event body models.CloudEventReceived true "CloudEvent payload"
|
||||
|
||||
Reference in New Issue
Block a user