import { LoaderCircle, Terminal, X } from 'lucide-react' import React from 'react' import '../i18n/domains/vm.gen' import { I18nKey, t } from '../i18n' import { taskDetail, taskTitle } from '../lib/tasks' import { Locale, Task } from '../types' import { Button, StatusShape } from '../ui/controls' interface Props { locale: Locale name: string task?: Task onCancel?: (taskId: string) => void onViewLogs: () => void } export const CreatingVMView: React.FC = ({ locale, name, task, onCancel, onViewLogs }) => { const tr = (k: I18nKey, v?: Record) => t(locale, k, v) const percent = task && typeof task.percent === 'number' ? task.percent : -1 const detail = task ? taskDetail(task) : '' const stepText = task?.step?.trim() || tr('creatingPreparing') const heading = task ? taskTitle(locale, task) : tr('taskCreate', { name }) return (

{name}

{tr('state_creating')}
{task?.cancelable && onCancel && ( )}
{tr('creatingProgressTitle')}
{percent >= 0 && {Math.floor(percent)}%}
{percent >= 0 && (
) }