74 lines
3.1 KiB
SQL
74 lines
3.1 KiB
SQL
SELECT 'dynamic' AS component, sqlpage.run_sql('shell.sql') AS properties;
|
|
|
|
|
|
|
|
|
|
--Delete an incident
|
|
DELETE FROM incident WHERE id = $delete
|
|
|
|
SELECT 'table' AS component,
|
|
'id' AS ID_Number,
|
|
'Title' AS title,
|
|
'Description' AS Description,
|
|
'EstimatedDuration' AS EstimatedDuration,
|
|
'WhoIsAffected' AS WhoIsAffected,
|
|
'Applications' AS Application,
|
|
'Date' AS Date,
|
|
'Edit_Action' AS markdown,
|
|
'Remove_Action' AS markdown,
|
|
TRUE AS sort,
|
|
TRUE AS search;
|
|
|
|
SELECT i.id AS ID_Number,
|
|
i.title AS title,
|
|
i.Description AS Description,
|
|
i.estimated_duration AS EstimatedDuration,
|
|
i.who_is_affected AS WhoIsAffected,
|
|
i.date_time AS Date,
|
|
'[Edit](incidents.sql?edit=' || i.id || ')' AS Edit_Action,
|
|
'[🗑️](incidents.sql?delete=' || i.id || ')' AS Remove_Action
|
|
FROM incident i
|
|
;
|
|
|
|
-- Add "Add New" button to set the $add parameter
|
|
SELECT 'button' as component, 'center' as justify;
|
|
SELECT '?add=1' as link, 'Add New' as title; -- Dynamic link for add new
|
|
|
|
-- Display a form for adding or editing an incident
|
|
SELECT 'form' AS component, 'multipart/form-data' AS enctype, 'Add an incident' AS title, 'incidents_submit.sql' as action;
|
|
SELECT (SELECT title FROM incident WHERE id = $edit) AS value, 'Title' AS name, 8 as 'width';
|
|
SELECT (SELECT estimated_duration FROM incident WHERE id = $edit) AS value, 'EstimatedDuration' AS name, 4 as 'width';
|
|
SELECT (SELECT Description FROM incident WHERE id = $edit) AS value, 'Description' AS name, 'textarea' AS type, 8 as 'width';
|
|
SELECT (SELECT who_is_affected FROM incident WHERE id = $edit) AS value, 'WhoIsAffected' AS name, 4 as 'width';
|
|
SELECT (SELECT date_time FROM incident WHERE id = $edit) 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,
|
|
'DETECTION' as selected;
|
|
SELECT 'Severity' AS name,
|
|
'radio' as type,
|
|
'1' as value,
|
|
'part of the application is not useable' as description,
|
|
'Severe' as label,
|
|
'orange' as color;
|
|
SELECT 'Severity' AS name,
|
|
'radio' as type,
|
|
'2' as value,
|
|
'the whole application is not useable' as description,
|
|
'Blocking' as label,
|
|
'red' as color;
|
|
|
|
;
|
|
|
|
select 'checkbox' as type,
|
|
2 as width,
|
|
'Applications[]' AS name,
|
|
application.id AS value,
|
|
application.name AS label
|
|
FROM application |