fix: anyway submit disabled when no catalog specs

This commit is contained in:
jialin
2025-12-19 20:33:25 +08:00
parent 6e16b2eb0c
commit 6738dfe0d3
@@ -96,6 +96,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const selectSpecRef = useRef<CatalogSpec>({} as CatalogSpec);
const specListRef = useRef<any[]>([]);
const noCompatibleGPUsRef = useRef<boolean>(false);
const [noCompatibleGPUs, setNoCompatibleGPUs] = useState<boolean>(false);
const handleSumit = () => {
form.current?.submit?.();
@@ -265,6 +266,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
// If no avaliable gpus for the model, show warning message
if (!res.items.length) {
noCompatibleGPUsRef.current = true;
setNoCompatibleGPUs(true);
setWarningStatus({
show: true,
type: 'warning',
@@ -273,6 +275,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
return;
}
noCompatibleGPUsRef.current = false;
setNoCompatibleGPUs(false);
handleCheckCompatibility(allValues);
} catch (error) {
// ignore
@@ -391,7 +394,11 @@ const AddModal: React.FC<AddModalProps> = (props) => {
showOkBtn={!showExtraButton}
extra={
showExtraButton && (
<Button type="primary" onClick={handleSubmitAnyway}>
<Button
type="primary"
onClick={handleSubmitAnyway}
disabled={noCompatibleGPUs}
>
{intl.formatMessage({
id: 'models.form.submit.anyway'
})}