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

[Fix] fix when DataSource type is doris the password is not required (#2098)

* fix datasource type doris bug * fix pom
parent be80e7ac
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky</artifactId> <artifactId>dinky</artifactId>
<version>0.8.0</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>dinky-web-flink</artifactId> <artifactId>dinky-web-flink</artifactId>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import React from 'react'; import React, {useState} from 'react';
import {FormInstance} from 'antd/es/form/hooks/useForm'; import {FormInstance} from 'antd/es/form/hooks/useForm';
import {Values} from 'async-validator'; import {Values} from 'async-validator';
import {ProForm, ProFormGroup, ProFormSelect, ProFormText} from '@ant-design/pro-components'; import {ProForm, ProFormGroup, ProFormSelect, ProFormText} from '@ant-design/pro-components';
...@@ -44,11 +44,14 @@ const CodeEditProps = { ...@@ -44,11 +44,14 @@ const CodeEditProps = {
const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
const {values, form, flinkTemplateChange, flinkConfigChange} = props; const {values, form, flinkTemplateChange, flinkConfigChange} = props;
const [excludeFormItem, setExcludeFormItem] = React.useState<boolean>(false); const [excludeFormItem, setExcludeFormItem] = useState<boolean>(false);
const [dbType, setDbType] = useState<string>(values.type ?? 'MySQL');
const handleTypeChange = (type: string) => {
if (type === 'Hive' || type === 'Presto') { const handleTypeChange = (value: any) => {
if (value.type) setDbType(value.type);
if (value.type === 'Hive' || value.type === 'Presto') {
setExcludeFormItem(true); setExcludeFormItem(true);
} else { } else {
setExcludeFormItem(false); setExcludeFormItem(false);
...@@ -94,7 +97,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -94,7 +97,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
name="password" name="password"
width={'sm'} width={'sm'}
label={l('rc.ds.password')} label={l('rc.ds.password')}
rules={[{required: true, message: l('rc.ds.passwordPlaceholder')}]} rules={[{required: dbType !== 'Doris', message: l('rc.ds.passwordPlaceholder')}]}
placeholder={l('rc.ds.passwordPlaceholder')} placeholder={l('rc.ds.passwordPlaceholder')}
/> />
<ProFormText <ProFormText
...@@ -147,7 +150,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => { ...@@ -147,7 +150,7 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
<ProForm <ProForm
initialValues={values} initialValues={values}
form={form} form={form}
onValuesChange={(changedValues) => handleTypeChange(changedValues.type)} onValuesChange={(changedValues, values) => handleTypeChange(values)}
submitter={false} submitter={false}
> >
{renderDataSourceForm()} {renderDataSourceForm()}
......
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