Skip to content

Commit

Permalink
wip: 11
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbraceAn committed Nov 13, 2024
1 parent 9cec545 commit 256e020
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:

# 静态文件压缩
- name: Pack output files
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: tar -zcvf out.tgz dist

- name: Upload Build Artifact
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v3
with:
name: build-output
Expand Down
6 changes: 3 additions & 3 deletions src/App/routers/AuthRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC, ReactNode } from 'react';
// import { useEffect } from 'react';
import { Navigate } from 'react-router-dom';
import useLoginStore from '../store/loginStore';
import { NoLoginPermission } from '@/compoments';

interface AuthRouteType {
children: ReactNode;
Expand All @@ -15,6 +14,7 @@ const AuthRoute: FC<AuthRouteType> = ({ children }) => {
// // dispatch(logOut(_pathname.slice(1)))
// }
// }, [token]);
return token ? children : <Navigate to="/login" replace />;

return token ? children : <NoLoginPermission />;
};
export default AuthRoute;
Binary file added src/assets/compoments/Empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/compoments/NoLoginPermission.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/compoments/EmptyBox/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { FC } from 'react';

import EmptyImages from '@/assets/compoments/Empty.png';

const EmptyBox: FC = () => {
return (
<div className="w-full h-full flex items-center justify-center flex-col gap-4">
<img src={EmptyImages} className="w-54" />
<div className="font-semibold text-sm">暂无数据</div>
</div>
);
};

export default EmptyBox;
26 changes: 26 additions & 0 deletions src/compoments/NoLoginPermission/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FC } from 'react';
import NoLoginPermissionImage from '@/assets/compoments/NoLoginPermission.png';
import { Button } from 'antd';
import { useNavigate } from 'react-router-dom';

const NoLoginPermission: FC = () => {
const navigate = useNavigate();

const headLogin = () => {
navigate('/login', { replace: true });
};
return (
<div className="w-full h-full flex items-center justify-center flex-col gap-4">
<img src={NoLoginPermissionImage} className="w-80" />
<div className="color-[#31343F] text-sm font-semibold">
暂无访问权限
</div>
<div>登陆后即可访问该页面</div>
<Button color="primary" variant="outlined" onClick={headLogin}>
立即登陆
</Button>
</div>
);
};

export default NoLoginPermission;
5 changes: 5 additions & 0 deletions src/compoments/WizardTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import extendTableProps from './extendTableProps';

import './index.scss';
import { match } from 'ts-pattern';
import EmptyBox from '../EmptyBox';

const reducer = <T extends TRecudeInitiakValue>(state: T, payload: T): T => ({
...state,
Expand Down Expand Up @@ -370,6 +371,7 @@ const WizardTable = <T extends AnyObject = AnyObject>(
);
}, [state.loading]);

// Array.isArray(dataSource) && dataSource?.length > 0 ? (
return (
<div className="flex w-full h-full overflow-hidden justify-end">
{/* 表格部分 */}
Expand Down Expand Up @@ -433,6 +435,9 @@ const WizardTable = <T extends AnyObject = AnyObject>(
</div>
</div>
);
// ) : (
// <EmptyBox />
// );
};

WizardTable.usePage = usePage;
Expand Down
2 changes: 2 additions & 0 deletions src/compoments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export { default as WizardProFilterDrawer } from './WizardProFilterDrawer';
export { default as WizardTooltip } from './WizardTooltip';
export { default as WizardModal } from './WizardModal';
export { default as ChunkUpload } from './ChunkUpload';
export { default as EmptyBox } from './EmptyBox';
export { default as NoLoginPermission } from './NoLoginPermission';
2 changes: 1 addition & 1 deletion src/pages/NetworkError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const NetworkError = () => {
请检查网络连接
</div>
<div>连网后才可访问 Yakit 插件商店</div>
<Button type="link" onClick={headClean}>
<Button color="primary" variant="outlined" onClick={headClean}>
<SyncOutlined />
刷新页面
</Button>
Expand Down
84 changes: 44 additions & 40 deletions src/pages/TaskScript/TaskScript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StartUpScriptModal } from './compoment/StartUpScriptModal';
import { TaskScriptTags } from './compoment/TaskScriptTags';
import { useRequest } from 'ahooks';
import { getAnalysisScript, getScriptTaskGroup } from '@/apis/task';
import { WizardModal } from '@/compoments';
import { EmptyBox, WizardModal } from '@/compoments';
import { Spin } from 'antd';

const TaskScript: FC = () => {
Expand Down Expand Up @@ -61,51 +61,55 @@ const TaskScript: FC = () => {
// }));

return (
<div className="p-4 ">
<Spin spinning={scriptLoading}>
<div className="grid grid-cols-3 gap-4">
{scriptData?.map((items) => {
return (
<div
key={items.script_name}
className={styles['wizard-card']}
>
<div className={styles['card-header']}>
<div
className={`text-clip ${styles['card-header-text']}`}
>
{items?.script_name}
<div className="p-4 h-full">
{Array.isArray(scriptData) && scriptData.length > 0 ? (
<Spin spinning={scriptLoading}>
<div className="grid grid-cols-3 gap-4">
{scriptData?.map((items) => {
return (
<div
key={items.script_name}
className={styles['wizard-card']}
>
<div className={styles['card-header']}>
<div
className={`text-clip ${styles['card-header-text']}`}
>
{items?.script_name}
</div>
</div>

<div className={styles['card-content']}>
<TaskScriptTags
tags={items?.tags}
script_name={items.script_name}
/>
<div
className={`text-clip2 ${styles['content-describe']}`}
>
{items?.description &&
items.description?.length > 0
? items.description
: '-'}
</div>
</div>
</div>

<div className={styles['card-content']}>
<TaskScriptTags
tags={items?.tags}
script_name={items.script_name}
/>
<div
className={`text-clip2 ${styles['content-describe']}`}
className={styles['card-footer']}
onClick={async () => {
await runAsync(items);
}}
>
{items?.description &&
items.description?.length > 0
? items.description
: '-'}
使用模版
</div>
</div>

<div
className={styles['card-footer']}
onClick={async () => {
await runAsync(items);
}}
>
使用模版
</div>
</div>
);
})}
</div>
</Spin>
);
})}
</div>
</Spin>
) : (
<EmptyBox />
)}
<StartUpScriptModal ref={StartUpScriptModalRef} title="创建任务" />
</div>
);
Expand Down

0 comments on commit 256e020

Please sign in to comment.