fix: instance name text overflow
This commit is contained in:
@@ -86,11 +86,22 @@ const useInstancesColumns = ({
|
|||||||
const description = JSON.parse(record?.description || '{}').spec || {};
|
const description = JSON.parse(record?.description || '{}').spec || {};
|
||||||
return (
|
return (
|
||||||
<Flex align="flex-start" orientation="vertical">
|
<Flex align="flex-start" orientation="vertical">
|
||||||
<span className="text-primary">
|
<AutoTooltip
|
||||||
{description.acceleratable
|
ghost
|
||||||
? `${description.product} x ${record.spec?.resources?.accelerator}`
|
title={
|
||||||
: 'CPU'}
|
<span>
|
||||||
</span>
|
{description.acceleratable
|
||||||
|
? `${description.product} x ${record.spec?.resources?.accelerator}`
|
||||||
|
: 'CPU'}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="text-primary">
|
||||||
|
{description.acceleratable
|
||||||
|
? `${description.product} x ${record.spec?.resources?.accelerator}`
|
||||||
|
: 'CPU'}
|
||||||
|
</span>
|
||||||
|
</AutoTooltip>
|
||||||
<Flex
|
<Flex
|
||||||
align="center"
|
align="center"
|
||||||
style={{ fontSize: 13, color: 'var(--ant-color-text-tertiary)' }}
|
style={{ fontSize: 13, color: 'var(--ant-color-text-tertiary)' }}
|
||||||
@@ -239,17 +250,16 @@ const useInstancesColumns = ({
|
|||||||
ellipsis: {
|
ellipsis: {
|
||||||
showTitle: false
|
showTitle: false
|
||||||
},
|
},
|
||||||
width: 220,
|
width: 260,
|
||||||
render: (_text: string, record: ListItem) => (
|
render: (_text: string, record: ListItem) => renderInstanceType(record)
|
||||||
<div style={{ width: 'max-content' }}>
|
|
||||||
<AutoTooltip ghost>{renderInstanceType(record)}</AutoTooltip>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'clusters.title' }),
|
title: intl.formatMessage({ id: 'clusters.title' }),
|
||||||
dataIndex: 'clusterId',
|
dataIndex: 'clusterId',
|
||||||
hidden: !access.canSeeAdmin,
|
hidden: !access.canSeeAdmin,
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false
|
||||||
|
},
|
||||||
render: (id: number) => (
|
render: (id: number) => (
|
||||||
<AutoTooltip ghost maxWidth={240}>
|
<AutoTooltip ghost maxWidth={240}>
|
||||||
{_.find(clusterList, { value: id })?.label || id || '-'}
|
{_.find(clusterList, { value: id })?.label || id || '-'}
|
||||||
@@ -264,6 +274,7 @@ const useInstancesColumns = ({
|
|||||||
ellipsis: {
|
ellipsis: {
|
||||||
showTitle: false
|
showTitle: false
|
||||||
},
|
},
|
||||||
|
width: 180,
|
||||||
render: (text: string) => (
|
render: (text: string) => (
|
||||||
<AutoTooltip ghost>
|
<AutoTooltip ghost>
|
||||||
{text ? dayjs(text).format('YYYY-MM-DD HH:mm:ss') : '-'}
|
{text ? dayjs(text).format('YYYY-MM-DD HH:mm:ss') : '-'}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ const ActionsCell: React.FC<ActionsCellProps> = ({
|
|||||||
) => {
|
) => {
|
||||||
api.open({
|
api.open({
|
||||||
duration: data.duration,
|
duration: data.duration,
|
||||||
message: renderMessage(data.filename),
|
title: renderMessage(data.filename),
|
||||||
key: data.filename,
|
key: data.filename,
|
||||||
closeIcon: (
|
closeIcon: (
|
||||||
<span>{intl.formatMessage({ id: 'common.button.cancel' })}</span>
|
<span>{intl.formatMessage({ id: 'common.button.cancel' })}</span>
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const NameCell: React.FC<NameCellProps> = ({
|
|||||||
styles
|
styles
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<span className="flex-center instance-name">
|
<span className="instance-name flex-center" style={{ gap: 4 }}>
|
||||||
<AutoTooltip title={record.name} ghost>
|
<AutoTooltip title={record.name} ghost>
|
||||||
<span className="m-r-5" style={styles?.label}>
|
<span className="m-r-5" style={styles?.label}>
|
||||||
{record.name}
|
{record.name}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from '@gpustack/core-ui';
|
} from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
import { Tooltip } from 'antd';
|
import { Flex, Tooltip } from 'antd';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -158,12 +158,19 @@ const useModelsColumns = ({
|
|||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
span: 5,
|
span: 5,
|
||||||
render: (text: string, record: ListItem) => (
|
render: (text: string, record: ListItem) => (
|
||||||
<span className="flex-center" style={{ maxWidth: '100%' }}>
|
<Flex align="center" gap={4} style={{ maxWidth: '100%' }}>
|
||||||
<AutoTooltip ghost>
|
<AutoTooltip
|
||||||
|
ghost
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'var(--ant-color-text-light-solid)' }}>
|
||||||
|
{text}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
>
|
||||||
<span className="text-primary font-400">{text}</span>
|
<span className="text-primary font-400">{text}</span>
|
||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
<ModelTag categoryKey={record.categories?.[0] || ''} />
|
<ModelTag categoryKey={record.categories?.[0] || ''} />
|
||||||
</span>
|
</Flex>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { ListItem as workerListItem } from '@/pages/resources/config/types';
|
|||||||
import { convertFileSize } from '@/utils';
|
import { convertFileSize } from '@/utils';
|
||||||
import { AutoTooltip, IconFont } from '@gpustack/core-ui';
|
import { AutoTooltip, IconFont } from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Flex } from 'antd';
|
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -12,7 +11,6 @@ import { useMemo } from 'react';
|
|||||||
import ActionsCell from '../components/instance-cells/actions-cell';
|
import ActionsCell from '../components/instance-cells/actions-cell';
|
||||||
import DistributeInfoCell from '../components/instance-cells/distribute-info-cell';
|
import DistributeInfoCell from '../components/instance-cells/distribute-info-cell';
|
||||||
import DownloadingStatusCell from '../components/instance-cells/downloading-status-cell';
|
import DownloadingStatusCell from '../components/instance-cells/downloading-status-cell';
|
||||||
import InjectedParamsCell from '../components/instance-cells/injected-params-cell';
|
|
||||||
import InstanceStatusCell from '../components/instance-cells/instance-status-cell';
|
import InstanceStatusCell from '../components/instance-cells/instance-status-cell';
|
||||||
import NameCell, {
|
import NameCell, {
|
||||||
NameCellProps
|
NameCellProps
|
||||||
@@ -29,10 +27,6 @@ const WorkerInfoContent: React.FC<NameCellProps> = ({ record, modelData }) => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>{record.worker_name}</div>
|
<div>{record.worker_name}</div>
|
||||||
{/* <div className="flex-center">
|
|
||||||
<HddFilled className="m-r-5 text-tertiary" style={{ fontSize: 12 }} />
|
|
||||||
<span className="text-secondary">{workerIp}</span>
|
|
||||||
</div> */}
|
|
||||||
<div className="flex-center">
|
<div className="flex-center">
|
||||||
<IconFont
|
<IconFont
|
||||||
type="icon-filled-gpu"
|
type="icon-filled-gpu"
|
||||||
@@ -48,18 +42,6 @@ const WorkerInfoContent: React.FC<NameCellProps> = ({ record, modelData }) => {
|
|||||||
]
|
]
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="flex-center">
|
|
||||||
<ThunderboltFilled
|
|
||||||
className="m-r-5 text-tertiary"
|
|
||||||
style={{ fontSize: 12 }}
|
|
||||||
/>
|
|
||||||
<span className="text-secondary">
|
|
||||||
{record?.backend || modelData?.backend || ''}
|
|
||||||
{record.backend_version || modelData?.backend_version
|
|
||||||
? `(${record.backend_version || modelData?.backend_version})`
|
|
||||||
: ''}
|
|
||||||
</span>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -101,38 +83,20 @@ const useInstancesColumns = (options: {
|
|||||||
title: intl.formatMessage({ id: 'common.table.name' }),
|
title: intl.formatMessage({ id: 'common.table.name' }),
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
sorter: tableSorter(1),
|
sorter: tableSorter(1),
|
||||||
minWidth: 160,
|
|
||||||
render: (value: string, record: ListItem) => (
|
render: (value: string, record: ListItem) => (
|
||||||
<>
|
<NameCell
|
||||||
<Flex gap={8} wrap="wrap">
|
showWorkerInfo={true}
|
||||||
<NameCell
|
record={record}
|
||||||
showWorkerInfo={true}
|
modelData={{
|
||||||
record={record}
|
backend: record.backend,
|
||||||
modelData={{
|
backend_version: record.backend_version
|
||||||
backend: record.backend,
|
}}
|
||||||
backend_version: record.backend_version
|
styles={{
|
||||||
}}
|
label: {
|
||||||
styles={{
|
color: 'var(--ant-color-text)'
|
||||||
label: {
|
}
|
||||||
color: 'var(--ant-color-text)'
|
}}
|
||||||
}
|
></NameCell>
|
||||||
}}
|
|
||||||
></NameCell>
|
|
||||||
<InjectedParamsCell record={record}></InjectedParamsCell>
|
|
||||||
</Flex>
|
|
||||||
{/* <div className="flex-center">
|
|
||||||
<ThunderboltFilled
|
|
||||||
className="m-r-5 text-quaternary"
|
|
||||||
style={{ fontSize: 12, position: 'relative', top: 2 }}
|
|
||||||
/>
|
|
||||||
<span className="text-quaternary">
|
|
||||||
{record?.backend || record?.backend || ''}
|
|
||||||
{record.backend_version || record?.backend_version
|
|
||||||
? `(${record.backend_version || record?.backend_version})`
|
|
||||||
: ''}
|
|
||||||
</span>
|
|
||||||
</div> */}
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user