|
|
|
import { shortcut } from '@core/core';
|
|
|
|
import { Connection } from 'src/modules/crud/crud.typings';
|
|
|
|
import { getPluginWidgetEdit } from '../../../../app.service';
|
|
|
|
@shortcut()
|
|
|
|
export class FormPlugin extends BI.Widget {
|
|
|
|
static xtype = 'dec.dcm.maintain_plugin';
|
|
|
|
props = {
|
|
|
|
formData: {} as Connection,
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin: any;
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { connectionType } = this.options.formData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: getPluginWidgetEdit(connectionType),
|
|
|
|
ref: (_ref: any) => {
|
|
|
|
this.plugin = _ref;
|
|
|
|
},
|
|
|
|
value: this.options.formData.connectionData,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public getSubmitValue(): Connection {
|
|
|
|
const { connectionType, connectionId, connectionName } = this.options.formData;
|
|
|
|
|
|
|
|
return {
|
|
|
|
connectionId,
|
|
|
|
connectionType,
|
|
|
|
connectionName,
|
|
|
|
connectionData: this.plugin.getValue(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|