Skip to content

Commit

Permalink
feat: 下发任务接口对接
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbraceAn authored and Go0p committed Nov 14, 2024
1 parent cbb83ed commit 13de6e6
Show file tree
Hide file tree
Showing 21 changed files with 1,336 additions and 2,114 deletions.
6 changes: 3 additions & 3 deletions src/apis/task/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ const postTaskStart = (

// 任务列表 编辑回显
const getTaskStartEditDispaly = (
id: string,
): Promise<ResponseData<TableResponseData<any>>> =>
axios.get<never, ResponseData<TableResponseData<any>>>(
id: number,
): Promise<ResponseData<TPostTaskStartRequest>> =>
axios.get<never, ResponseData<TPostTaskStartRequest>>(
`/task/start/batch-invoking-script-task/fetch?id=${id}`,
);

Expand Down
7 changes: 4 additions & 3 deletions src/apis/task/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,24 @@ type TNodeListRequest = Partial<{

type TPromptArgs = Partial<{
target: string;
'preset-protes': string[];
'preset-protes': string;
ports: string;
'enable-brute': boolean;
'enbale-cve-baseline': boolean;
execution_node: number;
plugins: string;
'scheduling-type': number;
timestamp: string[];
timestamp: number[];
interval_seconds: string;
interval_seconds_type: number;
execution_date: number;
}>;

type TPostTaskStartRequest = Partial<{
task_id: string;
task_group: string;
script_type: string;
prompt_args: TPromptArgs;
params: TPromptArgs;
scanner: string[];
first: boolean;
}>;
Expand Down
16 changes: 14 additions & 2 deletions src/pages/TaskPageList/TaskPageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,16 @@ const TaskPageList: FC = () => {

// 返回更新后的任务列表
return updatedSiderTaskGrounpAllList
.concat(fetchResultdata)
.concat(
fetchResultdata.filter(
(it) => it.name === '默认分组',
),
)
.concat(
fetchResultdata.filter(
(it) => it.name !== '默认分组',
),
)
.filter((it) => it);
};
setSiderContextList(transformTaskGroupData);
Expand Down Expand Up @@ -224,7 +233,10 @@ const TaskPageList: FC = () => {
};
}}
/>
<CreateTaskScriptModal ref={openCreateTaskModalRef} />
<CreateTaskScriptModal
ref={openCreateTaskModalRef}
pageLoad={page.onLoad}
/>
</div>
);
};
Expand Down
6 changes: 5 additions & 1 deletion src/pages/TaskPageList/compoment/CreateTaskScriptModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { StartUpScriptModal } from '@/pages/TaskScript/compoment/StartUpScriptMo
import { TGetAnalysisScriptReponse } from '@/apis/task/types';
import { getScriptTaskGroup } from '@/apis/task';

const CreateTaskScriptModal = forwardRef<UseModalRefType>(({}, ref) => {
const CreateTaskScriptModal = forwardRef<
UseModalRefType,
{ pageLoad: () => void }
>(({ pageLoad }, ref) => {
const [model1] = WizardModal.useModal();
const StartUpScriptModalRef = useRef<UseModalRefType>(null);

Expand Down Expand Up @@ -112,6 +115,7 @@ const CreateTaskScriptModal = forwardRef<UseModalRefType>(({}, ref) => {
<StartUpScriptModal
ref={StartUpScriptModalRef}
title={'创建任务'}
pageLoad={pageLoad}
/>
</>
);
Expand Down
Loading

0 comments on commit 13de6e6

Please sign in to comment.