Unverified Commit 13ea40c7 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Fix] fix savepoint interface 404 (#2928)

* fix-savepoint-interface-404 * Spotless Apply * delete unuse code * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 89c14b30
......@@ -20,16 +20,21 @@
package org.dinky.controller;
import org.dinky.data.model.Savepoints;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result;
import org.dinky.service.SavepointsService;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
......@@ -50,10 +55,28 @@ public class SavePointsController {
private final SavepointsService savepointsService;
/**
* query all savepoint list
*
* @param para {@link JsonNode} params
* @return {@link ProTableResult}<{@link Savepoints}>
*/
@PostMapping
@ApiOperation("Query SavePoint List")
@ApiImplicitParam(
name = "para",
value = "Query Params",
dataType = "JsonNode",
paramType = "body",
required = true,
dataTypeClass = JsonNode.class)
public ProTableResult<Savepoints> listSavePoints(@RequestBody JsonNode para) {
return savepointsService.selectForProTable(para);
}
/**
* query savepoint list by task id
*
* @param taskID {@link Integer}
* @param taskId {@link Integer}
* @return {@link Result}<{@link List}<{@link Savepoints}>>
*/
@GetMapping("/listSavepointsByTaskId")
......
......@@ -35,6 +35,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import cn.dev33.satoken.SaManager;
......@@ -47,7 +48,7 @@ import lombok.extern.slf4j.Slf4j;
public class TenantInterceptor implements AsyncHandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler)
throws Exception {
boolean isPass = false;
Cookie[] cookies = request.getCookies();
......
......@@ -13,7 +13,7 @@
and a.task_id = #{param.taskId}
</if>
<if test='param.name!=null and param.name!=""'>
and a.name like "%${param.name}%"
and a.name like concat("%",#{param.name},"%" )
</if>
<if test='param.createTime!=null and param.createTime!=""'>
and a.create_time <![CDATA[>=]]> str_to_date( #{param.createTime},'%Y-%m-%d %H:%i:%s')
......
......@@ -18,28 +18,27 @@
*/
import { getCurrentData } from '@/pages/DataStudio/function';
import { StateType } from '@/pages/DataStudio/model';
import { StateType, TaskDataType } from '@/pages/DataStudio/model';
import { postAll } from '@/services/api';
import { API_CONSTANTS } from '@/services/endpoints';
import { SavePoint } from '@/types/Studio/data';
import { l } from '@/utils/intl';
import { ActionType, ProDescriptions, ProTable } from '@ant-design/pro-components';
import { ActionType, ProColumns, ProDescriptions, ProTable } from '@ant-design/pro-components';
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import { Drawer } from 'antd';
import { useRef, useState } from 'react';
import { connect } from 'umi';
const url = '/api/savepoints';
const SavePoints = (props: any) => {
const {
tabs: { panes, activeKey }
} = props;
const current = getCurrentData(panes, activeKey);
const current = getCurrentData(panes, activeKey) as TaskDataType;
const [row, setRow] = useState<SavePoint>();
const actionRef = useRef<ActionType>();
actionRef.current?.reloadAndRest?.();
const columns: ProDescriptionsItemProps<SavePoint>[] = [
const columns: ProDescriptionsItemProps<SavePoint>[] | ProColumns<SavePoint>[] = [
{
title: l('pages.task.savePointPath'),
dataIndex: 'path',
......@@ -52,7 +51,7 @@ const SavePoints = (props: any) => {
valueType: 'dateTime',
hideInForm: true,
hideInSearch: true,
render: (dom, entity) => {
render: (dom: any, entity: SavePoint) => {
return <a onClick={() => setRow(entity)}>{dom}</a>;
}
}
......@@ -64,9 +63,10 @@ const SavePoints = (props: any) => {
actionRef={actionRef}
rowKey='id'
request={(params, sorter, filter) =>
postAll(url, { taskId: current.key, ...params, sorter, filter })
postAll(API_CONSTANTS.GET_SAVEPOINT_LIST, { params, sorter, filter })
}
columns={columns}
params={{ taskId: current.id }}
columns={columns as ProColumns<SavePoint>[]}
search={false}
/>
<Drawer
......@@ -87,7 +87,7 @@ const SavePoints = (props: any) => {
params={{
id: row?.name
}}
columns={columns}
columns={columns as ProDescriptionsItemProps<SavePoint>[]}
/>
)}
</Drawer>
......
......@@ -20,29 +20,19 @@
import EllipsisMiddle from '@/components/Typography/EllipsisMiddle';
import { recoveryCheckPoint } from '@/pages/DevOps/JobDetail/CheckPointsTab/components/functions';
import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { queryDataByParams } from '@/services/BusinessCrud';
import { postAll } from '@/services/api';
import { API_CONSTANTS } from '@/services/endpoints';
import { SavePoint } from '@/types/Studio/data';
import { l } from '@/utils/intl';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { Button } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { useRef } from 'react';
const SavepointTable = (props: JobProps) => {
const { jobDetail } = props;
const actionRef = useRef<ActionType>();
const [savepointData, setSavepointData] = useState<SavePoint[]>([]);
useEffect(() => {
queryDataByParams<Partial<SavePoint[]>>(API_CONSTANTS.GET_SAVEPOINT_LIST_BY_TASK_ID, {
taskId: jobDetail?.instance?.taskId
}).then((res) => {
setSavepointData((res as SavePoint[]) ?? []);
});
}, [jobDetail]);
const columns: ProColumns<SavePoint>[] = [
{
title: l('devops.jobinfo.ck.id'),
......@@ -96,7 +86,14 @@ const SavepointTable = (props: JobProps) => {
<ProTable<SavePoint>
columns={columns}
style={{ width: '100%', height: 'calc(100vh - 450px)' }}
dataSource={savepointData}
request={(params, sorter, filter) =>
postAll(API_CONSTANTS.GET_SAVEPOINT_LIST, {
...params,
sorter,
filter
})
}
params={{ taskId: jobDetail?.instance?.taskId }}
actionRef={actionRef}
toolBarRender={false}
rowKey='id'
......
......@@ -249,6 +249,7 @@ export enum API_CONSTANTS {
SAVEPOINT = '/api/task/savepoint',
RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask',
GET_SAVEPOINT_LIST_BY_TASK_ID = '/api/savepoints/listSavepointsByTaskId',
GET_SAVEPOINT_LIST = '/api/savepoints',
ALERT_HISTORY_LIST = '/api/alertHistory/list',
ALERT_HISTORY_DELETE = '/api/alertHistory/delete',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment