From 757af11ab35479aa5bdb03545bae0fe89cb4b509 Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 20 Apr 2026 15:55:56 +0800 Subject: [PATCH] chore: history options --- src/locales/en-US/models.ts | 8 +- src/locales/ja-JP/models.ts | 8 +- src/locales/ru-RU/models.ts | 8 +- src/locales/tr-TR/models.ts | 8 +- src/locales/zh-CN/models.ts | 7 +- .../llmodels/components/view-logs-modal.tsx | 95 +++++++++++-------- .../use-query-instance-restart-count.ts | 3 +- 7 files changed, 83 insertions(+), 54 deletions(-) diff --git a/src/locales/en-US/models.ts b/src/locales/en-US/models.ts index 9856dfce..320516cc 100644 --- a/src/locales/en-US/models.ts +++ b/src/locales/en-US/models.ts @@ -283,7 +283,9 @@ export default { 'models.table.modelView': 'Model List', 'models.table.instanceView': 'Instance List', 'models.table.category': 'Category', - 'models.instance.firstStart': 'First Deployment', - 'models.instance.lastStart': 'Last Startup', - 'models.instance.startHistory': 'Startup History' + 'models.instance.currentRun': 'Current Run', + 'models.instance.previousRun': 'Previous Run', + 'models.instance.startHistory': 'Run History', + 'models.instance.startHistory.tips': + 'Logs from the previous run before the current restart.' }; diff --git a/src/locales/ja-JP/models.ts b/src/locales/ja-JP/models.ts index 9bdbfbf6..16bebf20 100644 --- a/src/locales/ja-JP/models.ts +++ b/src/locales/ja-JP/models.ts @@ -283,9 +283,11 @@ export default { 'models.table.modelView': 'Model List', 'models.table.instanceView': 'Instance List', 'models.table.category': 'Category', - 'models.instance.firstStart': 'First Deployment', - 'models.instance.lastStart': 'Last Startup', - 'models.instance.startHistory': 'Startup History' + 'models.instance.currentRun': 'Current Run', + 'models.instance.previousRun': 'Previous Run', + 'models.instance.startHistory': 'Run History', + 'models.instance.startHistory.tips': + 'Logs from the previous run before the current restart.' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== diff --git a/src/locales/ru-RU/models.ts b/src/locales/ru-RU/models.ts index c42cddf2..48de8a20 100644 --- a/src/locales/ru-RU/models.ts +++ b/src/locales/ru-RU/models.ts @@ -287,9 +287,11 @@ export default { 'models.table.modelView': 'Model List', 'models.table.instanceView': 'Instance List', 'models.table.category': 'Category', - 'models.instance.firstStart': 'First Deployment', - 'models.instance.lastStart': 'Last Startup', - 'models.instance.startHistory': 'Startup History' + 'models.instance.currentRun': 'Current Run', + 'models.instance.previousRun': 'Previous Run', + 'models.instance.startHistory': 'Run History', + 'models.instance.startHistory.tips': + 'Logs from the previous run before the current restart.' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== diff --git a/src/locales/tr-TR/models.ts b/src/locales/tr-TR/models.ts index 5ed0a9cd..4a35a10a 100644 --- a/src/locales/tr-TR/models.ts +++ b/src/locales/tr-TR/models.ts @@ -283,9 +283,11 @@ export default { 'models.table.modelView': 'Model List', 'models.table.instanceView': 'Instance List', 'models.table.category': 'Category', - 'models.instance.firstStart': 'First Deployment', - 'models.instance.lastStart': 'Last Startup', - 'models.instance.startHistory': 'Startup History' + 'models.instance.currentRun': 'Current Run', + 'models.instance.previousRun': 'Previous Run', + 'models.instance.startHistory': 'Run History', + 'models.instance.startHistory.tips': + 'Logs from the previous run before the current restart.' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== diff --git a/src/locales/zh-CN/models.ts b/src/locales/zh-CN/models.ts index 4447feb8..157f54be 100644 --- a/src/locales/zh-CN/models.ts +++ b/src/locales/zh-CN/models.ts @@ -267,7 +267,8 @@ export default { 'models.table.modelView': '模型列表', 'models.table.instanceView': '实例列表', 'models.table.category': '类别', - 'models.instance.firstStart': '首次部署', - 'models.instance.lastStart': '最近启动', - 'models.instance.startHistory': '启动记录' + 'models.instance.currentRun': '当前运行', + 'models.instance.previousRun': '上一次运行', + 'models.instance.startHistory': '运行记录', + 'models.instance.startHistory.tips': '显示当前重启之前那次运行的日志。' }; diff --git a/src/pages/llmodels/components/view-logs-modal.tsx b/src/pages/llmodels/components/view-logs-modal.tsx index c8fe4e65..7fdb3c6c 100644 --- a/src/pages/llmodels/components/view-logs-modal.tsx +++ b/src/pages/llmodels/components/view-logs-modal.tsx @@ -1,9 +1,9 @@ import useSetChunkRequest from '@/hooks/use-chunk-request'; import { formatOrdinal } from '@/utils'; -import { CloseOutlined } from '@ant-design/icons'; +import { CloseOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import { BaseSelect, LogsViewer } from '@gpustack/core-ui'; import { useIntl } from '@umijs/max'; -import { Button, Modal } from 'antd'; +import { Button, Modal, Tooltip } from 'antd'; import dayjs from 'dayjs'; import React, { useCallback, useEffect, useState } from 'react'; import { MODELS_API } from '../apis'; @@ -115,11 +115,11 @@ const ViewLogsModal: React.FC = (props) => { const optionRender = (option: any) => { const { data = {} } = option || {}; let label = formatOrdinal(data.value); - if (data.value === 0) { - label = intl.formatMessage({ id: 'models.instance.firstStart' }); + if (data.isCurrent) { + label = intl.formatMessage({ id: 'models.instance.currentRun' }); } - if (data.isLast) { - label = intl.formatMessage({ id: 'models.instance.lastStart' }); + if (data.isPrevious) { + label = intl.formatMessage({ id: 'models.instance.previousRun' }); } return renderLabel(label, data.start_at); }; @@ -132,38 +132,58 @@ const ViewLogsModal: React.FC = (props) => { const renderTitle = () => { return ( - + {intl.formatMessage({ id: 'common.button.viewlog' })} - - {intl.formatMessage({ id: 'models.instance.startHistory' })} ( - {countOptions.length}) - - } - options={countOptions} - labelRender={labelRender} - optionRender={optionRender} - style={{ - width: 400, - marginRight: 16 - }} - > + {countOptions.length > 1 && ( + + {intl.formatMessage({ id: 'models.instance.startHistory' })} + + + {intl.formatMessage({ + id: 'models.instance.previousRun' + })} + : + + {intl.formatMessage({ + id: 'models.instance.startHistory.tips' + })} + + } + > + + + + } + options={countOptions} + labelRender={labelRender} + optionRender={optionRender} + style={{ + width: 400, + marginRight: 16 + }} + > + )}