Unverified Commit 7563410e authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

Fix udf bug (#2501)

* Spotless Apply * Spotless Apply * fix-udf-bug * fix-udf-bug * modify git build model layout * fix table enum bug * Spotless Apply * modify some code * Spotless Apply * modify some code * modify git build model layout && udf bug * modify some code * modify some code * Spotless Apply --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 59a32223
...@@ -98,6 +98,11 @@ public class GitProject extends SuperEntity<GitProject> { ...@@ -98,6 +98,11 @@ public class GitProject extends SuperEntity<GitProject> {
@TableField(value = "build_state") @TableField(value = "build_state")
private Integer buildState; 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") @ApiModelProperty(value = "Build Step", dataType = "Integer")
@TableField(value = "build_step") @TableField(value = "build_step")
private Integer buildStep; private Integer buildStep;
......
...@@ -169,7 +169,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourcesMapper, Resources> ...@@ -169,7 +169,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourcesMapper, Resources>
Resources resources = getById(id); Resources resources = getById(id);
Assert.notNull(resources, () -> new BusException(Status.RESOURCE_DIR_OR_FILE_NOT_EXIST)); 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!")); 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) @Transactional(rollbackFor = Exception.class)
......
...@@ -93,7 +93,8 @@ public class MavenUtil { ...@@ -93,7 +93,8 @@ public class MavenUtil {
} else { } else {
localRepositoryDirectory = repositoryDir; 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")); Opt.ofNullable(consumer).ifPresent(c -> c.accept("Executing command: " + mavenCommandLine + "\n"));
int waitValue = RuntimeUtils.run( int waitValue = RuntimeUtils.run(
...@@ -102,7 +103,7 @@ public class MavenUtil { ...@@ -102,7 +103,7 @@ public class MavenUtil {
s = DateUtil.date().toMsStr() + " - " + s + "\n"; s = DateUtil.date().toMsStr() + " - " + s + "\n";
consumer.accept(s); consumer.accept(s);
}, },
log::error); consumer::accept);
return waitValue == 0; return waitValue == 0;
} }
...@@ -149,6 +150,30 @@ public class MavenUtil { ...@@ -149,6 +150,30 @@ public class MavenUtil {
return StrUtil.join(" ", commandLine); return StrUtil.join(" ", commandLine);
} }
public static String getMavenCommandLineByMvn(
String projectDir,
String mavenHome,
String repositoryDir,
String settingsPath,
List<String> goals,
List<String> args) {
projectDir = StrUtil.wrap(projectDir, "\"");
settingsPath = StrUtil.wrap(settingsPath, "\"");
List<String> 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() { public static String getMavenVersion() {
return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v"); return RuntimeUtil.execForStr(getMavenHome() + "/bin/" + EXECTOR + " -v");
} }
......
...@@ -29,6 +29,7 @@ import java.util.concurrent.CopyOnWriteArrayList; ...@@ -29,6 +29,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.lang.Opt; import cn.hutool.core.lang.Opt;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -61,7 +62,8 @@ public class RuntimeUtils { ...@@ -61,7 +62,8 @@ public class RuntimeUtils {
reader.close(); reader.close();
inputStream.close(); inputStream.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); errorConsumer.accept(ExceptionUtil.stacktraceToOneLineString(e));
RUNNING.remove(process);
} }
}) })
.start(); .start();
...@@ -74,7 +76,7 @@ public class RuntimeUtils { ...@@ -74,7 +76,7 @@ public class RuntimeUtils {
Opt.ofNullable(errorConsumer).ifPresent(x -> x.accept(errMsg)); Opt.ofNullable(errorConsumer).ifPresent(x -> x.accept(errMsg));
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); errorConsumer.accept(ExceptionUtil.stacktraceToOneLineString(e));
} }
return waitValue; return waitValue;
} }
......
...@@ -11,7 +11,7 @@ ds.work.flow.not.save=Please Save Workflow First ...@@ -11,7 +11,7 @@ ds.work.flow.not.save=Please Save Workflow First
schedule.status.unknown=Unknown Status: {0} schedule.status.unknown=Unknown Status: {0}
user.binding.role.delete.all=User Binding Role Delete All user.binding.role.delete.all=User Binding Role Delete All
modify.failed=Update Failed 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 menu.has.child=Menu Has Child, Can Not Delete
tenant.already.exists=Tenant Already Exists tenant.already.exists=Tenant Already Exists
save.failed=Save Failed save.failed=Save Failed
......
...@@ -11,7 +11,7 @@ ds.work.flow.not.save=\u8BF7\u5148\u4FDD\u5B58\u5DE5\u4F5C\u6D41 ...@@ -11,7 +11,7 @@ ds.work.flow.not.save=\u8BF7\u5148\u4FDD\u5B58\u5DE5\u4F5C\u6D41
schedule.status.unknown=\u672A\u77E5\u72B6\u6001: {0} schedule.status.unknown=\u672A\u77E5\u72B6\u6001: {0}
user.binding.role.delete.all=\u7528\u6237\u7ED1\u5B9A\u89D2\u8272\u5220\u9664\u6240\u6709 user.binding.role.delete.all=\u7528\u6237\u7ED1\u5B9A\u89D2\u8272\u5220\u9664\u6240\u6709
modify.failed=\u4FEE\u6539\u5931\u8D25 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 menu.has.child=\u5B58\u5728\u5B50\u83DC\u5355 \u4E0D\u5141\u8BB8\u5220\u9664
tenant.already.exists=\u79DF\u6237\u5DF2\u5B58\u5728 tenant.already.exists=\u79DF\u6237\u5DF2\u5B58\u5728
save.failed=\u4FDD\u5B58\u5931\u8D25 save.failed=\u4FDD\u5B58\u5931\u8D25
......
...@@ -24,6 +24,8 @@ export default { ...@@ -24,6 +24,8 @@ export default {
'button.recovery': 'Recovery', 'button.recovery': 'Recovery',
'button.cancel': 'Cancel', 'button.cancel': 'Cancel',
'button.finish': 'Finish', 'button.finish': 'Finish',
'button.retry': 'Retry',
'button.rebuild': 'Re Build',
'button.back': 'Back', 'button.back': 'Back',
'button.save': 'Save', 'button.save': 'Save',
'button.delete': 'Delete', 'button.delete': 'Delete',
......
...@@ -760,7 +760,8 @@ export default { ...@@ -760,7 +760,8 @@ export default {
'rc.gp.build.step.1': 'Check Env', 'rc.gp.build.step.1': 'Check Env',
'rc.gp.build.step.2': 'Git Clone', 'rc.gp.build.step.2': 'Git Clone',
'rc.gp.build.step.3': 'Maven Build', '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.5': 'Analysis UDF',
'rc.gp.build.step.6': 'Finish', 'rc.gp.build.step.6': 'Finish',
'rc.gp.buildArgs': 'Build Arguments', 'rc.gp.buildArgs': 'Build Arguments',
......
...@@ -26,6 +26,8 @@ export default { ...@@ -26,6 +26,8 @@ export default {
'button.confirm': '确定', 'button.confirm': '确定',
'button.cancel': '取消', 'button.cancel': '取消',
'button.finish': '完成', 'button.finish': '完成',
'button.retry': '重试',
'button.rebuild': '重新构建',
'button.back': '返回', 'button.back': '返回',
'button.save': '保存', 'button.save': '保存',
'button.delete': '删除', 'button.delete': '删除',
......
...@@ -726,7 +726,7 @@ export default { ...@@ -726,7 +726,7 @@ export default {
'rc.gp.build.step.1': '环境检查', 'rc.gp.build.step.1': '环境检查',
'rc.gp.build.step.2': '克隆项目', 'rc.gp.build.step.2': '克隆项目',
'rc.gp.build.step.3': '编译构建', '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.5': '分析 UDF',
'rc.gp.build.step.6': '完成', 'rc.gp.build.step.6': '完成',
'rc.gp.buildArgs': '构建参数', 'rc.gp.buildArgs': '构建参数',
......
...@@ -163,7 +163,7 @@ const ConsoleContent = (props: ConsoleProps) => { ...@@ -163,7 +163,7 @@ const ConsoleContent = (props: ConsoleProps) => {
onSelect={onSelect} onSelect={onSelect}
treeData={[processNode]} treeData={[processNode]}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
expandAction={"doubleClick"} expandAction={'doubleClick'}
onExpand={handleExpand} onExpand={handleExpand}
/> />
) : ( ) : (
......
/*
* 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<DataSources.Column[]>;
};
const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
const { columnInfo } = props;
const columns: ProColumns<DataSources.Column>[] = [
{
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 ? <KeyOutlined style={{ color: '#FAA100' }} /> : undefined;
}
},
{
title: l('rc.ds.autoIncrement'),
dataIndex: 'autoIncrement',
width: '4%',
render: (_, record) => {
return record.autoIncrement ? (
<CheckSquareOutlined style={{ color: '#1296db' }} />
) : undefined;
}
},
{
title: l('rc.ds.isNull'),
dataIndex: 'nullable',
width: '4%',
render: (_, record) => {
return !record.nullable ? <CheckSquareOutlined style={{ color: '#1296db' }} /> : 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 (
<>
<ProTable<DataSources.Column>
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;
/* /*
* 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'; import { Height80VHDiv } from '@/components/StyledComponents';
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -29,15 +29,19 @@ import { API_CONSTANTS } from '@/services/endpoints'; ...@@ -29,15 +29,19 @@ import { API_CONSTANTS } from '@/services/endpoints';
import { GitProject } from '@/types/RegCenter/data.d'; import { GitProject } from '@/types/RegCenter/data.d';
import { InitGitBuildStepsState } from '@/types/RegCenter/init.d'; import { InitGitBuildStepsState } from '@/types/RegCenter/init.d';
import { GitBuildStepsState } from '@/types/RegCenter/state.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'; import React, { useEffect, useState } from 'react';
/** /**
* props * props
*/ */
type BuildStepsProps = { type BuildStepsProps = {
onCancel: (flag?: boolean) => void; onOk: (flag?: boolean) => void;
onReTry?: () => void;
onRebuild: () => void;
title: string; title: string;
showLog?: boolean;
values: Partial<GitProject>; values: Partial<GitProject>;
}; };
...@@ -45,7 +49,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -45,7 +49,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
/** /**
* extract props * extract props
*/ */
const { onCancel: handleModalVisible, title, values } = props; const { onOk: handleModalVisible, onReTry, showLog = false, onRebuild, title, values } = props;
// todo: refactor this // todo: refactor this
const [buildStepState, setBuildStepState] = useState<GitBuildStepsState>(InitGitBuildStepsState); const [buildStepState, setBuildStepState] = useState<GitBuildStepsState>(InitGitBuildStepsState);
...@@ -88,7 +92,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -88,7 +92,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
// type // 1是总状态 2是log 3是部分状态 // type // 1是总状态 2是log 3是部分状态
// status // 0是失败 1是进行中 2 完成 // status // 0是失败 1是进行中 2 完成
let result = JSON.parse(e.data); let result = JSON.parse(e.data);
const { currentStep, type, data, status, history } = result; const { currentStep, type, data, status } = result;
lastStep = currentStep; lastStep = currentStep;
if (type === 0) { if (type === 0) {
...@@ -171,18 +175,46 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => { ...@@ -171,18 +175,46 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
handleModalVisible(); handleModalVisible();
}; };
// todo: 重试需要实现在不关闭弹窗的情况下,重新构建, 目前是关闭弹窗,重新打开,重新构建
const handleReTry = () => {
onReTry?.();
};
const footerButtons = [
<Button
key={'retry'}
type={'primary'}
danger
hidden={!onReTry}
disabled={onReTry && Number(steps[currentStep]?.status) !== 2}
onClick={() => handleReTry()}
>
{l('button.retry')}
</Button>,
<Button
key={'rebuild'}
type={'dashed'}
hidden={showLog}
loading={currentStep !== steps.length && percent !== 99}
onClick={() => onRebuild()}
>
{l('button.rebuild')}
</Button>,
<Button
key={'finish'}
type={showLog ? 'default' : 'primary'}
loading={currentStep !== steps.length && percent !== 99}
onClick={() => handleCancel()}
>
{showLog ? l('button.close') : l('button.finish')}
</Button>
];
/** /**
* render * render
*/ */
return ( return (
<Modal <Modal title={title} width={'85%'} open={true} maskClosable={false} footer={footerButtons}>
title={title}
width={'85%'}
open={true}
maskClosable={false}
onCancel={() => handleCancel()}
okButtonProps={{ style: { display: 'none' } }}
>
<AutoSteps <AutoSteps
steps={steps} steps={steps}
percent={percent} percent={percent}
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -29,8 +29,8 @@ import ClassList from '@/pages/RegCenter/GitProject/components/BuildSteps/JarSho ...@@ -29,8 +29,8 @@ import ClassList from '@/pages/RegCenter/GitProject/components/BuildSteps/JarSho
import { CodeTree } from '@/pages/RegCenter/GitProject/components/CodeTree'; import { CodeTree } from '@/pages/RegCenter/GitProject/components/CodeTree';
import ProjectModal from '@/pages/RegCenter/GitProject/components/ProjectModal'; import ProjectModal from '@/pages/RegCenter/GitProject/components/ProjectModal';
import { import {
GIT_PROJECT_BUILD_STEP, GIT_PROJECT_BUILD_STEP_JAVA_ENUM,
GIT_PROJECT_BUILD_STEP_ENUM, GIT_PROJECT_BUILD_STEP_PYTHON_ENUM,
GIT_PROJECT_CODE_TYPE, GIT_PROJECT_CODE_TYPE,
GIT_PROJECT_CODE_TYPE_ENUM, GIT_PROJECT_CODE_TYPE_ENUM,
GIT_PROJECT_STATUS, GIT_PROJECT_STATUS,
...@@ -227,8 +227,9 @@ const ProjectProTable: React.FC = () => { ...@@ -227,8 +227,9 @@ const ProjectProTable: React.FC = () => {
title: l('rc.gp.buildStep'), title: l('rc.gp.buildStep'),
dataIndex: 'buildStep', dataIndex: 'buildStep',
hideInSearch: true, hideInSearch: true,
filters: GIT_PROJECT_BUILD_STEP, // filters: GIT_PROJECT_BUILD_STEP,
valueEnum: GIT_PROJECT_BUILD_STEP_ENUM valueEnum: (row) =>
row.codeType === 1 ? GIT_PROJECT_BUILD_STEP_JAVA_ENUM : GIT_PROJECT_BUILD_STEP_PYTHON_ENUM
}, },
{ {
title: l('rc.gp.buildState'), title: l('rc.gp.buildState'),
...@@ -352,6 +353,15 @@ const ProjectProTable: React.FC = () => { ...@@ -352,6 +353,15 @@ const ProjectProTable: React.FC = () => {
return <Empty image={Empty.PRESENTED_IMAGE_DEFAULT} />; return <Empty image={Empty.PRESENTED_IMAGE_DEFAULT} />;
}; };
/**
* re try build
* @param value
*/
const handleReTryBuild = async (value: Partial<GitProject>) => {
handleCancel();
await handleBuild(value);
};
/** /**
* render * render
*/ */
...@@ -401,7 +411,9 @@ const ProjectProTable: React.FC = () => { ...@@ -401,7 +411,9 @@ const ProjectProTable: React.FC = () => {
{gitProjectStatus.buildOpen && ( {gitProjectStatus.buildOpen && (
<BuildSteps <BuildSteps
title={l('rc.gp.build')} title={l('rc.gp.build')}
onCancel={handleCancel} onOk={handleCancel}
onRebuild={() => handleReTryBuild(gitProjectStatus.value)}
onReTry={() => handleReTryBuild(gitProjectStatus.value)}
values={gitProjectStatus.value} values={gitProjectStatus.value}
/> />
)} )}
...@@ -410,7 +422,9 @@ const ProjectProTable: React.FC = () => { ...@@ -410,7 +422,9 @@ const ProjectProTable: React.FC = () => {
{gitProjectStatus.logOpen && ( {gitProjectStatus.logOpen && (
<BuildSteps <BuildSteps
title={l('rc.gp.log')} title={l('rc.gp.log')}
onCancel={handleCancel} onOk={handleCancel}
showLog={gitProjectStatus.logOpen}
onRebuild={() => handleReTryBuild(gitProjectStatus.value)}
values={gitProjectStatus.value} values={gitProjectStatus.value}
/> />
)} )}
......
/* /*
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * 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 not use this file except in compliance with
* the License. You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
*/ */
...@@ -131,7 +131,7 @@ export const CLONE_TYPES = [ ...@@ -131,7 +131,7 @@ export const CLONE_TYPES = [
* @param item * @param item
*/ */
export const renderBranchesTagColor = (item: string) => { export const renderBranchesTagColor = (item: string) => {
let colorTag = item.includes('dev') return item.includes('dev')
? 'processing' ? 'processing'
: item.includes('test') : item.includes('test')
? 'warning' ? 'warning'
...@@ -142,13 +142,14 @@ export const renderBranchesTagColor = (item: string) => { ...@@ -142,13 +142,14 @@ export const renderBranchesTagColor = (item: string) => {
: item.includes('main') : item.includes('main')
? 'success' ? 'success'
: 'default'; : '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: { 0: {
title: l('rc.gp.build.step.0'), title: l('rc.gp.build.step.0'),
text: l('rc.gp.build.step.0'), text: l('rc.gp.build.step.0'),
...@@ -158,7 +159,13 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { ...@@ -158,7 +159,13 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = {
title: l('rc.gp.build.step.1'), title: l('rc.gp.build.step.1'),
text: l('rc.gp.build.step.1'), text: l('rc.gp.build.step.1'),
status: 'default' status: 'default'
}, }
};
/**
* git project build step enum
*/
export const GIT_PROJECT_BUILD_STEP_JAVA_ENUM = {
...GIT_PROJECT_BUILD_STEP_BASE,
2: { 2: {
title: l('rc.gp.build.step.2'), title: l('rc.gp.build.step.2'),
text: l('rc.gp.build.step.2'), text: l('rc.gp.build.step.2'),
...@@ -185,6 +192,31 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = { ...@@ -185,6 +192,31 @@ export const GIT_PROJECT_BUILD_STEP_ENUM = {
status: 'success' 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 * git project build step filter
*/ */
...@@ -228,7 +260,6 @@ export const GIT_PROJECT_BUILD_STEP = [ ...@@ -228,7 +260,6 @@ export const GIT_PROJECT_BUILD_STEP = [
/** /**
* git project build step enum * git project build step enum
* @type {{"100%": string, "0%": string, "20%": string, "40%": string, "60%": string, "80%": string}}
*/ */
export const processColor = { export const processColor = {
'0%': '#8ac1ea', '0%': '#8ac1ea',
......
/* /*
* 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 = { export type BuildStepsState = {
key: number; key: number;
title: string; title: string;
status: string; status: string; // 0-notStart(未开始) 1-process(进行中/构建中) 2-failed(构建失败) 3-success(构建成功)
description: string; description: string;
disabled: boolean; disabled: boolean;
onClick: () => void; onClick: () => void;
......
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
import { EditBtn } from '@/components/CallBackButton/EditBtn'; import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn'; import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import { BackIcon } from '@/components/Icons/CustomIcons';
import UDFRegisterModal from '@/pages/RegCenter/UDF/components/UDFRegister/UDFRegisterModal'; import UDFRegisterModal from '@/pages/RegCenter/UDF/components/UDFRegister/UDFRegisterModal';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { UDFRegisterInfo, UDFRegisterInfoParent } from '@/types/RegCenter/data'; import { UDFRegisterInfo, UDFRegisterInfoParent } from '@/types/RegCenter/data';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { useRequest } from '@@/plugin-request'; import { useRequest } from '@@/plugin-request';
import { SaveTwoTone } from '@ant-design/icons';
import { ProColumns } from '@ant-design/pro-components'; import { ProColumns } from '@ant-design/pro-components';
import ProTable, { ActionType } from '@ant-design/pro-table'; import ProTable, { ActionType } from '@ant-design/pro-table';
import React, { Key, useEffect, useRef, useState } from 'react'; import React, { Key, useEffect, useRef, useState } from 'react';
...@@ -182,6 +184,8 @@ const UDFRegister: React.FC<UDFRegisterProps> = (props) => { ...@@ -182,6 +184,8 @@ const UDFRegister: React.FC<UDFRegisterProps> = (props) => {
editable={{ editable={{
deleteText: false, deleteText: false,
type: 'single', type: 'single',
saveText: <SaveTwoTone title={l('button.save')} />,
cancelText: <BackIcon title={l('button.back')} />,
editableKeys: udfRegisterState.editableKeys, editableKeys: udfRegisterState.editableKeys,
onChange: editableKeysChange, onChange: editableKeysChange,
onSave: async (_, row) => handleOnSave(row), onSave: async (_, row) => handleOnSave(row),
......
...@@ -1550,7 +1550,7 @@ CREATE TABLE `dinky_git_project` ( ...@@ -1550,7 +1550,7 @@ CREATE TABLE `dinky_git_project` (
`last_build` datetime DEFAULT NULL, `last_build` datetime DEFAULT NULL,
`description` varchar(255) 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_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', `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0-disable 1-enable',
`udf_class_map_list` text COMMENT 'scan udf class', `udf_class_map_list` text COMMENT 'scan udf class',
`order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order', `order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order',
......
...@@ -1204,10 +1204,22 @@ CREATE TABLE "public"."dinky_git_project" ( ...@@ -1204,10 +1204,22 @@ CREATE TABLE "public"."dinky_git_project" (
"update_time" timestamp(6) NOT null "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"."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"."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"."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_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"."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"."udf_class_map_list" IS 'scan udf class';
COMMENT ON COLUMN "public"."dinky_git_project"."order_line" IS 'order'; COMMENT ON COLUMN "public"."dinky_git_project"."order_line" IS 'order';
......
...@@ -97,7 +97,7 @@ CREATE TABLE `dinky_git_project` ( ...@@ -97,7 +97,7 @@ CREATE TABLE `dinky_git_project` (
`last_build` datetime DEFAULT NULL, `last_build` datetime DEFAULT NULL,
`description` varchar(255) 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_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', `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0-disable 1-enable',
`udf_class_map_list` text COMMENT 'scan udf class', `udf_class_map_list` text COMMENT 'scan udf class',
`order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order', `order_line` int(11) NOT NULL DEFAULT '1' COMMENT 'order',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment