diff --git a/web/app/Services/Cloud/CloudJobService.php b/web/app/Services/Cloud/CloudJobService.php index 712b9658..a46d33f2 100644 --- a/web/app/Services/Cloud/CloudJobService.php +++ b/web/app/Services/Cloud/CloudJobService.php @@ -4125,16 +4125,12 @@ final class CloudJobService return $fields; } - /** - * Read the user's instance operation history directly from cloud_jobs. - * Power, reinstall and snapshot jobs are part of this user-facing audit view. - */ + /** Read the user's complete instance operation history from cloud_jobs. */ public static function operationLogs(CloudInstance $instance, int $page = 1, int $perPage = 10): array { $perPage = max(1, min(50, $perPage)); $query = CloudJob::where('instance_id', $instance->id) - ->whereIn('kind', ['action', 'reinstall', 'snapshot_create', - 'snapshot_restore', 'snapshot_delete', 'firewall_apply']) + ->whereIn('kind', CloudOperationCatalog::instanceLogKinds()) ->orderByDesc('id'); $total = max(0, (int) (clone $query)->count('id')); $pages = max(1, (int) ceil($total / $perPage)); diff --git a/web/app/Services/Cloud/CloudOperationCatalog.php b/web/app/Services/Cloud/CloudOperationCatalog.php index 46deb6a4..02a178f4 100644 --- a/web/app/Services/Cloud/CloudOperationCatalog.php +++ b/web/app/Services/Cloud/CloudOperationCatalog.php @@ -52,6 +52,19 @@ final class CloudOperationCatalog 'reset' => '强制重置', ]; + /** Jobs shown in the operation log on an instance detail page. */ + private const INSTANCE_LOG_KINDS = [ + 'action', + 'reinstall', + 'instance_settings', + 'network_change', + 'firewall_apply', + 'snapshot_create', + 'snapshot_restore', + 'snapshot_delete', + 'rescue', + ]; + /** Safe server-derived detail codes retained with instance-setting jobs. */ private const INSTANCE_SETTING_FIELDS = [ 'hostname' => '修改主机名', @@ -80,6 +93,12 @@ final class CloudOperationCatalog return array_key_exists($action, self::POWER_ACTIONS); } + /** Return every user-visible operation retained in instance history. */ + public static function instanceLogKinds(): array + { + return self::INSTANCE_LOG_KINDS; + } + public static function kindLabel(?string $kind, ?string $action = null, array $settingsFields = []): string { diff --git a/web/resources/views/venix/cloud/pages/detail.tpl b/web/resources/views/venix/cloud/pages/detail.tpl index 0fb820ae..adcafac0 100644 --- a/web/resources/views/venix/cloud/pages/detail.tpl +++ b/web/resources/views/venix/cloud/pages/detail.tpl @@ -31,7 +31,7 @@
记录这台实例的开机、关机、重启和重装系统任务。
记录这台实例的电源、重装、设置、网络、防火墙、快照和救援操作。
打开操作日志后加载。