|
|
@ -114,7 +114,8 @@ BI.config("dec.connection.provider.datebase", function (provider) { |
|
|
|
版本和平台保持一致 |
|
|
|
版本和平台保持一致 |
|
|
|
|
|
|
|
|
|
|
|
## 接口文档: |
|
|
|
## 接口文档: |
|
|
|
### 增加数据连接类型 |
|
|
|
### A 增加数据连接类型 |
|
|
|
|
|
|
|
#### 1. 增加数据连接类型 |
|
|
|
使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.types`,值为连接的名称 |
|
|
|
使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.types`,值为连接的名称 |
|
|
|
|
|
|
|
|
|
|
|
例如增加`Redis`的连接: |
|
|
|
例如增加`Redis`的连接: |
|
|
@ -128,25 +129,25 @@ BI.config(ConstantPluginTyps, (datas: string[]) => [...datas, { |
|
|
|
}]); |
|
|
|
}]); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
### 数据连接填写页面 |
|
|
|
#### 2. 数据连接填写页面 |
|
|
|
edit属性值为填写组件shortcut的名称 |
|
|
|
edit属性值为填写组件shortcut的名称 |
|
|
|
|
|
|
|
|
|
|
|
### 数据连接展示页面 |
|
|
|
#### 3. 数据连接展示页面 |
|
|
|
show属性值为组件shortcut的名称 |
|
|
|
show属性值为组件shortcut的名称 |
|
|
|
|
|
|
|
|
|
|
|
### 示例 |
|
|
|
#### 4. 示例 |
|
|
|
``` |
|
|
|
```js |
|
|
|
const DataBaseConfigProvider = 'dec.connection.provider.datebase'; |
|
|
|
const DataBaseConfigProvider = 'dec.connection.provider.datebase'; |
|
|
|
|
|
|
|
|
|
|
|
const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; |
|
|
|
const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; |
|
|
|
const RedisEditName = 'dec.dcm.connection.plugin.redis.edit'; |
|
|
|
const RedisEditName = 'dec.dcm.connection.plugin.redis.edit'; |
|
|
|
BI.config(DataBaseConfigProvider, function (provider) { |
|
|
|
BI.config(DataBaseConfigProvider, function (provider) { |
|
|
|
provider.registerDatabaseType({ |
|
|
|
provider.registerDatabaseType([{ |
|
|
|
text: "Redis", |
|
|
|
text: "Redis", |
|
|
|
databaseType: "Redis", |
|
|
|
databaseType: "Redis", |
|
|
|
edit: "dec.dcm.connection.plugin.demo.edit", |
|
|
|
edit: "dec.dcm.connection.plugin.demo.edit", |
|
|
|
show: "dec.dcm.connection.plugin.demo.show", |
|
|
|
show: "dec.dcm.connection.plugin.demo.show", |
|
|
|
}); |
|
|
|
}]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const RedisShow = BI.inherit(BI.Widget, { |
|
|
|
const RedisShow = BI.inherit(BI.Widget, { |
|
|
@ -214,7 +215,22 @@ const RedisShow = BI.inherit(BI.Widget, { |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
|
|
|
|
this.fireEvent('EVENT_HIDE_TEST_CONNECTION', true);//可以触发隐藏测试按钮 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//可以触发组件的数据save方法,不需要则可不写 |
|
|
|
|
|
|
|
async save() { |
|
|
|
|
|
|
|
let result = 0; |
|
|
|
|
|
|
|
await Promise.resolve().then(() => {result = 1}); |
|
|
|
|
|
|
|
//要求返回是否成功的boolean变量 |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//可以阻止触发平台保存数据的方法 |
|
|
|
|
|
|
|
preventParentSave() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.shortcut(RedisShowName, RedisShow); |
|
|
|
BI.shortcut(RedisShowName, RedisShow); |
|
|
@ -313,3 +329,38 @@ const RedisEdit = BI.inherit(BI.Widget, { |
|
|
|
BI.shortcut(RedisEditName, RedisEdit); |
|
|
|
BI.shortcut(RedisEditName, RedisEdit); |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
### B 添加数据连接实例 |
|
|
|
|
|
|
|
#### 1. 增加数据连接 |
|
|
|
|
|
|
|
```js |
|
|
|
|
|
|
|
BI.config('dec.constant.connection.list', function (value) { |
|
|
|
|
|
|
|
const result = [{ |
|
|
|
|
|
|
|
"connectionType": "Redis",//和databaseType一致 |
|
|
|
|
|
|
|
"connectionName": "CHART",//类似于id,唯一性 |
|
|
|
|
|
|
|
"pluginConnection": true,//表示是外来添加的插件 |
|
|
|
|
|
|
|
"connectionData": { |
|
|
|
|
|
|
|
//表单保存数据 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"connectionId": null, |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
return value.concat(result); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
### C 添加数据连接类型分类 |
|
|
|
|
|
|
|
#### 1. 添加分类DEMO |
|
|
|
|
|
|
|
```js |
|
|
|
|
|
|
|
BI.config('dec.constant.database.filter.type', (value) => { |
|
|
|
|
|
|
|
value.push({text:"DEMO", value:"DEMO_VALUE"});return value; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
#### 2. 添加数据连接类型进DEMO |
|
|
|
|
|
|
|
```js |
|
|
|
|
|
|
|
BI.config('dec.connection.provider.datebase', function (provider) { |
|
|
|
|
|
|
|
text: "Redis",//必填 |
|
|
|
|
|
|
|
databaseType: "Redis",//唯一值 |
|
|
|
|
|
|
|
marker: 'DEMO_VALUE',//marker对标dec.constant.database.filter.type常量item的value,用于过滤 |
|
|
|
|
|
|
|
iconUrl:'https://work.fineres.com/secure/projectavatar?pid=10301&avatarId=10011', |
|
|
|
|
|
|
|
driver: 'com.amazon.redshift.jdbc41.Driver', |
|
|
|
|
|
|
|
drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], |
|
|
|
|
|
|
|
url: 'jdbc:redshift://endpoint:port/database', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|