Files
dashboard-sqlpage/incident.sql
2025-04-06 22:30:23 +02:00

59 lines
1.9 KiB
SQL

SELECT 'dynamic' AS component, sqlpage.run_sql('shell.sql') AS properties;
-- Write the name of the group in the title of the page
SELECT 'title' as component, title as contents FROM incident WHERE id = $id;
select
'datagrid' as component,
title as title,
description as description_md
FROM incident WHERE incident.id = $id
;
select
'Status' as title,
status as description,
CASE
WHEN incident.status = 'CLOSED' THEN 'green'
ELSE 'yellow'
END
as color
FROM incident WHERE id = $id
;
select
'Severity' as title,
severity.name as description,
severity.color as color
FROM incident, severity WHERE incident.id = $id
AND severity.id = incident.severity
;
select
'Who is affected' as title,
who_is_affected as description
FROM incident WHERE id = $id
;
select
'Estimated duration' as title,
estimated_duration as description
FROM incident WHERE id = $id
;
select 'list' as component,
'Affected applications' as title;
select a.name as title
from application a
join incident_application on a.id = incident_application.application_id
where incident_application.incident_id = $id;
-- Display a form for adding or editing an incident
SELECT 'form' AS component, 'multipart/form-data' AS enctype, 'Add information' AS title, 'incident_update.sql' as action;
SELECT (SELECT datetime()) AS value, 'DateTime' AS name, 'datetime-local' as type, 4 as width;
select
'status' as name,
true as required,
4 as 'width',
(select status from incident WHERE incident.id = $id) as value,
'select' as type,
'Select a status...' as empty_option,
'[{"label": "DETECTION", "value": "DETECTION"}, {"label": "ANALYSIS", "value": "ANALYSIS"}
, {"label": "RESOLUTION", "value": "RESOLUTION"}, {"label": "CLOSED", "value": "CLOSED"}]' as options;
SELECT 'Information' AS name, 'textarea' AS type, 8 as 'width', true as required;