You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by xu...@apache.org on 2022/12/15 11:55:58 UTC
[dolphinscheduler] branch labbomb created (now cc9ce950f3)
This is an automated email from the ASF dual-hosted git repository.
xujunjie pushed a change to branch labbomb
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
at cc9ce950f3 feat: add AZURESQL datasource
This branch includes the following new commits:
new cc9ce950f3 feat: add AZURESQL datasource
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[dolphinscheduler] 01/01: feat: add AZURESQL datasource
Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xujunjie pushed a commit to branch labbomb
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
commit cc9ce950f3580843c118dfa44996f1764e54fb0c
Author: labbomb <73...@qq.com>
AuthorDate: Thu Dec 15 19:54:46 2022 +0800
feat: add AZURESQL datasource
---
.../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 | 63 ++++++++-
5 files changed, 243 insertions(+), 5 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 3e5f06dc52..60dce81113 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'
type IDataBaseLabel =
| 'MYSQL'
@@ -42,6 +43,7 @@ type IDataBaseLabel =
| 'REDSHIFT'
| 'ATHENA'
| 'TRINO'
+| 'AZURESQL'
interface IDataSource {
id?: number
@@ -55,6 +57,7 @@ interface IDataSource {
javaSecurityKrb5Conf?: string
loginUserKeytabUsername?: string
loginUserKeytabPath?: string
+ mode?: string
userName?: string
password?: string
awsRegion?: string
@@ -63,6 +66,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..aa53074ec8 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='text'
+ 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='text'
+ 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='text'
+ 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='text'
+ 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='text'
+ 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 d2e67d0096..caeed45b06 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,6 +101,14 @@ 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() {
@@ -152,8 +164,46 @@ 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) {
+ 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 +215,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 +277,7 @@ export function useForm(id?: number) {
const getFieldsValue = () => state.detailForm
+
return {
state,
changeType,
@@ -298,6 +350,11 @@ export const datasourceType: IDataBaseOptionKeys = {
value: 'TRINO',
label: 'TRINO',
defaultPort: 8080
+ },
+ AZURESQL: {
+ value: 'AZURESQL',
+ label: 'AZURESQL',
+ defaultPort: 1433
}
}