style: deploy modal message cover the content

This commit is contained in:
jialin
2025-11-19 11:46:18 +08:00
parent 18f861f771
commit 71bbf59467
13 changed files with 67 additions and 53 deletions
+14 -7
View File
@@ -1,25 +1,32 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
const useResizeObserver = (ref: React.RefObject<HTMLElement>) => { export const useResizeObserver = (ref: React.RefObject<HTMLElement>) => {
const [size, setSize] = useState({ width: 0, height: 0 }); const [size, setSize] = useState({ width: 0, height: 0 });
useEffect(() => { useEffect(() => {
const element = ref.current; const element = ref.current;
if (!element) return; if (!element) return;
const observer = new ResizeObserver((entries) => { const updateSize = () => {
if (entries[0]) { const rect = element.getBoundingClientRect();
const { width, height } = entries[0].contentRect; setSize((prev) => {
setSize({ width, height }); if (prev.width === rect.width && prev.height === rect.height)
} return prev;
return { width: rect.width, height: rect.height };
});
};
const observer = new ResizeObserver(() => {
updateSize();
}); });
observer.observe(element); observer.observe(element);
updateSize();
return () => { return () => {
observer.disconnect(); observer.disconnect();
}; };
}, [ref]); }, [ref.current]);
return size; return size;
}; };
+24 -11
View File
@@ -18,17 +18,17 @@ const ColumnWrapper: React.FC<ColumnWrapperProps> = ({
children, children,
footer, footer,
maxHeight, maxHeight,
paddingBottom = 50,
styles = {} styles = {}
}) => { }) => {
const scroller = React.useRef<any>(null); const scroller = React.useRef<any>(null);
const footerRef = React.useRef<HTMLDivElement>(null);
const contentRef = React.useRef<HTMLDivElement>(null);
const { const {
initialize, initialize,
instance, instance,
scrollEventElement, scrollEventElement,
scrollToBottom, scrollToBottom,
scrollToTarget, scrollToTarget,
getScrollElement,
getScrollElementScrollableHeight getScrollElementScrollableHeight
} = useOverlayScroller({ } = useOverlayScroller({
options: { options: {
@@ -44,13 +44,28 @@ const ColumnWrapper: React.FC<ColumnWrapperProps> = ({
} }
}, []); }, []);
React.useLayoutEffect(() => {
if (!scroller.current || !footerRef.current || !contentRef.current) return;
const updatePadding = () => {
const height = footerRef.current!.getBoundingClientRect().height;
contentRef.current!.style.paddingBottom = `${height - 22}px`;
};
updatePadding();
const observer = new ResizeObserver(updatePadding);
observer.observe(footerRef.current);
return () => observer.disconnect();
}, []);
return ( return (
<WrapperContext.Provider <WrapperContext.Provider
value={{ value={{
scroller: scroller, scroller: scroller,
osInstance: instance, osInstance: instance,
scrollEventElement, scrollEventElement,
getScrollElement,
getScrollElementScrollableHeight, getScrollElementScrollableHeight,
scrollToBottom, scrollToBottom,
scrollToTarget scrollToTarget
@@ -65,15 +80,13 @@ const ColumnWrapper: React.FC<ColumnWrapperProps> = ({
ref={scroller} ref={scroller}
style={{ padding: '16px 24px', ...styles.container }} style={{ padding: '16px 24px', ...styles.container }}
> >
<div <div ref={contentRef}>{children}</div>
style={{
paddingBottom: footer ? paddingBottom : 0
}}
>
{children}
</div>
</div> </div>
{footer && <div className="footer">{footer}</div>} {footer && (
<div className="footer" ref={footerRef}>
{footer}
</div>
)}
</div> </div>
</WrapperContext.Provider> </WrapperContext.Provider>
); );
+9 -9
View File
@@ -192,20 +192,20 @@ export const frameworks = [
]; ];
export const yamlTemplate = `# backend configuration template export const yamlTemplate = `# backend configuration template
backend_name: my-backend-custom backend_name: vllm-custom
description: this is my-backend description: this is my custom vllm backend
default_version: v0.5.1 default_version: v0.11.0
health_check_path: /${GPUSTACK_API_BASE_URL}/models health_check_path: /${GPUSTACK_API_BASE_URL}/models
default_backend_param: default_backend_param:
- --host - --host
default_run_command: myBackend serve {{model_path}} --port {{port}} default_run_command: vllm serve {{model_path}} --port {{port}} --served-model-name {{model_name}}
version_configs: version_configs:
v0.0.1: v0.11.0:
image_name: lm/mybackend:latest image_name: lm/vllm:latest
run_command: myBackend serve {{model_path}} --port {{port}} run_command: vllm serve {{model_path}} --port {{port}} --served-model-name {{model_name}}
custom_framework: cuda custom_framework: cuda
v0.0.2: v0.10.0:
image_name: lm/mybackend:test image_name: lm/vllm:test
run_command: run_command:
custom_framework: custom_framework:
`; `;
+1 -1
View File
@@ -55,7 +55,7 @@ const BasicForm: React.FC<AddModalProps> = ({ action, currentData }) => {
</Form.Item> </Form.Item>
<Form.Item name="default_run_command"> <Form.Item name="default_run_command">
<SealTextArea <SealTextArea
scaleSize={true} scaleSize={false}
alwaysFocus={true} alwaysFocus={true}
description={intl.formatMessage({ description={intl.formatMessage({
id: 'backend.form.defaultExecuteCommand.tips' id: 'backend.form.defaultExecuteCommand.tips'
@@ -63,8 +63,6 @@ const FormWrapper = styled.div`
maxwidth: 100%; maxwidth: 100%;
`; `;
const AscendNPUQuant_F16 = ['F16', 'FP16'];
const AddModal: React.FC<AddModalProps> = (props) => { const AddModal: React.FC<AddModalProps> = (props) => {
const { const {
title, title,
@@ -97,7 +95,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const axiosToken = useRef<any>(null); const axiosToken = useRef<any>(null);
const selectSpecRef = useRef<CatalogSpec>({} as CatalogSpec); const selectSpecRef = useRef<CatalogSpec>({} as CatalogSpec);
const specListRef = useRef<any[]>([]); const specListRef = useRef<any[]>([]);
const hasF16Ref = useRef<boolean>(false);
const handleSumit = () => { const handleSumit = () => {
form.current?.submit?.(); form.current?.submit?.();
@@ -361,13 +358,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
paddingTop: 0 paddingTop: 0
} }
}} }}
paddingBottom={
warningStatus.show
? Array.isArray(warningStatus.message)
? 150
: 125
: 50
}
footer={ footer={
<> <>
<CompatibilityAlert <CompatibilityAlert
@@ -587,7 +587,6 @@ const AddModal: FC<AddModalProps> = (props) => {
<FormWrapper> <FormWrapper>
<ColumnWrapper <ColumnWrapper
paddingBottom={warningStatus.show ? 170 : 50}
styles={{ styles={{
container: { paddingTop: 0 } container: { paddingTop: 0 }
}} }}
@@ -262,7 +262,6 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
paddingTop: 0 paddingTop: 0
} }
}} }}
paddingBottom={warningStatus.show ? 100 : 50}
footer={ footer={
<> <>
<CompatibilityAlert <CompatibilityAlert
-1
View File
@@ -216,7 +216,6 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
)} )}
<FormWrapper> <FormWrapper>
<ColumnWrapper <ColumnWrapper
paddingBottom={50}
styles={{ styles={{
container: { paddingTop: 0 } container: { paddingTop: 0 }
}} }}
+5 -2
View File
@@ -44,7 +44,7 @@ const CustomBackend: React.FC = () => {
<SealTextArea <SealTextArea
allowClear allowClear
required required
scaleSize={true} scaleSize={false}
alwaysFocus={true} alwaysFocus={true}
autoSize={{ minRows: 2, maxRows: 4 }} autoSize={{ minRows: 2, maxRows: 4 }}
label={intl.formatMessage({ id: 'backend.runCommand' })} label={intl.formatMessage({ id: 'backend.runCommand' })}
@@ -53,7 +53,10 @@ const CustomBackend: React.FC = () => {
})} })}
placeholder={intl.formatMessage( placeholder={intl.formatMessage(
{ id: 'common.help.eg' }, { id: 'common.help.eg' },
{ content: 'vllm serve {{model_path}} --port {{port}}' } {
content:
'vllm serve {{model_path}} --port {{port}} --served-model-name {{model_name}}'
}
)} )}
></SealTextArea> ></SealTextArea>
</Form.Item> </Form.Item>
+3 -7
View File
@@ -103,12 +103,9 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
onClusterChange, onClusterChange,
onOk onOk
} = props; } = props;
const { const { getScrollElementScrollableHeight, osInstance, scrollEventElement } =
getScrollElementScrollableHeight, useWrapperContext();
getScrollElement, console.log('data form render');
osInstance,
scrollEventElement
} = useWrapperContext();
const { backendOptions, getBackendOptions } = useQueryBackends(); const { backendOptions, getBackendOptions } = useQueryBackends();
const { getGPUOptionList, gpuOptions, workerLabelOptions } = const { getGPUOptionList, gpuOptions, workerLabelOptions } =
useGenerateGPUOptions(); useGenerateGPUOptions();
@@ -171,7 +168,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
setActiveKey, setActiveKey,
segmentOptions, segmentOptions,
segmentedTop: segmentedTop, segmentedTop: segmentedTop,
getScrollElement,
getScrollElementScrollableHeight: getScrollElementScrollableHeight getScrollElementScrollableHeight: getScrollElementScrollableHeight
}); });
+1 -3
View File
@@ -15,8 +15,7 @@ export default function useScrollAfterExpand({
segmentOptions, segmentOptions,
defaultWait = 300, defaultWait = 300,
segmentedTop = { top: 0, offsetTop: 96 }, segmentedTop = { top: 0, offsetTop: 96 },
getScrollElementScrollableHeight, getScrollElementScrollableHeight
getScrollElement
}: { }: {
form: any; form: any;
activeKey: string[]; activeKey: string[];
@@ -26,7 +25,6 @@ export default function useScrollAfterExpand({
scrollHeight: number; scrollHeight: number;
scrollTop: number; scrollTop: number;
}; };
getScrollElement?: () => HTMLElement | null;
defaultWait?: number; defaultWait?: number;
segmentedTop: { segmentedTop: {
top: number; top: number;
@@ -125,6 +125,9 @@ export const ImageParamsConfig: ParamsSchema[] = [
min: 1, min: 1,
max: 4 max: 4
}, },
formItemAttrs: {
hidden: true
},
rules: [ rules: [
{ {
required: false required: false
@@ -164,6 +167,9 @@ export const ImageCountConfig: ParamsSchema[] = [
min: 1, min: 1,
max: 4 max: 4
}, },
formItemAttrs: {
hidden: true
},
rules: [ rules: [
{ {
required: false required: false
@@ -223,6 +229,9 @@ export const ImageEidtParamsConfig: ParamsSchema[] = [
min: 1, min: 1,
max: 4 max: 4
}, },
formItemAttrs: {
hidden: true
},
rules: [ rules: [
{ {
required: false required: false
@@ -90,6 +90,7 @@
left: calc(50% + 10px); left: calc(50% + 10px);
transform: translateX(-50%); transform: translateX(-50%);
background-color: transparent; background-color: transparent;
cursor: ns-resize;
} }
} }
} }