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 selectSpecRef = useRef<CatalogSpec>({} as CatalogSpec);
|
||||||
const specListRef = useRef<any[]>([]);
|
const specListRef = useRef<any[]>([]);
|
||||||
const noCompatibleGPUsRef = useRef<boolean>(false);
|
const noCompatibleGPUsRef = useRef<boolean>(false);
|
||||||
|
const [noCompatibleGPUs, setNoCompatibleGPUs] = useState<boolean>(false);
|
||||||
|
|
||||||
const handleSumit = () => {
|
const handleSumit = () => {
|
||||||
form.current?.submit?.();
|
form.current?.submit?.();
|
||||||
@@ -265,6 +266,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
// If no avaliable gpus for the model, show warning message
|
// If no avaliable gpus for the model, show warning message
|
||||||
if (!res.items.length) {
|
if (!res.items.length) {
|
||||||
noCompatibleGPUsRef.current = true;
|
noCompatibleGPUsRef.current = true;
|
||||||
|
setNoCompatibleGPUs(true);
|
||||||
setWarningStatus({
|
setWarningStatus({
|
||||||
show: true,
|
show: true,
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
@@ -273,6 +275,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
noCompatibleGPUsRef.current = false;
|
noCompatibleGPUsRef.current = false;
|
||||||
|
setNoCompatibleGPUs(false);
|
||||||
handleCheckCompatibility(allValues);
|
handleCheckCompatibility(allValues);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ignore
|
// ignore
|
||||||
@@ -391,7 +394,11 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
showOkBtn={!showExtraButton}
|
showOkBtn={!showExtraButton}
|
||||||
extra={
|
extra={
|
||||||
showExtraButton && (
|
showExtraButton && (
|
||||||
<Button type="primary" onClick={handleSubmitAnyway}>
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={handleSubmitAnyway}
|
||||||
|
disabled={noCompatibleGPUs}
|
||||||
|
>
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
id: 'models.form.submit.anyway'
|
id: 'models.form.submit.anyway'
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user