Unverified Commit 01db56fe authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Fix-2855] Fix savepoint table params bug (#2860)

* Spotless Apply * Fix-savepiont-search-bug * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 83bdc31c
...@@ -20,21 +20,16 @@ ...@@ -20,21 +20,16 @@
package org.dinky.controller; package org.dinky.controller;
import org.dinky.data.model.Savepoints; import org.dinky.data.model.Savepoints;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.SavepointsService; import org.dinky.service.SavepointsService;
import java.util.List; import java.util.List;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -55,25 +50,6 @@ public class SavePointsController { ...@@ -55,25 +50,6 @@ public class SavePointsController {
private final SavepointsService savepointsService; 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 * query savepoint list by task id
* *
...@@ -82,8 +58,8 @@ public class SavePointsController { ...@@ -82,8 +58,8 @@ public class SavePointsController {
*/ */
@GetMapping("/listSavepointsByTaskId") @GetMapping("/listSavepointsByTaskId")
@ApiOperation("Query SavePoint List By TaskId") @ApiOperation("Query SavePoint List By TaskId")
@ApiImplicitParam(name = "taskID", value = "Task ID", dataType = "Integer", paramType = "query", required = true) @ApiImplicitParam(name = "taskId", value = "Task ID", dataType = "Integer", paramType = "query", required = true)
public Result<List<Savepoints>> listSavePointsByTaskId(@RequestParam Integer taskID) { public Result<List<Savepoints>> listSavePointsByTaskId(@RequestParam Integer taskId) {
return Result.succeed(savepointsService.listSavepointsByTaskId(taskID)); return Result.succeed(savepointsService.listSavepointsByTaskId(taskId));
} }
} }
...@@ -30,7 +30,7 @@ import java.util.List; ...@@ -30,7 +30,7 @@ import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/** /**
* SavepointsServiceImpl * SavepointsServiceImpl
...@@ -42,7 +42,7 @@ public class SavepointsServiceImpl extends SuperServiceImpl<SavepointsMapper, Sa ...@@ -42,7 +42,7 @@ public class SavepointsServiceImpl extends SuperServiceImpl<SavepointsMapper, Sa
@Override @Override
public List<Savepoints> listSavepointsByTaskId(Integer taskId) { public List<Savepoints> listSavepointsByTaskId(Integer taskId) {
return list(new QueryWrapper<Savepoints>().eq("task_id", taskId)); return list(new LambdaQueryWrapper<>(Savepoints.class).eq(Savepoints::getTaskId, taskId));
} }
@Override @Override
......
...@@ -21,6 +21,7 @@ import { TagAlignLeft } from '@/components/StyledComponents'; ...@@ -21,6 +21,7 @@ import { TagAlignLeft } from '@/components/StyledComponents';
import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function'; import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function';
import { RUN_MODE } from '@/services/constants'; import { RUN_MODE } from '@/services/constants';
import { Alert, ALERT_TYPE, Cluster } from '@/types/RegCenter/data.d'; import { Alert, ALERT_TYPE, Cluster } from '@/types/RegCenter/data.d';
import { TaskInfo } from '@/types/Studio/data.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { PaperClipOutlined } from '@ant-design/icons'; import { PaperClipOutlined } from '@ant-design/icons';
import { Badge, Space, Tag } from 'antd'; import { Badge, Space, Tag } from 'antd';
...@@ -103,7 +104,7 @@ export const buildClusterOptions = ( ...@@ -103,7 +104,7 @@ export const buildClusterOptions = (
*/ */
export const buildClusterConfigOptions = ( export const buildClusterConfigOptions = (
selectedRunMode: string, selectedRunMode: string,
clusterConfiguration: Cluster.Config[] clusterConfiguration: Cluster.Config[] = []
) => { ) => {
// if run mode is yarn-application or yarn per-job, need to filter yarn application and yarn per-job // if run mode is yarn-application or yarn per-job, need to filter yarn application and yarn per-job
if ([RUN_MODE.YARN_APPLICATION, RUN_MODE.YARN_PER_JOB].includes(selectedRunMode)) { if ([RUN_MODE.YARN_APPLICATION, RUN_MODE.YARN_PER_JOB].includes(selectedRunMode)) {
...@@ -140,7 +141,7 @@ export const buildClusterConfigOptions = ( ...@@ -140,7 +141,7 @@ export const buildClusterConfigOptions = (
/** /**
* build env options * build env options
*/ */
export const buildEnvOptions = (env: any[]) => { export const buildEnvOptions = (env: TaskInfo[] = []) => {
const envList: DefaultOptionType[] = [ const envList: DefaultOptionType[] = [
{ {
label: l('button.disable'), label: l('button.disable'),
...@@ -171,7 +172,7 @@ export const buildEnvOptions = (env: any[]) => { ...@@ -171,7 +172,7 @@ export const buildEnvOptions = (env: any[]) => {
/** /**
* build job alert groups * build job alert groups
*/ */
export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => { export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[] = []) => {
const alertGroupOptions: DefaultOptionType[] = [ const alertGroupOptions: DefaultOptionType[] = [
{ {
label: ( label: (
...@@ -184,7 +185,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => { ...@@ -184,7 +185,7 @@ export const buildAlertGroupOptions = (alertGroups: Alert.AlertGroup[]) => {
key: -1 key: -1
} }
]; ];
alertGroups?.forEach((item) => { alertGroups.forEach((item) => {
alertGroupOptions.push({ alertGroupOptions.push({
label: ( label: (
<TagAlignLeft> <TagAlignLeft>
......
...@@ -19,18 +19,28 @@ ...@@ -19,18 +19,28 @@
import EllipsisMiddle from '@/components/Typography/EllipsisMiddle'; import EllipsisMiddle from '@/components/Typography/EllipsisMiddle';
import { JobProps } from '@/pages/DevOps/JobDetail/data'; import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { queryList } from '@/services/api'; import { queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { SavePoint } from '@/types/Studio/data'; import { SavePoint } from '@/types/Studio/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { useRef } from 'react'; import { useEffect, useRef, useState } from 'react';
const SavepointTable = (props: JobProps) => { const SavepointTable = (props: JobProps) => {
const { jobDetail } = props; const { jobDetail } = props;
const actionRef = useRef<ActionType>(); 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>[] = [ const columns: ProColumns<SavePoint>[] = [
{ {
title: l('devops.jobinfo.ck.id'), title: l('devops.jobinfo.ck.id'),
...@@ -73,13 +83,7 @@ const SavepointTable = (props: JobProps) => { ...@@ -73,13 +83,7 @@ const SavepointTable = (props: JobProps) => {
<ProTable<SavePoint> <ProTable<SavePoint>
columns={columns} columns={columns}
style={{ width: '100%', height: 'calc(100vh - 450px)' }} style={{ width: '100%', height: 'calc(100vh - 450px)' }}
request={(params, sorter, filter) => dataSource={savepointData}
queryList(API_CONSTANTS.GET_SAVEPOINTS, {
...params,
sorter,
filter: { taskId: [jobDetail?.instance.taskId] }
})
}
actionRef={actionRef} actionRef={actionRef}
toolBarRender={false} toolBarRender={false}
rowKey='id' rowKey='id'
......
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
*/ */
import CodeEdit from '@/components/CustomEditor/CodeEdit'; import CodeEdit from '@/components/CustomEditor/CodeEdit';
import {JOB_TYPE} from '@/pages/DataStudio/LeftContainer/Project/constants'; import { JOB_TYPE } from '@/pages/DataStudio/LeftContainer/Project/constants';
import { import {
DOCUMENT_CATEGORY_ENUMS, DOCUMENT_CATEGORY_ENUMS,
DOCUMENT_FUNCTION_TYPE_ENUMS, DOCUMENT_FUNCTION_TYPE_ENUMS,
DOCUMENT_TYPE_ENUMS, DOCUMENT_TYPE_ENUMS,
VERSIONS VERSIONS
} from '@/pages/RegCenter/Document/constans'; } from '@/pages/RegCenter/Document/constans';
import {Document} from '@/types/RegCenter/data'; import { Document } from '@/types/RegCenter/data';
import {l} from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
ProFormGroup, ProFormGroup,
ProFormItem, ProFormItem,
...@@ -36,10 +36,10 @@ import { ...@@ -36,10 +36,10 @@ import {
ProFormText, ProFormText,
ProFormTextArea ProFormTextArea
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import {FormInstance} from 'antd/es/form/hooks/useForm'; import { FormInstance } from 'antd/es/form/hooks/useForm';
import {Values} from 'async-validator'; import { Values } from 'async-validator';
import {DefaultOptionType} from 'rc-select/lib/Select'; import { DefaultOptionType } from 'rc-select/lib/Select';
import React, {useState} from 'react'; import React, { useState } from 'react';
type DocumentFormProps = { type DocumentFormProps = {
values: Partial<Document>; values: Partial<Document>;
...@@ -52,16 +52,16 @@ const CodeEditProps = { ...@@ -52,16 +52,16 @@ const CodeEditProps = {
}; };
const DocumentForm: React.FC<DocumentFormProps> = (props) => { const DocumentForm: React.FC<DocumentFormProps> = (props) => {
const {values, form} = props; const { values, form } = props;
/** /**
* status * status
*/ */
const [codeFillValue, setCodeFillValue] = useState<string>(values.fillValue || ''); const [codeFillValue, setCodeFillValue] = useState<string>(values.fillValue || '');
const {FLINK_OPTIONS, SQL_TEMPLATE, FUN_UDF, OTHER} = DOCUMENT_TYPE_ENUMS; const { FLINK_OPTIONS, SQL_TEMPLATE, FUN_UDF, OTHER } = DOCUMENT_TYPE_ENUMS;
const [CATEGORY_LIST] = useState<DefaultOptionType[]>( const [CATEGORY_LIST] = useState<DefaultOptionType[]>(
Object.values(DOCUMENT_CATEGORY_ENUMS).map((item) => ({label: item.text, value: item.value})) Object.values(DOCUMENT_CATEGORY_ENUMS).map((item) => ({ label: item.text, value: item.value }))
); );
const [FUNCTION_TYPES] = useState<DefaultOptionType[]>( const [FUNCTION_TYPES] = useState<DefaultOptionType[]>(
...@@ -72,12 +72,11 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -72,12 +72,11 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
); );
const [VERSION_OPTIONS] = useState<DefaultOptionType[]>( const [VERSION_OPTIONS] = useState<DefaultOptionType[]>(
VERSIONS.map((item) => ({label: item.text, value: item.value})) VERSIONS.map((item) => ({ label: item.text, value: item.value }))
); );
const [documentType, setDocumentType] = useState<string>(''); const [documentType, setDocumentType] = useState<string>('');
/** /**
* form * form
* @constructor * @constructor
...@@ -90,8 +89,9 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -90,8 +89,9 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
name='type' name='type'
label={l('rc.doc.functionType')} label={l('rc.doc.functionType')}
initialValue={SQL_TEMPLATE.value} initialValue={SQL_TEMPLATE.value}
rules={[{required: true, message: l('rc.doc.typePlaceholder')}]} rules={[{ required: true, message: l('rc.doc.typePlaceholder') }]}
valueEnum={DOCUMENT_TYPE_ENUMS} fieldProps={{onChange: (value) => setDocumentType(value as string)}} valueEnum={DOCUMENT_TYPE_ENUMS}
fieldProps={{ onChange: (value) => setDocumentType(value as string) }}
/> />
<ProFormText <ProFormText
...@@ -99,7 +99,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -99,7 +99,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
width={'md'} width={'md'}
label={l('rc.doc.name')} label={l('rc.doc.name')}
placeholder={l('rc.doc.namePlaceholder')} placeholder={l('rc.doc.namePlaceholder')}
rules={[{required: true, message: l('rc.doc.namePlaceholder')}]} rules={[{ required: true, message: l('rc.doc.namePlaceholder') }]}
/> />
<ProFormSwitch <ProFormSwitch
...@@ -108,7 +108,6 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -108,7 +108,6 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
checkedChildren={l('button.enable')} checkedChildren={l('button.enable')}
unCheckedChildren={l('button.disable')} unCheckedChildren={l('button.disable')}
/> />
</ProFormGroup> </ProFormGroup>
<ProFormGroup> <ProFormGroup>
...@@ -116,7 +115,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -116,7 +115,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
name='subtype' name='subtype'
width={'sm'} width={'sm'}
label={l('rc.doc.subFunctionType')} label={l('rc.doc.subFunctionType')}
rules={[{required: true, message: l('rc.doc.subTypePlaceholder')}]} rules={[{ required: true, message: l('rc.doc.subTypePlaceholder') }]}
options={documentType == FUN_UDF.value ? FUNCTION_TYPES : JOB_TYPE} options={documentType == FUN_UDF.value ? FUNCTION_TYPES : JOB_TYPE}
/> />
...@@ -124,14 +123,14 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -124,14 +123,14 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
name='category' name='category'
width={'sm'} width={'sm'}
label={l('rc.doc.category')} label={l('rc.doc.category')}
rules={[{required: true, message: l('rc.doc.categoryPlaceholder')}]} rules={[{ required: true, message: l('rc.doc.categoryPlaceholder') }]}
options={CATEGORY_LIST} options={CATEGORY_LIST}
/> />
<ProFormSelect <ProFormSelect
name='version' name='version'
width={'sm'} width={'sm'}
label={l('rc.doc.version')} label={l('rc.doc.version')}
rules={[{required: true, message: l('rc.doc.versionPlaceholder')}]} rules={[{ required: true, message: l('rc.doc.versionPlaceholder') }]}
options={VERSION_OPTIONS} options={VERSION_OPTIONS}
/> />
</ProFormGroup> </ProFormGroup>
...@@ -140,7 +139,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -140,7 +139,7 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
name='fillValue' name='fillValue'
label={l('rc.doc.fillValue')} label={l('rc.doc.fillValue')}
tooltip={l('rc.doc.fillValuePlaceholder')} tooltip={l('rc.doc.fillValuePlaceholder')}
rules={[{required: true, message: l('rc.doc.fillValueHelp')}]} rules={[{ required: true, message: l('rc.doc.fillValueHelp') }]}
> >
<CodeEdit <CodeEdit
code={codeFillValue} code={codeFillValue}
...@@ -159,10 +158,6 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => { ...@@ -159,10 +158,6 @@ const DocumentForm: React.FC<DocumentFormProps> = (props) => {
); );
}; };
return ( return <>{documentFormRender()}</>;
<>
{documentFormRender()}
</>
);
}; };
export default DocumentForm; export default DocumentForm;
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
import { FormContextValue } from '@/components/Context/FormContext'; import { FormContextValue } from '@/components/Context/FormContext';
import DocumentForm from '@/pages/RegCenter/Document/components/DocumentModal/DocumentForm'; import DocumentForm from '@/pages/RegCenter/Document/components/DocumentModal/DocumentForm';
import {MODAL_FORM_OPTIONS} from '@/services/constants'; import { MODAL_FORM_OPTIONS } from '@/services/constants';
import { Document } from '@/types/RegCenter/data'; import { Document } from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import {Form} from 'antd'; import { ModalForm } from '@ant-design/pro-components';
import { Form } from 'antd';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import {ModalForm} from "@ant-design/pro-components";
type DocumentModalProps = { type DocumentModalProps = {
onCancel: (flag?: boolean) => void; onCancel: (flag?: boolean) => void;
...@@ -75,7 +75,6 @@ const DocumentModalForm: React.FC<DocumentModalProps> = (props) => { ...@@ -75,7 +75,6 @@ const DocumentModalForm: React.FC<DocumentModalProps> = (props) => {
await handleCancel(); await handleCancel();
}; };
return ( return (
<ModalForm<Partial<Document>> <ModalForm<Partial<Document>>
{...MODAL_FORM_OPTIONS} {...MODAL_FORM_OPTIONS}
......
...@@ -247,7 +247,7 @@ export enum API_CONSTANTS { ...@@ -247,7 +247,7 @@ export enum API_CONSTANTS {
RESTART_TASK = '/api/task/restartTask', RESTART_TASK = '/api/task/restartTask',
SAVEPOINT = '/api/task/savepoint', SAVEPOINT = '/api/task/savepoint',
RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask', RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask',
GET_SAVEPOINTS = '/api/savepoints', GET_SAVEPOINT_LIST_BY_TASK_ID = '/api/savepoints/listSavepointsByTaskId',
ALERT_HISTORY_LIST = '/api/alertHistory/list', ALERT_HISTORY_LIST = '/api/alertHistory/list',
ALERT_HISTORY_DELETE = '/api/alertHistory/delete', ALERT_HISTORY_DELETE = '/api/alertHistory/delete',
......
...@@ -31,7 +31,7 @@ export type Catalogue = { ...@@ -31,7 +31,7 @@ export type Catalogue = {
updateTime: Date; updateTime: Date;
children: Catalogue[]; children: Catalogue[];
configJson: TaskExtConfig; configJson: TaskExtConfig;
task: Task; task: TaskInfo;
}; };
export type TaskUdfConfig = { export type TaskUdfConfig = {
...@@ -50,7 +50,7 @@ export type TaskExtConfig = { ...@@ -50,7 +50,7 @@ export type TaskExtConfig = {
customConfig: List<Map<string, object>>; customConfig: List<Map<string, object>>;
}; };
export type Task = { export type TaskInfo = {
id: number; id: number;
name: string; name: string;
dialect: string; dialect: string;
...@@ -67,6 +67,7 @@ export type Task = { ...@@ -67,6 +67,7 @@ export type Task = {
clusterConfigurationId: number; clusterConfigurationId: number;
databaseId: number; databaseId: number;
envId: number; envId: number;
enabled: boolean;
alertGroupId: number; alertGroupId: number;
note: string; note: string;
step: number; step: number;
......
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