fix: add detection version files
This commit is contained in:
parent
9add82dc7e
commit
7ca06de217
@ -91,5 +91,6 @@
|
|||||||
"Tips": "Tips",
|
"Tips": "Tips",
|
||||||
"Check username introduction": "Check your username, if the username is not available, you can contact the customer service to modify.",
|
"Check username introduction": "Check your username, if the username is not available, you can contact the customer service to modify.",
|
||||||
"Delete and remove file": "Delete and remove file",
|
"Delete and remove file": "Delete and remove file",
|
||||||
"Delete App Introduce": "Delete App, when you click the delete button, the file will be deleted from the file management system."
|
"Delete App Introduce": "Delete App, when you click the delete button, the file will be deleted from the file management system.",
|
||||||
|
"Detect Files": "Detect Files"
|
||||||
}
|
}
|
@ -91,5 +91,6 @@
|
|||||||
"Tips": "提示",
|
"Tips": "提示",
|
||||||
"Check username introduction": "查看是否可以取名,如果当前用户名已存在,请更换其他用户名。其中用户名以@开头",
|
"Check username introduction": "查看是否可以取名,如果当前用户名已存在,请更换其他用户名。其中用户名以@开头",
|
||||||
"Delete and remove file": "删除并删除文件",
|
"Delete and remove file": "删除并删除文件",
|
||||||
"Delete App Introduce": "删除应用, 当点击同时删除文件,会把文件管理中,应用相关的存储的资源同步删除。"
|
"Delete App Introduce": "删除应用, 当点击同时删除文件,会把文件管理中,应用相关的存储的资源同步删除。",
|
||||||
|
"Detect Files": "检测文件"
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ import { useForm, Controller } from 'react-hook-form';
|
|||||||
import { TextField } from '@mui/material';
|
import { TextField } from '@mui/material';
|
||||||
import { pick } from 'lodash-es';
|
import { pick } from 'lodash-es';
|
||||||
import { useAppDeleteModalStore, AppDeleteModal } from '../modules/AppDeleteModal';
|
import { useAppDeleteModalStore, AppDeleteModal } from '../modules/AppDeleteModal';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
const FormModal = () => {
|
const FormModal = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -159,7 +160,6 @@ export const AppVersionList = () => {
|
|||||||
const isPublish = item.version === appVersion;
|
const isPublish = item.version === appVersion;
|
||||||
const color = isPublish ? 'bg-green-500' : '';
|
const color = isPublish ? 'bg-green-500' : '';
|
||||||
const isRunning = item.status === 'running';
|
const isRunning = item.status === 'running';
|
||||||
console.log('appVersion', item, appVersion, versionStore.app);
|
|
||||||
return (
|
return (
|
||||||
<div className='card w-[300px]' key={index}>
|
<div className='card w-[300px]' key={index}>
|
||||||
<div className={'flex items-center justify-between'}>
|
<div className={'flex items-center justify-between'}>
|
||||||
@ -257,6 +257,7 @@ export const AppVersionFile = () => {
|
|||||||
useShallow((state) => {
|
useShallow((state) => {
|
||||||
return {
|
return {
|
||||||
formData: state.formData,
|
formData: state.formData,
|
||||||
|
detectVersionList: state.detectVersionList,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -265,6 +266,24 @@ export const AppVersionFile = () => {
|
|||||||
const files = versionStore.formData.data.files || [];
|
const files = versionStore.formData.data.files || [];
|
||||||
return files;
|
return files;
|
||||||
}, [versionStore.formData]);
|
}, [versionStore.formData]);
|
||||||
|
const onDetect = useCallback(async () => {
|
||||||
|
console.log('formData', versionStore.formData);
|
||||||
|
if (!versionStore.formData.key || !versionStore.formData.version) {
|
||||||
|
toast.error('请先选择应用和版本');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const res = await versionStore.detectVersionList({
|
||||||
|
appKey: versionStore.formData.key,
|
||||||
|
version: versionStore.formData.version,
|
||||||
|
});
|
||||||
|
console.log('res', res);
|
||||||
|
if (res.code === 200) {
|
||||||
|
toast.success('检测实际文件成功');
|
||||||
|
} else {
|
||||||
|
toast.error(res.message || 'Detect failed');
|
||||||
|
}
|
||||||
|
}, [versionStore.formData]);
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div>version: {versionStore.formData.version}</div>
|
<div>version: {versionStore.formData.version}</div>
|
||||||
@ -272,6 +291,9 @@ export const AppVersionFile = () => {
|
|||||||
<div className='flex gap-2 items-center border-b border-b-gray-200 py-2 px-2'>
|
<div className='flex gap-2 items-center border-b border-b-gray-200 py-2 px-2'>
|
||||||
Files
|
Files
|
||||||
<FileUpload />
|
<FileUpload />
|
||||||
|
<Tooltip title='从同文件目录下检测已经上传的文件内容'>
|
||||||
|
<Button onClick={onDetect}>{t('Detect Files')}</Button>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className='mt-2 '
|
className='mt-2 '
|
||||||
|
@ -25,6 +25,7 @@ type AppVersionStore = {
|
|||||||
*/
|
*/
|
||||||
deleteData: (id: string, deleteFile?: boolean) => Promise<void>;
|
deleteData: (id: string, deleteFile?: boolean) => Promise<void>;
|
||||||
publishVersion: (data: { id?: string; appKey?: string; version?: string }, opts?: { showToast?: boolean }) => Promise<any>;
|
publishVersion: (data: { id?: string; appKey?: string; version?: string }, opts?: { showToast?: boolean }) => Promise<any>;
|
||||||
|
detectVersionList: (data: { appKey: string; version: string }) => Promise<any>;
|
||||||
};
|
};
|
||||||
export const useAppVersionStore = create<AppVersionStore>((set, get) => {
|
export const useAppVersionStore = create<AppVersionStore>((set, get) => {
|
||||||
return {
|
return {
|
||||||
@ -134,5 +135,13 @@ export const useAppVersionStore = create<AppVersionStore>((set, get) => {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
detectVersionList: async (data) => {
|
||||||
|
const res = await query.post({
|
||||||
|
path: 'app',
|
||||||
|
key: 'detectVersionList',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
return res;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user