- Added CloudlyTaskManager class for managing tasks, including registration, execution, scheduling, and cancellation. - Created predefined tasks: DNS Sync, Certificate Renewal, Cleanup, Health Check, Resource Report, Database Maintenance, Security Scan, and Docker Cleanup. - Introduced ITaskExecution interface for tracking task execution details and outcomes. - Developed API request interfaces for task management operations (getTasks, getTaskExecutions, triggerTask, cancelTask). - Implemented CloudlyViewTasks web component for displaying tasks and their execution history, including filtering and detailed views.
84 lines
1.6 KiB
TypeScript
84 lines
1.6 KiB
TypeScript
/**
|
|
* Task execution tracking for the task management system
|
|
* Tasks themselves are hard-coded using @push.rocks/taskbuffer
|
|
* This interface tracks execution history and outcomes
|
|
*/
|
|
export interface ITaskExecution {
|
|
id: string;
|
|
data: {
|
|
/**
|
|
* Name of the task being executed
|
|
*/
|
|
taskName: string;
|
|
|
|
/**
|
|
* Optional description of what the task does
|
|
*/
|
|
taskDescription?: string;
|
|
|
|
/**
|
|
* Category for grouping tasks
|
|
*/
|
|
category?: 'maintenance' | 'deployment' | 'backup' | 'monitoring' | 'cleanup' | 'system' | 'security';
|
|
|
|
/**
|
|
* Timestamp when the task started
|
|
*/
|
|
startedAt: number;
|
|
|
|
/**
|
|
* Timestamp when the task completed
|
|
*/
|
|
completedAt?: number;
|
|
|
|
/**
|
|
* Current status of the task execution
|
|
*/
|
|
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
|
|
/**
|
|
* Duration in milliseconds
|
|
*/
|
|
duration?: number;
|
|
|
|
/**
|
|
* How the task was triggered
|
|
*/
|
|
triggeredBy: 'schedule' | 'manual' | 'system';
|
|
|
|
/**
|
|
* User ID if manually triggered
|
|
*/
|
|
userId?: string;
|
|
|
|
/**
|
|
* Execution logs
|
|
*/
|
|
logs: Array<{
|
|
timestamp: number;
|
|
message: string;
|
|
severity: 'info' | 'warning' | 'error' | 'success';
|
|
}>;
|
|
|
|
/**
|
|
* Task-specific metrics
|
|
*/
|
|
metrics?: {
|
|
[key: string]: any;
|
|
};
|
|
|
|
/**
|
|
* Final result/output of the task
|
|
*/
|
|
result?: any;
|
|
|
|
/**
|
|
* Error details if the task failed
|
|
*/
|
|
error?: {
|
|
message: string;
|
|
stack?: string;
|
|
code?: string;
|
|
};
|
|
};
|
|
} |