chore: history options
This commit is contained in:
@@ -283,7 +283,9 @@ export default {
|
|||||||
'models.table.modelView': 'Model List',
|
'models.table.modelView': 'Model List',
|
||||||
'models.table.instanceView': 'Instance List',
|
'models.table.instanceView': 'Instance List',
|
||||||
'models.table.category': 'Category',
|
'models.table.category': 'Category',
|
||||||
'models.instance.firstStart': 'First Deployment',
|
'models.instance.currentRun': 'Current Run',
|
||||||
'models.instance.lastStart': 'Last Startup',
|
'models.instance.previousRun': 'Previous Run',
|
||||||
'models.instance.startHistory': 'Startup History'
|
'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.modelView': 'Model List',
|
||||||
'models.table.instanceView': 'Instance List',
|
'models.table.instanceView': 'Instance List',
|
||||||
'models.table.category': 'Category',
|
'models.table.category': 'Category',
|
||||||
'models.instance.firstStart': 'First Deployment',
|
'models.instance.currentRun': 'Current Run',
|
||||||
'models.instance.lastStart': 'Last Startup',
|
'models.instance.previousRun': 'Previous Run',
|
||||||
'models.instance.startHistory': 'Startup History'
|
'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) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
|
|||||||
@@ -287,9 +287,11 @@ export default {
|
|||||||
'models.table.modelView': 'Model List',
|
'models.table.modelView': 'Model List',
|
||||||
'models.table.instanceView': 'Instance List',
|
'models.table.instanceView': 'Instance List',
|
||||||
'models.table.category': 'Category',
|
'models.table.category': 'Category',
|
||||||
'models.instance.firstStart': 'First Deployment',
|
'models.instance.currentRun': 'Current Run',
|
||||||
'models.instance.lastStart': 'Last Startup',
|
'models.instance.previousRun': 'Previous Run',
|
||||||
'models.instance.startHistory': 'Startup History'
|
'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) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
|
|||||||
@@ -283,9 +283,11 @@ export default {
|
|||||||
'models.table.modelView': 'Model List',
|
'models.table.modelView': 'Model List',
|
||||||
'models.table.instanceView': 'Instance List',
|
'models.table.instanceView': 'Instance List',
|
||||||
'models.table.category': 'Category',
|
'models.table.category': 'Category',
|
||||||
'models.instance.firstStart': 'First Deployment',
|
'models.instance.currentRun': 'Current Run',
|
||||||
'models.instance.lastStart': 'Last Startup',
|
'models.instance.previousRun': 'Previous Run',
|
||||||
'models.instance.startHistory': 'Startup History'
|
'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) ==========
|
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||||
|
|||||||
@@ -267,7 +267,8 @@ export default {
|
|||||||
'models.table.modelView': '模型列表',
|
'models.table.modelView': '模型列表',
|
||||||
'models.table.instanceView': '实例列表',
|
'models.table.instanceView': '实例列表',
|
||||||
'models.table.category': '类别',
|
'models.table.category': '类别',
|
||||||
'models.instance.firstStart': '首次部署',
|
'models.instance.currentRun': '当前运行',
|
||||||
'models.instance.lastStart': '最近启动',
|
'models.instance.previousRun': '上一次运行',
|
||||||
'models.instance.startHistory': '启动记录'
|
'models.instance.startHistory': '运行记录',
|
||||||
|
'models.instance.startHistory.tips': '显示当前重启之前那次运行的日志。'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import useSetChunkRequest from '@/hooks/use-chunk-request';
|
import useSetChunkRequest from '@/hooks/use-chunk-request';
|
||||||
import { formatOrdinal } from '@/utils';
|
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 { BaseSelect, LogsViewer } from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Modal } from 'antd';
|
import { Button, Modal, Tooltip } from 'antd';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { MODELS_API } from '../apis';
|
import { MODELS_API } from '../apis';
|
||||||
@@ -115,11 +115,11 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
const optionRender = (option: any) => {
|
const optionRender = (option: any) => {
|
||||||
const { data = {} } = option || {};
|
const { data = {} } = option || {};
|
||||||
let label = formatOrdinal(data.value);
|
let label = formatOrdinal(data.value);
|
||||||
if (data.value === 0) {
|
if (data.isCurrent) {
|
||||||
label = intl.formatMessage({ id: 'models.instance.firstStart' });
|
label = intl.formatMessage({ id: 'models.instance.currentRun' });
|
||||||
}
|
}
|
||||||
if (data.isLast) {
|
if (data.isPrevious) {
|
||||||
label = intl.formatMessage({ id: 'models.instance.lastStart' });
|
label = intl.formatMessage({ id: 'models.instance.previousRun' });
|
||||||
}
|
}
|
||||||
return renderLabel(label, data.start_at);
|
return renderLabel(label, data.start_at);
|
||||||
};
|
};
|
||||||
@@ -132,38 +132,58 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
|
|
||||||
const renderTitle = () => {
|
const renderTitle = () => {
|
||||||
return (
|
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)' }}>
|
<span style={{ fontWeight: 'var(--font-weight-bold)' }}>
|
||||||
{intl.formatMessage({ id: 'common.button.viewlog' })}
|
{intl.formatMessage({ id: 'common.button.viewlog' })}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<BaseSelect
|
{countOptions.length > 1 && (
|
||||||
allowClear
|
<BaseSelect
|
||||||
value={record}
|
allowClear
|
||||||
onChange={handleOnChange}
|
value={record}
|
||||||
prefix={
|
onChange={handleOnChange}
|
||||||
<span
|
prefix={
|
||||||
style={{
|
<span
|
||||||
fontWeight: 400,
|
style={{
|
||||||
fontSize: 13,
|
fontWeight: 400,
|
||||||
marginRight: 8,
|
fontSize: 13,
|
||||||
paddingRight: 8,
|
display: 'flex',
|
||||||
color: 'var(--ant-color-text-secondary)',
|
alignItems: 'center',
|
||||||
borderRight: '1px solid var(--ant-color-split)'
|
marginRight: 8,
|
||||||
}}
|
paddingRight: 8,
|
||||||
>
|
color: 'var(--ant-color-text-secondary)',
|
||||||
{intl.formatMessage({ id: 'models.instance.startHistory' })} (
|
borderRight: '1px solid var(--ant-color-split)'
|
||||||
{countOptions.length})
|
}}
|
||||||
</span>
|
>
|
||||||
}
|
{intl.formatMessage({ id: 'models.instance.startHistory' })}
|
||||||
options={countOptions}
|
<Tooltip
|
||||||
labelRender={labelRender}
|
title={
|
||||||
optionRender={optionRender}
|
<span>
|
||||||
style={{
|
<span className="font-600 m-r-8">
|
||||||
width: 400,
|
{intl.formatMessage({
|
||||||
marginRight: 16
|
id: 'models.instance.previousRun'
|
||||||
}}
|
})}
|
||||||
></BaseSelect>
|
:
|
||||||
|
</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
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
color="default"
|
color="default"
|
||||||
@@ -184,10 +204,9 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
handler: updateHandler
|
handler: updateHandler
|
||||||
});
|
});
|
||||||
fetchData(props.id).then((list) => {
|
fetchData(props.id).then((list) => {
|
||||||
if (list.length === 1) {
|
const lastItem = list?.[0];
|
||||||
setRecord(list[0].value);
|
if (lastItem) {
|
||||||
} else if (list.length > 1) {
|
setRecord(lastItem.value);
|
||||||
setRecord(list[1].value);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ export default function useQueryModelInstanceRestartCount() {
|
|||||||
label: restart.restart_count,
|
label: restart.restart_count,
|
||||||
start_at: restart.started_at,
|
start_at: restart.started_at,
|
||||||
worker_id: workerId,
|
worker_id: workerId,
|
||||||
isLast: index === 1
|
isCurrent: index === 0,
|
||||||
|
isPrevious: index === 1
|
||||||
};
|
};
|
||||||
}) || [];
|
}) || [];
|
||||||
setDataList(dataList);
|
setDataList(dataList);
|
||||||
|
|||||||
Reference in New Issue
Block a user