diff --git a/views/006_config_views.sql b/views/006_config_views.sql index 8e680c25..95d2d228 100644 --- a/views/006_config_views.sql +++ b/views/006_config_views.sql @@ -736,7 +736,8 @@ CREATE OR REPLACE VIEW config_detail AS 'changes', COALESCE(config_changes.changes_count, 0), 'playbook_runs', COALESCE(playbook_runs.playbook_runs_count, 0), 'checks', COALESCE(config_checks.checks_count, 0) - ) as summary + ) as summary, + to_json(config_components.components) as components FROM config_items as ci LEFT JOIN (SELECT config_id, count(*) as related_count FROM config_relationships GROUP BY config_id) as related @@ -765,7 +766,13 @@ CREATE OR REPLACE VIEW config_detail AS (SELECT config_id, count(*) as checks_count from check_config_relationships WHERE deleted_at IS NULL GROUP BY config_id) as config_checks - ON ci.id = config_checks.config_id; + ON ci.id = config_checks.config_id + LEFT JOIN + (SELECT ccr.config_id as config_id, components FROM config_component_relationships as ccr + LEFT JOIN components ON components.id = ccr.component_id + WHERE ccr.component_id = components.id + ) as config_components + ON ci.id = config_components.config_id; --- config_path is a function that given a config id returns its path by walking the tree recursively up using the parent id and then joining the ids with a `.` CREATE OR REPLACE FUNCTION config_path(UUID)