Browse Source

refactor: 删掉之前的旧代码

master^2
alan 5 years ago
parent
commit
bff9066784
  1. 5
      .eslintignore
  2. 289
      .eslintrc.js
  3. 7
      .gitattributes
  4. 141
      README.md
  5. 60
      i18n/zh_cn.properties
  6. 38
      package.json
  7. 373
      private/constants.ts
  8. 63
      private/i18n.ts
  9. 4
      src/app/app.constant.ts
  10. 39
      src/app/app.model.ts
  11. 55
      src/app/app.ts
  12. 4
      src/app/connection/left/item/left_item.less
  13. 77
      src/app/connection/left/item/left_item.ts
  14. 43
      src/app/connection/left/item/left_item_delete.ts
  15. 26
      src/app/connection/left/item/left_item_icon.ts
  16. 39
      src/app/connection/left/left.ts
  17. 50
      src/app/connection/link_set.mixin.ts
  18. 154
      src/app/connection/link_set.model.ts
  19. 26
      src/app/connection/link_set.service.ts
  20. 58
      src/app/connection/link_set.ts
  21. 6
      src/app/connection/more/item/more_link_item.less
  22. 68
      src/app/connection/more/item/more_link_item.ts
  23. 6
      src/app/connection/more/item/more_link_litem.model.ts
  24. 16
      src/app/connection/more/more_link.model.ts
  25. 50
      src/app/connection/more/more_link.service.ts
  26. 52
      src/app/connection/more/more_link.ts
  27. 30
      src/app/connection/right/nothing.ts
  28. 33
      src/app/connection/right/right.ts
  29. 25
      src/app/connection/right/right.typing.d.ts
  30. 6
      src/app/connection/right/right_detail/right_detail.model.ts
  31. 74
      src/app/connection/right/right_detail/right_detail.ts
  32. 20
      src/app/connection/right/right_edit/right_edit.model.ts
  33. 24
      src/app/connection/right/right_edit/right_edit.service.ts
  34. 373
      src/app/connection/right/right_edit/right_edit.ts
  35. 226
      src/app/connection/right/right_edit/right_edit_jndi.ts
  36. 325
      src/app/connection/right/right_edit/right_edit_mysql.ts
  37. 20
      src/app/connection/right/right_show/right_show.model.ts
  38. 72
      src/app/connection/right/right_show/right_show.ts
  39. 203
      src/app/connection/right/right_show/right_show_jndi.ts
  40. 20
      src/app/connection/right/right_title/right_title.model.ts
  41. 66
      src/app/connection/right/right_title/right_title.ts
  42. 23
      src/app/connection/select/select.service.ts
  43. 77
      src/app/connection/select/select.ts
  44. 17
      src/app/status/left/left.model.ts
  45. 44
      src/app/status/left/left.ts
  46. 39
      src/app/status/left/left_item.ts
  47. 9
      src/app/status/link_status.model.ts
  48. 63
      src/app/status/link_status.ts
  49. 14
      src/app/status/right/right.model.ts
  50. 68
      src/app/status/right/right.ts
  51. 6
      src/app/status/right/right.typings.d.ts
  52. 9
      src/app/status/right/right_card.less
  53. 91
      src/app/status/right/right_card.ts
  54. 8
      src/app/title/title.less
  55. 11
      src/app/title/title.model.ts
  56. 61
      src/app/title/title.ts
  57. 91
      src/demo/plugin.redis.edit.ts
  58. 68
      src/demo/plugin.redis.preview.ts
  59. 53
      src/demo/plugin.tedis.pool.ts
  60. 3
      src/demo/style.scss
  61. BIN
      src/img/ads.jpg
  62. BIN
      src/img/amazon-redshift.jpg
  63. BIN
      src/img/apache-impala.jpg
  64. BIN
      src/img/apache-kylin.jpg
  65. BIN
      src/img/apache-phoenix.jpg
  66. BIN
      src/img/database-selected.png
  67. BIN
      src/img/derby.jpg
  68. BIN
      src/img/error.png
  69. BIN
      src/img/gbase-8a.jpg
  70. BIN
      src/img/gbase-8s.jpg
  71. BIN
      src/img/gbase-8t.jpg
  72. BIN
      src/img/h2.jpg
  73. BIN
      src/img/hadoop-hive.jpg
  74. BIN
      src/img/hbase.jpg
  75. BIN
      src/img/hp-vertica.jpg
  76. BIN
      src/img/hsql.jpg
  77. BIN
      src/img/hw-dws.jpg
  78. BIN
      src/img/hw-elk.jpg
  79. BIN
      src/img/hw-fusioninsight-hd.jpg
  80. BIN
      src/img/hw-libr-a.jpg
  81. BIN
      src/img/ibm-db2.jpg
  82. BIN
      src/img/icon_close9x9_normal.png
  83. BIN
      src/img/informix.jpg
  84. BIN
      src/img/kingbase.jpg
  85. BIN
      src/img/loading.gif
  86. BIN
      src/img/mysql.jpg
  87. BIN
      src/img/oracle.jpg
  88. BIN
      src/img/pivotal-greenplum-database.jpg
  89. BIN
      src/img/postgresql.jpg
  90. BIN
      src/img/presto.jpg
  91. BIN
      src/img/resources.png
  92. BIN
      src/img/sap-hana.jpg
  93. BIN
      src/img/sap-sybase.jpg
  94. BIN
      src/img/spark.jpg
  95. BIN
      src/img/sql-server.jpeg
  96. BIN
      src/img/sql-server.jpg
  97. BIN
      src/img/sqlite.jpg
  98. BIN
      src/img/success.png
  99. BIN
      src/img/teradata.jpg
  100. BIN
      src/img/transwarp-inceptor.jpg
  101. Some files were not shown because too many files have changed in this diff Show More

5
.eslintignore

@ -1,5 +0,0 @@
dist/*.js
src/assets/*
src/lib/*
webpack.config.js
curd.mock.ts

289
.eslintrc.js

@ -1,289 +0,0 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended'],
rules:{
"indent": "off",
"quotes": [1, "single"],
"space-infix-ops": 2,//操作符前后有空格
// 必须使用 === 和 !== ,和 null 对比时除外
'eqeqeq': [2, 'always', { 'null': 'ignore' }],
// 函数的形参不能多于5个
'max-params': [2, 5],
// 禁止 switch 中出现相同的 case
'no-duplicate-case': 2,
// 禁止使用 var,必须用 let 或 const
'no-var': 0,
// 禁止出现空代码块
'no-empty': [2, { 'allowEmptyCatch': true }],
// 禁止空的 function
// 包含注释的情况下允许
'no-empty-function': 0,
// if 后必须包含 { ,单行 if 除外
'curly': [2, 'multi-line', 'consistent'],
// for 循环不得因方向错误造成死循环
'for-direction': 2,
// 关键字前后必须有空格
'keyword-spacing': 2,
'key-spacing':2,
// 最大块嵌套深度为 5 层
'max-depth': [2, 5],
// 最大回调深度为 3 层
'max-nested-callbacks': [2, 3],
// 禁止普通字符串中出现模板字符串语法
'no-template-curly-in-string': 0,
// 禁止连等赋值
'no-multi-assign': 2,
// 禁止使用连续的空格
'no-multi-spaces': 2,
// 禁止使用 \ 来定义多行字符串,统一使用模板字符串来做
'no-multi-str': 2,
// 禁止使用 new Object
'no-new-object': 2,
// 禁止使用 new require
'no-new-require': 2,
// 禁止使用 new Symbol
'no-new-symbol': 2,
// 禁止 new Boolean、Number 或 String
'no-new-wrappers': 2,
// 禁止 new 一个类而不存储该实例
'no-new': 2,
// 禁止把原生对象 Math、JSON、Reflect 当函数使用
'no-obj-calls': 2,
// 禁止使用八进制转义符
'no-octal-escape': 2,
// 禁止使用0开头的数字表示八进制
'no-octal': 2,
// 禁止使用 __dirname + 'file' 的形式拼接路径,应该使用 path.join 或 path.resolve 来代替
'no-path-concat': 2,
// 禁止对函数的参数重新赋值
'no-param-reassign': 2,
// 禁止使用保留字作为变量名
'no-shadow-restricted-names': 2,
// 禁止数组中出现连续逗号
'no-sparse-arrays': 2,
// 禁止在finally块中出现 return、throw、break、continue
'no-unsafe-finally': 2,
// 禁止出现不安全的否定,如 for (!key in obj} {},应该写为 for (!(key in obj)} {}
'no-unsafe-negation': 2,
// ...后面不允许有空格
'rest-spread-spacing': [2, 'never'],
// 注释的斜线和星号后要加空格
'spaced-comment': [2, 'always', {
'block': {
exceptions: ['*'],
balanced: true
}
}],
// typeof 判断条件只能是 "undefined", "object", "boolean", "number", "string", "function" 或 "symbol"
'valid-typeof': 2,
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/explicit-function-return-type": ["warn", {
allowExpressions: true
}],
"@typescript-eslint/no-explicit-any": ["off"],
// 声明
"prefer-const": "error", //如果一个变量不会被重新赋值,最好使用const进行声明
"no-const-assign": "error", //不允许改变用const声明的变量
"no-var": "error", //用let/const代替var
// 对象
"no-dupe-keys": "error", // 禁止在对象字面量中出现重复的键
"no-prototype-builtins": "error", // 禁止直接使用 Object.prototypes 的内置属性
"no-extend-native": "error", // 禁止扩展原生对象
"no-new-object": "error", // 禁止使用 Object 构造函数
"object-shorthand": [
"error",
"always"
], //要求对象字面量简写语法
"quote-props": [
"error",
"as-needed"
], // 对象属性只在需要的时候加引号
// 数组
"no-sparse-arrays": "error", // 禁用稀疏数组
"no-array-constructor": "error", //禁止使用 Array 构造函数
"array-callback-return": "error", // 数组回调函数内必须返回一个状态
// 字符串
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true
}
], // 字符串开头和结束使用单引号
"prefer-template": "error", // 使用模板而非字符串连接
"template-curly-spacing": [
"error",
"never"
], // 强制模板字符串中花括号内不能出现空格
"no-path-concat": "error", // 当使用 _dirname 和 _filename 时不允许字符串拼接
"no-useless-concat": "error", // 禁止没有必要的字符拼接
"no-useless-escape": "error", // 禁用不必要的转义
// 函数
"no-dupe-args": "error", // 禁止在 function 定义中出现重复的参数
"no-new-func": "error", // 禁用Function构造函数
"no-return-assign": "error", // 禁止在返回语句中赋值
"func-style": [
"error",
"declaration",
{
"allowArrowFunctions": true
}
], // 统一函数风格为函数表达式或函数声明,并且允许使用箭头函数
"newline-before-return": "error", // 要求 return 语句之前有一空行
"wrap-iife": [
"error",
"outside"
], // 立即执行函数外部必须包裹括号
"no-loop-func": "error", // 禁止在非function内声明function
// "space-before-function-paren": "error", // 函数括号前必须要有空格
"no-param-reassign": "error", // 禁止修改函数参数
"prefer-spread": "error", // 使用解构形式代替.apply()
// 箭头函数
"prefer-arrow-callback": "error", // 回调使用箭头函数
"arrow-spacing": "error", // 箭头前后要有空格
"arrow-parens": [
"error",
"as-needed"
], // 参数使用括号包裹
"arrow-body-style": [
"error",
"as-needed",
{
"requireReturnForObjectLiteral": true
}
], // 函数体在必要的时候使用大括号
// 类 & 构造器
"no-useless-constructor": "error", // 禁止没必要的构造器
"no-dupe-class-members": "error", // 禁止重复创建类成员
// 模块
"no-duplicate-imports": "error", // 禁止从一个模块多次import
// 迭代器 & 生成器
"no-iterator": "error", // 禁止使用Iterator属性
"no-restricted-syntax": "error", // 使用对应的数组/对象方法去迭代操作成员
"generator-star-spacing": "error", // *前后不要都有空格
// 属性
"dot-notation": "error", //强制在任何允许的时候使用点号访问属性
// 变量
// "one-var": ["error", "never"], // 变量统一声明
// 比较运算符 & 相等运算符
"eqeqeq": "error", // 使用 === 和 !== 代替 == 和 !=
"no-nested-ternary": "error", // 禁止混合的三目运算符
"no-unneeded-ternary": "error", //禁止可以在有更简单的可替代的表达式时使用三元操作符
// 条件
"no-cond-assign": "error", // 禁止在条件语句中出现赋值操作符
"no-constant-condition": "error", //禁止在条件中使用常量表达式
"no-duplicate-case": "error", // 禁止在 switch 语句中的 case 子句中出现重复的测试表达式
"default-case": "error", // 要求 Switch 语句中有 Default 分支
"no-else-return": "error", // 如果 if 块中包含了一个 return 语句,else 块就成了多余的了。可以将其内容移至块外
"no-fallthrough": "error", // 禁止 case 语句落空
// 代码块
"brace-style": "error", // 代码块左括号紧跟上一行结束
"curly": [
"error",
"multi-line"
], // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
], // 禁止空块语句,但允许出现空的 catch 子句
// 注释
"spaced-comment": "error", // 注释前有空格
"no-mixed-spaces-and-tabs": "error", // 禁止使用 空格 和 tab 混合缩进
"space-before-blocks": [
"error",
"always"
], // 语句块之前的需要有空格
"keyword-spacing": "error", // 关键字后面必须要有空格
"space-infix-ops": [
"error",
{
"int32Hint": false
}
], // 要求中缀操作符周围有空格,设置 int32Hint 选项为 true (默认 false) 允许 a|0 不带空格
"eol-last": "error", // 要求文件末尾保留一行空行
"newline-per-chained-call": "error", // 要求方法链中每个调用都有一个换行符
"padded-blocks": [
"error",
"never"
], // 代码块开始和结束位置不可以有多余的空行
"space-in-parens": [
"error",
"never"
], // 禁止圆括号内的空格
"array-bracket-spacing": [
"error",
"never"
], // 数组紧贴括号部分不允许包含空格
"object-curly-spacing": [
"error",
"never"
], // 对象紧贴花括号部分不允许包含空格
"no-regex-spaces": "error", // 禁止正则表达式字面量中出现多个空格
"no-multi-spaces": "error", // 禁止出现多个空格而且不是用来作缩进的
"block-spacing": [
"error",
"never"
], // 单行代码块中紧贴括号部分不允许包含空格
"computed-property-spacing": [
"error",
"never"
], // 禁止括号和其内部值之间的空格
"no-trailing-spaces": [
"error",
{
"skipBlankLines": true
}
], // 禁用行尾空格
"no-spaced-func": "error", // 禁止函数调用时,与圆括号之间有空格
"space-unary-ops": "error", // 要求或禁止在一元操作符之前或之后存在空格,new、delete、typeof、void、yield要求有空格,-、+、--、++、!、!!要求无空格
"yield-star-spacing": [
"error",
{
"before": true,
"after": false
}
], // 强制 yield* 表达式中 * 号前有空格,后无空格
// 逗号
"comma-style": "error", // 逗号必须放在行末
"comma-dangle": [
"error",
"always-multiline"
], // 多行对象字面量中要求拖尾逗号
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
], //在变量声明、数组字面量、对象字面量、函数参数 和 序列中禁止在逗号前使用空格,要求在逗号后使用一个或多个空格
// 分号
"semi": "error", //不得省略语句结束的分号
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
], //禁止分号周围的空格
"no-extra-semi": "error", // 禁用不必要的分号
// 类型转换
"radix": "error", // 在parseInt()中始终使用基数以消除意想不到的后果
"no-extra-boolean-cast": "error", // 禁止不必要的布尔类型转换
// 其他最佳实践或规范
"strict": "error", // 使用强制模式开关use strict;
// "@typescript-eslint/no-extra-parens": ["error"],
"no-eval": "error", // 禁用 eval()
"no-with": "error", // 禁用 with 语句
"no-unexpected-multiline": "error", // 禁止使用令人困惑的多行表达式
"no-unreachable": "error", // 禁止在 return、throw、continue 和 break 语句后出现不可达代码
"no-unsafe-finally": "error", // 禁止在 finally 语句块中出现控制流语句
"valid-typeof": "error", // 强制 typeof 表达式与有效的字符串进行比较
"no-new-wrappers": "error", // 禁止通过 new 操作符使用 String、Number 和 Boolean
"handle-callback-err": "error" // 强制回调错误处理
}
}

7
.gitattributes vendored

@ -1,7 +0,0 @@
* text=auto !eol
designer_scripts/designer_scripts.iml -text
designer_scripts/src/readme.md -text
designer_scripts/src/scripts/store/web/index.html -text
designer_scripts/src/scripts/store/web/js/bridge.js -text
designer_scripts/src/scripts/store/web/js/lib/jquery-2.2.2.min.js -text
designer_scripts/src/scripts/store/web/js/store.js -text

141
README.md

@ -2,152 +2,15 @@
用于决策平台和设计器中管理数据连接的通用管理器 用于决策平台和设计器中管理数据连接的通用管理器
![finui](https://img.shields.io/badge/lib-FinUi-blue.svg) ![fineui](https://img.shields.io/badge/lib-FineUI-blue.svg)
## 开始 ## 开始
下载代码
```
git clone ssh://git@cloud.finedevelop.com:7999/~alan/database-connection.git
```
安装依赖 安装依赖
``` ```
yarn yarn
``` ```
开始开发 开始开发
``` ```
yarn start yarn dev
```
## 接口文档
### 增加数据连接类型
使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.list`,值为连接的名称
例如增加`Redis`的连接:
```js
BI.config(ConstantName, (datas: string[]) => [...datas, 'Redis']);
```
### 数据连接填写页面
ConstantName名称为`dec.constant.database.conf.connect.form.${name.toLowerCase()}.edit`,值为组件shortcut的名称
例如配置`Redis`的连接填写页面:
```js
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`的连接预览页面:
```js
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`,值为插件数据结构
例如:
```js
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);
```
### 数据连接池页面
ConstantName名称为`dec.constant.database.conf.connect.form.${name.toLowerCase()}.pool`,值为组件shortcut的名称
例如配置`Redis`的连接预览页面:
```js
const classNamePool = 'fr.plugin.redis.pool';
const WidgetPool = BI.inherit(BI.Widget, {
render() {
const {maxActive, maxIdle, numActive, numIdle} = this.options;
return {
type: 'bi.left',
items: [
{
type: 'bi.left',
cls: 'right-status-item',
items: [
{
type: 'bi.vertical',
cls:'right-status-board',
items: [
{
type: 'bi.vertical',
cls:'right-status-board-item',
items: [
{
type: 'bi.label',
cls: 'right-status-text',
extraCls: 'card-font1',
text: numActive,
},
{
type: 'bi.label',
cls: 'right-status-text',
text: '/',
},
{
type: 'bi.label',
cls: 'right-status-text',
text: maxActive,
},
],
},
{
type: 'bi.label',
text: 'Redis连接数',
},
],
},
],
},
],
};
},
});
BI.shortcut(classNamePool, WidgetPool);
BI.constant('dec.constant.database.conf.connect.form.redis.pool', classNamePool);
``` ```

60
i18n/zh_cn.properties

@ -1,60 +0,0 @@
Dec-Dcm_Connection_Management= 数据连接管理
Dec-Dcm_Pool_Connection_Management= 连接池管理
Dec-Dcm_Data_Connections= 数据连接
Dec-Dcm_Active_Connections_Number= 活动连接数
Dec-Dcm_Leisure_Connections_Number= 空闲连接数
Dec-Dcm_Connections= 连接
Dec-Dcm_Default= 默认
Dec-Dcm_Delete= 删除
Dec-Dcm_Test_Connection= 测试连接
Dec-Dcm_Copy= 复制
Dec-Dcm_Edit= 编辑
Dec-Dcm_Save= 保存
Dec-Dcm_Yes= 是
Dec-Dcm_No= 否
Dec-Dcm_Search= 搜索
Dec-Dcm_Type= 类型
Dec-Dcm_Other= 其他
Dec-Dcm_Tips= 提示
Dec-Dcm_Back= 返回
Dec-Dcm_Creator= 创建者
Dec-Dcm_First_Step= 第一步
Dec-Dcm_Second_Step= 第二步
Dec-Dcm_Third_Step= 第三步
Dec-Dcm_Connection_Detailed_Information= 详细信息
Dec-Dcm_Connection_Handup_Information= 收起信息
Dec-Dcm_Connection_Testing= 正在测试连接,请稍候...
Dec-Dcm_Connection_Test_Fail= 测试连接失败
Dec-Dcm_Connection_Test_Success= 连接成功
Dec-Dcm_Connection_Option_Cannot_Find= 找不到该连接的配置信息
Dec-Dcm_Connection_Config_No_Save= 当前设置尚未保存,是否保存?
Dec-Dcm_Connection_New= 新建数据连接
Dec-Dcm_Connection_More= 更多数据连接...
Dec-Dcm_Connection_More_Title= 更多数据连接
Dec-Dcm_Connection_Other= 其他
Dec-Dcm_Connection_Plase_Add_One= 请选择左侧数据连接或点击新建数据连接
Dec-Dcm_Connection_Is_Existence= 数据连接名已存在
Dec-Dcm_Connection_Form_ConnectionName= 数据连接名
Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm= *修改数据连接名会影响相关数据表和仪表板
Dec-Dcm_Connection_Form_Driver= 驱动器
Dec-Dcm_Connection_Form_URL= URL
Dec-Dcm_Connection_Form_Place_Input= 请输入
Dec-Dcm_Connection_Form_OriginalCharsetName= 编码
Dec-Dcm_Connection_Form_Auto= 自动
Dec-Dcm_Connection_Form_UserName= 用户名
Dec-Dcm_Connection_Form_Password= 密码
Dec-Dcm_Connection_Form_Pool_Properties= 连接池属性
Dec-Dcm_Connection_Form_SQL_Validation_Query= SQL验证查询
Dec-Dcm_Connection_Form_Connection-Check= 获取连接前校验
Dec-Dcm_Connection_Form_Connection_Max_Number= 最大活动连接数
Dec-Dcm_Connection_Form_Place_Input-Number= 请输入有效的正整数
Dec-Dcm_Connection_Form_Pattern= 模式
Dec-Dcm_Connection_Form_Database_Addr= 数据库地址
Dec-Dcm_Connection_Form_Database_Port= 端口号
Dec-Dcm_Connection_Make_Sure_Delete= 确定删除该数据连接?
Dec-Dcm_Connection_ReConnect= 重新连接
Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字
Dec-Dcm_Connection_Form_JNDI_Context= 上下文
Dec-Dcm_Connection_Form_JNDI_Advanced= 高级
Dec-Dcm_Connection_Form_JNDI_Other_Attributes= 其他属性
Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes= 收起

38
package.json

@ -1,38 +0,0 @@
{
"name": "database-connection",
"version": "1.0.0",
"description": "数据连接设置页面",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development --open",
"build": "webpack --mode production"
},
"author": "alan <alan@fanrun.com>",
"license": "ISC",
"devDependencies": {
"@types/node": "^12.0.2",
"@typescript-eslint/eslint-plugin": "^1.6.0",
"@typescript-eslint/parser": "^1.6.0",
"copy-webpack-plugin": "^5.0.2",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.6.0",
"node-sass": "^4.11.0",
"path": "^0.12.7",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"ts-loader": "^5.3.3",
"typescript": "^3.4.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1",
"webpack-stream": "^5.2.1"
},
"optionalDependencies": {
"fineui": "git+ssh://git@cloud.finedevelop.com:7999/visual/fineui.git"
}
}

373
private/constants.ts

@ -1,373 +0,0 @@
export const OTHER_CONNECT = 'other';
export const JNDI_CONNECT = 'JNDI';
export const MYSQL_CONNECT = 'MySQL';
export const DEFAULT_INFO = 'DESIGNER';
export const ACTION_DELETE = 'ACTION_DELETE';
export const ACTION_COPY = 'ACTION_COPY';
export const ACTION_TEST = 'ACTION_TEST';
export const TAB_LINK_SET = 'TAB_LINK_SET';
export const TAB_LINK_POOL = 'TAB_LINK_POOL';
export const DATA_LINKS = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', 'JNDI'];
export const DATA_BASE_TYPE_OTHER = [
{
text: 'ADS',
databaseType: 'ads',
driver: 'com.mysql.jdbc.Driver',
url: 'jdbc:mysql://hostname:port/my_ads_db',
},
{
text: 'Amazon Redshift',
databaseType: 'amazon-redshift',
driver: 'com.amazon.redshift.jdbc4.Driver',
drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'],
url: 'jdbc:redshift://endpoint:port/database',
},
{
text: 'APACHE IMPALA',
databaseType: 'apache-impala',
driver: 'com.cloudera.impala.jdbc41.Driver',
url: 'jdbc:impala://hostname:port/_impala_builtins',
},
{
text: 'APACHE KYLIN',
databaseType: 'apache-kylin',
driver: 'org.apache.kylin.jdbc.Driver',
url: 'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text: 'APACHE Phoenix',
databaseType: 'apache-phoenix',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
},
{
text: 'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text: 'Gbase 8A',
databaseType: 'gbase-8a',
driver: 'com.gbase.jdbc.Driver',
url: 'jdbc:gbase://hostname:port/dbname',
},
{
text: 'Gbase 8S',
databaseType: 'gbase-8s',
driver: 'com.gbasedbt.jdbc.IfxDriver',
url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}',
},
{
text: 'Gbase 8T',
databaseType: 'gbase-8t',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text: 'H2',
databaseType: 'h2',
driver: 'org.h2.Driver',
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{
text: '华为云DWS',
databaseType: 'hw-dws',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'FusionInsight elk',
databaseType: 'hw-elk',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'FusionInsight HD',
databaseType: 'hw-fusioninsight-hd',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;',
},
{
text: 'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Hadoop Hive',
databaseType: 'hadoop-hive',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text: 'Hbase',
databaseType: 'hbase',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
}, {
text: 'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
}, {
text: 'Hsql',
databaseType: 'hsql',
driver: 'com.fr.third.org.hsqldb.jdbcDriver',
url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]',
}, {
text: 'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
}, {
text: 'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
}, {
text: 'KINGBASE',
databaseType: 'kingbase',
driver: 'com.kingbase.Driver',
url: 'jdbc:kingbase://hostname:port',
}, {
text: 'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
}, {
text: 'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text: 'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text: 'Pivotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Presto',
databaseType: 'presto',
driver: 'com.facebook.presto.jdbc.PrestoDriver',
url: 'jdbc:presto://host:port/catalog',
}, {
text: 'SAP HANA',
databaseType: 'sap-hana',
driver: 'com.sap.db.jdbc.Driver',
url: 'jdbc:sap://hostname:port?reconnect=true',
}, {
text: 'SAP Sybase',
databaseType: 'sap-sybase',
driver: 'com.sybase.jdbc4.jdbc.SybDriver',
url: 'jdbc:sybase:Tds:hostname:2638/databasename',
}, {
text: 'SPARK',
databaseType: 'spark',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text: 'Sqlite',
databaseType: 'sqlite',
driver: 'org.sqlite.JDBC',
url: 'jdbc:sqlite:[PATH_TO_DB_FILES]',
}, {
text: 'TeraData',
databaseType: 'teradata',
driver: 'com.ncr.teradata.TeraDriver',
url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT',
}, {
text: 'TRANSWARP INCEPTOR',
databaseType: 'transwarp-inceptor',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
},
];
export const DATA_BASE_TYPE = [
{
text: 'APACHE KYLIN',
databaseType: 'apache-kylin',
driver: 'org.apache.kylin.jdbc.Driver',
url: 'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text: 'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text: 'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
},
{
text: 'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
},
{
text: 'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text: 'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
},
{
text: 'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text: 'Privotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text: OTHER_CONNECT,
databaseType: 'other',
driver: 'org.h2.Driver',
drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
...DATA_BASE_TYPE_OTHER,
{
text: JNDI_CONNECT,
},
];
export const JNDI_FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory'];
export const OTHER_ATTRIBUTES = [
{
text: 'OBJECT_FACTORIES',
name: 'objectFactories',
},
{
text: 'STATE_FACTORIES',
name: 'stateFactories',
},
{
text: 'URL_PKG_PREFIXES',
name: 'urlPkgPrefixes',
},
{
text: 'DNS_URL',
name: 'dnsUrl',
},
{
text: 'AUTHORITATIVE',
name: 'authoritative',
},
{
text: 'BATCHSIZE',
name: 'batchSize',
},
{
text: 'REFERRAL',
name: 'referral',
},
{
text: 'SECURITY_PROTOCOL',
name: 'securityProtocol',
},
{
text: 'SECURITY_AUTHENTICATION',
name: 'securityAuthentication',
},
{
text: 'LANGUAGE',
name: 'language',
},
{
text: 'APPLET',
name: 'applet',
},
];
export const CONNECT_CHARSET = [
{
text: 'GBK',
value: 'GBK',
},
{
text: 'BIG5',
value: 'BIG5',
},
{
text: 'ISO-8859-1',
value: 'ISO-8859-1',
},
{
text: 'UTF-8',
value: 'UTF-8',
},
{
text: 'UTF-16',
value: 'UTF-16',
},
{
text: 'EUC_JP',
value: 'EUC_JP',
},
{
text: 'EUC_KR',
value: 'EUC_KR',
},
{
text: 'CP850',
value: 'CP850',
},
];
const DecDcm = {
TEST_STATUS_WAITING: 1,
TEST_STATUS_SUCCESS: 2,
TEST_STATUS_FAIL: 3,
};
export default DecDcm;

63
private/i18n.ts

@ -1,63 +0,0 @@
export default {
'Dec-Dcm_Connection_Management': '数据连接管理',
'Dec-Dcm_Pool_Connection_Management': '连接池管理',
'Dec-Dcm_Data_Connections': '数据连接',
'Dec-Dcm_Active_Connections_Number': '活动连接数',
'Dec-Dcm_Leisure_Connections_Number': '空闲连接数',
'Dec-Dcm_Connections': '连接',
'Dec-Dcm_Default': '默认',
'Dec-Dcm_Delete': '删除',
'Dec-Dcm_Test_Connection': '测试连接',
'Dec-Dcm_Copy': '复制',
'Dec-Dcm_Edit': '编辑',
'Dec-Dcm_Save': '保存',
'Dec-Dcm_Yes': '是',
'Dec-Dcm_No': '否',
'Dec-Dcm_Search': '搜索',
'Dec-Dcm_Type': '类型',
'Dec-Dcm_Other': '其他',
'Dec-Dcm_Tips': '提示',
'Dec-Dcm_Back': '返回',
'Dec-Dcm_Creator': '创建者',
'Dec-Dcm_First_Step': '第一步',
'Dec-Dcm_Second_Step': '第二步',
'Dec-Dcm_Third_Step': '第三步',
'Dec-Dcm_Connection_Detailed_Information': '详细信息',
'Dec-Dcm_Connection_Handup_Information': '收起信息',
'Dec-Dcm_Connection_Testing': '正在测试连接,请稍候...',
'Dec-Dcm_Connection_Test_Fail': '测试连接失败',
'Dec-Dcm_Connection_Test_Success': '连接成功',
'Dec-Dcm_Connection_Option_Cannot_Find': '找不到该连接的配置信息',
'Dec-Dcm_Connection_Config_No_Save': '当前设置尚未保存,是否保存?',
'Dec-Dcm_Connection_New': '新建数据连接',
'Dec-Dcm_Connection_More': '更多数据连接...',
'Dec-Dcm_Connection_More_Title': '更多数据连接',
'Dec-Dcm_Connection_Other': '其他',
'Dec-Dcm_Connection_Plase_Add_One': '请选择左侧数据连接或点击新建数据连接',
'Dec-Dcm_Connection_Is_Existence': '数据连接名已存在',
'Dec-Dcm_Connection_Form_ConnectionName': '数据连接名',
'Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm': '*修改数据连接名会影响相关数据表和仪表板',
'Dec-Dcm_Connection_Form_Driver': '驱动器',
'Dec-Dcm_Connection_Form_URL': 'URL',
'Dec-Dcm_Connection_Form_Place_Input': '请输入',
'Dec-Dcm_Connection_Form_OriginalCharsetName': '编码',
'Dec-Dcm_Connection_Form_Auto': '自动',
'Dec-Dcm_Connection_Form_UserName': '用户名',
'Dec-Dcm_Connection_Form_Password': '密码',
'Dec-Dcm_Connection_Form_Pool_Properties': '连接池属性',
'Dec-Dcm_Connection_Form_SQL_Validation_Query': 'SQL验证查询',
'Dec-Dcm_Connection_Form_Connection-Check': '获取连接前校验',
'Dec-Dcm_Connection_Form_Connection_Max_Number': '最大活动连接数',
'Dec-Dcm_Connection_Form_Place_Input-Number': '请输入有效的正整数',
'Dec-Dcm_Connection_Form_Pattern': '模式',
'Dec-Dcm_Connection_Form_Database_Addr': '数据库地址',
'Dec-Dcm_Connection_Form_Database_Port': '端口号',
'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?',
'Dec-Dcm_Connection_ReConnect': '重新连接',
'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字',
'Dec-Dcm_Connection_Form_JNDI_Context': '上下文',
'Dec-Dcm_Connection_Form_JNDI_Advanced': '高级',
'Dec-Dcm_Connection_Form_JNDI_Other_Attributes': '其他属性',
'Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes': '收起',
'Dec-Dcm_Connection_Form_JNDI_Notice': '注意:需要把包含INITIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下.',
};

4
src/app/app.constant.ts

@ -1,4 +0,0 @@
export const ConstantName = 'dec.constant.database.conf.connect.list';
BI.constant(ConstantName, [
]);
export default ConstantName;

39
src/app/app.model.ts

@ -1,39 +0,0 @@
const className = 'dec.dcm.model.main';
import {ModelType} from '@ui';
import {LinkType} from '@ui/type';
import {fetchLinkList} from '../shared/crud/crud.request';
import {TAB_LINK_SET} from '@private/constants';
const linkList: LinkType[] = [];
const Model: ModelType = {
childContext: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'moreLinkSelected', 'statusSelected', 'connectionNameErr'],
state () {
return {
tab: '',
linkList,
linkSelected: {},
linkUpdate: {},
moreLinkSelected: '',
statusSelected: '',
connectionNameErr: '',
};
},
computed: {
},
actions: {
initData(callback: Function) {
fetchLinkList((linkList: LinkType[]) => {
this.model.linkList = linkList;
this.model.tab = TAB_LINK_SET;
callback();
});
},
},
};
BI.model(className, BI.inherit(Fix.Model, Model));
export default className;

55
src/app/app.ts

@ -1,55 +0,0 @@
import {Vtape, Absolute, LinearSegment} from '../ui/index';
import appModel from './app.model';
import title from './title/title';
import linkSet from './connection/link_set';
import linkStatus from './status/link_status';
import '../less/index.less';
const className = 'dec.dcm.main';
const Widget = BI.inherit(BI.Widget, {
props: {
baseCls: 'dec-webui-dcm-layout bi-background',
},
_store() {
return BI.Models.getModel(appModel);
},
beforeInit (callback) {
this.store.initData(callback);
},
render() {
return {
type: Vtape,
items: [
{
el: {
type: title,
},
height: 40,
},
{
type: Absolute,
items: [{
el: {
type: linkSet,
},
left: 10,
top: 10,
right: 10,
bottom: 10,
}, {
el: {
type: linkStatus,
},
left: 10,
top: 10,
right: 10,
bottom: 10,
}],
},
],
};
},
});
BI.shortcut(className, Widget);
export default className;

4
src/app/connection/left/item/left_item.less

@ -1,4 +0,0 @@
@import '../../../../less/index.less';
.dec-webui-dcm-connection-left-item{
.hover-visible(link-item-icon);
}

77
src/app/connection/left/item/left_item.ts

@ -1,77 +0,0 @@
import './left_item.less';
import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui';
import ItemIcon from './left_item_icon';
import ItemDelete from './left_item_delete';
import Model from '../../link_set.model';
import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants';
const className = 'dec.dcm.component.linkSet.left.item';
const Widget: WidgetType = {
props: {
title: '',
id: '',
creator: '',
baseCls: 'dec-webui-dcm-connection-left-item bi-list-item-active',
},
_store() {
return BI.Models.getModel(Model);
},
render() {
const {title, creator, text, id} = this.options;
return {
type: LeftRightVerticalAdapt,
items: {
left: [
{
type: Icon,
cls: 'dcm-link-font',
height: 25,
width: 25,
text: BI.i18nText('Dec-Dcm_Connections'),
title,
},
{
type: TextButton,
text: title,
title,
},
],
right: [
{
type: ItemIcon,
cls: 'link-item-icon dcm-test-font',
title: BI.i18nText('Dec-Dcm_Test_Connection'),
value: ACTION_TEST,
id,
},
{
type: ItemIcon,
cls: 'link-item-icon copy-font',
title: BI.i18nText('Dec-Dcm_Copy'),
value: ACTION_COPY,
id,
},
{
type: ItemIcon,
cls: 'link-item-icon dcm-info-font',
title: `${BI.i18nText('Dec-Dcm_Type')}${text === DEFAULT_INFO ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}${creator}`,
id,
},
{
type: ItemDelete,
cls: 'link-item-icon dcm-delete-font',
title: BI.i18nText('Dec-Dcm_Delete'),
value: ACTION_DELETE,
id,
},
],
},
};
},
doClick() {
const {title} = this.options;
this.store.setLinkSelected(title);
},
};
BI.shortcut(className, BI.inherit(BI.BasicButton, Widget));
export default className;

43
src/app/connection/left/item/left_item_delete.ts

@ -1,43 +0,0 @@
import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView} from '@ui';
import Model from '../../link_set.model';
const className = 'dec.dcm.component.linkSet.left.item.icon.delete';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
render() {
const {title, id} = this.options;
const that = this;
return {
type: BubbleCombo,
stopPropagation: true,
direction: 'bottom',
ref: _ref => {
this.combo = _ref;
},
el: {
type: Icon,
height: 25,
width: 25,
title,
},
popup: {
type: TextBubblePopupBarView,
text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'),
listeners: [{
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action (type: boolean) {
that.combo.hideView();
if (type) {
that.store.onIconClick(title, id);
}
},
}],
},
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

26
src/app/connection/left/item/left_item_icon.ts

@ -1,26 +0,0 @@
import {WidgetType, IconButton} from '@ui';
import Model from '../../link_set.model';
const className = 'dec.dcm.component.linkSet.left.item.icon';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
render() {
const {title} = this.options;
return {
type: IconButton,
height: 25,
width: 25,
stopPropagation: true,
title,
handler: () => {
const {id, title} = this.options;
this.store.onIconClick(title, id);
},
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

39
src/app/connection/left/left.ts

@ -1,39 +0,0 @@
import {WidgetType, ListView} from '@ui';
import Model from '../link_set.model';
import {LinkType} from '@ui/type';
import LeftItem from './item/left_item';
const className = 'dec.dcm.component.linkset.left';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
linkList(linkList: LinkType[]) {
this.leftContent.populate(BI.createItems(this._renderItems(linkList)));
},
},
render() {
return {
type: ListView,
ref: _ref => {
this.leftContent = _ref;
},
items: this._renderItems(this.model.linkList),
};
},
_renderItems(linkList: LinkType[]) {
return BI.map(linkList, (index: number, item: LinkType) => {
return {
type: LeftItem,
selected: item.isSelected,
title: item.connectionName,
id: item.connectionId,
creator: item.creator,
text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'),
};
});
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

50
src/app/connection/link_set.mixin.ts

@ -1,50 +0,0 @@
import {LinkType} from '@ui/type';
import {saveConnection} from './link_set.service';
const mixinName = 'dec.dcm.minxin.linkset';
const Mixin = {
setConnectionNameErr(err: string) {
this.model.connectionNameErr = err;
},
setEdit(type: boolean) {
this.model.linkSelected = {
...this.model.linkSelected,
isSelected: type,
};
this.model.linkUpdate = this.model.linkSelected;
},
setCancel() {
const linkSelected: LinkType = this.model.linkSelected;
const linkList: LinkType[] = this.model.linkList;
if (linkSelected.connectionId) {
this.setEdit(false);
} else {
this.model.linkList = [
...linkList.filter(item => !!item.connectionId),
];
if (this.model.linkList.length > 0) {
this.model.linkList[0].isSelected = true;
this.model.linkSelected = {
...this.model.linkList[0],
isSelected: false,
};
} else {
this.model.linkSelected = {};
}
this.model.linkUpdate = this.model.linkSelected;
}
},
saveLink() {
const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {};
const update = {
...this.model.linkUpdate,
...pluginData,
};
saveConnection(update).then(() => {
this.setEdit(false);
});
},
};
Fix.mixin(mixinName, Mixin);
export default mixinName;

154
src/app/connection/link_set.model.ts

@ -1,154 +0,0 @@
import {LinkType} from '@ui/type';
import {deleteConnection, testConnection} from '@shared/crud/crud.request';
import {getCnnectionName} from './select/select.service';
import {DATA_BASE_TYPE} from '@private/constants';
import dialog from '@shared/service/dialog.service';
import Mixin from './link_set.mixin';
const className = 'dec.dcm.model.linkset';
const Model = {
context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'],
mixins: [Mixin],
actions: {
/**
*
* @param name
*/
setLinkSelected(name: string) {
this._noSaveConfirm(() => {
this._setLinkSelected(name);
});
},
onIconClick(title: string, id: string) {
switch (title) {
case BI.i18nText('Dec-Dcm_Delete'):
deleteConnection(id, () => {
this.model.linkList = [...this.model.linkList.filter((item: LinkType) => item.connectionId !== id)];
this.model.linkSelected = {};
this.model.linkUpdate = {};
});
break;
case BI.i18nText('Dec-Dcm_Test_Connection'):
this._textLink(id);
break;
case BI.i18nText('Dec-Dcm_Copy'):
this._noSaveConfirm(() => {
this.copyLink(id);
});
break;
default:
break;
}
},
copyLink(id: string) {
const connectionName = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionId === id).connectionName;
const name = getCnnectionName(this.model.linkList, connectionName);
let data = {};
this.model.linkList.forEach((item: LinkType) => {
if (item.connectionId === id) {
data = item;
}
});
const newCopy = {
...data,
isSelected: true,
connectionName: name,
connectionId: '',
};
this.model.linkList = [
newCopy,
...this.model.linkList,
];
this.model.linkSelected = {
...newCopy,
};
this.model.linkUpdate = {
...newCopy,
};
},
setLinkUpdate(value: any) {
this.model.linkUpdate = value;
},
setNewLink(value: string) {
if (!DATA_BASE_TYPE.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) {
dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find'));
return;
}
this._noSaveConfirm(() => {
this._setNewLink(value);
});
},
},
_setLinkSelected(name: string) {
this.model.linkList.forEach((item: LinkType) => {
item.isSelected = item.connectionName === name;
if (item.connectionName === name) {
this.model.linkSelected = {
...item,
isSelected: false,
};
}
});
this.model.linkList = [...this.model.linkList];
this.model.linkUpdate = this.model.linkSelected;
},
_textLink(id: string) {
const link = this.model.linkList.find((item: LinkType) => item.connectionId === id);
const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing'));
testConnection(link, (res: any) => {
dialog.remove(loadingId);
if (res && res.errorCode) {
dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => {
this._textLink(id);
});
} else {
dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success'));
}
});
},
_setNewLink(value: string) {
const name = getCnnectionName(this.model.linkList, value);
let data = {};
DATA_BASE_TYPE.forEach(item => {
if (item.text === value) {
data = item;
}
});
this.model.linkList = [
{
connectionName: name,
isSelected: true,
...data,
text: value,
},
...this.model.linkList,
];
this.model.linkSelected = {
...data,
connectionName: name,
isSelected: true,
text: value,
};
this.model.linkUpdate = {
...data,
connectionName: name,
text: value,
};
},
_noSaveConfirm(cb: Function) {
if (this.model.linkSelected && this.model.linkSelected.isSelected) {
dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => {
if (isConfirm) {
this.saveLink();
} else {
this.setCancel();
}
cb();
});
} else {
cb();
}
},
};
BI.model(className, BI.inherit(Fix.Model, Model));
export default className;

26
src/app/connection/link_set.service.ts

@ -1,26 +0,0 @@
import {LinkType} from '@ui/type';
import {addConnection, updateConnection} from '@shared/crud/crud.request';
export function saveConnection(linkUpdate: LinkType): Promise<string> {
if (linkUpdate.connectionId) {
return new Promise(((resolve, reject) => {
try {
addConnection(linkUpdate, (res: string) => {
resolve(res);
});
} catch (error) {
reject(error);
}
}));
}
return new Promise(((resolve, reject) => {
try {
updateConnection(linkUpdate, (res: string) => {
resolve(res);
});
} catch (error) {
reject(error);
}
}));
}

58
src/app/connection/link_set.ts

@ -1,58 +0,0 @@
import {Htape, WidgetType, Vtape, VerticalAdapt} from '@ui';
import LeftList from './left/left';
import linkSetModel from './link_set.model';
import Select from './select/select';
import Right from './right/right';
import {TAB_LINK_SET} from '@private/constants';
const className = 'dec.dcm.linkset';
const Widget: WidgetType = {
props: {
baseCls: 'bi-card',
},
_store() {
return BI.Models.getModel(linkSetModel);
},
watch: {
tab(tab: string) {
this.setVisible(tab === TAB_LINK_SET);
},
},
render() {
return {
type: Htape,
items: [{
el: {
type: Vtape,
cls: 'dcm-link-left bi-border-right',
items: [
{
el: {
type: VerticalAdapt,
cls: 'bi-border-bottom',
items: [
{
type: Select,
hgap: 10,
vgap: 10,
},
],
},
height: 40,
}, {
type: LeftList,
cls: 'left-list',
vgap: 10,
hgap: 10,
},
],
},
width: 280,
}, {
type: Right,
}],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

6
src/app/connection/more/item/more_link_item.less

@ -1,6 +0,0 @@
@import '../../../../less/index.less';
.dec-webui-dcm-connection-more-link-item{
&:hover{
border-color :@border-color-highlight;
}
}

68
src/app/connection/more/item/more_link_item.ts

@ -1,68 +0,0 @@
import './more_link_item.less';
import {WidgetType, Img, Label, Layout, Absolute, Vtape} from '@ui/index';
import ModelName from './more_link_litem.model';
const className = 'dec.dcm.component.linkSet.morelink.item';
const Widget: WidgetType = {
props: {
baseCls: 'dec-webui-dcm-connection-more-link-item bi-border',
height: 120,
width: 120,
},
_store() {
return BI.Models.getModel(ModelName);
},
watch: {
otherSelected(otherSelected: string) {
const {text} = this.options;
this.selected.setVisible(text === otherSelected);
},
},
render() {
const {text, name} = this.options;
return {
type: Vtape,
items: [
{
type: Absolute,
items: [
{
el: {
type: Img,
src: this._buildResourceUrl(name),
},
},
{
el: {
type: Layout,
cls: 'dcm-link-more-selected',
invisible: true,
width: 30,
height: 30,
ref: _ref => {
this.selected = _ref;
},
},
right: 0,
},
],
},
{
el: {
type: Label,
cls: 'bi-header-background',
text,
},
height: 30,
},
],
};
},
_buildResourceUrl(name: string) {
// TODO: 目前不知道生产环境下的图片的绝对地址,先这样写用于测试。
return `img/${name}.jpg`;
},
};
BI.shortcut(className, BI.inherit(BI.BasicButton, Widget));
export default className;

6
src/app/connection/more/item/more_link_litem.model.ts

@ -1,6 +0,0 @@
const className = 'dec.dcm.model.link_set.more_link_item';
export const Model = BI.inherit(Fix.Model, {
context: ['otherSelected'],
});
BI.model(className, Model);
export default className;

16
src/app/connection/more/more_link.model.ts

@ -1,16 +0,0 @@
const className = 'dec.dcm.model.link_set.more_link';
export const Model = BI.inherit(Fix.Model, {
childContext: ['otherSelected'],
state() {
return {
otherSelected: '',
};
},
actions: {
setOtherSelected(name: string) {
this.model.otherSelected = name;
},
},
});
BI.model(className, Model);
export default className;

50
src/app/connection/more/more_link.service.ts

@ -1,50 +0,0 @@
import MoreLink from './more_link';
let subbitButton = null;
let selectKey = '';
export const moreLink = (onConfirm?: Function): void => {
const id = BI.UUID();
BI.Popovers.create(id, {
type: 'bi.bar_popover',
size: 'normal',
header: BI.i18nText('Dec-Dcm_Connection_More_Title'),
width: 560,
height: 500,
body: {
type: MoreLink,
listeners: [
{
eventName: 'EVENT_SELECT',
action (text: string) {
selectKey = text;
subbitButton.setEnable(true);
},
},
],
},
footer: {
type: 'bi.right_vertical_adapt',
lgap: 10,
items: [{
type: 'bi.button',
text: BI.i18nText('BI-Basic_Cancel'),
value: 1,
level: 'ignore',
handler () {
BI.Popovers.close(id);
},
}, {
type: 'bi.button',
text: BI.i18nText('BI-Basic_Sure'),
disabled: true,
value: 0,
ref: _ref => {
subbitButton = _ref;
},
handler () {
BI.Popovers.close(id);
onConfirm ? onConfirm(selectKey) : null;
},
}],
},
}).open(id);
};

52
src/app/connection/more/more_link.ts

@ -1,52 +0,0 @@
import {WidgetType, SearchEditor, Left, Vtape, VerticalAdapt} from '@ui/index';
import {DATA_BASE_TYPE_OTHER} from '@private/constants';
import MoreLinkItem from './item/more_link_item';
import ModelName from './more_link.model';
const className = 'dec.dcm.component.linkSet.morelink';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(ModelName);
},
render() {
return {
type: Vtape,
items: [
{
el: {
type: VerticalAdapt,
items: [{
type: SearchEditor,
width: 300,
watermark: BI.i18nText('Dec-Dcm_Search'),
}],
},
height: 30,
},
{
type: Left,
scrolly: true,
tgap: 2,
rgap: 2,
bgap: 2,
lgap: 2,
items: this._createItems(),
},
],
};
},
_createItems() {
return BI.map(DATA_BASE_TYPE_OTHER, (index: number, item) => {
return {
type: MoreLinkItem,
text: item.text,
name: item.databaseType,
handler: () => {
this.store.setOtherSelected(item.text);
this.fireEvent('EVENT_SELECT', item.text);
},
};
});
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

30
src/app/connection/right/nothing.ts

@ -1,30 +0,0 @@
import {WidgetType, Layout, Label, HorizotalAdapt, Vtape} from '@ui/index';
const className = 'dec.dcm.component.right.nothing';
const Widget: WidgetType = {
render() {
return {
type: HorizotalAdapt,
top: 200,
items: [{
type: Vtape,
width: 260,
height: 150,
items: [
{
el: {
type: Layout,
cls: 'data-connection-background',
},
height: 130,
},
{
type: Label,
text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'),
},
],
}],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

33
src/app/connection/right/right.ts

@ -1,33 +0,0 @@
import {WidgetType, ListView} from '@ui';
import {LinkType} from '@ui/type';
import Nothing from './nothing';
import RightDetail from './right_detail/right_detail';
import Model from '../link_set.model';
const className = 'dec.dcm.component.right';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
linkSelected(linkSelected: LinkType) {
this.rightContent.populate(BI.createItems([
{
type: (linkSelected && linkSelected.connectionName) ? RightDetail : Nothing,
},
]));
},
},
render() {
return {
type: ListView,
ref: _ref => {
this.rightContent = _ref;
},
items: [{
type: Nothing,
}],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

25
src/app/connection/right/right.typing.d.ts vendored

@ -1,25 +0,0 @@
export interface AttributeType {
text: string;
name: string;
}
export interface FormType {
connectionName?: string;
factory?: string;
url?: string;
principal?: string;
credentials?: string;
originalCharsetName?: string;
objectFactories?: string;
stateFactories?: string;
urlPkgPrefixes?: string;
dnsUrl?: string;
authoritative?: string;
batchSize?: string;
referral?: string;
securityProtocol?: string;
securityAuthentication?: string;
language?: string;
applet?: string;
}

6
src/app/connection/right/right_detail/right_detail.model.ts

@ -1,6 +0,0 @@
const className = 'dec.dcm.model.link.set.right.detail';
export const Model = BI.inherit(Fix.Model, {
context: ['linkSelected'],
});
BI.model(className, Model);
export default className;

74
src/app/connection/right/right_detail/right_detail.ts

@ -1,74 +0,0 @@
import {WidgetType, ListView} from '@ui/index';
import Model from './right_detail.model';
import {LinkType} from '@ui/type';
import Title from '../right_title/right_title';
import RightShow from '../right_show/right_show';
import RightShowJndi from '../right_show/right_show_jndi';
import RightEdit from '../right_edit/right_edit';
import RightEditMysql from '../right_edit/right_edit_mysql';
import RightEditJndi from '../right_edit/right_edit_jndi';
import pluginListConstant from '../../../app.constant';
import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants';
const className = 'dec.dcm.component.right.detail';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
linkSelected(linkSelected: LinkType) {
const showPage = this._createItems(linkSelected);
this.rightDetail.populate(BI.createItems(showPage));
},
},
render() {
const linkSelected = this.model.linkSelected;
return {
type: ListView,
ref: _ref => {
this.rightDetail = _ref;
},
items: this._createItems(linkSelected),
};
},
_createItems(linkSelected: LinkType) {
const plugins: string[] = BI.Constants.getConstant(pluginListConstant);
const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text);
let editPage = null;
let showPage = null;
switch (linkSelected.text) {
case (MYSQL_CONNECT):
editPage = RightEditMysql;
showPage = RightShow;
break;
case (JNDI_CONNECT):
editPage = RightEditJndi;
showPage = RightShowJndi;
break;
default:
editPage = RightEdit;
showPage = RightShow;
}
if (isPlugin) {
editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`);
showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`);
}
return [
{
type: Title,
isEdit: linkSelected.isSelected,
linkSelected,
}, {
type: linkSelected.isSelected ? editPage : showPage,
vgap: 10,
hgap: 10,
linkSelected,
},
];
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

20
src/app/connection/right/right_edit/right_edit.model.ts

@ -1,20 +0,0 @@
export const className = 'dec.dcm.model.components.right.edit';
export const Model = BI.inherit(Fix.Model, {
state() {
return {
isCollapse: false,
};
},
computed: {
},
actions: {
setIsCollapse(status: boolean) {
this.model.isCollapse = status;
},
},
});
BI.model(className, Model);
export default className;

24
src/app/connection/right/right_edit/right_edit.service.ts

@ -1,24 +0,0 @@
import {LinkType} from '@ui/type';
export function getDrivers(linkSelected: LinkType): {text: string; value: string}[] {
const drivers: {text: string; value: string}[] = [];
if (linkSelected.drivers && linkSelected.drivers.length > 0) {
linkSelected.drivers.forEach(item => {
drivers.push({
text: item,
value: item,
});
});
} else {
drivers.push({
text: linkSelected.driver,
value: linkSelected.driver,
});
}
return drivers;
}
export function connectNameChecker(name: string): boolean {
return /^\+?[1-9][0-9]*$/.test(name);
}

373
src/app/connection/right/right_edit/right_edit.ts

@ -1,373 +0,0 @@
import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index';
import {LinkType} from '@ui/type';
import {CONNECT_CHARSET} from '@private/constants';
import Model from '../../link_set.model';
import Title from '@shared/components/title';
import {getDrivers, connectNameChecker} from './right_edit.service';
let connectionName: any = null;
const className = 'dec.dcm.component.right.edit';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
connectionNameErr(msg: string) {
if (msg) {
BI.Bubbles.show('singleBubble', msg, connectionName, {
level: 'error',
});
} else {
BI.Bubbles.hide('singleBubble');
}
},
},
render() {
const linkSelected: LinkType = this.model.linkSelected;
const that = this;
return {
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'),
},
{
type: TextEditor,
width: 300,
value: linkSelected.connectionName,
ref(ref: any) {
connectionName = ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
connectionName: this.getValue(),
});
},
}, {
eventName: BI.Editor.EVENT_FOCUS,
action() {
that.store.setConnectionNameErr('');
},
}],
},
{
type: Label,
cls: 'bi-water-mark',
lgap: 5,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'),
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_First_Step'),
},
{
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
},
{
type: TextValueCombo,
width: 300,
text: linkSelected.driver,
items: getDrivers(linkSelected),
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
driver: this.getValue()[0],
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_URL'),
},
{
type: TextEditor,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.url,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
url: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
},
{
type: TextValueCombo,
width: 300,
text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName,
items: [
{
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: '',
},
...CONNECT_CHARSET,
],
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
originalCharsetName: this.getValue()[0],
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
},
{
type: TextEditor,
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.user,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
user: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
},
{
type: TextEditor,
inputType: 'password',
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.password,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
password: this.getValue(),
});
},
}],
},
],
},
{
type: Title,
text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'),
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
},
{
type: TextAreaEditor,
cls: 'bi-border',
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
height: 100,
value: linkSelected.validationQuery,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
validationQuery: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
},
{
type: MultiSelectItem,
text: BI.i18nText('Dec-Dcm_Yes'),
selected: linkSelected.testOnBorrow,
width: 60,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
testOnBorrow: this.isSelected(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'),
},
{
type: TextEditor,
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 60,
value: linkSelected.maxActive,
errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'),
validationChecker: connectNameChecker,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
maxActive: this.getValue(),
});
},
}],
},
],
},
],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Second_Step'),
},
{
type: Button,
width: 80,
text: BI.i18nText('Dec-Dcm_Test_Connection'),
level: 'ignore',
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Third_Step'),
},
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
},
{
type: TextEditor,
width: 300,
disabled: true,
},
],
},
],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

226
src/app/connection/right/right_edit/right_edit_jndi.ts

@ -1,226 +0,0 @@
import {Vertical, TextValueCombo, TextButton, Label, TextEditor, VerticalAdapt} from '@ui';
import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants';
import {AttributeType} from '../right.typing';
import ModelName from './right_edit.model';
const classNameEdit = 'dec.dcm.component.right.edit.jndi';
const Widget = BI.inherit(BI.Widget, {
_store() {
return BI.Models.getModel(ModelName);
},
watch: {
isCollapse(isCollapse) {
const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes');
this.collapseRef.setText(text);
this.otherAttributesRef.setVisible(isCollapse);
},
},
render() {
const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options;
return {
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
},
{
type: TextEditor,
width: 300,
allowBlank: true,
value: connectionName,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'),
},
{
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'INTIAL_CONTEXT_FACTORY',
},
{
type: TextValueCombo,
width: 300,
value: factory,
items: BI.map(JNDI_FACTORYS, (index: number, item: string) => {
return {
text: item,
value: item,
};
}),
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'PROVIDER_URL',
},
{
type: TextEditor,
width: 300,
allowBlank: true,
value: url,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'SECURITY_PRINCIPAL',
},
{
type: TextEditor,
width: 300,
allowBlank: true,
value: principal,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'SECURITY_CREDENTIALS',
},
{
type: TextEditor,
width: 300,
allowBlank: true,
value: credentials,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: TextButton,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'),
width: 480,
textAlign: 'right',
ref: _ref => {
this.collapseRef = _ref;
},
handler: () => {
this.store.setIsCollapse(!this.model.isCollapse);
},
},
],
},
{
type: Vertical,
invisible: true,
ref: _ref => {
this.otherAttributesRef = _ref;
},
items: this._getOtherItems(),
},
],
},
],
},
{
type: Label,
cls: 'bi-error',
lgap: 10,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'),
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'),
},
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
},
{
type: TextValueCombo,
width: 300,
items: [{
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: originalCharsetName,
},
...CONNECT_CHARSET,
],
},
],
},
],
};
},
_getOtherItems() {
return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => {
return {
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: item.text,
},
{
type: TextEditor,
width: 300,
allowBlank: true,
value: this.options[item.name],
},
],
};
});
},
});
BI.shortcut(classNameEdit, Widget);
export default classNameEdit;

325
src/app/connection/right/right_edit/right_edit_mysql.ts

@ -1,325 +0,0 @@
import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index';
import {LinkType} from '@ui/type';
import {CONNECT_CHARSET} from '@private/constants';
import Model from '../../link_set.model';
import Title from '@shared/components/title';
import {getDrivers, connectNameChecker} from './right_edit.service';
let connectionName: any = null;
const className = 'dec.dcm.component.right.edit.mysql';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
connectionNameErr(msg: string) {
if (msg) {
BI.Bubbles.show('singleBubble', msg, connectionName, {
level: 'error',
});
} else {
BI.Bubbles.hide('singleBubble');
}
},
},
render() {
const linkSelected: LinkType = this.model.linkSelected;
const that = this;
return {
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'),
},
{
type: TextEditor,
width: 300,
value: linkSelected.connectionName,
ref(ref: any) {
connectionName = ref;
},
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
connectionName: this.getValue(),
});
},
}, {
eventName: BI.Editor.EVENT_FOCUS,
action() {
that.store.setConnectionNameErr('');
},
}],
},
{
type: Label,
cls: 'bi-water-mark',
lgap: 5,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'),
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
},
{
type: TextValueCombo,
width: 300,
text: linkSelected.driver,
items: getDrivers(linkSelected),
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
driver: this.getValue()[0],
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_URL'),
},
{
type: TextEditor,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.url,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
url: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
},
{
type: TextValueCombo,
width: 300,
text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName,
items: [
{
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: '',
},
...CONNECT_CHARSET,
],
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
originalCharsetName: this.getValue()[0],
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
},
{
type: TextEditor,
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.user,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
user: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
},
{
type: TextEditor,
inputType: 'password',
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
value: linkSelected.password,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
password: this.getValue(),
});
},
}],
},
],
},
{
type: Title,
text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'),
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
},
{
type: TextAreaEditor,
cls: 'bi-border',
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 300,
height: 100,
value: linkSelected.validationQuery,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
validationQuery: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
},
{
type: MultiSelectItem,
text: BI.i18nText('Dec-Dcm_Yes'),
selected: linkSelected.testOnBorrow,
width: 60,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
testOnBorrow: this.isSelected(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'),
},
{
type: TextEditor,
allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
width: 60,
value: linkSelected.maxActive,
errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'),
validationChecker: connectNameChecker,
listeners: [{
eventName: BI.Editor.EVENT_CHANGE,
action() {
that.store.setLinkUpdate({
...that.model.linkUpdate,
maxActive: this.getValue(),
});
},
}],
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Button,
width: 80,
text: BI.i18nText('Dec-Dcm_Test_Connection'),
level: 'ignore',
},
],
},
],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

20
src/app/connection/right/right_show/right_show.model.ts

@ -1,20 +0,0 @@
export const className = 'dec.dcm.model.components.right.show';
export const Model = BI.inherit(Fix.Model, {
state() {
return {
isCollapse: false,
};
},
computed: {
},
actions: {
setIsCollapse(status: boolean) {
this.model.isCollapse = status;
},
},
});
BI.model(className, Model);
export default className;

72
src/app/connection/right/right_show/right_show.ts

@ -1,72 +0,0 @@
import {WidgetType, Vertical} from '@ui/index';
import RightShowModel from '../../link_set.model';
import BothSide from '@shared/components/both_side';
import Title from '@shared/components/title';
import {LinkType} from '@ui/type';
const className = 'dec.dcm.component.right.show';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(RightShowModel);
},
render() {
const linkSelected: LinkType = this.model.linkSelected;
return {
type: Vertical,
vgap: 10,
items: [
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'),
rightText: linkSelected.connectionName,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
rightText: linkSelected.driver,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_URL'),
rightText: linkSelected.url,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
rightText: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
rightText: linkSelected.user,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
rightText: linkSelected.password,
},
{
type: Title,
text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'),
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
rightText: linkSelected.validationQuery,
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'),
rightText: linkSelected.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
},
{
type: BothSide,
leftText: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'),
rightText: linkSelected.maxActive,
},
],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

203
src/app/connection/right/right_show/right_show_jndi.ts

@ -1,203 +0,0 @@
import {Vertical, TextButton, Label, VerticalAdapt} from '@ui';
import {OTHER_ATTRIBUTES} from '@private/constants';
import {AttributeType} from '../right.typing';
import ModelName from './right_show.model';
const className = 'dec.dcm.component.right.show.jndi';
const Widget = BI.inherit(BI.Widget, {
_store() {
return BI.Models.getModel(ModelName);
},
watch: {
isCollapse(isCollapse) {
const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes');
this.collapseRef.setText(text);
this.otherAttributesRef.setVisible(isCollapse);
},
},
render() {
const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options;
return {
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
},
{
type: Label,
text: connectionName,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'),
},
{
type: Vertical,
vgap: 10,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'INTIAL_CONTEXT_FACTORY',
},
{
type: Label,
text: factory,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'PROVIDER_URL',
},
{
type: Label,
text: url,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'SECURITY_PRINCIPAL',
},
{
type: Label,
value: principal,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: 'SECURITY_CREDENTIALS',
},
{
type: Label,
value: credentials,
},
],
},
{
type: VerticalAdapt,
items: [
{
type: TextButton,
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'),
width: 480,
textAlign: 'right',
ref: _ref => {
this.collapseRef = _ref;
},
handler: () => {
this.store.setIsCollapse(!this.model.isCollapse);
},
},
],
},
{
type: Vertical,
invisible: true,
ref: _ref => {
this.otherAttributesRef = _ref;
},
items: this._getOtherItems(),
},
],
},
],
},
{
type: Label,
cls: 'bi-error',
lgap: 10,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'),
},
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 115,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'),
},
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
},
{
type: Label,
text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
},
],
},
],
};
},
_getOtherItems() {
return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => {
return {
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-font-bold',
width: 180,
textAlign: 'left',
text: item.text,
},
{
type: Label,
value: this.options[item.name],
},
],
};
});
},
});
BI.shortcut(className, Widget);
export default className;

20
src/app/connection/right/right_title/right_title.model.ts

@ -1,20 +0,0 @@
import LinksetMixin from '../../link_set.mixin';
import {LinkType} from '@ui/type';
const modelName = 'dec.dcm.model.component.right.title';
export const Model = BI.inherit(Fix.Model, {
context: ['linkSelected', 'linkList', 'linkUpdate'],
mixins: [LinksetMixin],
actions: {
onSave() {
const linkList: LinkType[] = this.model.linkList;
const result = BI.find(linkList, (idx: number, value: LinkType) => this.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== this.model.linkUpdate.connectionId);
if (result) {
this.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence'));
} else {
this.saveLink();
}
},
},
});
BI.model(modelName, Model);
export default modelName;

66
src/app/connection/right/right_title/right_title.ts

@ -1,66 +0,0 @@
import {WidgetType, Label, Button, LeftRightVerticalAdapt} from '@ui/index';
import RightTitleModel from './right_title.model';
import {LinkType} from '@ui/type';
import {OTHER_CONNECT} from '@private/constants';
const className = 'dec.dcm.component.right.title';
const Widget: WidgetType = {
props: {
baseCls: 'bi-border-bottom',
},
_store() {
return BI.Models.getModel(RightTitleModel);
},
render() {
const linkSelected: LinkType = this.model.linkSelected;
const that = this;
const {isEdit} = this.options;
const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text;
return {
type: LeftRightVerticalAdapt,
height: 40,
items: {
left: [
{
type: Label,
cls: 'bi-font-bold',
hgap: 10,
text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`,
},
],
right: [
{
type: Button,
hgap: 10,
invisible: isEdit,
text: BI.i18nText('Dec-Dcm_Edit'),
handler() {
that.store.setEdit(true);
},
},
{
type: Button,
hgap: 10,
invisible: !isEdit,
level: 'ignore',
text: BI.i18nText('BI-Basic_Cancel'),
handler() {
that.store.setCancel();
},
},
{
type: Button,
hgap: 10,
invisible: !isEdit,
text: BI.i18nText('Dec-Dcm_Save'),
handler() {
that.store.onSave();
},
},
],
},
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

23
src/app/connection/select/select.service.ts

@ -1,23 +0,0 @@
import {LinkType} from '@ui/type';
import pluginListConstant from '../../app.constant';
export const getCnnectionName = (links: LinkType[], name: string): string => {
const plugins: string[] = BI.Constants.getConstant(pluginListConstant);
let nameIndex = 0;
const title = name.replace(/[0-9]/g, '');
const isPlugin = BI.some(plugins, (index: number, item: string) => item === title);
const startWith = isPlugin ? title : BI.i18nText('Dec-Dcm_Data_Connections');
links.forEach(link => {
link.isSelected = false;
if (link.connectionName.startsWith(startWith)) {
const name = link.connectionName.replace(startWith, '0');
const index = parseInt(name, 10) + 1;
if (index > nameIndex) {
nameIndex = index;
}
}
});
return `${startWith}${nameIndex > 0 ? nameIndex : ''}`;
};

77
src/app/connection/select/select.ts

@ -1,77 +0,0 @@
import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui';
import selectModel from '../link_set.model';
import {moreLink} from '../more/more_link.service';
import connectList from '../../app.constant';
import {DATA_LINKS} from '@private/constants';
const className = 'dec.dcm.linkset.select';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(selectModel);
},
render() {
return {
type: Combo,
trigger: 'click',
adjustYOffset: 4,
el: {
type: 'bi.button',
text: BI.i18nText('Dec-Dcm_Connection_New'),
},
popup: {
el: {
type: ButtonGroup,
items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => {
return {
type: TextItem,
height: 24,
width: 152,
textLgap: 10,
text: item,
title: item,
value: item,
};
}), {
type: TextItem,
height: 24,
width: 152,
textLgap: 10,
text: BI.i18nText('Dec-Dcm_Connection_More'),
title: BI.i18nText('Dec-Dcm_Connection_More'),
value: 'more',
}, {
type: TextItem,
cls: 'bi-border-top',
height: 24,
width: 152,
textLgap: 10,
text: BI.i18nText('Dec-Dcm_Connection_Other'),
title: BI.i18nText('Dec-Dcm_Connection_Other'),
value: 'other',
}],
layouts: [{
type: Vertical,
}],
},
maxHeight: 400,
},
listeners: [{
eventName: 'EVENT_CHANGE',
action: (v: string) => {
if (v === 'more') {
moreLink((text: string) => {
this.store.setNewLink(text);
});
} else {
this.store.setNewLink(v);
}
this.combo.hideView();
},
}],
ref: _ref => {
this.combo = _ref;
},
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

17
src/app/status/left/left.model.ts

@ -1,17 +0,0 @@
import {ModelType} from '@ui';
const className = 'dec.dcm.model.linkstatus.left';
const Model: ModelType = {
context: ['tab', 'linkList', 'statusSelected'],
state () {
return {
selected: '',
};
},
actions: {
setStatusSelected(title: string) {
this.model.statusSelected = title;
},
},
};
BI.model(className, BI.inherit(Fix.Model, Model));
export default className;

44
src/app/status/left/left.ts

@ -1,44 +0,0 @@
import {WidgetType, ListView} from '@ui';
import Model from './left.model';
import {LinkType} from '@ui/type';
import LeftItem from './left_item';
const className = 'dec.dcm.component.linkStatus.left';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(Model);
},
watch: {
linkList(linkList: LinkType[]) {
const title = linkList.length > 0 ? linkList[0].connectionName : '';
this.store.setStatusSelected(title);
},
statusSelected(title: string) {
const linkList = this.model.linkList;
this.leftContent.populate(BI.createItems(this._renderItems(linkList, title)));
},
},
render() {
return {
type: ListView,
ref: _ref => {
this.leftContent = _ref;
},
items: this._renderItems(this.model.linkList, this.model.statusSelected),
};
},
_renderItems(linkList: LinkType[], selectTitle = '') {
return BI.map(linkList, (index: number, item: LinkType) => {
return {
type: LeftItem,
selected: item.connectionName === selectTitle,
title: item.connectionName,
id: item.connectionId,
creator: item.creator,
text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'),
};
});
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

39
src/app/status/left/left_item.ts

@ -1,39 +0,0 @@
import {WidgetType, TextButton, VerticalAdapt} from '@ui';
import Model from './left.model';
const className = 'dec.dcm.component.linkStatus.left.item';
const Widget: WidgetType = {
props: {
title: '',
id: '',
creator: '',
baseCls: 'bi-list-item-active',
},
_store() {
return BI.Models.getModel(Model);
},
render() {
const {title} = this.options;
return {
type: VerticalAdapt,
cls: 'bi-list-item-active',
height: 30,
items: [
{
type: TextButton,
cls: 'link-title',
lgap: 10,
textAlign: 'left',
text: title,
title,
},
],
};
},
doClick() {
const {title} = this.options;
this.store.setStatusSelected(title);
},
};
BI.shortcut(className, BI.inherit(BI.BasicButton, Widget));
export default className;

9
src/app/status/link_status.model.ts

@ -1,9 +0,0 @@
import {ModelType} from '@ui';
const className = 'dec.dcm.model.linkstatus';
const Model: ModelType = {
context: ['tab', 'linkList'],
actions: {
},
};
BI.model(className, BI.inherit(Fix.Model, Model));
export default className;

63
src/app/status/link_status.ts

@ -1,63 +0,0 @@
import {WidgetType, Htape, Vtape, Label, VerticalAdapt} from '@ui';
import linkStatusModel from './link_status.model';
import LeftList from './left/left';
import Right from './right/right';
import {TAB_LINK_POOL} from '@private/constants';
const className = 'dec.dcm.linkstatus';
const Widget: WidgetType = {
props: {
baseCls: 'bi-card',
},
_store() {
return BI.Models.getModel(linkStatusModel);
},
watch: {
tab(tab: string) {
this.linkStatus.setVisible(tab === TAB_LINK_POOL);
},
},
render() {
return {
type: Htape,
invisible: true,
ref: _ref => {
this.linkStatus = _ref;
},
items: [{
el: {
type: Vtape,
cls: 'dcm-link-left',
items: [
{
el: {
type: VerticalAdapt,
cls: 'bi-border-bottom',
items: [
{
type: Label,
cls: 'bi-font-bold',
hgap: 6,
vgap: 6,
text: BI.i18nText('Dec-Dcm_Data_Connections'),
},
],
},
height: 40,
}, {
type: LeftList,
cls: 'left-list',
},
],
},
width: 280,
}, {
type: Right,
cls: 'bi-border-left',
}],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

14
src/app/status/right/right.model.ts

@ -1,14 +0,0 @@
import {ModelType} from '@ui';
const className = 'dec.dcm.model.linkstatus.right';
const Model: ModelType = {
context: ['linkList', 'statusSelected'],
state () {
return {
selected: '',
};
},
actions: {
},
};
BI.model(className, BI.inherit(Fix.Model, Model));
export default className;

68
src/app/status/right/right.ts

@ -1,68 +0,0 @@
import {WidgetType, Label, ListView, VerticalAdapt, Vtape} 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 = 'dcm-link-form';
const Widget: WidgetType = {
props: {
baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom',
},
_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) => {
this.statusGroup.populate(BI.createItems([{
type: Pool,
...res,
}]));
});
this.statusTitle.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`);
},
},
render() {
return {
type: Vtape,
items: [
{
el: {
type: VerticalAdapt,
cls: 'bi-border-bottom',
items: [
{
type: Label,
cls: 'bi-font-bold',
lgap: 10,
text: BI.i18nText('Dec-Dcm_Data_Connections'),
},
],
ref: _ref => {
this.statusTitle = _ref;
},
},
height: 40,
}, {
type: ListView,
cls: 'right-status-body',
vgap: 10,
hgap: 10,
ref: _ref => {
this.statusGroup = _ref;
},
},
],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

6
src/app/status/right/right.typings.d.ts vendored

@ -1,6 +0,0 @@
export interface InfoType{
maxActive: number;
maxIdle: number;
numActive: number;
numIdle: number;
}

9
src/app/status/right/right_card.less

@ -1,9 +0,0 @@
@import '../../../less/index.less';
.dec-webui-dcm-status-right-card{
.card-font-success{
font-size: @font-size-30;
}
.card-font-heighlight{
font-size: @font-size-30;
}
}

91
src/app/status/right/right_card.ts

@ -1,91 +0,0 @@
import './right_card.less';
import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt, VerticalAdapt} from '@ui/index';
const className = 'dec.dcm.component.linkStatus.right.card';
const Widget: WidgetType = {
props: {
baseCls: 'dec-webui-dcm-status-right-card',
},
render() {
const {maxActive, maxIdle, numActive, numIdle} = this.options;
return {
type: FloatCenter,
height: 150,
hgap: 20,
items: [
{
type: Vertical,
cls: 'bi-background',
items: [
{
type: CenterAdapt,
cls: 'right-status-board-item',
tgap: 40,
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-high-light card-font-success',
text: numActive,
},
{
type: Label,
text: '/',
},
{
type: Label,
text: maxActive,
},
],
},
],
},
{
type: Label,
text: BI.i18nText('Dec-Dcm_Active_Connections_Number'),
},
],
},
{
type: Vertical,
cls: 'bi-background',
items: [
{
type: CenterAdapt,
tgap: 40,
cls: 'right-status-board-item',
items: [
{
type: VerticalAdapt,
items: [
{
type: Label,
cls: 'bi-high-light card-font-heighlight',
text: numIdle,
},
{
type: Label,
text: '/',
},
{
type: Label,
text: maxIdle,
},
],
},
],
},
{
type: Label,
text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'),
},
],
},
],
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

8
src/app/title/title.less

@ -1,8 +0,0 @@
@import '../../less/index.less';
.dec-webui-dcm-title{
.title-item-selected{
color: @background-color-highlight;
border-bottom-color:@border-color-highlight;
border-bottom-width: 2px;
}
}

11
src/app/title/title.model.ts

@ -1,11 +0,0 @@
const className = 'dec.dcm.model.title.item';
const Model = BI.inherit(Fix.Model, {
context: ['tab'],
actions: {
setTab(value: string) {
this.model.tab = value;
},
},
});
BI.model(className, Model);
export default className;

61
src/app/title/title.ts

@ -1,61 +0,0 @@
import './title.less';
import {WidgetType, IconButton, LeftRightVerticalAdapt, LinearSegment} from '@ui/index';
import Model from './title.model';
import {isDesigner, closeWindow} from '@shared/crud/crud.request';
import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants';
const className = 'dec.dcm.title';
const Widget: WidgetType = {
props: {
baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom',
},
_store() {
return BI.Models.getModel(Model);
},
render() {
const showCloseButton = isDesigner();
const that = this;
return {
type: LeftRightVerticalAdapt,
items: {
left: [
{
type: LinearSegment,
cls: 'bi-card',
height: 40,
width: 200,
items: [{
text: BI.i18nText('Dec-Dcm_Connection_Management'),
value: TAB_LINK_SET,
selected: true,
}, {
text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'),
value: TAB_LINK_POOL,
}],
listeners: [{
eventName: 'EVENT_CHANGE',
action () {
that.store.setTab(this.getValue()[0]);
},
}],
},
],
right: [
showCloseButton ? {
type: IconButton,
cls: 'close-ha-font',
width: 30,
height: 30,
rgap: 10,
handler() {
closeWindow();
},
} : null,
],
},
};
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
export default className;

91
src/demo/plugin.redis.edit.ts

@ -1,91 +0,0 @@
import './style.scss';
import {TextEditor, Vertical, Left, Label} from '@ui/index';
const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value';
const form = {
url: '192.168.1.22',
port: 6379,
password: '123456',
};
const classNameEdit = 'dec.dcm.plugin.redis.edit';
const Widget = BI.inherit(BI.Widget, {
render() {
return {
type: Vertical,
cls: 'bi-plugin-redis',
bgap: 10,
items: [
{
type: Left,
height: 30,
items: [
{
type: Label,
text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: TextEditor,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'),
value: form.url,
allowBlank: true,
width: 300,
height: 24,
}],
},
{
type: Left,
height: 30,
items: [
{
type: Label,
text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: TextEditor,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
allowBlank: true,
width: 300,
height: 24,
value: form.port,
errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'),
validationChecker (v: string) {
return /^\+?[1-9][0-9]*$/.test(v);
},
}],
},
{
type: Left,
height: 30,
items: [
{
type: Label,
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: TextEditor,
inputType: 'password',
value: form.password,
allowBlank: true,
width: 300,
height: 24,
}],
},
],
};
},
});
BI.shortcut(classNameEdit, Widget);
export default classNameEdit;
export const ConstantName = 'dec.constant.database.conf.connect.list';
BI.config(ConstantName, (datas: string[]) => [...datas, 'Redis']);
BI.constant(RedisConstantName, form);
BI.constant('dec.constant.database.conf.connect.form.redis.edit', classNameEdit);

68
src/demo/plugin.redis.preview.ts

@ -1,68 +0,0 @@
const classNamePreview = 'dec.dcm.plugin.redis.preview';
const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value';
const form = BI.Constants.getConstant(RedisConstantName);
const Widget = BI.inherit(BI.Widget, {
render() {
return {
type: 'bi.vertical',
cls: 'bi-plugin-redis',
bgap: 10,
items: [
{
type: 'bi.left',
height: 30,
items: [
{
type: 'bi.label',
text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: 'bi.label',
text: form.url,
height: 24,
}],
},
{
type: 'bi.left',
height: 30,
items: [
{
type: 'bi.label',
text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: 'bi.label',
text: form.port,
height: 24,
}],
},
{
type: 'bi.left',
height: 30,
items: [
{
type: 'bi.label',
text: BI.i18nText('Dec-Dcm_Connection_Form_Password'),
height: 24,
width: 115,
textAlign: 'left',
},
{
type: 'bi.label',
text: '********',
height: 24,
}],
},
],
};
},
});
BI.shortcut(classNamePreview, Widget);
BI.constant('dec.constant.database.conf.connect.form.redis.preview', classNamePreview);

53
src/demo/plugin.tedis.pool.ts

@ -1,53 +0,0 @@
const classNamePool = 'dec.dcm.plugin.redis.pool';
const WidgetPool = BI.inherit(BI.Widget, {
render() {
const {maxActive, maxIdle, numActive, numIdle} = this.options;
return {
type: 'bi.left',
items: [
{
type: 'bi.left',
cls: 'right-status-item',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board-item',
items: [
{
type: 'bi.label',
cls: 'right-status-text',
text: numActive,
},
{
type: 'bi.label',
cls: 'right-status-text',
text: '/',
},
{
type: 'bi.label',
cls: 'right-status-text',
text: maxActive,
},
],
},
{
type: 'bi.label',
height: 20,
text: BI.i18nText('Dec-Dcm_Active_Connections_Number'),
},
],
},
],
},
],
};
},
});
BI.shortcut(classNamePool, WidgetPool);
BI.constant('dec.constant.database.conf.connect.form.redis.pool', classNamePool);

3
src/demo/style.scss

@ -1,3 +0,0 @@
.bi-plugin-redis{
padding: 20px;
}

BIN
src/img/ads.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
src/img/amazon-redshift.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
src/img/apache-impala.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/apache-kylin.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
src/img/apache-phoenix.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
src/img/database-selected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/img/derby.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
src/img/error.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

BIN
src/img/gbase-8a.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
src/img/gbase-8s.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
src/img/gbase-8t.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

BIN
src/img/h2.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
src/img/hadoop-hive.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
src/img/hbase.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
src/img/hp-vertica.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/hsql.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/hw-dws.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
src/img/hw-elk.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
src/img/hw-fusioninsight-hd.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/hw-libr-a.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
src/img/ibm-db2.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
src/img/icon_close9x9_normal.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

BIN
src/img/informix.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
src/img/kingbase.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
src/img/loading.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
src/img/mysql.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

BIN
src/img/oracle.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
src/img/pivotal-greenplum-database.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/postgresql.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

BIN
src/img/presto.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
src/img/resources.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
src/img/sap-hana.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

BIN
src/img/sap-sybase.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/spark.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/sql-server.jpeg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/sql-server.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
src/img/sqlite.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
src/img/success.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

BIN
src/img/teradata.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
src/img/transwarp-inceptor.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save