Skip to content

Commit 5c775d7

Browse files
authored
[]Optimize][Web]Optimize flink jar form select (#3972)
Co-authored-by: zackyoungh <zackyoungh@users.noreply.github.com>
1 parent d64de82 commit 5c775d7

File tree

4 files changed

+50
-40
lines changed

4 files changed

+50
-40
lines changed

dinky-admin/src/main/java/org/dinky/controller/TaskController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,6 @@ public Result<String> flinkJarFormConvertSql(@RequestBody FlinkJarSqlConvertVO d
348348
.orElse(false)
349349
.toString());
350350
String executeJarSql = ENGINE.getTemplate("executeJar.sql").render(objectMap);
351-
return Result.succeed(dto.getInitSqlStatement() + "\n" + executeJarSql, "");
351+
return Result.succeed(Opt.ofNullable(dto.getInitSqlStatement()).orElse("") + "\n" + executeJarSql, "");
352352
}
353353
}

dinky-web/src/locales/en-US/pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export default {
157157
'datastudio.sqlTask.flinkJar.tip':
158158
'The code editor on the left is the FlinkSql pre-statement, and the current form item is the EXECUTE JAR WITH syntax',
159159
'datastudio.sqlTask.flinkJar.uri': 'Program path',
160+
'datastudio.sqlTask.flinkJar.manualInput': 'Manual input',
160161
'datastudio.sqlTask.flinkJar.uri.tip': 'Please enter the path to run the program (uri)',
161162
'datastudio.sqlTask.flinkJar.mainClass': 'Program running class (mainClass)',
162163
'datastudio.sqlTask.flinkJar.mainClass.tip':

dinky-web/src/locales/zh-CN/pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export default {
144144
'datastudio.project.import.tip': '点击或拖拽文件到此区域上传',
145145
'datastudio.sqlTask.flinkJar.tip':
146146
'左边代码编辑器是 FlinkSql 前置语句,当前表单项是 EXECUTE JAR WITH 语法',
147+
'datastudio.sqlTask.flinkJar.manualInput': '手动输入',
147148
'datastudio.sqlTask.flinkJar.uri': '程序路径',
148149
'datastudio.sqlTask.flinkJar.uri.tip': '请输入运行程序路径(uri)',
149150
'datastudio.sqlTask.flinkJar.mainClass': '程序运行类(mainClass)',

dinky-web/src/pages/DataStudio/CenterTabContent/SqlTask/index.tsx

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { connect, useModel } from '@umijs/max';
4646
import CusPanelResizeHandle from '@/pages/DataStudio/components/CusPanelResizeHandle';
4747
import {
4848
ProForm,
49+
ProFormCheckbox,
4950
ProFormInstance,
5051
ProFormSwitch,
5152
ProFormText,
@@ -93,13 +94,9 @@ import DiffModal from '@/pages/DataStudio/CenterTabContent/SqlTask/DiffModal';
9394
import TaskConfig from '@/pages/DataStudio/CenterTabContent/SqlTask/TaskConfig';
9495
import SelectDb from '@/pages/DataStudio/CenterTabContent/RunToolbar/SelectDb';
9596
import { SseData, Topic } from '@/models/UseWebSocketModel';
96-
import WarpProFormTreeSelect from '@ant-design/pro-form/es/components/TreeSelect';
9797
import { ResourceInfo } from '@/types/RegCenter/data';
98-
import {
99-
buildResourceTreeData,
100-
buildResourceTreeDataAtTreeForm
101-
} from '@/pages/RegCenter/Resource/components/FileTree/function';
102-
import Paragraph from 'antd/es/typography/Paragraph';
98+
import { buildResourceTreeDataAtTreeForm } from '@/pages/RegCenter/Resource/components/FileTree/function';
99+
import { ProFormDependency } from '@ant-design/pro-form';
103100

104101
export type FlinkSqlProps = {
105102
showDesc: boolean;
@@ -912,41 +909,51 @@ export const SqlTask = memo((props: FlinkSqlProps & any) => {
912909
}));
913910
}}
914911
>
915-
{/*<ProFormText*/}
916-
{/* name={'uri'}*/}
917-
{/* label={'程序路径'}*/}
918-
{/* placeholder={'请输入运行程序路径'}*/}
919-
{/*/>*/}
920-
<ProFormTreeSelect
921-
request={async () => {
922-
return buildResourceTreeDataAtTreeForm(
923-
tempData.resourceDataList as ResourceInfo[],
924-
false,
925-
[]
912+
<ProFormCheckbox.Group name='manualInput' options={[l('datastudio.sqlTask.flinkJar.manualInput')]} />
913+
914+
<ProFormDependency name={['manualInput']}>
915+
{({ manualInput }) => {
916+
return manualInput?.length > 0 ? (
917+
<ProFormText
918+
name={'uri'}
919+
label={l('datastudio.sqlTask.flinkJar.uri')}
920+
placeholder={l('datastudio.sqlTask.flinkJar.uri.tip')}
921+
/>
922+
) : (
923+
<ProFormTreeSelect
924+
request={async () => {
925+
return buildResourceTreeDataAtTreeForm(
926+
tempData.resourceDataList as ResourceInfo[],
927+
false,
928+
[]
929+
);
930+
}}
931+
normalize={(value) => {
932+
return value?.value ?? '';
933+
}}
934+
name={'uri'}
935+
label={l('datastudio.sqlTask.flinkJar.uri')}
936+
placeholder={l('datastudio.sqlTask.flinkJar.uri.tip')}
937+
fieldProps={{
938+
suffixIcon: null,
939+
filterTreeNode: true,
940+
showSearch: true,
941+
treeIcon: true,
942+
popupMatchSelectWidth: false,
943+
labelInValue: true,
944+
autoClearSearchValue: true,
945+
treeLine: true,
946+
treeDefaultExpandedKeys: ['rs:/'],
947+
treeNodeLabelProp: 'value',
948+
fieldNames: {
949+
label: 'title'
950+
}
951+
}}
952+
/>
926953
);
927954
}}
928-
normalize={(value) => {
929-
return value.value;
930-
}}
931-
name={'uri'}
932-
label={l('datastudio.sqlTask.flinkJar.uri')}
933-
placeholder={l('datastudio.sqlTask.flinkJar.uri.tip')}
934-
fieldProps={{
935-
suffixIcon: null,
936-
filterTreeNode: true,
937-
showSearch: true,
938-
treeIcon: true,
939-
popupMatchSelectWidth: false,
940-
labelInValue: true,
941-
autoClearSearchValue: true,
942-
treeLine: true,
943-
treeDefaultExpandedKeys: ['rs:/'],
944-
treeNodeLabelProp: 'value',
945-
fieldNames: {
946-
label: 'title'
947-
}
948-
}}
949-
/>
955+
</ProFormDependency>
956+
950957
<ProFormText
951958
name={'mainClass'}
952959
label={l('datastudio.sqlTask.flinkJar.mainClass')}
@@ -959,6 +966,7 @@ export const SqlTask = memo((props: FlinkSqlProps & any) => {
959966
/>
960967
<ProFormSwitch
961968
name={'allowNonRestoredState'}
969+
layout='vertical'
962970
label={l('datastudio.sqlTask.flinkJar.allowNonRestoredState')}
963971
/>
964972
</ProForm>

0 commit comments

Comments
 (0)