diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/resource/ResourceJar.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/resource/ResourceJar.java index aa4a6e076..efb540509 100644 --- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/resource/ResourceJar.java +++ b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/resource/ResourceJar.java @@ -36,9 +36,6 @@ public class ResourceJar extends BaseDO { private static final long serialVersionUID = 1L; - @TableField("`group`") - private String group; - @TableField("file_name") private String fileName; diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/resource/ResourceJarMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/resource/ResourceJarMapper.xml index 2364ba333..6e7d0f43b 100644 --- a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/resource/ResourceJarMapper.xml +++ b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/resource/ResourceJarMapper.xml @@ -26,7 +26,6 @@ - @@ -35,7 +34,7 @@ id, creator, create_time, editor, update_time, - `group`, file_name, `path`, remark + file_name, `path`, remark diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecUserRoleMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecUserRoleMapper.xml index 614cfd678..bad8979d4 100644 --- a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecUserRoleMapper.xml +++ b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecUserRoleMapper.xml @@ -37,7 +37,7 @@ sec_user t1 JOIN sec_user_role t2 ON t1.id = t2.user_id WHERE - t2.role_id = 1 + t2.role_id = #{roleId} AND t1.`status` = #{status} diff --git a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/convert/JarConvert.java b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/convert/JarConvert.java index f9926b77d..fe2133e56 100644 --- a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/convert/JarConvert.java +++ b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/convert/JarConvert.java @@ -35,8 +35,7 @@ public interface JarConvert extends BaseConvert { default JarListParam convert(ResourceListParam param) { JarListParam target = BeanUtil.copy(param, new JarListParam()); - target.setGroup(param.getLabel()); - target.setFileName(param.getName()); + target.setFileName(param.getLabel()); return target; } diff --git a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/impl/JarServiceImpl.java b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/impl/JarServiceImpl.java index 3d30430dc..675fa17c8 100644 --- a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/impl/JarServiceImpl.java +++ b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/impl/JarServiceImpl.java @@ -80,7 +80,6 @@ public Page list(JarListParam param) throws IOException { final Page page = jarMapper.selectPage( new Page<>(param.getCurrent(), param.getPageSize()), Wrappers.lambdaQuery(ResourceJar.class) - .eq(StringUtils.hasText(param.getGroup()), ResourceJar::getGroup, param.getGroup()) .like(StringUtils.hasText(param.getFileName()), ResourceJar::getFileName, param.getFileName())); Page result = new Page<>(page.getCurrent(), page.getSize(), page.getTotal()); @@ -101,7 +100,7 @@ public void upload(JarUploadParam param, MultipartFile file) throws IOException String fileName = file.getOriginalFilename(); Path path = null; try (InputStream inputStream = file.getInputStream()) { - path = fileSystemService.upload(inputStream, getJarPath(param.getGroup(), fileName)); + path = fileSystemService.upload(inputStream, getJarPath(fileName)); } ResourceJar record = new ResourceJar(); BeanUtils.copyProperties(param, record); @@ -134,11 +133,10 @@ public void delete(Long id) throws IOException { jarMapper.deleteById(id); } - private String getJarPath(String group, String fileName) { - return String.format("%s/%s/%s", getJarRootPath(), group, fileName); + private String getJarPath(String fileName) { + return String.format("%s/%s", getJarRootPath(), fileName); } - private String getJarRootPath() { return "jar"; } diff --git a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarListParam.java b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarListParam.java index 4ae6c32d8..27d553528 100644 --- a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarListParam.java +++ b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarListParam.java @@ -27,9 +27,6 @@ @EqualsAndHashCode(callSuper = true) public class JarListParam extends PaginationParam { - @Schema(description = "jar group") - private String group; - @Schema(description = "文件名称。支持模糊匹配") private String fileName; diff --git a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarUploadParam.java b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarUploadParam.java index 127599d71..11ec99ef2 100644 --- a/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarUploadParam.java +++ b/scaleph-resource/src/main/java/cn/sliew/scaleph/resource/service/param/JarUploadParam.java @@ -21,15 +21,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import javax.validation.constraints.NotBlank; - @Data public class JarUploadParam { - - @NotBlank - @Schema(description = "jar group") - private String group; - + @Schema(description = "备注") private String remark; } diff --git a/scaleph-ui-react/config/routes.ts b/scaleph-ui-react/config/routes.ts index 1fcc0a931..a68cb2902 100644 --- a/scaleph-ui-react/config/routes.ts +++ b/scaleph-ui-react/config/routes.ts @@ -150,6 +150,13 @@ export default [ pCode: PRIVILEGE_CODE.workspaceClusterConfigShow, access: 'normalRouteFilter' }, + { + path: '/workspace/flink/kubernetes/template/steps', + exact: true, + component: './Project/Workspace/Kubernetes/Template/Steps', + pCode: PRIVILEGE_CODE.workspaceClusterConfigShow, + access: 'normalRouteFilter' + }, { path: '/workspace/flink/kubernetes/template/detail', exact: true, diff --git a/scaleph-ui-react/src/locales/zh-CN/pages/project.ts b/scaleph-ui-react/src/locales/zh-CN/pages/project.ts index a6c40469c..d06611bde 100644 --- a/scaleph-ui-react/src/locales/zh-CN/pages/project.ts +++ b/scaleph-ui-react/src/locales/zh-CN/pages/project.ts @@ -818,11 +818,12 @@ export default { // Sql 'pages.project.di.step.sql.query': 'SQL', - 'pages.project.flink.kubernetes.deployment.template': 'Deployment Template', - 'pages.project.flink.kubernetes.deployment.template.name': '名称', - 'pages.project.flink.kubernetes.deployment.template.deploymentKind': '部署模式', - 'pages.project.flink.kubernetes.deployment.template.namespace': 'Namespace', - 'pages.project.flink.kubernetes.deployment.template.define': '模板定义', + 'pages.project.flink.kubernetes.template': 'Template', + 'pages.project.flink.kubernetes.template.name': '名称', + 'pages.project.flink.kubernetes.template.deploymentKind': '部署模式', + 'pages.project.flink.kubernetes.template.namespace': 'Namespace', + 'pages.project.flink.kubernetes.template.detail': '模板详情', + 'pages.project.flink.kubernetes.template.step.base': '基础信息', 'pages.project.flink.kubernetes.template.step.advanced.configOptions': 'ConfigOption', 'pages.project.flink.kubernetes.template.step.advanced.configOptions.key': 'Config', 'pages.project.flink.kubernetes.template.step.advanced.configOptions.value': 'Value', diff --git a/scaleph-ui-react/src/locales/zh-CN/pages/resource.ts b/scaleph-ui-react/src/locales/zh-CN/pages/resource.ts index 9ba8a5ad3..b1972973f 100644 --- a/scaleph-ui-react/src/locales/zh-CN/pages/resource.ts +++ b/scaleph-ui-react/src/locales/zh-CN/pages/resource.ts @@ -21,7 +21,6 @@ export default { 'YARN 上传 core-site.xml 和 hdfs-site.xml, ' + 'Kubernetes 上传 kubeconfig 文件', 'pages.resource.jar': '公共 Jar', - 'pages.resource.jar.group': 'Group', 'pages.resource.jar.file': 'Jar', 'pages.resource.jar.fileName': '文件名', 'pages.resource.jar.path': '存储路径', diff --git a/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateDetail.ts b/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateDetail.ts new file mode 100644 index 000000000..552ea1cd0 --- /dev/null +++ b/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateDetail.ts @@ -0,0 +1,55 @@ +import {WsFlinkKubernetesTemplate} from "@/services/project/typings"; +import { Reducer, Effect } from "umi"; +import {WsFlinkKubernetesTemplateService} from "@/services/project/WsFlinkKubernetesTemplateService"; +import YAML from "yaml"; + +export interface StateType { + template: WsFlinkKubernetesTemplate, + templateYaml: string + templateYamlWithDefault: string +} + +export interface ModelType { + namespace: string; + + state: StateType; + + effects: { + queryTemplate: Effect; + }; + + reducers: { + updateTemplate: Reducer; + }; +} + +const model: ModelType = { + namespace: "flinkKubernetesTemplateDetail", + + state: { + template: null, + templateYaml: null, + templateYamlWithDefault: null + }, + + effects: { + *editTemplate({ payload }, { call, put }) { + const { data } = yield call(WsFlinkKubernetesTemplateService.asYaml, payload); + const response = yield call(WsFlinkKubernetesTemplateService.asYamlWithDefault, payload); + yield put({ type: 'updateTemplate', payload: {template: payload, templateYaml: YAML.stringify(data), templateYamlWithDefault: YAML.stringify(response.data)} }); + }, + }, + + reducers: { + updateTemplate(state, { payload }) { + return { + ...state, + template: payload.template, + templateYaml: payload.templateYaml, + templateYamlWithDefault: payload.templateYamlWithDefault, + }; + }, + }, +}; + +export default model; diff --git a/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateSteps.ts b/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateSteps.ts new file mode 100644 index 000000000..0e17e8ebd --- /dev/null +++ b/scaleph-ui-react/src/models/project/workspace/kubernetes/template/flinkKubernetesTemplateSteps.ts @@ -0,0 +1,55 @@ +import {WsFlinkKubernetesTemplate} from "@/services/project/typings"; +import { Reducer, Effect } from "umi"; +import {WsFlinkKubernetesTemplateService} from "@/services/project/WsFlinkKubernetesTemplateService"; +import YAML from "yaml"; + +export interface StateType { + template: WsFlinkKubernetesTemplate, + templateYaml: string + templateYamlWithDefault: string +} + +export interface ModelType { + namespace: string; + + state: StateType; + + effects: { + queryTemplate: Effect; + }; + + reducers: { + updateTemplate: Reducer; + }; +} + +const model: ModelType = { + namespace: "flinkKubernetesTemplateSteps", + + state: { + template: null, + templateYaml: null, + templateYamlWithDefault: null + }, + + effects: { + *editTemplate({ payload }, { call, put }) { + const { data } = yield call(WsFlinkKubernetesTemplateService.asYaml, payload); + const response = yield call(WsFlinkKubernetesTemplateService.asYamlWithDefault, payload); + yield put({ type: 'updateTemplate', payload: {template: payload, templateYaml: YAML.stringify(data), templateYamlWithDefault: YAML.stringify(response.data)} }); + }, + }, + + reducers: { + updateTemplate(state, { payload }) { + return { + ...state, + template: payload.template, + templateYaml: payload.templateYaml, + templateYamlWithDefault: payload.templateYamlWithDefault, + }; + }, + }, +}; + +export default model; diff --git a/scaleph-ui-react/src/pages/Project/Workspace/Kubernetes/Template/DeploymentTemplateForm.tsx b/scaleph-ui-react/src/pages/Project/Workspace/Kubernetes/Template/DeploymentTemplateForm.tsx index 42719af7a..b4a73f8e6 100644 --- a/scaleph-ui-react/src/pages/Project/Workspace/Kubernetes/Template/DeploymentTemplateForm.tsx +++ b/scaleph-ui-react/src/pages/Project/Workspace/Kubernetes/Template/DeploymentTemplateForm.tsx @@ -1,21 +1,19 @@ import {useIntl} from "umi"; import React from "react"; import {Form, message, Modal} from "antd"; -import {ProForm, ProFormDigit, ProFormRadio, ProFormSelect, ProFormText} from "@ant-design/pro-components"; +import {ProForm, ProFormDigit, ProFormRadio, ProFormText, ProFormTextArea} from "@ant-design/pro-components"; import {ModalFormProps} from '@/app.d'; import {WsFlinkKubernetesTemplate} from "@/services/project/typings"; -import { - WsFlinkKubernetesTemplateService -} from "@/services/project/WsFlinkKubernetesTemplateService"; +import {WsFlinkKubernetesTemplateService} from "@/services/project/WsFlinkKubernetesTemplateService"; import {DICT_TYPE, WORKSPACE_CONF} from "@/constant"; import {DictDataService} from "@/services/admin/dictData.service"; const DeploymentTemplateForm: React.FC> = ({ - data, - visible, - onVisibleChange, - onCancel - }) => { + data, + visible, + onVisibleChange, + onCancel + }) => { const intl = useIntl(); const [form] = Form.useForm(); const projectId = localStorage.getItem(WORKSPACE_CONF.projectId); @@ -26,9 +24,9 @@ const DeploymentTemplateForm: React.FC title={ data.id ? intl.formatMessage({id: 'app.common.operate.edit.label'}) + - intl.formatMessage({id: 'pages.project.flink.kubernetes.deployment.template'}) + intl.formatMessage({id: 'pages.project.flink.kubernetes.template'}) : intl.formatMessage({id: 'app.common.operate.new.label'}) + - intl.formatMessage({id: 'pages.project.flink.kubernetes.deployment.template'}) + intl.formatMessage({id: 'pages.project.flink.kubernetes.template'}) } width={580} destroyOnClose={true} @@ -72,22 +70,22 @@ const DeploymentTemplateForm: React.FC