diff --git a/dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java b/dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java index fe6ff904ca..0ae55d8e2f 100644 --- a/dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java +++ b/dinky-admin/src/main/java/org/dinky/data/dto/DebugDTO.java @@ -39,13 +39,6 @@ public class DebugDTO { notes = "The ID of Task which is debugged") private Integer id; - @ApiModelProperty( - value = "Use Result", - dataType = "boolean", - example = "true", - notes = "Flag indicating whether to preview table result") - private boolean useResult = true; - @ApiModelProperty( value = "Use ChangeLog", dataType = "boolean", diff --git a/dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java b/dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java index b861955b1e..86cc91c47d 100644 --- a/dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java +++ b/dinky-admin/src/main/java/org/dinky/job/Job2MysqlHandler.java @@ -145,7 +145,8 @@ public boolean success() { clusterId = clusterInstance.getId(); } } else if (GatewayType.LOCAL.equalsValue(job.getJobConfig().getType()) - && Asserts.isNotNullString(job.getJobManagerAddress())) { + && Asserts.isNotNullString(job.getJobManagerAddress()) + && Asserts.isNotNullString(job.getJobId())) { clusterInstance = clusterInstanceService.registersCluster(ClusterInstanceDTO.autoRegistersClusterDTO( job.getJobManagerAddress(), job.getJobId(), diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java index 0dda7472a2..5630ffc815 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java @@ -266,8 +266,6 @@ public JobResult submitTask(Integer id, String savePointPath) throws Exception { } // 注解自调用会失效,这里通过获取对象方法绕过此限制 TaskServiceImpl taskServiceBean = applicationContext.getBean(TaskServiceImpl.class); - taskServiceBean.preCheckTask(taskDTO); - JobResult jobResult = taskServiceBean.executeJob(taskDTO); if (Job.JobStatus.SUCCESS == jobResult.getStatus()) { @@ -288,16 +286,14 @@ public JobResult debugTask(DebugDTO debugDTO) throws Exception { initTenantByTaskId(debugDTO.getId()); TaskDTO taskDTO = this.getTaskInfoById(debugDTO.getId()); - taskDTO.setUseResult(debugDTO.isUseResult()); + // Debug mode need return result + taskDTO.setUseResult(true); taskDTO.setUseChangeLog(debugDTO.isUseChangeLog()); taskDTO.setUseAutoCancel(debugDTO.isUseAutoCancel()); taskDTO.setMaxRowNum(debugDTO.getMaxRowNum()); // 注解自调用会失效,这里通过获取对象方法绕过此限制 TaskServiceImpl taskServiceBean = applicationContext.getBean(TaskServiceImpl.class); - taskServiceBean.preCheckTask(taskDTO); - JobResult jobResult = taskServiceBean.executeJob(taskDTO); - if (Job.JobStatus.SUCCESS == jobResult.getStatus()) { log.info("Job debug success"); Task task = new Task(debugDTO.getId(), jobResult.getJobInstanceId()); diff --git a/dinky-executor/src/main/java/org/dinky/executor/VariableManager.java b/dinky-executor/src/main/java/org/dinky/executor/VariableManager.java index c9c6f0c5b6..1a9a8efff3 100644 --- a/dinky-executor/src/main/java/org/dinky/executor/VariableManager.java +++ b/dinky-executor/src/main/java/org/dinky/executor/VariableManager.java @@ -53,7 +53,6 @@ * @since 2021/6/7 22:06 */ public final class VariableManager { - public static final String VARIABLE = "variable"; static final String SHOW_VARIABLES = "SHOW VARIABLES"; private final Map variables; @@ -92,17 +91,10 @@ public List listVariablesName() { * * @param variableName name under which to register the given sql variable * @param variable a variable of sql to register - * @throws CatalogException if the registration of the sql variable under the given name failed. - * But at the moment, with CatalogException, not SqlException */ public void registerVariable(String variableName, String variable) { checkArgument(!StringUtils.isNullOrWhitespaceOnly(variableName), "sql variable name cannot be null or empty."); checkNotNull(variable, "sql variable cannot be null"); - - if (variables.containsKey(variableName)) { - throw new CatalogException(format("The variable of sql %s already exists.", variableName)); - } - variables.put(variableName, variable); } diff --git a/dinky-web/src/locales/en-US/pages.ts b/dinky-web/src/locales/en-US/pages.ts index b2c01e1a78..58c2f0e140 100644 --- a/dinky-web/src/locales/en-US/pages.ts +++ b/dinky-web/src/locales/en-US/pages.ts @@ -361,9 +361,6 @@ export default { 'pages.datastudio.label.execConfig.selectDatabase.tip': 'Select the database to be used', 'pages.datastudio.label.execConfig.maxrow': 'Maximum number of rows', 'pages.datastudio.label.execConfig.maxrow.tip': 'The maximum number of rows of preview data', - 'pages.datastudio.label.execConfig.preview.result': 'Preview Result', - 'pages.datastudio.label.execConfig.preview.result.tip': - 'Open the preview result, it will run synchronously and return the data result', 'pages.datastudio.label.jobConfig': 'Job Config', 'pages.datastudio.label.jobConfig.addConfig': 'Add Config item', 'pages.datastudio.label.jobConfig.addConfig.params': 'parameters', diff --git a/dinky-web/src/locales/zh-CN/pages.ts b/dinky-web/src/locales/zh-CN/pages.ts index b48347c1ea..72007e3555 100644 --- a/dinky-web/src/locales/zh-CN/pages.ts +++ b/dinky-web/src/locales/zh-CN/pages.ts @@ -349,8 +349,6 @@ export default { 'pages.datastudio.label.execConfig.selectDatabase.tip': '选择 Sql 语句执行的数据源', 'pages.datastudio.label.execConfig.maxrow': '最大行数', 'pages.datastudio.label.execConfig.maxrow.tip': '预览数据的最大行数', - 'pages.datastudio.label.execConfig.preview.result': '预览结果', - 'pages.datastudio.label.execConfig.preview.result.tip': '开启预览结果,将同步运行并返回数据结果', 'pages.datastudio.label.jobConfig': '作业配置', 'pages.datastudio.label.jobConfig.addConfig': '添加配置项', 'pages.datastudio.label.jobConfig.addConfig.params': '参数', diff --git a/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx b/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx index 8eece0b598..0516f4f57b 100644 --- a/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx +++ b/dinky-web/src/pages/DataStudio/BottomContainer/Result/index.tsx @@ -126,8 +126,9 @@ const Result = (props: any) => { } const params = currentTabs.params; - if (params.resultData && !isRefresh) { - setData(params.resultData); + const consoleData = currentTabs.console; + if (consoleData.result && !isRefresh) { + setData(consoleData.result); } else { if (isSql(current.dialect)) { // common sql @@ -135,13 +136,12 @@ const Result = (props: any) => { taskId: params.taskId }); if (res.datas) { - params.resultData = res.datas; + consoleData.result = res.datas; setData(res.datas); } } else { // flink sql // to do: get job data by history id list, not flink jid - console.log(current); if (current.id) { const res = await handleGetOptionWithoutMsg(API_CONSTANTS.GET_LATEST_HISTORY_BY_ID, { id: current.id @@ -154,10 +154,10 @@ const Result = (props: any) => { }); const datas = tableData.datas; if (datas.success) { - params.resultData = datas; + consoleData.result = datas; setData(datas); } else { - params.resultData = {}; + consoleData.result = {}; setData({}); } } @@ -170,7 +170,7 @@ const Result = (props: any) => { useEffect(() => { setData({}); loadData(); - }, [currentTabs]); + }, [currentTabs, currentTabs?.console.result]); const getColumns = (columns: string[]) => { return columns?.map((item) => { diff --git a/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx b/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx index e2b11c2d0b..3bb77d5937 100644 --- a/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx +++ b/dinky-web/src/pages/DataStudio/HeaderContainer/index.tsx @@ -152,6 +152,7 @@ const HeaderContainer = (props: any) => { }); messageApi.success(l('pages.datastudio.editor.debug.success')); currentData.status = JOB_STATUS.RUNNING; + if (currentTab) currentTab.console.result = res.datas.result; saveTabs({ ...props.tabs }); }; diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx index 37da5b412d..dfb89886ff 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/JobTree/index.tsx @@ -43,6 +43,7 @@ type TreeProps = { onRightClick: (info: any) => void; style?: React.CSSProperties; selectedKeys: Key[]; + selectKeyChange: (keys: Key[]) => void; }; const JobTree: React.FC = (props) => { @@ -52,7 +53,8 @@ const JobTree: React.FC = (props) => { style, height, onRightClick, - selectedKeys: selectedKey + selectKeyChange, + selectedKeys } = props; const [searchValue, setSearchValueValue] = useState(''); @@ -64,7 +66,6 @@ const JobTree: React.FC = (props) => { const [expandedKeys, setExpandedKeys] = useState(); const [autoExpandParent, setAutoExpandParent] = useState(true); - const [selectedKeys, setSelectedKeys] = useState(selectedKey); const onChangeSearch = (e: any) => { let { value } = e.target; if (!value) { @@ -110,7 +111,7 @@ const JobTree: React.FC = (props) => { .filter((item: any, i: number, self: any) => item && self.indexOf(item) === i); setExpandedKeys(expandedKeys); setAutoExpandParent(true); - setSelectedKeys([treeKey]); + selectKeyChange([treeKey]) } }; diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx index 6a98c7a222..824954f66c 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/function.tsx @@ -83,25 +83,6 @@ export const buildProjectTree = ( const currentPath = path ? [...path, item.name] : [item.name]; // 构造生命周期的值 const stepValue = buildStepValue(item.task?.step); - // 渲染生命周期的徽标 - const renderStepBadge = item.isLeaf && showBadge(item.type) && ( - <> - - - ); // 渲染生命周期的 标记点 const renderPreFixState = item.isLeaf && showBadge(item.type) && ( <> @@ -116,7 +97,6 @@ export const buildProjectTree = ( const renderTitle = ( <> - {renderStepBadge} {searchTreeNode(item.name, searchValue)} @@ -138,7 +118,7 @@ export const buildProjectTree = ( type: item.type, title: ( <> - {item.isLeaf && showBadge(item.type) && <>{'\u00A0'.repeat(16)}} {renderTitle} + {item.isLeaf && showBadge(item.type) && <>{'\u00A0'.repeat(2)}} {renderTitle} ), fullInfo: item, diff --git a/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx b/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx index 2710c32489..3e75664ba4 100644 --- a/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx +++ b/dinky-web/src/pages/DataStudio/LeftContainer/Project/index.tsx @@ -39,7 +39,7 @@ import { ProjectState } from '@/types/Studio/state.d'; import { l } from '@/utils/intl'; import { Modal, Typography } from 'antd'; import { MenuInfo } from 'rc-menu/es/interface'; -import React, { useEffect, useState } from 'react'; +import React, {Key, useEffect, useState} from 'react'; import { connect } from 'umi'; const { Text } = Typography; @@ -120,6 +120,7 @@ const Project: React.FC = (props: connect) => { taskId: taskId }, type: 'project', + console: {}, subType: type } }); @@ -353,6 +354,7 @@ const Project: React.FC = (props: connect) => { return (
setProjectState((prevState) => ({ ...prevState, selectedKeys: keys }))} selectedKeys={projectState.selectedKeys} onRightClick={handleRightClick} onNodeClick={(info: any) => onNodeClick(info)} diff --git a/dinky-web/src/pages/DataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx b/dinky-web/src/pages/DataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx index 1220e1a46b..e8617864af 100644 --- a/dinky-web/src/pages/DataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx +++ b/dinky-web/src/pages/DataStudio/RightContainer/ExecuteConfig/FlinkSql/index.tsx @@ -63,16 +63,6 @@ const ExecuteConfigFlinkSql = (props: any) => { onValuesChange={onValuesChange} > - - }} - {...SWITCH_OPTIONS()} - /> - { }} {...SWITCH_OPTIONS()} /> - - { }} {...SWITCH_OPTIONS()} /> + + ; export type DataStudioParams = { taskId: number; taskData: TaskDataType; - resultData: Record; }; export enum TabsPageType {