diff --git a/datavines-core/src/main/java/io/datavines/core/enums/Status.java b/datavines-core/src/main/java/io/datavines/core/enums/Status.java index df90e3316..c28c334d3 100644 --- a/datavines-core/src/main/java/io/datavines/core/enums/Status.java +++ b/datavines-core/src/main/java/io/datavines/core/enums/Status.java @@ -46,6 +46,8 @@ public enum Status { CREATE_VERIFICATION_IMAGE_ERROR(10020005, "create verification image error", "创建验证码错误"), EXPIRED_VERIFICATION_CODE(10020006, "expired verification code", "验证码已过期,请重新刷新"), INVALID_VERIFICATION_CODE(10020007, "invalid verification code", "错误的验证码,请重新输入"), + OLD_PASSWORD_IS_INCORRECT_ERROR(10020004, "Old Password is Incorrect", "旧密码错误"), + NEW_PASSWORD_CONFIRM_IS_INCORRECT_ERROR(10020004, "New Password Confirm is Incorrect", "新密码确认错误"), WORKSPACE_EXIST_ERROR(11010001, "WorkSpace {0} is Exist error", "工作空间 {0} 已存在错误"), CREATE_WORKSPACE_ERROR(11010002, "Create WorkSpace {0} Error", "创建工作空间 {0} 错误"), diff --git a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-api/src/main/java/io/datavines/engine/local/api/LocalRuntimeEnvironment.java b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-api/src/main/java/io/datavines/engine/local/api/LocalRuntimeEnvironment.java index af1817c44..a2784c64b 100644 --- a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-api/src/main/java/io/datavines/engine/local/api/LocalRuntimeEnvironment.java +++ b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-api/src/main/java/io/datavines/engine/local/api/LocalRuntimeEnvironment.java @@ -24,6 +24,8 @@ import io.datavines.engine.local.api.utils.LoggerFactory; import org.slf4j.Logger; +import java.sql.Statement; + public class LocalRuntimeEnvironment implements RuntimeEnvironment { protected Logger log = LoggerFactory.getLogger(LocalRuntimeEnvironment.class); @@ -34,6 +36,8 @@ public class LocalRuntimeEnvironment implements RuntimeEnvironment { private ConnectionHolder metadataConnection; + private Statement currentStatement; + @Override public void prepare() { @@ -84,6 +88,10 @@ public void setTargetConnection(ConnectionHolder targetConnection) { } public void close() throws Exception { + if (currentStatement != null) { + currentStatement.close(); + } + if (sourceConnection != null) { sourceConnection.close(); } @@ -96,4 +104,8 @@ public void close() throws Exception { metadataConnection.close(); } } + + public void setCurrentStatement(Statement statement) { + this.currentStatement = statement; + } } diff --git a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/BaseDataSinkExecutor.java b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/BaseDataSinkExecutor.java index c7d50512a..71c4de09f 100644 --- a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/BaseDataSinkExecutor.java +++ b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/BaseDataSinkExecutor.java @@ -47,7 +47,7 @@ public BaseDataSinkExecutor(Config config, LocalRuntimeEnvironment env) { this.env = env; } - protected void innerExecute(Map inputParameter) throws SQLException{ + protected void innerExecute(Map inputParameter) throws SQLException { executeDataSink(env, inputParameter); } @@ -71,9 +71,16 @@ private void executeDataSink(LocalRuntimeEnvironment env, Map inp } private void executeInsert(String sql, LocalRuntimeEnvironment env) throws SQLException { - Statement statement = env.getMetadataConnection().getConnection().createStatement(); - statement.execute(sql); - statement.close(); + + Statement statement = null; + try { + statement = env.getMetadataConnection().getConnection().createStatement(); + env.setCurrentStatement(statement); + statement.execute(sql); + } finally { + SqlUtils.closeStatement(statement); + env.setCurrentStatement(null); + } } private boolean checkTableExist(LocalRuntimeEnvironment env, String tableName) throws SQLException { @@ -90,7 +97,7 @@ private boolean checkTableExist(LocalRuntimeEnvironment env, String tableName) t return flag; } - private void createTable(LocalRuntimeEnvironment env, String createTableSql) throws SQLException{ + private void createTable(LocalRuntimeEnvironment env, String createTableSql) throws SQLException { Statement statement = env.getMetadataConnection().getConnection().createStatement(); statement.execute(createTableSql); statement.close(); diff --git a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/ErrorDataSinkExecutor.java b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/ErrorDataSinkExecutor.java index 967373364..de85e141f 100644 --- a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/ErrorDataSinkExecutor.java +++ b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-connector-jdbc/src/main/java/io/datavines/engine/local/connector/executor/ErrorDataSinkExecutor.java @@ -137,6 +137,7 @@ private void sinkErrorData() { try { sourceConnectionStatement = env.getSourceConnection().getConnection().createStatement(); + env.setCurrentStatement(sourceConnectionStatement); String srcConnectorType = config.getString(SRC_CONNECTOR_TYPE); ConnectorFactory connectorFactory = PluginLoader.getPluginLoader(ConnectorFactory.class).getOrCreatePlugin(srcConnectorType); @@ -172,6 +173,7 @@ private void sinkErrorData() { } errorDataPreparedStatement = errorDataStorageConnection.prepareStatement(insertStatement); + env.setCurrentStatement(errorDataPreparedStatement); for (int i=0; i { + const intl = useIntl(); + + const schema: IFormRender = { + name: 'reset-password', + layout: 'vertical', + meta: [ + { + label: intl.formatMessage({ id: 'reset_password_old' }), + name: 'oldPassword', + rules: [ + { + required: true, + message: intl.formatMessage({ id: 'common_required' }), + }, + ], + widget: , + }, + { + label: intl.formatMessage({ id: 'reset_password_new' }), + name: 'newPassword', + rules: [ + { + required: true, + message: intl.formatMessage({ id: 'common_required' }), + }, + ], + widget: , + }, + { + label: intl.formatMessage({ id: 'reset_password_new_confirm' }), + name: 'newPasswordConfirm', + rules: [ + { + required: true, + message: intl.formatMessage({ id: 'common_required' }), + }, + ], + widget: , + } + ], + }; + return ; +}; + +export const useResetPassword = (options: ModalProps) => { + const [form] = Form.useForm() as [FormInstance]; + const [loading, setLoading] = useState(false); + const loadingRef = useRef(loading); + loadingRef.current = loading; + const intl = useIntl(); + const userIdRef = useRef(); + const onOk = usePersistFn(() => { + form.validateFields().then(async (values) => { + try { + setLoading(true); + await $http.post('/user/resetPassword', { ...values, id: userIdRef.current }); + hide(); + } catch (error: any) { + } finally { + setLoading(false); + } + }).catch(() => {}); + }); + + const { + Render, hide, show, ...rest + } = useModal({ + title: intl.formatMessage({ id: 'common_reset_password' }), + ...(options || {}), + confirmLoading: loadingRef.current, + onOk, + }); + + return { + hide, + show1(data?: number | null) { + userIdRef.current = data; + show(data); + }, + Render: useImmutable(() => ()), + ...rest, + }; +}; diff --git a/datavines-ui/src/component/Menu/MenuAside/index.tsx b/datavines-ui/src/component/Menu/MenuAside/index.tsx index 5172c7039..50502dece 100644 --- a/datavines-ui/src/component/Menu/MenuAside/index.tsx +++ b/datavines-ui/src/component/Menu/MenuAside/index.tsx @@ -6,16 +6,16 @@ import { } from 'react-router-dom'; import useWatch from '@Editor/common/useWatch'; import logoPng from 'assets/images/logo-light.png'; -import EscapePng from 'assets/images/escape.svg'; import EhPng from 'assets/images/en.svg'; import ChPng from 'assets/images/ch.svg'; import './index.less'; -import { LogoutOutlined, PlusOutlined } from '@ant-design/icons'; +import { LogoutOutlined, PlusOutlined, EditOutlined } from '@ant-design/icons'; import { useIntl } from 'react-intl'; import { useSelector, useCommonActions, useWorkSpaceActions } from '@/store'; import shareData from '@/utils/shareData'; import { DV_LANGUAGE, DV_STORAGE_LOGIN, DV_WORKSPACE_ID } from '@/utils/constants'; import { useAddSpace } from '../../Header/WorkSpaceSwitch/useAddSpace'; +import { useResetPassword } from '../../Header/WorkSpaceSwitch/useResetPassword'; const Logo = memo(({ style }:any) => ); const Eh = memo(({ style, onClick }:any) => ); @@ -40,7 +40,9 @@ const MenuAside: React.FC = ({ menus, history }) => { const { workspaceId, spaceList } = useSelector((r) => r.workSpaceReducer); const { loginInfo } = useSelector((r) => r.userReducer); const intl = useIntl(); - const { Render: RenderSpace, show } = useAddSpace({}); + const { Render: RenderCreateSpace, show } = useAddSpace({}); + + const { Render: RenderResetPassword, show1 } = useResetPassword({}); const setActiveKeyRedirect = (redirect = false) => { const url = window.location.href; const match = menus.find((item) => { @@ -84,6 +86,11 @@ const MenuAside: React.FC = ({ menus, history }) => { const onShowSpace = (val: any) => { show(val); }; + + const onShowResetPassword = (val: any) => { + show1(val); + }; + const content = (
AD
@@ -128,18 +135,17 @@ const MenuAside: React.FC = ({ menus, history }) => { } } /> - {/* mysql - */} - {/* */}
- {/*
  • onShowResetPassword(loginInfo.id)} > - - 退出空间 -
  • */} + + {intl.formatMessage({ id: 'common_reset_password' })} +
  • = ({ menus, history }) => { /> ) } - {/* */} AD - + + ); }; diff --git a/datavines-ui/src/locale/en_US.ts b/datavines-ui/src/locale/en_US.ts index ac0be09b0..1882398e9 100755 --- a/datavines-ui/src/locale/en_US.ts +++ b/datavines-ui/src/locale/en_US.ts @@ -27,9 +27,13 @@ export default { common_fail: 'Fail', common_updater: 'Updater', common_back: 'Back', - common_Logout: 'Exit the system', + common_Logout: 'Exit', + common_reset_password: 'Reset Password', common_error_tips: 'User not logged in', common_update_time: 'Update Time', + reset_password_old: 'Old Password', + reset_password_new: 'New Password', + reset_password_new_confirm: 'Confirm Password', '/main/home': 'DataSource', '/main/warning': 'Warning', diff --git a/datavines-ui/src/locale/zh_CN.ts b/datavines-ui/src/locale/zh_CN.ts index 29c74572f..d5159efc5 100755 --- a/datavines-ui/src/locale/zh_CN.ts +++ b/datavines-ui/src/locale/zh_CN.ts @@ -27,9 +27,13 @@ export default { common_fail: '操作失败', common_updater: '更新人', common_back: '返回', - common_Logout: '退出系统', + common_Logout: '退出', + common_reset_password: '重置密码', common_error_tips: '用户未登录', common_update_time: '更新时间', + reset_password_old: '旧密码', + reset_password_new: '新密码', + reset_password_new_confirm: '密码确认', '/main/home': '数据源管理', '/main/warning': '告警管理', diff --git a/datavines-ui/src/view/Main/HomeDetail/JobExecutionLogs/index.tsx b/datavines-ui/src/view/Main/HomeDetail/JobExecutionLogs/index.tsx index c8998f706..d2b109fb3 100644 --- a/datavines-ui/src/view/Main/HomeDetail/JobExecutionLogs/index.tsx +++ b/datavines-ui/src/view/Main/HomeDetail/JobExecutionLogs/index.tsx @@ -65,7 +65,7 @@ const JobExecutionLogs = ({ datasourceId }: TJobExecutionLogs) => { res['startTime'] = startDay.format(format) console.log("start " + startDay.format(format)) } - if(endDay.isValid()){ + if (endDay.isValid()) { res['endTime'] = endDay.format(format) console.log("end " + endDay.format(format)) } @@ -88,63 +88,63 @@ const JobExecutionLogs = ({ datasourceId }: TJobExecutionLogs) => { title: intl.formatMessage({ id: 'jobs_task_schema_name' }), dataIndex: 'schemaName', key: 'schemaName', - width: 120, + width: 150, render: (text) => defaultRender(text, 300), }, { title: intl.formatMessage({ id: 'jobs_task_table_name' }), dataIndex: 'tableName', key: 'tableName', - width: 200, + width: 150, render: (text) => defaultRender(text, 300), }, { title: intl.formatMessage({ id: 'jobs_task_column_name' }), dataIndex: 'columnName', key: 'columnName', - width: 200, + width: 150, render: (text) => defaultRender(text, 300), }, { title: intl.formatMessage({ id: 'jobs_task_metric_type' }), dataIndex: 'metricType', key: 'metricType', - width: 220, + width: 150, render: (text) => defaultRender(text, 300), }, { title: intl.formatMessage({ id: 'jobs_task_type' }), dataIndex: 'jobType', key: 'jobType', - width: 180, + width: 150, render: (text: string) =>
    {text}
    , }, { title: intl.formatMessage({ id: 'jobs_task_status' }), dataIndex: 'status', key: 'status', - width: 160, + width: 150, render: (text: string) =>
    {text}
    , }, { title: intl.formatMessage({ id: 'jobs_task_start_time' }), dataIndex: 'startTime', key: 'startTime', - width: 160, + width: 200, render: (text: string) =>
    {text || '--'}
    , }, { title: intl.formatMessage({ id: 'jobs_task_end_time' }), dataIndex: 'endTime', key: 'endTime', - width: 160, + width: 200, render: (text: string) =>
    {text || '--'}
    , }, { title: intl.formatMessage({ id: 'jobs_update_time' }), dataIndex: 'updateTime', key: 'updateTime', - width: 160, + width: 200, render: (text: string) =>
    {text || '--'}
    }, { @@ -202,7 +202,7 @@ const JobExecutionLogs = ({ datasourceId }: TJobExecutionLogs) => { return (
    -
    +