Add Activity Timeline feature and database migrations
- Add Activity Timeline tab to ticket view showing chronological history - Create getTicketTimeline() method in AuditLogModel - Update TicketController to load timeline data - Add timeline UI with helper functions for formatting events - Add comprehensive timeline CSS with dark mode support - Create migrations 007-010 for upcoming features: - 007: Ticket assignment functionality - 008: Status workflow transitions - 009: Ticket templates - 010: Bulk operations tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
13
migrations/007_add_ticket_assignment.sql
Normal file
13
migrations/007_add_ticket_assignment.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- Migration 007: Add ticket assignment functionality
|
||||
-- Adds assigned_to column to tickets table
|
||||
|
||||
-- Add assigned_to column to tickets table
|
||||
ALTER TABLE tickets
|
||||
ADD COLUMN assigned_to INT NULL,
|
||||
ADD CONSTRAINT fk_tickets_assigned_to
|
||||
FOREIGN KEY (assigned_to)
|
||||
REFERENCES users(user_id)
|
||||
ON DELETE SET NULL;
|
||||
|
||||
-- Add index for performance
|
||||
CREATE INDEX idx_assigned_to ON tickets(assigned_to);
|
||||
31
migrations/008_add_status_workflows.sql
Normal file
31
migrations/008_add_status_workflows.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- Migration 008: Add status workflow management
|
||||
-- Creates status_transitions table for workflow validation
|
||||
|
||||
-- Table to define allowed status transitions
|
||||
CREATE TABLE status_transitions (
|
||||
transition_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
from_status VARCHAR(50) NOT NULL,
|
||||
to_status VARCHAR(50) NOT NULL,
|
||||
requires_comment BOOLEAN DEFAULT FALSE,
|
||||
requires_admin BOOLEAN DEFAULT FALSE,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY unique_transition (from_status, to_status),
|
||||
INDEX idx_from_status (from_status)
|
||||
);
|
||||
|
||||
-- Insert default transitions
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment) VALUES
|
||||
('Open', 'In Progress', FALSE),
|
||||
('Open', 'Closed', TRUE),
|
||||
('In Progress', 'Open', FALSE),
|
||||
('In Progress', 'Closed', TRUE),
|
||||
('Closed', 'Open', TRUE),
|
||||
('Closed', 'In Progress', FALSE);
|
||||
|
||||
-- Add new status "Resolved"
|
||||
INSERT INTO status_transitions (from_status, to_status, requires_comment) VALUES
|
||||
('In Progress', 'Resolved', FALSE),
|
||||
('Resolved', 'Closed', FALSE),
|
||||
('Resolved', 'In Progress', TRUE),
|
||||
('Open', 'Resolved', FALSE);
|
||||
24
migrations/009_add_ticket_templates.sql
Normal file
24
migrations/009_add_ticket_templates.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- Migration 009: Add ticket templates
|
||||
-- Creates ticket_templates table for reusable ticket templates
|
||||
|
||||
CREATE TABLE ticket_templates (
|
||||
template_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
template_name VARCHAR(100) NOT NULL,
|
||||
title_template VARCHAR(255) NOT NULL,
|
||||
description_template TEXT NOT NULL,
|
||||
category VARCHAR(50),
|
||||
type VARCHAR(50),
|
||||
default_priority INT DEFAULT 4,
|
||||
created_by INT,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (created_by) REFERENCES users(user_id),
|
||||
INDEX idx_template_name (template_name)
|
||||
);
|
||||
|
||||
-- Insert default templates
|
||||
INSERT INTO ticket_templates (template_name, title_template, description_template, category, type, default_priority) VALUES
|
||||
('Hardware Failure', 'Hardware Failure: [Device Name]', 'Device: \nIssue: \nError Messages: \nTroubleshooting Done: ', 'Hardware', 'Problem', 2),
|
||||
('Software Installation', 'Install [Software Name]', 'Software: \nVersion: \nLicense Key: \nInstallation Path: ', 'Software', 'Install', 3),
|
||||
('Network Issue', 'Network Issue: [Brief Description]', 'Affected System: \nSymptoms: \nIP Address: \nConnectivity Tests: ', 'Hardware', 'Problem', 2),
|
||||
('Maintenance Request', 'Scheduled Maintenance: [System Name]', 'System: \nMaintenance Type: \nScheduled Date: \nDowntime Expected: ', 'Hardware', 'Maintenance', 4);
|
||||
19
migrations/010_add_bulk_operations.sql
Normal file
19
migrations/010_add_bulk_operations.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Migration 010: Add bulk operations tracking
|
||||
-- Creates bulk_operations table for admin bulk actions
|
||||
|
||||
CREATE TABLE bulk_operations (
|
||||
operation_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
operation_type VARCHAR(50) NOT NULL,
|
||||
ticket_ids TEXT NOT NULL, -- Comma-separated
|
||||
performed_by INT NOT NULL,
|
||||
parameters JSON,
|
||||
status VARCHAR(20) DEFAULT 'pending',
|
||||
total_tickets INT,
|
||||
processed_tickets INT DEFAULT 0,
|
||||
failed_tickets INT DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
completed_at TIMESTAMP NULL,
|
||||
FOREIGN KEY (performed_by) REFERENCES users(user_id),
|
||||
INDEX idx_performed_by (performed_by),
|
||||
INDEX idx_created_at (created_at)
|
||||
);
|
||||
Reference in New Issue
Block a user