build(desktop): 升级 electron-shell 版本至 1.6.3 并调整插件执行超时配置
- 插件执行超时默认延长至 6 小时,支持插件单独配置超时时间 - 新增插件根目录迁移逻辑,解决旧版权限问题 - 新增多个服务端实体、DTO、配置模块等基础代码 - 新增插件 UI 模板及相关静态资源
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
import { Column, Entity, Index, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* 运行上报(现网 runtime_reports 表)
|
||||
*/
|
||||
@Entity('runtime_reports')
|
||||
export class RuntimeReportEntity {
|
||||
@PrimaryGeneratedColumn({ name: 'id', type: 'bigint', unsigned: true, comment: '记录自增ID' })
|
||||
id: number;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'account', type: 'varchar', length: 64, default: '', comment: '运行账号(工号)' })
|
||||
account: string;
|
||||
|
||||
@Column({ name: 'device_id', type: 'varchar', length: 64, default: '', comment: '执行机设备ID' })
|
||||
deviceId: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'plugin_id', type: 'varchar', length: 64, default: '', comment: '插件ID' })
|
||||
pluginId: string;
|
||||
|
||||
@Column({ name: 'version', type: 'varchar', length: 32, default: '', comment: '插件版本号' })
|
||||
version: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'status', type: 'varchar', length: 32, default: '', comment: 'start/done/success/error/failed' })
|
||||
status: string;
|
||||
|
||||
@Column({ name: 'msg', type: 'text', comment: '结果/错误信息' })
|
||||
msg: string;
|
||||
|
||||
@Column({ name: 'duration_sec', type: 'int', unsigned: true, default: 0, comment: '运行时长(秒)' })
|
||||
durationSec: number;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '上报时间' })
|
||||
at: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行机设备(现网 devices 表,主键 device_id)
|
||||
*/
|
||||
@Entity('devices')
|
||||
export class DeviceEntity {
|
||||
@PrimaryColumn({ name: 'device_id', type: 'varchar', length: 64, comment: '执行机设备ID' })
|
||||
deviceId: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'account', type: 'varchar', length: 64, default: '', comment: '当前登录账号' })
|
||||
account: string;
|
||||
|
||||
@Column({ name: 'hostname', type: 'varchar', length: 128, default: '', comment: '主机名' })
|
||||
hostname: string;
|
||||
|
||||
@Column({ name: 'os', type: 'varchar', length: 64, default: '', comment: '操作系统' })
|
||||
os: string;
|
||||
|
||||
@Column({ name: 'ip', type: 'varchar', length: 64, default: '', comment: 'IP 地址' })
|
||||
ip: string;
|
||||
|
||||
@Column({ name: 'chrome_installed', type: 'tinyint', width: 1, default: 0, comment: '是否已安装 Chrome' })
|
||||
chromeInstalled: number;
|
||||
|
||||
@Column({ name: 'chrome_version', type: 'varchar', length: 32, default: '', comment: 'Chrome 版本号' })
|
||||
chromeVersion: string;
|
||||
|
||||
@Column({ name: 'chrome_ok', type: 'tinyint', width: 1, default: 0, comment: 'Chrome 是否就绪' })
|
||||
chromeOk: number;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'last_seen', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '最后在线时间' })
|
||||
lastSeen: Date;
|
||||
|
||||
@Column({ name: 'status', type: 'tinyint', width: 1, default: 1, comment: '1=在线 0=离线' })
|
||||
status: number;
|
||||
|
||||
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '首次上报时间' })
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ name: 'updated_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 审计日志(现网 audit_logs 表)
|
||||
*/
|
||||
@Entity('audit_logs')
|
||||
export class AuditLogEntity {
|
||||
@PrimaryGeneratedColumn({ name: 'id', type: 'bigint', unsigned: true, comment: '日志自增ID' })
|
||||
id: number;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'account', type: 'varchar', length: 64, default: '', comment: '操作账号' })
|
||||
account: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'action', type: 'varchar', length: 64, comment: '动作' })
|
||||
action: string;
|
||||
|
||||
@Column({ name: 'target', type: 'varchar', length: 128, default: '', comment: '操作对象' })
|
||||
target: string;
|
||||
|
||||
@Column({ name: 'detail', type: 'text', comment: '操作详情(JSON)' })
|
||||
detail: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '操作时间' })
|
||||
at: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知(现网 notifications 表)
|
||||
*/
|
||||
@Entity('notifications')
|
||||
export class NotificationEntity {
|
||||
@PrimaryGeneratedColumn({ name: 'id', type: 'int', unsigned: true, comment: '通知ID' })
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'title', type: 'varchar', length: 200, comment: '标题' })
|
||||
title: string;
|
||||
|
||||
@Column({ name: 'content', type: 'text', comment: '内容' })
|
||||
content: string;
|
||||
|
||||
@Column({ name: 'level', type: 'varchar', length: 16, default: 'info', comment: 'info/warning/important' })
|
||||
level: string;
|
||||
|
||||
@Column({ name: 'target', type: 'varchar', length: 16, default: 'all', comment: 'all/account' })
|
||||
target: string;
|
||||
|
||||
@Column({ name: 'account', type: 'varchar', length: 64, default: '', comment: 'target=account 时的目标账号' })
|
||||
account: string;
|
||||
|
||||
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '创建时间' })
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ name: 'expires_at', type: 'datetime', nullable: true, comment: '过期时间' })
|
||||
expiresAt: Date;
|
||||
|
||||
@Column({ name: 'active', type: 'tinyint', width: 1, default: 1, comment: '1=启用 0=停用' })
|
||||
active: number;
|
||||
}
|
||||
Reference in New Issue
Block a user