Files
crawlab/frontend/crawlab-ui/typings/interfaces/views/task.d.ts
Marvin Zhang b5f10cb6a8 feat: add TypeScript interfaces for Vuex store modules
- Introduced new interfaces for various store modules including environment, file, git, layout, node, notification alerts, channels, requests, settings, plugins, projects, roles, schedules, spiders, systems, tags, tasks, tokens, and users.
- Each module includes state, getters, mutations, and actions definitions to enhance type safety and maintainability.
- Added utility interfaces for file handling and view-specific types for database, git, login, node, project, result, schedule, spider, task, and user.
- Improved overall structure and organization of TypeScript typings for better developer experience.
2025-09-12 14:57:42 +08:00

57 lines
1.1 KiB
TypeScript

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';
}