Files
crawlab/frontend/crawlab-ui/typings/interfaces/views/task.d.ts
Marvin Zhang 4f57d277e7 refactor: standardize timestamp fields and improve code clarity
- Updated timestamp fields across the codebase from `*_ts` to `*_at` for consistency and clarity.
- Renamed constants for node status from "on"/"off" to "online"/"offline" to better reflect their meanings.
- Enhanced validation and error handling in various components to ensure data integrity.
- Refactored test cases to align with the new naming conventions and improve readability.
2025-04-21 18:13:22 +08:00

57 lines
1.1 KiB
Go

import {
TASK_MODE_ALL_NODES,
TASK_MODE_RANDOM,
TASK_MODE_SELECTED_NODES,
} from '@/constants/task';
export declare global {
interface Task extends BaseModel {
spider_id?: string;
spider_name?: string;
status?: TaskStatus;
node_id?: string;
node_name?: string;
pid?: number;
schedule_id?: string;
schedule_name?: string;
type?: string;
mode?: TaskMode;
parent_id?: string;
cmd?: string;
param?: string;
error?: string;
stat?: TaskStat;
priority?: number;
// view model
node?: CNode;
spider?: Spider;
schedule?: Schedule;
}
interface TaskStat {
create_ts?: string;
started_at?: string;
ended_at?: string;
result_count?: number;
error_log_count?: number;
wait_duration?: number;
runtime_duration?: number;
total_duration?: number;
}
type TaskMode =
| TASK_MODE_RANDOM
| TASK_MODE_ALL_NODES
| TASK_MODE_SELECTED_NODES;
type TaskStatus =
| 'abnormal'
| 'cancelled'
| 'error'
| 'finished'
| 'running'
| 'assigned'
| 'pending';
}