fix: click twice for submitting deployment form, using iconfont static files
This commit is contained in:
+1
-2
@@ -3,7 +3,6 @@ node_modules
|
|||||||
.umi-production
|
.umi-production
|
||||||
public/static/*.js
|
public/static/*.js
|
||||||
public/static/*.css
|
public/static/*.css
|
||||||
src/components/icon-font/iconfont/iconfont.js
|
src/components/iconfont/
|
||||||
src/components/icon-font/iconfont/*.css
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,5 +3,5 @@ module.exports = {
|
|||||||
rules: {
|
rules: {
|
||||||
'selector-class-pattern': null
|
'selector-class-pattern': null
|
||||||
},
|
},
|
||||||
ignoreFiles: ['public/static/*.css']
|
ignoreFiles: ['public/static/*.css', 'src/components/iconfont/iconfont.css']
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-1
@@ -14,7 +14,8 @@ export default defineConfig([
|
|||||||
'dist',
|
'dist',
|
||||||
'src/.umi/',
|
'src/.umi/',
|
||||||
'src/.umi-production/',
|
'src/.umi-production/',
|
||||||
'src/.umi-test/'
|
'src/.umi-test/',
|
||||||
|
'src/components/iconfont/'
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
files: ['**/*.{ts,tsx,js,jsx}'],
|
files: ['**/*.{ts,tsx,js,jsx}'],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
import { routeCacheAtom, setRouteCache } from '@/atoms/route-cache';
|
import { routeCacheAtom, setRouteCache } from '@/atoms/route-cache';
|
||||||
import { userAtom } from '@/atoms/user';
|
import { userAtom } from '@/atoms/user';
|
||||||
import DarkMask from '@/components/dark-mask';
|
import DarkMask from '@/components/dark-mask';
|
||||||
|
import '@/components/iconfont/iconfont.js';
|
||||||
import PluginExtraFields from '@/components/plugin-extra-fields';
|
import PluginExtraFields from '@/components/plugin-extra-fields';
|
||||||
import routeCachekey from '@/config/route-cachekey';
|
import routeCachekey from '@/config/route-cachekey';
|
||||||
import { DEFAULT_ENTER_PAGE, GPUSTACK_API_BASE_URL } from '@/config/settings';
|
import { DEFAULT_ENTER_PAGE, GPUSTACK_API_BASE_URL } from '@/config/settings';
|
||||||
@@ -356,7 +357,7 @@ export default (props: any) => {
|
|||||||
config={{
|
config={{
|
||||||
apiBaseUrl: GPUSTACK_API_BASE_URL,
|
apiBaseUrl: GPUSTACK_API_BASE_URL,
|
||||||
theme: userSettings.theme,
|
theme: userSettings.theme,
|
||||||
iconUrl: '//at.alicdn.com/t/c/font_4613488_jmdepcs90im.js',
|
iconUrl: '',
|
||||||
isDarkTheme: userSettings.isDarkTheme,
|
isDarkTheme: userSettings.isDarkTheme,
|
||||||
defaultColorPrimary: COLOR_PRIMARY
|
defaultColorPrimary: COLOR_PRIMARY
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ interface FormContextProps {
|
|||||||
flatBackendOptions: BackendOption[];
|
flatBackendOptions: BackendOption[];
|
||||||
initialValues?: FormData; // for editing model
|
initialValues?: FormData; // for editing model
|
||||||
modelContextData?: Record<string, any>;
|
modelContextData?: Record<string, any>;
|
||||||
|
submitAttempted?: boolean;
|
||||||
clearCacheFormValues?: () => void;
|
clearCacheFormValues?: () => void;
|
||||||
onValuesChange?: (changedValues: any, allValues: any) => void;
|
onValuesChange?: (changedValues: any, allValues: any) => void;
|
||||||
onBackendChange: (backend: string, option: any) => void;
|
onBackendChange: (backend: string, option: any) => void;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [activeKey, setActiveKey] = React.useState<string[]>([]);
|
const [activeKey, setActiveKey] = React.useState<string[]>([]);
|
||||||
|
const [submitAttempted, setSubmitAttempted] = React.useState(false);
|
||||||
const { modelContextData, fetchContextLength } = useQueryContextLength();
|
const { modelContextData, fetchContextLength } = useQueryContextLength();
|
||||||
const localPath = Form.useWatch('local_path', form);
|
const localPath = Form.useWatch('local_path', form);
|
||||||
const modelScopeModelId = Form.useWatch('model_scope_model_id', form);
|
const modelScopeModelId = Form.useWatch('model_scope_model_id', form);
|
||||||
@@ -229,6 +230,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
..._.omit(data, ['scheduleType']),
|
..._.omit(data, ['scheduleType']),
|
||||||
...gpuSelector
|
...gpuSelector
|
||||||
};
|
};
|
||||||
|
console.log('submit form data:', allValues);
|
||||||
onOk(allValues);
|
onOk(allValues);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -282,6 +284,8 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleOnFinishFailed = (errorInfo: any) => {
|
const handleOnFinishFailed = (errorInfo: any) => {
|
||||||
|
setSubmitAttempted(true);
|
||||||
|
console.log('Failed:', errorInfo);
|
||||||
const { errorFields } = errorInfo;
|
const { errorFields } = errorInfo;
|
||||||
if (errorFields && errorFields.length > 0) {
|
if (errorFields && errorFields.length > 0) {
|
||||||
const collapseKeys: string[] = [];
|
const collapseKeys: string[] = [];
|
||||||
@@ -398,6 +402,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
workerLabelOptions: workerLabelOptions,
|
workerLabelOptions: workerLabelOptions,
|
||||||
initialValues: initialValues,
|
initialValues: initialValues,
|
||||||
modelContextData: modelContextData,
|
modelContextData: modelContextData,
|
||||||
|
submitAttempted: submitAttempted,
|
||||||
clearCacheFormValues: clearCacheFormValues,
|
clearCacheFormValues: clearCacheFormValues,
|
||||||
onValuesChange: onValuesChange,
|
onValuesChange: onValuesChange,
|
||||||
onBackendChange: handleBackendChange
|
onBackendChange: handleBackendChange
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { MetadataList } from '@gpustack/core-ui';
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import { useFormContext } from '../config/form-context';
|
||||||
import { FormData, LoraListItem } from '../config/types';
|
import { FormData, LoraListItem } from '../config/types';
|
||||||
import useQueryModelLoraList from '../services/use-query-lora-list';
|
import useQueryModelLoraList from '../services/use-query-lora-list';
|
||||||
import LoraItem from './lora-list-item';
|
import LoraItem from './lora-list-item';
|
||||||
@@ -20,9 +21,10 @@ const ModelLoraList = () => {
|
|||||||
console.log('fetching lora list with base', base, form.getFieldsValue());
|
console.log('fetching lora list with base', base, form.getFieldsValue());
|
||||||
|
|
||||||
const { dataList: defaultDataList, fetchData } = useQueryModelLoraList();
|
const { dataList: defaultDataList, fetchData } = useQueryModelLoraList();
|
||||||
|
const { submitAttempted } = useFormContext();
|
||||||
|
const validated = !!submitAttempted;
|
||||||
|
|
||||||
const [itemList, setItemList] = useState<ItemValue[]>([]);
|
const [itemList, setItemList] = useState<ItemValue[]>([]);
|
||||||
const [validated, setValidated] = useState(false);
|
|
||||||
const initializedRef = useRef(false);
|
const initializedRef = useRef(false);
|
||||||
const prevBaseRef = useRef<string>('');
|
const prevBaseRef = useRef<string>('');
|
||||||
|
|
||||||
@@ -150,9 +152,6 @@ const ModelLoraList = () => {
|
|||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
validator: async (_, value: LoraListItem[]) => {
|
validator: async (_, value: LoraListItem[]) => {
|
||||||
if (!validated) {
|
|
||||||
setValidated(true);
|
|
||||||
}
|
|
||||||
if (!value || value.length === 0) return;
|
if (!value || value.length === 0) return;
|
||||||
|
|
||||||
for (const it of value) {
|
for (const it of value) {
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ const Login = () => {
|
|||||||
config={{
|
config={{
|
||||||
apiBaseUrl: GPUSTACK_API_BASE_URL,
|
apiBaseUrl: GPUSTACK_API_BASE_URL,
|
||||||
theme: userSettings.theme,
|
theme: userSettings.theme,
|
||||||
iconUrl: '//at.alicdn.com/t/c/font_4613488_vy4szhexci.js',
|
iconUrl: '',
|
||||||
isDarkTheme: userSettings.isDarkTheme,
|
isDarkTheme: userSettings.isDarkTheme,
|
||||||
defaultColorPrimary: COLOR_PRIMARY
|
defaultColorPrimary: COLOR_PRIMARY
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user