fix(style): hide table cell content if too long

This commit is contained in:
jialin
2024-09-28 19:23:56 +08:00
parent 197488bff6
commit bc921ff835
13 changed files with 46 additions and 21 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const isProduction = env === 'production';
const t = Date.now(); const t = Date.now();
export default defineConfig({ export default defineConfig({
proxy: { proxy: {
...proxy('http://192.168.50.166:8080') ...proxy()
}, },
history: { history: {
type: 'hash' type: 'hash'
+7 -3
View File
@@ -1,4 +1,4 @@
import { Tag, Tooltip } from 'antd'; import { Tag, Tooltip, type TagProps } from 'antd';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import React, { import React, {
useCallback, useCallback,
@@ -8,12 +8,15 @@ import React, {
useState useState
} from 'react'; } from 'react';
interface AutoTooltipProps extends React.ComponentProps<typeof Tag> { // type TagProps = React.ComponentProps<typeof Tag>;
interface AutoTooltipProps extends Omit<TagProps, 'title'> {
children: React.ReactNode; children: React.ReactNode;
maxWidth?: number | string; maxWidth?: number | string;
color?: string; color?: string;
style?: React.CSSProperties; style?: React.CSSProperties;
ghost?: boolean; ghost?: boolean;
title?: React.ReactNode;
showTitle?: boolean; showTitle?: boolean;
} }
@@ -21,6 +24,7 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
children, children,
maxWidth = '100%', maxWidth = '100%',
ghost = false, ghost = false,
title,
showTitle = false, showTitle = false,
...tagProps ...tagProps
}) => { }) => {
@@ -64,7 +68,7 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
); );
return ( return (
<Tooltip title={isOverflowing || showTitle ? children : ''}> <Tooltip title={isOverflowing || showTitle ? title || children : ''}>
{ghost ? ( {ghost ? (
<div ref={contentRef} style={tagStyle}> <div ref={contentRef} style={tagStyle}>
{children} {children}
@@ -77,6 +77,7 @@ const LabelItem: React.FC<LabelItemProps> = ({
title={intl.formatMessage({ id: 'resources.table.key.tips' })} title={intl.formatMessage({ id: 'resources.table.key.tips' })}
> >
<SealInput.Input <SealInput.Input
checkStatus="success"
label={intl.formatMessage({ id: 'common.input.key' })} label={intl.formatMessage({ id: 'common.input.key' })}
value={label.key} value={label.key}
onChange={handleOnKeyChange} onChange={handleOnKeyChange}
@@ -89,6 +90,7 @@ const LabelItem: React.FC<LabelItemProps> = ({
<div className="label-value"> <div className="label-value">
{valueAddon ?? ( {valueAddon ?? (
<SealInput.Input <SealInput.Input
checkStatus={label.value ? 'success' : ''}
label={intl.formatMessage({ id: 'common.input.value' })} label={intl.formatMessage({ id: 'common.input.value' })}
value={label.value} value={label.value}
onChange={handleOnValueChange} onChange={handleOnValueChange}
+2 -2
View File
@@ -26,11 +26,11 @@
} }
.xterm { .xterm {
height: 100% !important; // height: 100% !important;
.xterm-viewport { .xterm-viewport {
overflow-y: auto !important; overflow-y: auto !important;
// custom scrollbar
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: var(--scrollbar-size); width: var(--scrollbar-size);
height: var(--scrollbar-size); height: var(--scrollbar-size);
+11 -6
View File
@@ -26,7 +26,7 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
const [logs, setLogs] = useState(''); const [logs, setLogs] = useState('');
const size = useSize(scroller); const size = useSize(scroller);
const throttleScroll = _.debounce(() => { const throttleScroll = _.throttle(() => {
termRef.current?.scrollToBottom?.(); termRef.current?.scrollToBottom?.();
}, 100); }, 100);
@@ -36,6 +36,7 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
termRef.current?.clear?.(); termRef.current?.clear?.();
cacheDataRef.current = data; cacheDataRef.current = data;
termRef.current?.write?.(data); termRef.current?.write?.(data);
setLogs(data);
}, 100), }, 100),
[] []
); );
@@ -78,11 +79,11 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
termRef.current.open(termwrapRef.current); termRef.current.open(termwrapRef.current);
// add event // add event
termRef.current.onLineFeed((e: any) => { // termRef.current.onLineFeed((e: any) => {
if (cacheDataRef.current) { // if (cacheDataRef.current) {
throttleScroll(); // throttleScroll();
} // }
}); // });
}; };
const handleResize = _.throttle(() => { const handleResize = _.throttle(() => {
@@ -111,6 +112,10 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
} }
}, [size]); }, [size]);
useEffect(() => {
throttleScroll();
}, [logs]);
return ( return (
<div className="logs-viewer-wrap-w2"> <div className="logs-viewer-wrap-w2">
<div className="wrap" style={{ height: height }} ref={scroller}> <div className="wrap" style={{ height: height }} ref={scroller}>
+2 -1
View File
@@ -17,6 +17,7 @@ const SealInput: React.FC<InputProps & SealFormItemProps> = (props) => {
isInFormItems = true, isInFormItems = true,
variant, variant,
addAfter, addAfter,
checkStatus,
trim = true, trim = true,
...rest ...rest
} = props; } = props;
@@ -70,7 +71,7 @@ const SealInput: React.FC<InputProps & SealFormItemProps> = (props) => {
return ( return (
<Wrapper <Wrapper
status={status} status={checkStatus || status}
label={label || (placeholder as string)} label={label || (placeholder as string)}
isFocus={isFocus} isFocus={isFocus}
required={required} required={required}
+1
View File
@@ -9,4 +9,5 @@ export interface SealFormItemProps {
addAfter?: React.ReactNode; addAfter?: React.ReactNode;
loading?: React.ReactNode; loading?: React.ReactNode;
trim?: boolean; trim?: boolean;
checkStatus?: 'success' | 'error' | 'warning' | '';
} }
@@ -5,6 +5,7 @@
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
height: 68px; height: 68px;
word-break: break-word;
.cell-content { .cell-content {
max-width: 100%; max-width: 100%;
+4
View File
@@ -665,6 +665,10 @@ body {
.ant-modal { .ant-modal {
max-width: 100vw; max-width: 100vw;
.ant-modal-title {
font-weight: var(--font-weight-bold);
}
} }
.tooltip-wrapper { .tooltip-wrapper {
+2 -2
View File
@@ -289,9 +289,9 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
replicas: 1, replicas: 1,
source: props.source, source: props.source,
placement_strategy: 'spread', placement_strategy: 'spread',
cpu_offloading: false, cpu_offloading: true,
scheduleType: 'auto', scheduleType: 'auto',
distributed_inference_across_workers: false distributed_inference_across_workers: true
}} }}
> >
<Form.Item<FormData> <Form.Item<FormData>
@@ -262,7 +262,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
return ( return (
<div> <div>
<TitleWrapper> <TitleWrapper>
<span> <span className="title">
{intl.formatMessage({ id: 'models.available.files' })} ( {intl.formatMessage({ id: 'models.available.files' })} (
{dataSource.fileList.length || 0}) {dataSource.fileList.length || 0})
</span> </span>
@@ -1,3 +1,4 @@
import AutoTooltip from '@/components/auto-tooltip';
import DropdownButtons from '@/components/drop-down-buttons'; import DropdownButtons from '@/components/drop-down-buttons';
import RowChildren from '@/components/seal-table/components/row-children'; import RowChildren from '@/components/seal-table/components/row-children';
import SimpleTabel from '@/components/simple-table'; import SimpleTabel from '@/components/simple-table';
@@ -159,10 +160,16 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
paddingInline: 'var(--ant-table-cell-padding-inline)' paddingInline: 'var(--ant-table-cell-padding-inline)'
}} }}
> >
<Tooltip title={renderWorkerInfo(item)}> <span className="flex-center">
<span className="m-r-5">{item.name}</span> <AutoTooltip
title={renderWorkerInfo(item)}
ghost
showTitle={true}
>
<span className="m-r-5">{item.name}</span>
</AutoTooltip>
<InfoCircleOutlined /> <InfoCircleOutlined />
</Tooltip> </span>
</Col> </Col>
<Col span={6}> <Col span={6}>
<span <span
+2 -2
View File
@@ -519,8 +519,8 @@ const Models: React.FC<ModelsProps> = ({
span={5} span={5}
render={(text, record: ListItem) => { render={(text, record: ListItem) => {
return ( return (
<span className="flex" style={{ maxWidth: '100%' }}> <span className="flex-center" style={{ maxWidth: '100%' }}>
<AutoTooltip className="m-r-5" showTitle={true} ghost> <AutoTooltip className="m-r-5" ghost>
{text} {text}
</AutoTooltip> </AutoTooltip>
<span> <span>