From 2a61336062755fbf98b99ec034412d2cf728dfd2 Mon Sep 17 00:00:00 2001 From: zhu-mingye Date: Sun, 5 Nov 2023 10:30:12 +0000 Subject: [PATCH 01/14] Spotless Apply --- .../pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx b/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx index 6a2104351e..6ae7e22fa1 100644 --- a/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx +++ b/dinky-web/src/pages/DataStudio/BottomContainer/Console/ConsoleContent.tsx @@ -163,7 +163,7 @@ const ConsoleContent = (props: ConsoleProps) => { onSelect={onSelect} treeData={[processNode]} expandedKeys={expandedKeys} - expandAction={"doubleClick"} + expandAction={'doubleClick'} onExpand={handleExpand} /> ) : ( From 9457bf89401fc9c3246923254284738a798bcef6 Mon Sep 17 00:00:00 2001 From: zhu-mingye Date: Mon, 6 Nov 2023 03:13:56 +0000 Subject: [PATCH 02/14] Spotless Apply --- .../components/ResourceOverView/index.tsx | 507 +++++++++--------- 1 file changed, 252 insertions(+), 255 deletions(-) diff --git a/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx b/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx index e788ec9fc0..332f1685f6 100644 --- a/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx +++ b/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx @@ -18,286 +18,283 @@ */ import RightContextMenu from '@/components/RightContextMenu'; -import {AuthorizedObject, useAccess} from '@/hooks/useAccess'; +import { AuthorizedObject, useAccess } from '@/hooks/useAccess'; import { - RIGHT_CONTEXT_FILE_MENU, - RIGHT_CONTEXT_FOLDER_MENU + RIGHT_CONTEXT_FILE_MENU, + RIGHT_CONTEXT_FOLDER_MENU } from '@/pages/RegCenter/Resource/components/constants'; import FileShow from '@/pages/RegCenter/Resource/components/FileShow'; import FileTree from '@/pages/RegCenter/Resource/components/FileTree'; import ResourceModal from '@/pages/RegCenter/Resource/components/ResourceModal'; import ResourcesUploadModal from '@/pages/RegCenter/Resource/components/ResourcesUploadModal'; -import {handleOption, handleRemoveById, queryDataByParams} from '@/services/BusinessCrud'; -import {API_CONSTANTS} from '@/services/endpoints'; -import {ResourceInfo} from '@/types/RegCenter/data'; -import {InitResourceState} from '@/types/RegCenter/init.d'; -import {ResourceState} from '@/types/RegCenter/state.d'; -import {l} from '@/utils/intl'; -import {ProCard} from '@ant-design/pro-components'; -import {MenuInfo} from 'rc-menu/es/interface'; -import {Resizable} from 're-resizable'; -import React, {useCallback, useState} from 'react'; -import {useAsyncEffect} from "ahooks"; -import {unSupportView} from "@/utils/function"; +import { handleOption, handleRemoveById, queryDataByParams } from '@/services/BusinessCrud'; +import { API_CONSTANTS } from '@/services/endpoints'; +import { ResourceInfo } from '@/types/RegCenter/data'; +import { InitResourceState } from '@/types/RegCenter/init.d'; +import { ResourceState } from '@/types/RegCenter/state.d'; +import { unSupportView } from '@/utils/function'; +import { l } from '@/utils/intl'; +import { ProCard } from '@ant-design/pro-components'; +import { useAsyncEffect } from 'ahooks'; +import { MenuInfo } from 'rc-menu/es/interface'; +import { Resizable } from 're-resizable'; +import React, { useCallback, useState } from 'react'; const ResourceOverView: React.FC = () => { - const [resourceState, setResourceState] = useState(InitResourceState); + const [resourceState, setResourceState] = useState(InitResourceState); - const [editModal, setEditModal] = useState(''); + const [editModal, setEditModal] = useState(''); - const [uploadValue] = useState({ - url: API_CONSTANTS.RESOURCE_UPLOAD, - pid: '', - description: '' - }); + const [uploadValue] = useState({ + url: API_CONSTANTS.RESOURCE_UPLOAD, + pid: '', + description: '' + }); - const refreshTree = async () => { - await queryDataByParams(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) => - setResourceState((prevState) => ({...prevState, treeData: res ?? []})) - ); - }; - - useAsyncEffect(async () => { - await refreshTree(); - }, []) - - /** - * query content by id - * @type {(id: number) => Promise} - */ - const queryContent: (id: number) => Promise = useCallback( - async (id: number) => { - await queryDataByParams(API_CONSTANTS.RESOURCE_GET_CONTENT_BY_ID, { - id - }).then((res) => setResourceState((prevState) => ({...prevState, content: res ?? ''}))); - }, - [] + const refreshTree = async () => { + await queryDataByParams(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) => + setResourceState((prevState) => ({ ...prevState, treeData: res ?? [] })) ); + }; - /** - * the node click event - * @param info - * @returns {Promise} - */ - const handleNodeClick = async (info: any): Promise => { - const { - node: {id, isLeaf, key, name}, - node - } = info; - setResourceState((prevState) => ({...prevState, selectedKeys: [key], clickedNode: node})); - if (isLeaf && !unSupportView(name)) { - await queryContent(id); - } else { - setResourceState((prevState) => ({...prevState, content: ''})); - } - }; + useAsyncEffect(async () => { + await refreshTree(); + }, []); - /** - * the node right click event OF upload, - */ - const handleCreateFolder = () => { - if (resourceState.rightClickedNode) { - setEditModal('createFolder'); - const {id} = resourceState.rightClickedNode; - setResourceState((prevState) => ({ - ...prevState, - editOpen: true, - value: {id, fileName: '', description: ''}, - contextMenuOpen: false - })); - } - }; - const handleUpload = () => { - if (resourceState.rightClickedNode) { - uploadValue.pid = resourceState.rightClickedNode.id; - // todo: upload - setResourceState((prevState) => ({...prevState, uploadOpen: true, contextMenuOpen: false})); - } - }; + /** + * query content by id + * @type {(id: number) => Promise} + */ + const queryContent: (id: number) => Promise = useCallback(async (id: number) => { + await queryDataByParams(API_CONSTANTS.RESOURCE_GET_CONTENT_BY_ID, { + id + }).then((res) => setResourceState((prevState) => ({ ...prevState, content: res ?? '' }))); + }, []); - /** - * the node right click event OF delete, - */ - const handleDelete = async () => { - if (resourceState.rightClickedNode) { - setResourceState((prevState) => ({...prevState, contextMenuOpen: false})); - await handleRemoveById(API_CONSTANTS.RESOURCE_REMOVE, resourceState.rightClickedNode.id); - await refreshTree(); - } - }; + /** + * the node click event + * @param info + * @returns {Promise} + */ + const handleNodeClick = async (info: any): Promise => { + const { + node: { id, isLeaf, key, name }, + node + } = info; + setResourceState((prevState) => ({ ...prevState, selectedKeys: [key], clickedNode: node })); + if (isLeaf && !unSupportView(name)) { + await queryContent(id); + } else { + setResourceState((prevState) => ({ ...prevState, content: '' })); + } + }; - /** - * the node right click event OF rename, - */ - const handleRename = () => { - if (resourceState.rightClickedNode) { - setEditModal('rename'); - const {id, name, desc} = resourceState.rightClickedNode; - setResourceState((prevState) => ({ - ...prevState, - editOpen: true, - value: {id, fileName: name, description: desc}, - contextMenuOpen: false - })); - } - }; + /** + * the node right click event OF upload, + */ + const handleCreateFolder = () => { + if (resourceState.rightClickedNode) { + setEditModal('createFolder'); + const { id } = resourceState.rightClickedNode; + setResourceState((prevState) => ({ + ...prevState, + editOpen: true, + value: { id, fileName: '', description: '' }, + contextMenuOpen: false + })); + } + }; + const handleUpload = () => { + if (resourceState.rightClickedNode) { + uploadValue.pid = resourceState.rightClickedNode.id; + // todo: upload + setResourceState((prevState) => ({ ...prevState, uploadOpen: true, contextMenuOpen: false })); + } + }; - const handleMenuClick = async (node: MenuInfo) => { - switch (node.key) { - case 'createFolder': - handleCreateFolder(); - break; - case 'upload': - handleUpload(); - break; - case 'delete': - await handleDelete(); - break; - case 'rename': - handleRename(); - break; - default: - break; - } - }; + /** + * the node right click event OF delete, + */ + const handleDelete = async () => { + if (resourceState.rightClickedNode) { + setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false })); + await handleRemoveById(API_CONSTANTS.RESOURCE_REMOVE, resourceState.rightClickedNode.id); + await refreshTree(); + } + }; - /** - * the right click event - * @param info - */ - const handleRightClick = (info: any) => { - // 获取右键点击的节点信息 - const {node, event} = info; - console.log('node', node); - setResourceState((prevState) => ({ - ...prevState, - selectedKeys: [node.key], - rightClickedNode: node, - contextMenuOpen: true, - contextMenuPosition: { - ...prevState.contextMenuPosition, - left: event.clientX + 20, - top: event.clientY + 20 - } - })); - }; + /** + * the node right click event OF rename, + */ + const handleRename = () => { + if (resourceState.rightClickedNode) { + setEditModal('rename'); + const { id, name, desc } = resourceState.rightClickedNode; + setResourceState((prevState) => ({ + ...prevState, + editOpen: true, + value: { id, fileName: name, description: desc }, + contextMenuOpen: false + })); + } + }; - /** - * the rename cancel - */ - const handleModalCancel = async () => { - setResourceState((prevState) => ({...prevState, editOpen: false})); - await refreshTree(); - }; + const handleMenuClick = async (node: MenuInfo) => { + switch (node.key) { + case 'createFolder': + handleCreateFolder(); + break; + case 'upload': + handleUpload(); + break; + case 'delete': + await handleDelete(); + break; + case 'rename': + handleRename(); + break; + default: + break; + } + }; - /** - * the rename ok - */ - const handleModalSubmit = async (value: Partial) => { - const {id: pid} = resourceState.rightClickedNode; - if (editModal === 'createFolder') { - await handleOption(API_CONSTANTS.RESOURCE_CREATE_FOLDER, l('right.menu.createFolder'), { - ...value, - pid - }); - setResourceState((prevState) => ({...prevState, editOpen: false})); - } else if (editModal === 'rename') { - await handleOption(API_CONSTANTS.RESOURCE_RENAME, l('right.menu.rename'), {...value, pid}); - } - }; - const handleUploadCancel = async () => { - setResourceState((prevState) => ({...prevState, uploadOpen: false})); - await refreshTree(); - }; + /** + * the right click event + * @param info + */ + const handleRightClick = (info: any) => { + // 获取右键点击的节点信息 + const { node, event } = info; + console.log('node', node); + setResourceState((prevState) => ({ + ...prevState, + selectedKeys: [node.key], + rightClickedNode: node, + contextMenuOpen: true, + contextMenuPosition: { + ...prevState.contextMenuPosition, + left: event.clientX + 20, + top: event.clientY + 20 + } + })); + }; - /** - * the content change - * @param value - */ - const handleContentChange = (value: any) => { - setResourceState((prevState) => ({...prevState, content: value})); - // todo: save content - }; + /** + * the rename cancel + */ + const handleModalCancel = async () => { + setResourceState((prevState) => ({ ...prevState, editOpen: false })); + await refreshTree(); + }; - const access = useAccess(); + /** + * the rename ok + */ + const handleModalSubmit = async (value: Partial) => { + const { id: pid } = resourceState.rightClickedNode; + if (editModal === 'createFolder') { + await handleOption(API_CONSTANTS.RESOURCE_CREATE_FOLDER, l('right.menu.createFolder'), { + ...value, + pid + }); + setResourceState((prevState) => ({ ...prevState, editOpen: false })); + } else if (editModal === 'rename') { + await handleOption(API_CONSTANTS.RESOURCE_RENAME, l('right.menu.rename'), { ...value, pid }); + } + }; + const handleUploadCancel = async () => { + setResourceState((prevState) => ({ ...prevState, uploadOpen: false })); + await refreshTree(); + }; - const renderRightMenu = () => { - if (!resourceState.rightClickedNode.isLeaf) { - return RIGHT_CONTEXT_FOLDER_MENU.filter( - (menu) => !menu.path || !!AuthorizedObject({path: menu.path, children: menu, access}) - ); - } - return RIGHT_CONTEXT_FILE_MENU.filter( - (menu) => !menu.path || !!AuthorizedObject({path: menu.path, children: menu, access}) - ); - }; + /** + * the content change + * @param value + */ + const handleContentChange = (value: any) => { + setResourceState((prevState) => ({ ...prevState, content: value })); + // todo: save content + }; - /** - * render - */ - return ( - <> - - - - handleNodeClick(info)} - /> - - setResourceState((prevState) => ({...prevState, contextMenuOpen: false})) - } - items={renderRightMenu()} - onClick={handleMenuClick} - /> - - - - - - - - {resourceState.editOpen && ( - - )} - {resourceState.uploadOpen && ( - - )} - + const access = useAccess(); + + const renderRightMenu = () => { + if (!resourceState.rightClickedNode.isLeaf) { + return RIGHT_CONTEXT_FOLDER_MENU.filter( + (menu) => !menu.path || !!AuthorizedObject({ path: menu.path, children: menu, access }) + ); + } + return RIGHT_CONTEXT_FILE_MENU.filter( + (menu) => !menu.path || !!AuthorizedObject({ path: menu.path, children: menu, access }) ); + }; + + /** + * render + */ + return ( + <> + + + + handleNodeClick(info)} + /> + + setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false })) + } + items={renderRightMenu()} + onClick={handleMenuClick} + /> + + + + + + + + {resourceState.editOpen && ( + + )} + {resourceState.uploadOpen && ( + + )} + + ); }; export default ResourceOverView; From 829d37b04e9f07ed96009164ae11ee886a8f43c6 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 13:46:57 +0800 Subject: [PATCH 03/14] fix-udf-bug --- .../resource/impl/ResourceServiceImpl.java | 2 +- .../main/java/org/dinky/utils/MavenUtil.java | 29 +++++++++++++++++-- .../java/org/dinky/utils/RuntimeUtils.java | 6 ++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java index 2043142561..6edab021fa 100644 --- a/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java @@ -169,7 +169,7 @@ public File getFile(Integer id) { Resources resources = getById(id); Assert.notNull(resources, () -> new BusException(Status.RESOURCE_DIR_OR_FILE_NOT_EXIST)); Assert.isFalse(resources.getSize() > ALLOW_MAX_CAT_CONTENT_SIZE, () -> new BusException("file is too large!")); - return URLUtils.toFile("rs:" + resources.getFullName()); + return URLUtils.toFile("rs://" + resources.getFullName()); } @Transactional(rollbackFor = Exception.class) diff --git a/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java b/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java index 63a0289f5f..eb41b3741c 100644 --- a/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java +++ b/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java @@ -93,7 +93,8 @@ public static boolean build( } else { localRepositoryDirectory = repositoryDir; } - String mavenCommandLine = getMavenCommandLine(pom, mavenHome, localRepositoryDirectory, setting, goals, args); + String mavenCommandLine = + getMavenCommandLineByMvn(pom, mavenHome, localRepositoryDirectory, setting, goals, args); Opt.ofNullable(consumer).ifPresent(c -> c.accept("Executing command: " + mavenCommandLine + "\n")); int waitValue = RuntimeUtils.run( @@ -102,7 +103,7 @@ public static boolean build( s = DateUtil.date().toMsStr() + " - " + s + "\n"; consumer.accept(s); }, - log::error); + consumer::accept); return waitValue == 0; } @@ -149,6 +150,30 @@ public static String getMavenCommandLine( return StrUtil.join(" ", commandLine); } + public static String getMavenCommandLineByMvn( + String projectDir, + String mavenHome, + String repositoryDir, + String settingsPath, + List goals, + List args) { + projectDir = StrUtil.wrap(projectDir, "\""); + settingsPath = StrUtil.wrap(settingsPath, "\""); + List commandLine = new LinkedList<>(); + + commandLine.add(mavenHome + "/bin/mvn"); + commandLine.add("-Dmaven.multiModuleProjectDirectory=" + projectDir); + commandLine.add("-Dmaven.home=" + StrUtil.wrap(mavenHome, "\"")); + Opt.ofBlankAble(repositoryDir) + .ifPresent(x -> commandLine.add("-Dmaven.repo.local=" + StrUtil.wrap(repositoryDir, "\""))); + commandLine.add("-Dclassworlds.conf=" + StrUtil.wrap(mavenHome + "/bin/m2.conf", "\"")); + commandLine.add("-s " + settingsPath); + commandLine.add("-f " + projectDir); + commandLine.add(StrUtil.join(" ", args)); + commandLine.add(StrUtil.join(" ", goals)); + return StrUtil.join(" ", commandLine); + } + public static String getMavenVersion() { return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v"); } diff --git a/dinky-admin/src/main/java/org/dinky/utils/RuntimeUtils.java b/dinky-admin/src/main/java/org/dinky/utils/RuntimeUtils.java index c30f28b356..87f4ebeeaf 100644 --- a/dinky-admin/src/main/java/org/dinky/utils/RuntimeUtils.java +++ b/dinky-admin/src/main/java/org/dinky/utils/RuntimeUtils.java @@ -29,6 +29,7 @@ import java.util.function.Consumer; import java.util.stream.Collectors; +import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.lang.Opt; import lombok.extern.slf4j.Slf4j; @@ -61,7 +62,8 @@ public static int run(String shell, Consumer outputConsumer, Consumer outputConsumer, Consumer x.accept(errMsg)); } } catch (IOException | InterruptedException e) { - e.printStackTrace(); + errorConsumer.accept(ExceptionUtil.stacktraceToOneLineString(e)); } return waitValue; } From 3822628ef164cc04693a1d5c3468c1f82dcd0226 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 13:47:59 +0800 Subject: [PATCH 04/14] fix-udf-bug --- .../SchemaDesc/ColumnInfo/Index.tsx | 142 ------------------ 1 file changed, 142 deletions(-) delete mode 100644 dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx deleted file mode 100644 index 2094995ee5..0000000000 --- a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/Index.tsx +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { DataSources } from '@/types/RegCenter/data'; -import { transformTreeData } from '@/utils/function'; -import { l } from '@/utils/intl'; -import { CheckSquareOutlined, KeyOutlined } from '@ant-design/icons'; -import { ProTable } from '@ant-design/pro-components'; -import { ProColumns } from '@ant-design/pro-table/es/typing'; -import React from 'react'; - -type ColumnInfoProps = { - columnInfo: Partial; -}; - -const ColumnInfo: React.FC = (props) => { - const { columnInfo } = props; - - const columns: ProColumns[] = [ - { - title: l('rc.ds.no'), - dataIndex: 'position', - width: '4%' - }, - { - title: l('rc.ds.columnName'), - dataIndex: 'name', - width: '10%', - ellipsis: true - }, - { - title: l('rc.ds.columnType'), - dataIndex: 'type', - width: '6%' - }, - { - title: l('rc.ds.primarykey'), - dataIndex: 'keyFlag', - width: '4%', - render: (_, record) => { - return record.keyFlag ? : undefined; - } - }, - { - title: l('rc.ds.autoIncrement'), - dataIndex: 'autoIncrement', - width: '4%', - render: (_, record) => { - return record.autoIncrement ? ( - - ) : undefined; - } - }, - { - title: l('rc.ds.isNull'), - dataIndex: 'nullable', - width: '4%', - render: (_, record) => { - return !record.nullable ? : undefined; - } - }, - { - title: l('rc.ds.default'), - dataIndex: 'defaultValue', - ellipsis: true, - width: '8%' - }, - { - title: l('rc.ds.length'), - dataIndex: 'length', - width: '4%' - }, - { - title: l('rc.ds.precision'), - dataIndex: 'precision', - width: '4%' - }, - { - title: l('rc.ds.decimalDigits'), - dataIndex: 'scale', - ellipsis: true, - width: '6%' - }, - { - title: l('rc.ds.character'), - dataIndex: 'characterSet', - width: '6%', - ellipsis: true - }, - { - title: l('rc.ds.collationRule'), - dataIndex: 'collation', - width: '10%', - ellipsis: true - }, - { - title: l('rc.ds.javaType'), - dataIndex: 'javaType', - ellipsis: true, - width: '8%' - }, - { - title: l('rc.ds.comment'), - dataIndex: 'comment', - ellipsis: true - } - ]; - - return ( - <> - - toolBarRender={false} - pagination={{ - defaultPageSize: 14, - hideOnSinglePage: true - }} - search={false} - options={false} - size={'small'} - bordered - columns={columns} - dataSource={transformTreeData(columnInfo) as DataSources.Column[]} - /> - - ); -}; - -export default ColumnInfo; From ec2bd42f3d0cc5373a92e63a082ad3263d203a5e Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 15:36:46 +0800 Subject: [PATCH 05/14] modify git build model layout --- dinky-web/src/locales/en-US/global.ts | 2 + dinky-web/src/locales/zh-CN/global.ts | 2 + .../SchemaDesc/ColumnInfo/index.tsx | 26 +++--- .../components/BuildSteps/index.tsx | 79 +++++++++++++------ .../components/ProjectProTable/index.tsx | 41 ++++++---- .../src/pages/RegCenter/GitProject/data.d.tsx | 28 ++++--- .../UDF/components/UDFRegister/index.tsx | 4 + 7 files changed, 119 insertions(+), 63 deletions(-) diff --git a/dinky-web/src/locales/en-US/global.ts b/dinky-web/src/locales/en-US/global.ts index 061b06cf36..14d660283c 100644 --- a/dinky-web/src/locales/en-US/global.ts +++ b/dinky-web/src/locales/en-US/global.ts @@ -24,6 +24,8 @@ export default { 'button.recovery': 'Recovery', 'button.cancel': 'Cancel', 'button.finish': 'Finish', + 'button.retry': 'Retry', + 'button.rebuild': 'Re Build', 'button.back': 'Back', 'button.save': 'Save', 'button.delete': 'Delete', diff --git a/dinky-web/src/locales/zh-CN/global.ts b/dinky-web/src/locales/zh-CN/global.ts index 331eaa0e46..ada4aa2e27 100644 --- a/dinky-web/src/locales/zh-CN/global.ts +++ b/dinky-web/src/locales/zh-CN/global.ts @@ -26,6 +26,8 @@ export default { 'button.confirm': '确定', 'button.cancel': '取消', 'button.finish': '完成', + 'button.retry': '重试', + 'button.rebuild': '重新构建', 'button.back': '返回', 'button.save': '保存', 'button.delete': '删除', diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx index 2094995ee5..14c656b45c 100644 --- a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx +++ b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ import { DataSources } from '@/types/RegCenter/data'; diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx index a0284a630d..e5ad9e6db9 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx @@ -1,19 +1,19 @@ /* * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * */ @@ -29,15 +29,19 @@ import { API_CONSTANTS } from '@/services/endpoints'; import { GitProject } from '@/types/RegCenter/data.d'; import { InitGitBuildStepsState } from '@/types/RegCenter/init.d'; import { GitBuildStepsState } from '@/types/RegCenter/state.d'; -import { Modal } from 'antd'; +import { l } from '@/utils/intl'; +import { Button, Modal } from 'antd'; import React, { useEffect, useState } from 'react'; /** * props */ type BuildStepsProps = { - onCancel: (flag?: boolean) => void; + onOk: (flag?: boolean) => void; + onReTry?: () => void; + onRebuild: () => void; title: string; + showLog?: boolean; values: Partial; }; @@ -45,7 +49,7 @@ export const BuildSteps: React.FC = (props) => { /** * extract props */ - const { onCancel: handleModalVisible, title, values } = props; + const { onOk: handleModalVisible, onReTry, showLog = false, onRebuild, title, values } = props; // todo: refactor this const [buildStepState, setBuildStepState] = useState(InitGitBuildStepsState); @@ -88,7 +92,7 @@ export const BuildSteps: React.FC = (props) => { // type // 1是总状态 2是log 3是部分状态 // status // 0是失败 1是进行中 2 完成 let result = JSON.parse(e.data); - const { currentStep, type, data, status, history } = result; + const { currentStep, type, data, status } = result; lastStep = currentStep; if (type === 0) { @@ -171,18 +175,45 @@ export const BuildSteps: React.FC = (props) => { handleModalVisible(); }; + // todo: 重试需要实现在不关闭弹窗的情况下,重新构建, 目前是关闭弹窗,重新打开,重新构建 + const handleReTry = () => { + onReTry?.(); + }; + + const footerButtons = [ + , + , + + ]; + /** * render */ return ( - handleCancel()} - okButtonProps={{ style: { display: 'none' } }} - > + { return ; }; + /** + * re try build + * @param value + */ + const handleReTryBuild = async (value: Partial) => { + handleCancel(); + await handleBuild(value); + }; + /** * render */ @@ -401,7 +410,9 @@ const ProjectProTable: React.FC = () => { {gitProjectStatus.buildOpen && ( handleReTryBuild(gitProjectStatus.value)} + onReTry={() => handleReTryBuild(gitProjectStatus.value)} values={gitProjectStatus.value} /> )} @@ -410,7 +421,9 @@ const ProjectProTable: React.FC = () => { {gitProjectStatus.logOpen && ( handleReTryBuild(gitProjectStatus.value)} values={gitProjectStatus.value} /> )} diff --git a/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx b/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx index 4c38d7af06..925a944cd7 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx @@ -1,24 +1,26 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ export type BuildStepsState = { key: number; title: string; - status: string; + status: string; // 0-notStart(未开始) 1-process(进行中/构建中) 2-failed(构建失败) 3-success(构建成功) description: string; disabled: boolean; onClick: () => void; diff --git a/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx b/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx index e32b6c7e00..f7ee8d736c 100644 --- a/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx +++ b/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx @@ -19,11 +19,13 @@ import { EditBtn } from '@/components/CallBackButton/EditBtn'; import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn'; +import { BackIcon } from '@/components/Icons/CustomIcons'; import UDFRegisterModal from '@/pages/RegCenter/UDF/components/UDFRegister/UDFRegisterModal'; import { API_CONSTANTS } from '@/services/endpoints'; import { UDFRegisterInfo, UDFRegisterInfoParent } from '@/types/RegCenter/data'; import { l } from '@/utils/intl'; import { useRequest } from '@@/plugin-request'; +import { SaveTwoTone } from '@ant-design/icons'; import { ProColumns } from '@ant-design/pro-components'; import ProTable, { ActionType } from '@ant-design/pro-table'; import React, { Key, useEffect, useRef, useState } from 'react'; @@ -182,6 +184,8 @@ const UDFRegister: React.FC = (props) => { editable={{ deleteText: false, type: 'single', + saveText: , + cancelText: , editableKeys: udfRegisterState.editableKeys, onChange: editableKeysChange, onSave: async (_, row) => handleOnSave(row), From 08d6df051b206bff8ffab4b5773617ee5044ec52 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 16:23:14 +0800 Subject: [PATCH 06/14] fix table enum bug --- .../components/ProjectProTable/index.tsx | 7 ++-- .../pages/RegCenter/GitProject/constans.tsx | 41 +++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx index 0bf1accde7..2616954936 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx @@ -29,8 +29,7 @@ import ClassList from '@/pages/RegCenter/GitProject/components/BuildSteps/JarSho import { CodeTree } from '@/pages/RegCenter/GitProject/components/CodeTree'; import ProjectModal from '@/pages/RegCenter/GitProject/components/ProjectModal'; import { - GIT_PROJECT_BUILD_STEP, - GIT_PROJECT_BUILD_STEP_ENUM, + GIT_PROJECT_BUILD_STEP_JAVA_ENUM, GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, GIT_PROJECT_CODE_TYPE, GIT_PROJECT_CODE_TYPE_ENUM, GIT_PROJECT_STATUS, @@ -227,8 +226,8 @@ const ProjectProTable: React.FC = () => { title: l('rc.gp.buildStep'), dataIndex: 'buildStep', hideInSearch: true, - filters: GIT_PROJECT_BUILD_STEP, - valueEnum: GIT_PROJECT_BUILD_STEP_ENUM + // filters: GIT_PROJECT_BUILD_STEP, + valueEnum: (row) => row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, }, { title: l('rc.gp.buildState'), diff --git a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx index 81f901ea18..e8865267d6 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx @@ -131,7 +131,7 @@ export const CLONE_TYPES = [ * @param item */ export const renderBranchesTagColor = (item: string) => { - let colorTag = item.includes('dev') + return item.includes('dev') ? 'processing' : item.includes('test') ? 'warning' @@ -142,13 +142,9 @@ export const renderBranchesTagColor = (item: string) => { : item.includes('main') ? 'success' : 'default'; - return colorTag; }; -/** - * git project build step enum - */ -export const GIT_PROJECT_BUILD_STEP_ENUM = { +const GIT_PROJECT_BUILD_STEP_BASE = { 0: { title: l('rc.gp.build.step.0'), text: l('rc.gp.build.step.0'), @@ -159,6 +155,12 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { text: l('rc.gp.build.step.1'), status: 'default' }, +} +/** + * git project build step enum + */ +export const GIT_PROJECT_BUILD_STEP_JAVA_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, 2: { title: l('rc.gp.build.step.2'), text: l('rc.gp.build.step.2'), @@ -185,6 +187,32 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { status: 'success' } }; + +export const GIT_PROJECT_BUILD_STEP_PYTHON_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, + 2: { + title: l('rc.gp.build.step.2'), + text: l('rc.gp.build.step.2'), + status: 'processing' + }, + 3: { + title: l('rc.gp.build.step.4'), + text: l('rc.gp.build.step.4'), + status: 'success' + }, + 4: { + title: l('rc.gp.build.step.5'), + text: l('rc.gp.build.step.5'), + status: 'success' + }, + 5: { + title: l('rc.gp.build.step.6'), + text: l('rc.gp.build.step.6'), + status: 'success' + } +}; + + /** * git project build step filter */ @@ -228,7 +256,6 @@ export const GIT_PROJECT_BUILD_STEP = [ /** * git project build step enum - * @type {{"100%": string, "0%": string, "20%": string, "40%": string, "60%": string, "80%": string}} */ export const processColor = { '0%': '#8ac1ea', From 3d77a4fea964f720145ecaa90f5ce0b0f74e8382 Mon Sep 17 00:00:00 2001 From: zhu-mingye Date: Mon, 6 Nov 2023 08:26:57 +0000 Subject: [PATCH 07/14] Spotless Apply --- .../components/ProjectProTable/index.tsx | 6 ++-- .../pages/RegCenter/GitProject/constans.tsx | 29 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx index 2616954936..0d9955c1b5 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/ProjectProTable/index.tsx @@ -29,7 +29,8 @@ import ClassList from '@/pages/RegCenter/GitProject/components/BuildSteps/JarSho import { CodeTree } from '@/pages/RegCenter/GitProject/components/CodeTree'; import ProjectModal from '@/pages/RegCenter/GitProject/components/ProjectModal'; import { - GIT_PROJECT_BUILD_STEP_JAVA_ENUM, GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, + GIT_PROJECT_BUILD_STEP_JAVA_ENUM, + GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, GIT_PROJECT_CODE_TYPE, GIT_PROJECT_CODE_TYPE_ENUM, GIT_PROJECT_STATUS, @@ -227,7 +228,8 @@ const ProjectProTable: React.FC = () => { dataIndex: 'buildStep', hideInSearch: true, // filters: GIT_PROJECT_BUILD_STEP, - valueEnum: (row) => row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM, + valueEnum: (row) => + row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM }, { title: l('rc.gp.buildState'), diff --git a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx index e8865267d6..a2a9f5cf56 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx @@ -1,19 +1,19 @@ /* * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * */ @@ -154,8 +154,8 @@ const GIT_PROJECT_BUILD_STEP_BASE = { title: l('rc.gp.build.step.1'), text: l('rc.gp.build.step.1'), status: 'default' - }, -} + } +}; /** * git project build step enum */ @@ -212,7 +212,6 @@ export const GIT_PROJECT_BUILD_STEP_PYTHON_ENUM = { } }; - /** * git project build step filter */ From d22d38b72899a68b8edf2747124c27599d59c278 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Mon, 6 Nov 2023 16:51:02 +0800 Subject: [PATCH 08/14] modify some code --- .../main/java/org/dinky/data/model/GitProject.java | 5 +++++ dinky-admin/src/main/resources/db/db-h2.sql | 2 +- .../main/resources/i18n/messages_en_US.properties | 2 +- .../main/resources/i18n/messages_zh_CN.properties | 2 +- dinky-web/src/locales/en-US/pages.ts | 3 ++- dinky-web/src/locales/zh-CN/pages.ts | 2 +- .../GitProject/components/BuildSteps/index.tsx | 1 + .../src/pages/RegCenter/GitProject/constans.tsx | 5 +++++ script/sql/dinky-mysql.sql | 2 +- script/sql/dinky-pg.sql | 12 ++++++++++++ .../1.0.0-SNAPSHOT_schema/mysql/dinky_ddl.sql | 2 +- 11 files changed, 31 insertions(+), 7 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/data/model/GitProject.java b/dinky-admin/src/main/java/org/dinky/data/model/GitProject.java index dde18c8624..d026490332 100644 --- a/dinky-admin/src/main/java/org/dinky/data/model/GitProject.java +++ b/dinky-admin/src/main/java/org/dinky/data/model/GitProject.java @@ -98,6 +98,11 @@ public class GitProject extends SuperEntity { @TableField(value = "build_state") private Integer buildState; + /** + * 区别于 java 和 Python 类型 | different from java and python; + * 1. 构建 java 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 编译构建 3: 获取产物 4: 分析 UDF 5: 完成; (when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish) + * 2. 构建 python 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 获取产物 3: 分析 UDF 4: 完成;(when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish) + */ @ApiModelProperty(value = "Build Step", dataType = "Integer") @TableField(value = "build_step") private Integer buildStep; diff --git a/dinky-admin/src/main/resources/db/db-h2.sql b/dinky-admin/src/main/resources/db/db-h2.sql index f88d16598a..b27dc80797 100644 --- a/dinky-admin/src/main/resources/db/db-h2.sql +++ b/dinky-admin/src/main/resources/db/db-h2.sql @@ -2540,7 +2540,7 @@ CREATE TABLE `dinky_git_project` ( `last_build` datetime DEFAULT null, `description` varchar(255) DEFAULT null, `build_state` tinyint(2) NOT null DEFAULT '0' COMMENT '0-notStart 1-process 2-failed 3-success', - `build_step` tinyint(2) NOT null DEFAULT '0', + `build_step` tinyint(2) NOT null DEFAULT '0' COMMENT 'different from java and python, when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish; when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish', `enabled` tinyint(1) NOT null DEFAULT '1' COMMENT '0-disable 1-enable', `udf_class_map_list` text COMMENT 'scan udf class', `order_line` int(11) NOT null DEFAULT '1' COMMENT 'order', diff --git a/dinky-common/src/main/resources/i18n/messages_en_US.properties b/dinky-common/src/main/resources/i18n/messages_en_US.properties index 272a21ef52..d03793581e 100644 --- a/dinky-common/src/main/resources/i18n/messages_en_US.properties +++ b/dinky-common/src/main/resources/i18n/messages_en_US.properties @@ -11,7 +11,7 @@ ds.work.flow.not.save=Please Save Workflow First schedule.status.unknown=Unknown Status: {0} user.binding.role.delete.all=User Binding Role Delete All modify.failed=Update Failed -git.build.success=Git Build Success +git.build.success=Pre-update status success, start executing the build process menu.has.child=Menu Has Child, Can Not Delete tenant.already.exists=Tenant Already Exists save.failed=Save Failed diff --git a/dinky-common/src/main/resources/i18n/messages_zh_CN.properties b/dinky-common/src/main/resources/i18n/messages_zh_CN.properties index 850611025b..24b5b2b71d 100644 --- a/dinky-common/src/main/resources/i18n/messages_zh_CN.properties +++ b/dinky-common/src/main/resources/i18n/messages_zh_CN.properties @@ -11,7 +11,7 @@ ds.work.flow.not.save=\u8BF7\u5148\u4FDD\u5B58\u5DE5\u4F5C\u6D41 schedule.status.unknown=\u672A\u77E5\u72B6\u6001: {0} user.binding.role.delete.all=\u7528\u6237\u7ED1\u5B9A\u89D2\u8272\u5220\u9664\u6240\u6709 modify.failed=\u4FEE\u6539\u5931\u8D25 -git.build.success=\u6784\u5EFA\u6210\u529F +git.build.success=\u9884\u66F4\u65B0\u72B6\u6001\u6210\u529F,\u5F00\u59CB\u6267\u884C\u6784\u5EFA\u6D41\u7A0B menu.has.child=\u5B58\u5728\u5B50\u83DC\u5355 \u4E0D\u5141\u8BB8\u5220\u9664 tenant.already.exists=\u79DF\u6237\u5DF2\u5B58\u5728 save.failed=\u4FDD\u5B58\u5931\u8D25 diff --git a/dinky-web/src/locales/en-US/pages.ts b/dinky-web/src/locales/en-US/pages.ts index 8528d0b6b8..2dabb560b2 100644 --- a/dinky-web/src/locales/en-US/pages.ts +++ b/dinky-web/src/locales/en-US/pages.ts @@ -760,7 +760,8 @@ export default { 'rc.gp.build.step.1': 'Check Env', 'rc.gp.build.step.2': 'Git Clone', 'rc.gp.build.step.3': 'Maven Build', - 'rc.gp.build.step.4': 'Get Jars', + // 获取产物 + 'rc.gp.build.step.4': 'Get Artifact', 'rc.gp.build.step.5': 'Analysis UDF', 'rc.gp.build.step.6': 'Finish', 'rc.gp.buildArgs': 'Build Arguments', diff --git a/dinky-web/src/locales/zh-CN/pages.ts b/dinky-web/src/locales/zh-CN/pages.ts index 3c33e9ed72..16528c23cd 100644 --- a/dinky-web/src/locales/zh-CN/pages.ts +++ b/dinky-web/src/locales/zh-CN/pages.ts @@ -726,7 +726,7 @@ export default { 'rc.gp.build.step.1': '环境检查', 'rc.gp.build.step.2': '克隆项目', 'rc.gp.build.step.3': '编译构建', - 'rc.gp.build.step.4': '获取 Jar 包', + 'rc.gp.build.step.4': '获取产物', 'rc.gp.build.step.5': '分析 UDF', 'rc.gp.build.step.6': '完成', 'rc.gp.buildArgs': '构建参数', diff --git a/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx b/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx index e5ad9e6db9..7809dd7180 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx @@ -194,6 +194,7 @@ export const BuildSteps: React.FC = (props) => { , + , + + ]; + /** * render */ return ( - handleCancel()} - okButtonProps={{ style: { display: 'none' } }} - > + { title: l('rc.gp.buildStep'), dataIndex: 'buildStep', hideInSearch: true, - filters: GIT_PROJECT_BUILD_STEP, - valueEnum: GIT_PROJECT_BUILD_STEP_ENUM + // filters: GIT_PROJECT_BUILD_STEP, + valueEnum: (row) => + row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM }, { title: l('rc.gp.buildState'), @@ -352,6 +353,15 @@ const ProjectProTable: React.FC = () => { return ; }; + /** + * re try build + * @param value + */ + const handleReTryBuild = async (value: Partial) => { + handleCancel(); + await handleBuild(value); + }; + /** * render */ @@ -401,7 +411,9 @@ const ProjectProTable: React.FC = () => { {gitProjectStatus.buildOpen && ( handleReTryBuild(gitProjectStatus.value)} + onReTry={() => handleReTryBuild(gitProjectStatus.value)} values={gitProjectStatus.value} /> )} @@ -410,7 +422,9 @@ const ProjectProTable: React.FC = () => { {gitProjectStatus.logOpen && ( handleReTryBuild(gitProjectStatus.value)} values={gitProjectStatus.value} /> )} diff --git a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx index 81f901ea18..5d08f90b78 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/constans.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/constans.tsx @@ -1,19 +1,19 @@ /* * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * */ @@ -131,7 +131,7 @@ export const CLONE_TYPES = [ * @param item */ export const renderBranchesTagColor = (item: string) => { - let colorTag = item.includes('dev') + return item.includes('dev') ? 'processing' : item.includes('test') ? 'warning' @@ -142,13 +142,14 @@ export const renderBranchesTagColor = (item: string) => { : item.includes('main') ? 'success' : 'default'; - return colorTag; }; /** - * git project build step enum + * 区别于 java 和 Python 类型 | different from java and python + * 构建 java 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 编译构建 3: 获取产物 4: 分析 UDF 5: 完成; (when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish) + * 构建 python 工程时: 步骤值映射如下: 0: 环境检查 1: 克隆项目 2: 获取产物 3: 分析 UDF 4: 完成;(when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish) */ -export const GIT_PROJECT_BUILD_STEP_ENUM = { +const GIT_PROJECT_BUILD_STEP_BASE = { 0: { title: l('rc.gp.build.step.0'), text: l('rc.gp.build.step.0'), @@ -158,7 +159,13 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { title: l('rc.gp.build.step.1'), text: l('rc.gp.build.step.1'), status: 'default' - }, + } +}; +/** + * git project build step enum + */ +export const GIT_PROJECT_BUILD_STEP_JAVA_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, 2: { title: l('rc.gp.build.step.2'), text: l('rc.gp.build.step.2'), @@ -185,6 +192,31 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { status: 'success' } }; + +export const GIT_PROJECT_BUILD_STEP_PYTHON_ENUM = { + ...GIT_PROJECT_BUILD_STEP_BASE, + 2: { + title: l('rc.gp.build.step.2'), + text: l('rc.gp.build.step.2'), + status: 'processing' + }, + 3: { + title: l('rc.gp.build.step.4'), + text: l('rc.gp.build.step.4'), + status: 'success' + }, + 4: { + title: l('rc.gp.build.step.5'), + text: l('rc.gp.build.step.5'), + status: 'success' + }, + 5: { + title: l('rc.gp.build.step.6'), + text: l('rc.gp.build.step.6'), + status: 'success' + } +}; + /** * git project build step filter */ @@ -228,7 +260,6 @@ export const GIT_PROJECT_BUILD_STEP = [ /** * git project build step enum - * @type {{"100%": string, "0%": string, "20%": string, "40%": string, "60%": string, "80%": string}} */ export const processColor = { '0%': '#8ac1ea', diff --git a/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx b/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx index 4c38d7af06..925a944cd7 100644 --- a/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx +++ b/dinky-web/src/pages/RegCenter/GitProject/data.d.tsx @@ -1,24 +1,26 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ export type BuildStepsState = { key: number; title: string; - status: string; + status: string; // 0-notStart(未开始) 1-process(进行中/构建中) 2-failed(构建失败) 3-success(构建成功) description: string; disabled: boolean; onClick: () => void; diff --git a/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx b/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx index e788ec9fc0..332f1685f6 100644 --- a/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx +++ b/dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx @@ -18,286 +18,283 @@ */ import RightContextMenu from '@/components/RightContextMenu'; -import {AuthorizedObject, useAccess} from '@/hooks/useAccess'; +import { AuthorizedObject, useAccess } from '@/hooks/useAccess'; import { - RIGHT_CONTEXT_FILE_MENU, - RIGHT_CONTEXT_FOLDER_MENU + RIGHT_CONTEXT_FILE_MENU, + RIGHT_CONTEXT_FOLDER_MENU } from '@/pages/RegCenter/Resource/components/constants'; import FileShow from '@/pages/RegCenter/Resource/components/FileShow'; import FileTree from '@/pages/RegCenter/Resource/components/FileTree'; import ResourceModal from '@/pages/RegCenter/Resource/components/ResourceModal'; import ResourcesUploadModal from '@/pages/RegCenter/Resource/components/ResourcesUploadModal'; -import {handleOption, handleRemoveById, queryDataByParams} from '@/services/BusinessCrud'; -import {API_CONSTANTS} from '@/services/endpoints'; -import {ResourceInfo} from '@/types/RegCenter/data'; -import {InitResourceState} from '@/types/RegCenter/init.d'; -import {ResourceState} from '@/types/RegCenter/state.d'; -import {l} from '@/utils/intl'; -import {ProCard} from '@ant-design/pro-components'; -import {MenuInfo} from 'rc-menu/es/interface'; -import {Resizable} from 're-resizable'; -import React, {useCallback, useState} from 'react'; -import {useAsyncEffect} from "ahooks"; -import {unSupportView} from "@/utils/function"; +import { handleOption, handleRemoveById, queryDataByParams } from '@/services/BusinessCrud'; +import { API_CONSTANTS } from '@/services/endpoints'; +import { ResourceInfo } from '@/types/RegCenter/data'; +import { InitResourceState } from '@/types/RegCenter/init.d'; +import { ResourceState } from '@/types/RegCenter/state.d'; +import { unSupportView } from '@/utils/function'; +import { l } from '@/utils/intl'; +import { ProCard } from '@ant-design/pro-components'; +import { useAsyncEffect } from 'ahooks'; +import { MenuInfo } from 'rc-menu/es/interface'; +import { Resizable } from 're-resizable'; +import React, { useCallback, useState } from 'react'; const ResourceOverView: React.FC = () => { - const [resourceState, setResourceState] = useState(InitResourceState); + const [resourceState, setResourceState] = useState(InitResourceState); - const [editModal, setEditModal] = useState(''); + const [editModal, setEditModal] = useState(''); - const [uploadValue] = useState({ - url: API_CONSTANTS.RESOURCE_UPLOAD, - pid: '', - description: '' - }); + const [uploadValue] = useState({ + url: API_CONSTANTS.RESOURCE_UPLOAD, + pid: '', + description: '' + }); - const refreshTree = async () => { - await queryDataByParams(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) => - setResourceState((prevState) => ({...prevState, treeData: res ?? []})) - ); - }; - - useAsyncEffect(async () => { - await refreshTree(); - }, []) - - /** - * query content by id - * @type {(id: number) => Promise} - */ - const queryContent: (id: number) => Promise = useCallback( - async (id: number) => { - await queryDataByParams(API_CONSTANTS.RESOURCE_GET_CONTENT_BY_ID, { - id - }).then((res) => setResourceState((prevState) => ({...prevState, content: res ?? ''}))); - }, - [] + const refreshTree = async () => { + await queryDataByParams(API_CONSTANTS.RESOURCE_SHOW_TREE).then((res) => + setResourceState((prevState) => ({ ...prevState, treeData: res ?? [] })) ); + }; - /** - * the node click event - * @param info - * @returns {Promise} - */ - const handleNodeClick = async (info: any): Promise => { - const { - node: {id, isLeaf, key, name}, - node - } = info; - setResourceState((prevState) => ({...prevState, selectedKeys: [key], clickedNode: node})); - if (isLeaf && !unSupportView(name)) { - await queryContent(id); - } else { - setResourceState((prevState) => ({...prevState, content: ''})); - } - }; + useAsyncEffect(async () => { + await refreshTree(); + }, []); - /** - * the node right click event OF upload, - */ - const handleCreateFolder = () => { - if (resourceState.rightClickedNode) { - setEditModal('createFolder'); - const {id} = resourceState.rightClickedNode; - setResourceState((prevState) => ({ - ...prevState, - editOpen: true, - value: {id, fileName: '', description: ''}, - contextMenuOpen: false - })); - } - }; - const handleUpload = () => { - if (resourceState.rightClickedNode) { - uploadValue.pid = resourceState.rightClickedNode.id; - // todo: upload - setResourceState((prevState) => ({...prevState, uploadOpen: true, contextMenuOpen: false})); - } - }; + /** + * query content by id + * @type {(id: number) => Promise} + */ + const queryContent: (id: number) => Promise = useCallback(async (id: number) => { + await queryDataByParams(API_CONSTANTS.RESOURCE_GET_CONTENT_BY_ID, { + id + }).then((res) => setResourceState((prevState) => ({ ...prevState, content: res ?? '' }))); + }, []); - /** - * the node right click event OF delete, - */ - const handleDelete = async () => { - if (resourceState.rightClickedNode) { - setResourceState((prevState) => ({...prevState, contextMenuOpen: false})); - await handleRemoveById(API_CONSTANTS.RESOURCE_REMOVE, resourceState.rightClickedNode.id); - await refreshTree(); - } - }; + /** + * the node click event + * @param info + * @returns {Promise} + */ + const handleNodeClick = async (info: any): Promise => { + const { + node: { id, isLeaf, key, name }, + node + } = info; + setResourceState((prevState) => ({ ...prevState, selectedKeys: [key], clickedNode: node })); + if (isLeaf && !unSupportView(name)) { + await queryContent(id); + } else { + setResourceState((prevState) => ({ ...prevState, content: '' })); + } + }; - /** - * the node right click event OF rename, - */ - const handleRename = () => { - if (resourceState.rightClickedNode) { - setEditModal('rename'); - const {id, name, desc} = resourceState.rightClickedNode; - setResourceState((prevState) => ({ - ...prevState, - editOpen: true, - value: {id, fileName: name, description: desc}, - contextMenuOpen: false - })); - } - }; + /** + * the node right click event OF upload, + */ + const handleCreateFolder = () => { + if (resourceState.rightClickedNode) { + setEditModal('createFolder'); + const { id } = resourceState.rightClickedNode; + setResourceState((prevState) => ({ + ...prevState, + editOpen: true, + value: { id, fileName: '', description: '' }, + contextMenuOpen: false + })); + } + }; + const handleUpload = () => { + if (resourceState.rightClickedNode) { + uploadValue.pid = resourceState.rightClickedNode.id; + // todo: upload + setResourceState((prevState) => ({ ...prevState, uploadOpen: true, contextMenuOpen: false })); + } + }; - const handleMenuClick = async (node: MenuInfo) => { - switch (node.key) { - case 'createFolder': - handleCreateFolder(); - break; - case 'upload': - handleUpload(); - break; - case 'delete': - await handleDelete(); - break; - case 'rename': - handleRename(); - break; - default: - break; - } - }; + /** + * the node right click event OF delete, + */ + const handleDelete = async () => { + if (resourceState.rightClickedNode) { + setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false })); + await handleRemoveById(API_CONSTANTS.RESOURCE_REMOVE, resourceState.rightClickedNode.id); + await refreshTree(); + } + }; - /** - * the right click event - * @param info - */ - const handleRightClick = (info: any) => { - // 获取右键点击的节点信息 - const {node, event} = info; - console.log('node', node); - setResourceState((prevState) => ({ - ...prevState, - selectedKeys: [node.key], - rightClickedNode: node, - contextMenuOpen: true, - contextMenuPosition: { - ...prevState.contextMenuPosition, - left: event.clientX + 20, - top: event.clientY + 20 - } - })); - }; + /** + * the node right click event OF rename, + */ + const handleRename = () => { + if (resourceState.rightClickedNode) { + setEditModal('rename'); + const { id, name, desc } = resourceState.rightClickedNode; + setResourceState((prevState) => ({ + ...prevState, + editOpen: true, + value: { id, fileName: name, description: desc }, + contextMenuOpen: false + })); + } + }; - /** - * the rename cancel - */ - const handleModalCancel = async () => { - setResourceState((prevState) => ({...prevState, editOpen: false})); - await refreshTree(); - }; + const handleMenuClick = async (node: MenuInfo) => { + switch (node.key) { + case 'createFolder': + handleCreateFolder(); + break; + case 'upload': + handleUpload(); + break; + case 'delete': + await handleDelete(); + break; + case 'rename': + handleRename(); + break; + default: + break; + } + }; - /** - * the rename ok - */ - const handleModalSubmit = async (value: Partial) => { - const {id: pid} = resourceState.rightClickedNode; - if (editModal === 'createFolder') { - await handleOption(API_CONSTANTS.RESOURCE_CREATE_FOLDER, l('right.menu.createFolder'), { - ...value, - pid - }); - setResourceState((prevState) => ({...prevState, editOpen: false})); - } else if (editModal === 'rename') { - await handleOption(API_CONSTANTS.RESOURCE_RENAME, l('right.menu.rename'), {...value, pid}); - } - }; - const handleUploadCancel = async () => { - setResourceState((prevState) => ({...prevState, uploadOpen: false})); - await refreshTree(); - }; + /** + * the right click event + * @param info + */ + const handleRightClick = (info: any) => { + // 获取右键点击的节点信息 + const { node, event } = info; + console.log('node', node); + setResourceState((prevState) => ({ + ...prevState, + selectedKeys: [node.key], + rightClickedNode: node, + contextMenuOpen: true, + contextMenuPosition: { + ...prevState.contextMenuPosition, + left: event.clientX + 20, + top: event.clientY + 20 + } + })); + }; - /** - * the content change - * @param value - */ - const handleContentChange = (value: any) => { - setResourceState((prevState) => ({...prevState, content: value})); - // todo: save content - }; + /** + * the rename cancel + */ + const handleModalCancel = async () => { + setResourceState((prevState) => ({ ...prevState, editOpen: false })); + await refreshTree(); + }; - const access = useAccess(); + /** + * the rename ok + */ + const handleModalSubmit = async (value: Partial) => { + const { id: pid } = resourceState.rightClickedNode; + if (editModal === 'createFolder') { + await handleOption(API_CONSTANTS.RESOURCE_CREATE_FOLDER, l('right.menu.createFolder'), { + ...value, + pid + }); + setResourceState((prevState) => ({ ...prevState, editOpen: false })); + } else if (editModal === 'rename') { + await handleOption(API_CONSTANTS.RESOURCE_RENAME, l('right.menu.rename'), { ...value, pid }); + } + }; + const handleUploadCancel = async () => { + setResourceState((prevState) => ({ ...prevState, uploadOpen: false })); + await refreshTree(); + }; - const renderRightMenu = () => { - if (!resourceState.rightClickedNode.isLeaf) { - return RIGHT_CONTEXT_FOLDER_MENU.filter( - (menu) => !menu.path || !!AuthorizedObject({path: menu.path, children: menu, access}) - ); - } - return RIGHT_CONTEXT_FILE_MENU.filter( - (menu) => !menu.path || !!AuthorizedObject({path: menu.path, children: menu, access}) - ); - }; + /** + * the content change + * @param value + */ + const handleContentChange = (value: any) => { + setResourceState((prevState) => ({ ...prevState, content: value })); + // todo: save content + }; - /** - * render - */ - return ( - <> - - - - handleNodeClick(info)} - /> - - setResourceState((prevState) => ({...prevState, contextMenuOpen: false})) - } - items={renderRightMenu()} - onClick={handleMenuClick} - /> - - - - - - - - {resourceState.editOpen && ( - - )} - {resourceState.uploadOpen && ( - - )} - + const access = useAccess(); + + const renderRightMenu = () => { + if (!resourceState.rightClickedNode.isLeaf) { + return RIGHT_CONTEXT_FOLDER_MENU.filter( + (menu) => !menu.path || !!AuthorizedObject({ path: menu.path, children: menu, access }) + ); + } + return RIGHT_CONTEXT_FILE_MENU.filter( + (menu) => !menu.path || !!AuthorizedObject({ path: menu.path, children: menu, access }) ); + }; + + /** + * render + */ + return ( + <> + + + + handleNodeClick(info)} + /> + + setResourceState((prevState) => ({ ...prevState, contextMenuOpen: false })) + } + items={renderRightMenu()} + onClick={handleMenuClick} + /> + + + + + + + + {resourceState.editOpen && ( + + )} + {resourceState.uploadOpen && ( + + )} + + ); }; export default ResourceOverView; diff --git a/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx b/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx index e32b6c7e00..f7ee8d736c 100644 --- a/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx +++ b/dinky-web/src/pages/RegCenter/UDF/components/UDFRegister/index.tsx @@ -19,11 +19,13 @@ import { EditBtn } from '@/components/CallBackButton/EditBtn'; import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn'; +import { BackIcon } from '@/components/Icons/CustomIcons'; import UDFRegisterModal from '@/pages/RegCenter/UDF/components/UDFRegister/UDFRegisterModal'; import { API_CONSTANTS } from '@/services/endpoints'; import { UDFRegisterInfo, UDFRegisterInfoParent } from '@/types/RegCenter/data'; import { l } from '@/utils/intl'; import { useRequest } from '@@/plugin-request'; +import { SaveTwoTone } from '@ant-design/icons'; import { ProColumns } from '@ant-design/pro-components'; import ProTable, { ActionType } from '@ant-design/pro-table'; import React, { Key, useEffect, useRef, useState } from 'react'; @@ -182,6 +184,8 @@ const UDFRegister: React.FC = (props) => { editable={{ deleteText: false, type: 'single', + saveText: , + cancelText: , editableKeys: udfRegisterState.editableKeys, onChange: editableKeysChange, onSave: async (_, row) => handleOnSave(row), diff --git a/script/sql/dinky-mysql.sql b/script/sql/dinky-mysql.sql index fa7dd2f6ed..581b430c61 100644 --- a/script/sql/dinky-mysql.sql +++ b/script/sql/dinky-mysql.sql @@ -1550,7 +1550,7 @@ CREATE TABLE `dinky_git_project` ( `last_build` datetime DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `build_state` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0-notStart 1-process 2-failed 3-success', - `build_step` tinyint(2) NOT NULL DEFAULT '0', + `build_step` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'different from java and python, when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish; when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish', `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0-disable 1-enable', `udf_class_map_list` text COMMENT 'scan udf class', `order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order', diff --git a/script/sql/dinky-pg.sql b/script/sql/dinky-pg.sql index a1e277e0c7..7d7bd15134 100644 --- a/script/sql/dinky-pg.sql +++ b/script/sql/dinky-pg.sql @@ -1204,10 +1204,22 @@ CREATE TABLE "public"."dinky_git_project" ( "update_time" timestamp(6) NOT null ) ; +COMMENT ON COLUMN "public"."dinky_git_project"."id" IS 'ID'; +COMMENT ON COLUMN "public"."dinky_git_project"."tenant_id" IS 'tenant id'; +COMMENT ON COLUMN "public"."dinky_git_project"."name" IS 'project name'; +COMMENT ON COLUMN "public"."dinky_git_project"."url" IS 'git url'; +COMMENT ON COLUMN "public"."dinky_git_project"."branch" IS 'git branch'; +COMMENT ON COLUMN "public"."dinky_git_project"."username" IS 'username'; +COMMENT ON COLUMN "public"."dinky_git_project"."password" IS 'password'; +COMMENT ON COLUMN "public"."dinky_git_project"."pom" IS 'pom'; +COMMENT ON COLUMN "public"."dinky_git_project"."build_args" IS 'build args'; COMMENT ON COLUMN "public"."dinky_git_project"."private_key" IS 'keypath'; COMMENT ON COLUMN "public"."dinky_git_project"."code_type" IS 'code type(1-java,2-python)'; COMMENT ON COLUMN "public"."dinky_git_project"."type" IS '1-http ,2-ssh'; +COMMENT ON COLUMN "public"."dinky_git_project"."last_build" IS 'last build time'; +COMMENT ON COLUMN "public"."dinky_git_project"."description" IS 'description'; COMMENT ON COLUMN "public"."dinky_git_project"."build_state" IS '0-notStart 1-process 2-failed 3-success'; +COMMENT ON COLUMN "public"."dinky_git_project"."build_step" IS 'different from java and python, when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish; when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish'; COMMENT ON COLUMN "public"."dinky_git_project"."enabled" IS '0-disable 1-enable'; COMMENT ON COLUMN "public"."dinky_git_project"."udf_class_map_list" IS 'scan udf class'; COMMENT ON COLUMN "public"."dinky_git_project"."order_line" IS 'order'; diff --git a/script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_ddl.sql b/script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_ddl.sql index 56f0c3987b..f9f90b0ade 100644 --- a/script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_ddl.sql +++ b/script/sql/upgrade/1.0.0-SNAPSHOT_schema/mysql/dinky_ddl.sql @@ -97,7 +97,7 @@ CREATE TABLE `dinky_git_project` ( `last_build` datetime DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `build_state` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0-notStart 1-process 2-failed 3-success', - `build_step` tinyint(2) NOT NULL DEFAULT '0', + `build_step` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'different from java and python, when build java project, the step value is as follows: 0: environment check 1: clone project 2: compile and build 3: get artifact 4: analyze UDF 5: finish; when build python project, the step value is as follows: 0: environment check 1: clone project 2: get artifact 3: analyze UDF 4: finish', `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0-disable 1-enable', `udf_class_map_list` text COMMENT 'scan udf class', `order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order', From 5574aaf773b40eb6dc216c7eb0c496bfa999b8b1 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Tue, 7 Nov 2023 22:11:45 +0800 Subject: [PATCH 12/14] modify some code --- .../SchemaDesc/ColumnInfo/index.tsx | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx new file mode 100644 index 0000000000..2094995ee5 --- /dev/null +++ b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DataSources } from '@/types/RegCenter/data'; +import { transformTreeData } from '@/utils/function'; +import { l } from '@/utils/intl'; +import { CheckSquareOutlined, KeyOutlined } from '@ant-design/icons'; +import { ProTable } from '@ant-design/pro-components'; +import { ProColumns } from '@ant-design/pro-table/es/typing'; +import React from 'react'; + +type ColumnInfoProps = { + columnInfo: Partial; +}; + +const ColumnInfo: React.FC = (props) => { + const { columnInfo } = props; + + const columns: ProColumns[] = [ + { + title: l('rc.ds.no'), + dataIndex: 'position', + width: '4%' + }, + { + title: l('rc.ds.columnName'), + dataIndex: 'name', + width: '10%', + ellipsis: true + }, + { + title: l('rc.ds.columnType'), + dataIndex: 'type', + width: '6%' + }, + { + title: l('rc.ds.primarykey'), + dataIndex: 'keyFlag', + width: '4%', + render: (_, record) => { + return record.keyFlag ? : undefined; + } + }, + { + title: l('rc.ds.autoIncrement'), + dataIndex: 'autoIncrement', + width: '4%', + render: (_, record) => { + return record.autoIncrement ? ( + + ) : undefined; + } + }, + { + title: l('rc.ds.isNull'), + dataIndex: 'nullable', + width: '4%', + render: (_, record) => { + return !record.nullable ? : undefined; + } + }, + { + title: l('rc.ds.default'), + dataIndex: 'defaultValue', + ellipsis: true, + width: '8%' + }, + { + title: l('rc.ds.length'), + dataIndex: 'length', + width: '4%' + }, + { + title: l('rc.ds.precision'), + dataIndex: 'precision', + width: '4%' + }, + { + title: l('rc.ds.decimalDigits'), + dataIndex: 'scale', + ellipsis: true, + width: '6%' + }, + { + title: l('rc.ds.character'), + dataIndex: 'characterSet', + width: '6%', + ellipsis: true + }, + { + title: l('rc.ds.collationRule'), + dataIndex: 'collation', + width: '10%', + ellipsis: true + }, + { + title: l('rc.ds.javaType'), + dataIndex: 'javaType', + ellipsis: true, + width: '8%' + }, + { + title: l('rc.ds.comment'), + dataIndex: 'comment', + ellipsis: true + } + ]; + + return ( + <> + + toolBarRender={false} + pagination={{ + defaultPageSize: 14, + hideOnSinglePage: true + }} + search={false} + options={false} + size={'small'} + bordered + columns={columns} + dataSource={transformTreeData(columnInfo) as DataSources.Column[]} + /> + + ); +}; + +export default ColumnInfo; From 100ddc61617408430116677580894260ab608f00 Mon Sep 17 00:00:00 2001 From: zhu-mingye <934230207@qq.com> Date: Tue, 7 Nov 2023 22:12:26 +0800 Subject: [PATCH 13/14] modify some code --- .../RightTagsRouter/SchemaDesc/index.tsx | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx index e1407b3396..9534459213 100644 --- a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx +++ b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx @@ -1,18 +1,20 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ import { Height80VHDiv } from '@/components/StyledComponents'; From 8244ea932ba3fae7557d39655441a9f5cc641089 Mon Sep 17 00:00:00 2001 From: zhu-mingye Date: Tue, 7 Nov 2023 14:16:14 +0000 Subject: [PATCH 14/14] Spotless Apply --- .../DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx index 9534459213..bca42d43eb 100644 --- a/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx +++ b/dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx @@ -18,12 +18,12 @@ */ import { Height80VHDiv } from '@/components/StyledComponents'; +import ColumnInfo from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'; import TableInfo from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'; import { DataSources } from '@/types/RegCenter/data'; import { l } from '@/utils/intl'; import { Empty } from 'antd'; import React from 'react'; -import ColumnInfo from "@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo"; type SchemaDescProps = { tableInfo: Partial;