You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ti...@apache.org on 2022/12/19 02:28:16 UTC
[dolphinscheduler] branch dev updated: feat: add AZURESQL datasource (#13200)
This is an automated email from the ASF dual-hosted git repository.
tianqiyan pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 4b980ad6fa feat: add AZURESQL datasource (#13200)
4b980ad6fa is described below
commit 4b980ad6fa7717bc4d8a282acbf232ed517879c0
Author: labbomb <73...@qq.com>
AuthorDate: Mon Dec 19 10:28:11 2022 +0800
feat: add AZURESQL datasource (#13200)
* feat: add AZURESQL datasource
* fix form validate bug
* feat: Adjusted the password display form, added AZURESQL type
* feat: Order of adjustment
Co-authored-by: devosend <de...@gmail.com>
---
.../src/locales/en_US/datasource.ts | 13 +-
.../src/locales/zh_CN/datasource.ts | 13 +-
.../src/service/modules/data-source/types.ts | 5 +
.../src/views/datasource/list/detail.tsx | 154 +++++++++++++++++++++
.../src/views/datasource/list/use-form.ts | 72 +++++++++-
.../task/components/node/fields/use-datasource.ts | 7 +-
6 files changed, 257 insertions(+), 7 deletions(-)
diff --git a/dolphinscheduler-ui/src/locales/en_US/datasource.ts b/dolphinscheduler-ui/src/locales/en_US/datasource.ts
index 6d205d7434..6c1e48eee8 100644
--- a/dolphinscheduler-ui/src/locales/en_US/datasource.ts
+++ b/dolphinscheduler-ui/src/locales/en_US/datasource.ts
@@ -72,7 +72,18 @@ export default {
user_password_tips: 'Please enter your password',
aws_region: 'Aws Region',
aws_region_tips: 'Please enter AwsRegion',
+ validation: 'Validation',
+ mode_tips: 'Please select a mode',
jdbc_format_tips: 'jdbc connection parameters is not a correct JSON format',
datasource_test_flag_tips: 'Please select a data source definition',
- datasource_bind_test_id_tips: 'Please bind the test data source'
+ datasource_bind_test_id_tips: 'Please bind the test data source',
+ database_username: 'Database Username',
+ database_password: 'Database Password',
+ Azure_AD_username: 'Azure AD username',
+ Azure_AD_password: 'Azure AD password',
+ MSIClientId: 'MSI ClientId',
+ clientId: 'ClientId',
+ clientSecret: 'ClientSecret',
+ OAuth_token_endpoint: 'OAuth 2.0 token endpoint',
+ endpoint_tips: 'Please enter OAuth Token',
}
diff --git a/dolphinscheduler-ui/src/locales/zh_CN/datasource.ts b/dolphinscheduler-ui/src/locales/zh_CN/datasource.ts
index 8ddff9d8ff..48c29992e3 100644
--- a/dolphinscheduler-ui/src/locales/zh_CN/datasource.ts
+++ b/dolphinscheduler-ui/src/locales/zh_CN/datasource.ts
@@ -69,7 +69,18 @@ export default {
user_password_tips: '请输入密码',
aws_region: 'AwsRegion',
aws_region_tips: '请输入AwsRegion',
+ validation: '验证',
+ mode_tips: '请选择验证模式',
jdbc_format_tips: 'jdbc连接参数不是一个正确的JSON格式',
datasource_test_flag_tips: '请选择数据源定义',
- datasource_bind_test_id_tips: '请绑定测试数据源'
+ datasource_bind_test_id_tips: '请绑定测试数据源',
+ database_username: '数据库用户名',
+ database_password: '数据库密码',
+ Azure_AD_username: 'Azure AD用户名',
+ Azure_AD_password: 'Azure AD密码',
+ MSIClientId: 'MSI ClientId',
+ clientId: 'ClientId',
+ clientSecret: 'ClientSecret',
+ OAuth_token_endpoint: 'OAuth 2.0 token endpoint',
+ endpoint_tips: '请输入OAuth'
}
diff --git a/dolphinscheduler-ui/src/service/modules/data-source/types.ts b/dolphinscheduler-ui/src/service/modules/data-source/types.ts
index e61ba64ab3..1ad7fb7ad1 100644
--- a/dolphinscheduler-ui/src/service/modules/data-source/types.ts
+++ b/dolphinscheduler-ui/src/service/modules/data-source/types.ts
@@ -28,6 +28,7 @@ type IDataBase =
| 'REDSHIFT'
| 'ATHENA'
| 'TRINO'
+ | 'AZURESQL'
| 'STARROCKS'
type IDataBaseLabel =
@@ -43,6 +44,7 @@ type IDataBaseLabel =
| 'REDSHIFT'
| 'ATHENA'
| 'TRINO'
+| 'AZURESQL'
| 'STARROCKS'
interface IDataSource {
@@ -57,6 +59,7 @@ interface IDataSource {
javaSecurityKrb5Conf?: string
loginUserKeytabUsername?: string
loginUserKeytabPath?: string
+ mode?: string
userName?: string
password?: string
awsRegion?: string
@@ -65,6 +68,8 @@ interface IDataSource {
other?: object
testFlag?: number
bindTestId?: number
+ endpoint?: string
+ MSIClientId?: string
}
interface ListReq {
diff --git a/dolphinscheduler-ui/src/views/datasource/list/detail.tsx b/dolphinscheduler-ui/src/views/datasource/list/detail.tsx
index a67d2a457a..bb46683265 100644
--- a/dolphinscheduler-ui/src/views/datasource/list/detail.tsx
+++ b/dolphinscheduler-ui/src/views/datasource/list/detail.tsx
@@ -160,6 +160,8 @@ const DetailModal = defineComponent({
showAwsRegion,
showConnectType,
showPrincipal,
+ showMode,
+ modeOptions,
loading,
saving,
testing,
@@ -279,6 +281,156 @@ const DetailModal = defineComponent({
placeholder={t('datasource.krb5_conf_tips')}
/>
</NFormItem>
+ {/* 验证条件选择 */}
+ <NFormItem
+ v-show={showMode}
+ label={t('datasource.validation')}
+ path='mode'
+ show-require-mark
+ >
+ <NSelect
+ v-model={[detailForm.mode, 'value']}
+ options={modeOptions}
+ ></NSelect>
+ </NFormItem>
+ {/* SqlPassword */}
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'SqlPassword'}
+ label={t('datasource.database_username')}
+ path='userName'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.userName, 'value']}
+ type='text'
+ placeholder={t('datasource.database_username')}
+ />
+ </NFormItem>
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'SqlPassword'}
+ label={t('datasource.database_password')}
+ path='password'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.password, 'value']}
+ type='password'
+ placeholder={t('datasource.database_password')}
+ />
+ </NFormItem>
+ {/* ActiveDirectoryPassword */}
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'ActiveDirectoryPassword'}
+ label={t('datasource.Azure_AD_username')}
+ path='userName'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.userName, 'value']}
+ type='text'
+ placeholder={t('datasource.Azure_AD_username')}
+ />
+ </NFormItem>
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'ActiveDirectoryPassword'}
+ label={t('datasource.Azure_AD_password')}
+ path='password'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.password, 'value']}
+ type='password'
+ placeholder={t('datasource.Azure_AD_password')}
+ />
+ </NFormItem>
+ {/* ActiveDirectoryMSI */}
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'ActiveDirectoryMSI'}
+ label={t('datasource.MSIClientId')}
+ path='MSIClientId'
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.MSIClientId, 'value']}
+ type='password'
+ placeholder={t('datasource.MSIClientId')}
+ />
+ </NFormItem>
+ {/* ActiveDirectoryServicePrincipal */}
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'ActiveDirectoryServicePrincipal'}
+ label={t('datasource.clientId')}
+ path='userName'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.userName, 'value']}
+ type='text'
+ placeholder={t('datasource.clientId')}
+ />
+ </NFormItem>
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'ActiveDirectoryServicePrincipal'}
+ label={t('datasource.clientSecret')}
+ path='password'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.password, 'value']}
+ type='password'
+ placeholder={t('datasource.clientSecret')}
+ />
+ </NFormItem>
+ {/* accessToken */}
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'accessToken'}
+ label={t('datasource.clientId')}
+ path='userName'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.userName, 'value']}
+ type='text'
+ placeholder={t('datasource.clientId')}
+ />
+ </NFormItem>
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'accessToken'}
+ label={t('datasource.clientSecret')}
+ path='password'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.password, 'value']}
+ type='password'
+ placeholder={t('datasource.clientSecret')}
+ />
+ </NFormItem>
+ <NFormItem
+ v-show={showMode && detailForm.mode === 'accessToken'}
+ label={t('datasource.OAuth_token_endpoint')}
+ path='endpoint'
+ show-require-mark
+ >
+ <NInput
+ allowInput={this.trim}
+ v-model={[detailForm.endpoint, 'value']}
+ type='text'
+ placeholder={t('datasource.OAuth_token_endpoint')}
+ />
+ </NFormItem>
+
+
+
+
<NFormItem
v-show={showPrincipal}
label='keytab.username'
@@ -304,6 +456,7 @@ const DetailModal = defineComponent({
/>
</NFormItem>
<NFormItem
+ v-show={!showMode}
label={t('datasource.user_name')}
path='userName'
show-require-mark
@@ -318,6 +471,7 @@ const DetailModal = defineComponent({
/>
</NFormItem>
<NFormItem
+ v-show={!showMode}
label={t('datasource.user_password')}
path='password'
>
diff --git a/dolphinscheduler-ui/src/views/datasource/list/use-form.ts b/dolphinscheduler-ui/src/views/datasource/list/use-form.ts
index 2542fee7cc..371129ea04 100644
--- a/dolphinscheduler-ui/src/views/datasource/list/use-form.ts
+++ b/dolphinscheduler-ui/src/views/datasource/list/use-form.ts
@@ -45,13 +45,16 @@ export function useForm(id?: number) {
javaSecurityKrb5Conf: '',
loginUserKeytabUsername: '',
loginUserKeytabPath: '',
+ mode: '',
userName: '',
password: '',
database: '',
connectType: '',
other: '',
testFlag: -1,
- bindTestId: undefined
+ bindTestId: undefined,
+ endpoint: '',
+ MSIClientId: ''
} as IDataSourceDetail
const state = reactive({
@@ -63,6 +66,7 @@ export function useForm(id?: number) {
showAwsRegion: false,
showConnectType: false,
showPrincipal: false,
+ showMode: false,
bindTestDataSourceExample: [] as { label: string; value: number }[],
rules: {
name: {
@@ -97,10 +101,21 @@ export function useForm(id?: number) {
}
}
},
+ mode: {
+ trigger: ['blur'],
+ validator() {
+ if (!state.detailForm.mode && state.showMode) {
+ return new Error(t('datasource.mode_tips'))
+ }
+ }
+ },
userName: {
trigger: ['input'],
validator() {
- if (!state.detailForm.userName) {
+ if (
+ !state.detailForm.userName &&
+ state.detailForm.type !== 'AZURESQL'
+ ) {
return new Error(t('datasource.user_name_tips'))
}
}
@@ -152,8 +167,50 @@ export function useForm(id?: number) {
return new Error(t('datasource.datasource_bind_test_id_tips'))
}
}
- }
- } as FormRules
+ },
+ endpoint: {
+ trigger: ['input'],
+ validator() {
+ if (
+ !state.detailForm.endpoint &&
+ state.detailForm.type === 'AZURESQL' &&
+ state.detailForm.mode === 'accessToken'
+ ) {
+ return new Error(t('datasource.endpoint_tips'))
+ }
+ }
+ },
+ // databaseUserName: {
+ // trigger: ['input'],
+ // validator() {
+ // if (!state.detailForm.userName) {
+ // return new Error(t('datasource.user_name_tips'))
+ // }
+ // }
+ // },
+ } as FormRules,
+ modeOptions: [
+ {
+ label: "SqlPassword",
+ value: 'SqlPassword',
+ },
+ {
+ label: "ActiveDirectoryPassword",
+ value: 'ActiveDirectoryPassword',
+ },
+ {
+ label: "ActiveDirectoryMSI",
+ value: 'ActiveDirectoryMSI',
+ },
+ {
+ label: "ActiveDirectoryServicePrincipal",
+ value: 'ActiveDirectoryServicePrincipal',
+ },
+ {
+ label: "accessToken",
+ value: 'accessToken',
+ },
+ ]
})
const changeType = async (type: IDataBase, options: IDataBaseOption) => {
@@ -165,6 +222,7 @@ export function useForm(id?: number) {
state.showHost = type !== 'ATHENA'
state.showPort = type !== 'ATHENA'
state.showAwsRegion = type === 'ATHENA'
+ state.showMode = type === 'AZURESQL'
if (type === 'ORACLE' && !id) {
state.detailForm.connectType = 'ORACLE_SERVICE_NAME'
@@ -226,6 +284,7 @@ export function useForm(id?: number) {
const getFieldsValue = () => state.detailForm
+
return {
state,
changeType,
@@ -299,6 +358,11 @@ export const datasourceType: IDataBaseOptionKeys = {
label: 'TRINO',
defaultPort: 8080
},
+ AZURESQL: {
+ value: 'AZURESQL',
+ label: 'AZURESQL',
+ defaultPort: 1433
+ },
STARROCKS: {
value: 'STARROCKS',
label: 'STARROCKS',
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts
index e927e3629e..30cddc65cd 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts
+++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts
@@ -102,7 +102,12 @@ export function useDatasource(
id: 13,
code: 'STARROCKS',
disabled: false
- }
+ },
+ {
+ id: 14,
+ code: 'AZURESQL',
+ disabled: false
+ },
]
const getDatasourceTypes = async () => {