fix: anyway submit disabled when no catalog specs
This commit is contained in:
@@ -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'
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user