|
|
|
import {WidgetType, Vertical, Left, Label, ListView} from '@ui/index';
|
|
|
|
import Model from './right.model';
|
|
|
|
import {info} from '@shared/crud/crud.request';
|
|
|
|
import RightCard from './right_card';
|
|
|
|
import {InfoType} from './right.typings';
|
|
|
|
import {LinkType} from '@ui/type';
|
|
|
|
import pluginListConstant from '../../app.constant';
|
|
|
|
|
|
|
|
const className = 'fr.component.linkStatus.right';
|
|
|
|
let Title: any = null;
|
|
|
|
let Group: any = null;
|
|
|
|
|
|
|
|
const Widget: WidgetType = {
|
|
|
|
_store() {
|
|
|
|
return BI.Models.getModel(Model);
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
statusSelected(title: string) {
|
|
|
|
const link = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionName === title);
|
|
|
|
const plugins: string[] = BI.Constants.getConstant(pluginListConstant);
|
|
|
|
const isPlugin = link.text && BI.some(plugins, (index: number, item: string) => item === link.text);
|
|
|
|
const Pool = isPlugin ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${link.text.toLowerCase()}.pool`) : RightCard;
|
|
|
|
info(name, (res: InfoType) => {
|
|
|
|
Group.populate(BI.createItems([{
|
|
|
|
type: Pool,
|
|
|
|
...res,
|
|
|
|
}]));
|
|
|
|
});
|
|
|
|
Title.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return {
|
|
|
|
type: Vertical,
|
|
|
|
cls: 'dcm-link-form',
|
|
|
|
minWidth: 400,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: Left,
|
|
|
|
cls: 'right-status-title bi-border-bottom',
|
|
|
|
height: 40,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: Label,
|
|
|
|
cls: 'bi-font-bold',
|
|
|
|
textHeight: 40,
|
|
|
|
lgap: 10,
|
|
|
|
text: BI.i18nText('Dec-Dcm_Data_Connections'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
ref(ref: any) {
|
|
|
|
Title = ref;
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
type: ListView,
|
|
|
|
cls: 'right-status-body',
|
|
|
|
vgap: 10,
|
|
|
|
hgap: 10,
|
|
|
|
ref(ref: any) {
|
|
|
|
Group = ref;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
|
|
|
|
export default className;
|