From bcfd2132e224ed460c71073db6e3dc3103086dea Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 22 Aug 2019 16:32:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20DEC-9068=20=E6=B5=8B=E8=AF=95=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=9A=84=E6=97=B6=E5=80=99=E8=BF=94=E5=9B=9E=E5=B9=B6?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.typings.d.ts | 2 +- .../maintain/forms/components/form.jdbc.ts | 28 +++++++++++++++++-- src/modules/pages/maintain/forms/form.ts | 3 ++ 3 files changed, 30 insertions(+), 3 deletions(-) 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);