import {WidgetType, Vertical, Left, Label} 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: 'database-right', items: [ { type: Left, height: 40, cls: 'right-status-title', items: [ { type: Label, text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], ref(ref: any) { Title = ref; }, }, { type: Vertical, cls: 'right-status-body', ref(ref: any) { Group = ref; }, }, ], }; }, mounted() { }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className;