console/behavior/behavior-detail.sql
SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
-- not including breadcrumbs from sqlpage_aide_navigation
-- not including page title from sqlpage_aide_navigation
-- Breadcrumbs
SELECT 'breadcrumb' as component;
SELECT 'Home' as title, sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' as link;
SELECT 'Console' as title, sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console/index.sql' as link;
SELECT 'Behavior' as title, sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console/behavior/index.sql' as link;
SELECT behavior_name as title FROM behavior WHERE behavior_id = $behavior_id;
SELECT 'title' AS component,
(SELECT behavior_name FROM behavior WHERE behavior_id = $behavior_id) AS contents;
SELECT 'text' AS component,
'Detailed view of behavior configuration including JSON configuration, governance settings, and associated device information.' AS contents;
-- Behavior details card
SELECT 'card' AS component, 2 AS columns;
SELECT
'Behavior ID' AS title,
behavior_id AS description,
'blue' AS color
FROM behavior
WHERE behavior_id = $behavior_id;
SELECT
'Device' AS title,
(SELECT name FROM device WHERE device_id = b.device_id) AS description,
'green' AS color
FROM behavior b
WHERE behavior_id = $behavior_id;
-- Configuration details
SELECT 'title' AS component, 'Configuration Details' AS contents, 2 AS level;
SELECT 'table' AS component;
SELECT
'Behavior Name' AS "Property",
behavior_name AS "Value"
FROM behavior WHERE behavior_id = $behavior_id
UNION ALL
SELECT
'Device ID' AS "Property",
device_id AS "Value"
FROM behavior WHERE behavior_id = $behavior_id
UNION ALL
SELECT
'Created At' AS "Property",
created_at AS "Value"
FROM behavior WHERE behavior_id = $behavior_id
UNION ALL
SELECT
'Created By' AS "Property",
created_by AS "Value"
FROM behavior WHERE behavior_id = $behavior_id
UNION ALL
SELECT
'Updated At' AS "Property",
COALESCE(updated_at, 'Never') AS "Value"
FROM behavior WHERE behavior_id = $behavior_id
UNION ALL
SELECT
'Updated By' AS "Property",
COALESCE(updated_by, 'N/A') AS "Value"
FROM behavior WHERE behavior_id = $behavior_id;
-- JSON Configuration
SELECT 'title' AS component, 'JSON Configuration' AS contents, 2 AS level;
SELECT 'code' AS component;
SELECT
'json' as language,
behavior_conf_json as contents
FROM behavior
WHERE behavior_id = $behavior_id;
-- Governance (if available)
SELECT 'title' AS component, 'Governance' AS contents, 2 AS level
WHERE EXISTS (SELECT 1 FROM behavior WHERE behavior_id = $behavior_id AND governance IS NOT NULL);
SELECT 'code' AS component
WHERE EXISTS (SELECT 1 FROM behavior WHERE behavior_id = $behavior_id AND governance IS NOT NULL);
SELECT
'json' as language,
governance as contents
FROM behavior
WHERE behavior_id = $behavior_id AND governance IS NOT NULL;
-- Show message if no governance
SELECT 'text' AS component,
'No governance configuration available for this behavior.' AS contents
WHERE NOT EXISTS (SELECT 1 FROM behavior WHERE behavior_id = $behavior_id AND governance IS NOT NULL);