帆软决策平台数据连接界面库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2.2 KiB

database-connection 数据连接设置页面

start finui

KERNEL-493

开始

下载代码

git clone ssh://git@cloud.finedevelop.com:7999/~alan/database-connection.git

安装依赖

yarn

开始开发

yarn start

接口文档

增加数据连接类型

使用BI.config,ConstantName名称为dec.constant.database.conf.connect.list,值为连接的名称

例如增加Redis的连接:

BI.config(ConstantName, (datas: string[]) => [...datas, 'Redis']);

数据连接填写页面

ConstantName名称为dec.constant.database.conf.connect.form.${name.toLowerCase()}.edit,值为组件shortcut的名称

例如配置Redis的连接填写页面:

const className = 'fr.plugin.redis.preview';
const RedisPreview = BI.inherit(BI.Widget, {
  render() {
    return {
      type: 'bi.left',
      cls: 'title',
      items: [{
        type: 'bi.editor',
        watermark:'这里是编辑页',
      }],
    };
  },
});
BI.shortcut(className, RedisPreview);
BI.constant('dec.constant.database.conf.connect.form.redis.edit', className);

数据连接预览页面

ConstantName名称为dec.constant.database.conf.connect.form.${name.toLowerCase()}.show,值为组件shortcut的名称

例如配置Redis的连接预览页面:

const className = 'fr.plugin.redis.edit';
const RedisPreview = BI.inherit(BI.Widget, {
  render() {
    return {
      type: 'bi.left',
      cls: 'title',
      items: [{
        type: 'bi.label',
        text:'这里是预览页',
      }],
    };
  },
});
BI.shortcut(className, RedisPreview);
BI.constant('dec.constant.database.conf.connect.form.redis.edit', className);

插件配置表单值传递

ConstantName名称为dec.constant.database.conf.connect.form.${name.toLowerCase()}.value,值为插件数据结构

例如:

const ConstantName = 'dec.constant.database.conf.connect.form.redis.value';
const form = {
  url:'192.168.1.22',
  port: 6379,
  password: '123456'
};
BI.config(ConstantName, (data: object) => form);