Browse Source

feat: DEC-9068 测试连接的时候返回并绑定模式

qufenxi
alan 5 years ago
parent
commit
bcfd2132e2
  1. 2
      src/modules/crud/crud.typings.d.ts
  2. 28
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  3. 3
      src/modules/pages/maintain/forms/form.ts

2
src/modules/crud/crud.typings.d.ts vendored

@ -193,7 +193,7 @@ export interface ConnectionPlugin {
}
export interface TestRequest {
data?: [];
data?: string[];
errorCode?: string;
errorMsg?: string;
}

28
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;

3
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);

Loading…
Cancel
Save