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