diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 2f21b0c..fef47b3 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -193,7 +193,7 @@ export interface ConnectionPlugin { } export interface TestRequest { - data?: []; + data?: string[]; errorCode?: string; errorMsg?: string; } diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 1e46471..d077e3c 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -17,6 +17,8 @@ export class FormJdbc extends BI.Widget { oldPassword = ''; allDatabaseTypes = getAllDatabaseTypes(); + private schemas = [] as string[]; + testStatus: any; advancedSet: any; formUser: any; @@ -298,14 +300,33 @@ export class FormJdbc extends BI.Widget { invisible: !databaseType.hasSchema, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), forms: [{ - type: TextEditor, + type: SingleSelectInsertCombo, width: 300, - allowBlank: true, value: schema, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), ref: (_ref: any) => { this.form.schema = _ref; }, + itemsCreator: (options: { + keywords?: string[], + selectedValues: string[], + times: number, + type: number, + }, callback: Function) => { + let schemas = this.schemas; + if (options.selectedValues && options.selectedValues.length > 0) { + schemas = schemas.filter(item => item !== options.selectedValues[0]); + } + callback({ + items: schemas.map(item => { + return { + text: item, + value: item, + }; + }), + hasNext: false, + }); + }, }], }, { @@ -598,6 +619,9 @@ export class FormJdbc extends BI.Widget { this.form.url.setValue(url.replace('hostname', host).replace(':port', port ? `:${port}` : '')); } + public setSchemas(schemas: string[]) { + this.schemas = schemas; + } public getSubmitValue():Connection { const connectionData = this.options.formData.connectionData as ConnectionJDBC; diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 2f7323b..73d6ed3 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -46,6 +46,9 @@ export class MaintainForm extends BI.Widget { this.testStatus.setFail(re.errorMsg); } else if (re.data) { this.testStatus.setSuccess(); + if (re.data.length > 0) { + this.form.setSchemas && this.form.setSchemas(re.data); + } setTimeout(() => { BI.Maskers.remove(id); }, 1000 * 2);