chore: history options
This commit is contained in:
@@ -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.'
|
||||
};
|
||||
|
||||
@@ -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) ==========
|
||||
|
||||
@@ -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) ==========
|
||||
|
||||
@@ -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) ==========
|
||||
|
||||
@@ -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': '显示当前重启之前那次运行的日志。'
|
||||
};
|
||||
|
||||
@@ -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<ViewModalProps> = (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<ViewModalProps> = (props) => {
|
||||
|
||||
const renderTitle = () => {
|
||||
return (
|
||||
<span className="flex-between flex-center gap-16">
|
||||
<span className="flex-between flex-center gap-16" style={{ height: 40 }}>
|
||||
<span style={{ fontWeight: 'var(--font-weight-bold)' }}>
|
||||
{intl.formatMessage({ id: 'common.button.viewlog' })}
|
||||
</span>
|
||||
<span>
|
||||
<BaseSelect
|
||||
allowClear
|
||||
value={record}
|
||||
onChange={handleOnChange}
|
||||
prefix={
|
||||
<span
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontSize: 13,
|
||||
marginRight: 8,
|
||||
paddingRight: 8,
|
||||
color: 'var(--ant-color-text-secondary)',
|
||||
borderRight: '1px solid var(--ant-color-split)'
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage({ id: 'models.instance.startHistory' })} (
|
||||
{countOptions.length})
|
||||
</span>
|
||||
}
|
||||
options={countOptions}
|
||||
labelRender={labelRender}
|
||||
optionRender={optionRender}
|
||||
style={{
|
||||
width: 400,
|
||||
marginRight: 16
|
||||
}}
|
||||
></BaseSelect>
|
||||
{countOptions.length > 1 && (
|
||||
<BaseSelect
|
||||
allowClear
|
||||
value={record}
|
||||
onChange={handleOnChange}
|
||||
prefix={
|
||||
<span
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontSize: 13,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
marginRight: 8,
|
||||
paddingRight: 8,
|
||||
color: 'var(--ant-color-text-secondary)',
|
||||
borderRight: '1px solid var(--ant-color-split)'
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage({ id: 'models.instance.startHistory' })}
|
||||
<Tooltip
|
||||
title={
|
||||
<span>
|
||||
<span className="font-600 m-r-8">
|
||||
{intl.formatMessage({
|
||||
id: 'models.instance.previousRun'
|
||||
})}
|
||||
:
|
||||
</span>
|
||||
{intl.formatMessage({
|
||||
id: 'models.instance.startHistory.tips'
|
||||
})}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<QuestionCircleOutlined style={{ marginLeft: 4 }} />
|
||||
</Tooltip>
|
||||
</span>
|
||||
}
|
||||
options={countOptions}
|
||||
labelRender={labelRender}
|
||||
optionRender={optionRender}
|
||||
style={{
|
||||
width: 400,
|
||||
marginRight: 16
|
||||
}}
|
||||
></BaseSelect>
|
||||
)}
|
||||
<Button
|
||||
type="text"
|
||||
color="default"
|
||||
@@ -184,10 +204,9 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
||||
handler: updateHandler
|
||||
});
|
||||
fetchData(props.id).then((list) => {
|
||||
if (list.length === 1) {
|
||||
setRecord(list[0].value);
|
||||
} else if (list.length > 1) {
|
||||
setRecord(list[1].value);
|
||||
const lastItem = list?.[0];
|
||||
if (lastItem) {
|
||||
setRecord(lastItem.value);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,8 @@ export default function useQueryModelInstanceRestartCount() {
|
||||
label: restart.restart_count,
|
||||
start_at: restart.started_at,
|
||||
worker_id: workerId,
|
||||
isLast: index === 1
|
||||
isCurrent: index === 0,
|
||||
isPrevious: index === 1
|
||||
};
|
||||
}) || [];
|
||||
setDataList(dataList);
|
||||
|
||||
Reference in New Issue
Block a user