From 38dfec8d7f4ac839205d8bbef06725273ad62694 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 11:06:15 +0800 Subject: [PATCH 01/12] docs: update readme --- README.md | 151 ------------------------------------------------------ readme.md | 3 -- 2 files changed, 154 deletions(-) delete mode 100644 README.md delete mode 100644 readme.md diff --git a/README.md b/README.md deleted file mode 100644 index 0e5c11f..0000000 --- a/README.md +++ /dev/null @@ -1,151 +0,0 @@ -# database-connection 数据连接设置页面 -![start](https://img.shields.io/badge/start-2019%2F04%2F26-blue.svg) ![finui](https://img.shields.io/badge/lib-FinUi-blue.svg) - -[KERNEL-493](http://www.finedevelop.com:2016/browse/KERNEL-493) -## 开始 -下载代码 - -``` -git clone ssh://git@cloud.finedevelop.com:7999/~alan/database-connection.git -``` -安装依赖 - -``` -yarn -``` - -开始开发 -``` -yarn start -``` - -## 接口文档 -### 增加数据连接类型 -使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.list`,值为连接的名称 - -例如增加`Redis`的连接: - -```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); -``` \ No newline at end of file diff --git a/readme.md b/readme.md deleted file mode 100644 index ebed952..0000000 --- a/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# Database Connection Manager - -用于决策平台和设计器中管理数据连接的通用管理器 \ No newline at end of file From 96d6865f5ee606511f5b37005a07a64bace9cd94 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 11:06:48 +0800 Subject: [PATCH 02/12] docs: update readme --- README.md | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f42fee0 --- /dev/null +++ b/README.md @@ -0,0 +1,152 @@ +Database Connection Manager +用于决策平台和设计器中管理数据连接的通用管理器 + +![finui](https://img.shields.io/badge/lib-FinUi-blue.svg) + +## 开始 +下载代码 + +``` +git clone ssh://git@cloud.finedevelop.com:7999/~alan/database-connection.git +``` +安装依赖 + +``` +yarn +``` + +开始开发 +``` +yarn start +``` + +## 接口文档 +### 增加数据连接类型 +使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.list`,值为连接的名称 + +例如增加`Redis`的连接: + +```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); +``` \ No newline at end of file From 8147214a6ba193d88e514e8509db47f5a406f206 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 11:07:09 +0800 Subject: [PATCH 03/12] docs: update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f42fee0..5821f32 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Database Connection Manager +# Database Connection Manager + 用于决策平台和设计器中管理数据连接的通用管理器 ![finui](https://img.shields.io/badge/lib-FinUi-blue.svg) From cecb3f1eb5edae46dd10c88283ffd19940755a31 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 14:34:33 +0800 Subject: [PATCH 04/12] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/app/app.model.ts | 2 +- src/app/link_set/left/left.service.ts | 2 +- .../left/left_item/left.item.component.ts | 10 +-- .../left_item/left.item.icon.component.ts | 6 +- src/app/link_set/link-set.component.ts | 2 +- src/app/link_set/link-set.model.ts | 16 ++--- src/app/link_set/more/more.link.component.ts | 2 +- src/app/link_set/more/more.link.service.ts | 6 +- src/app/link_set/right/nothing.component.ts | 8 +-- .../right/right_edit/right.edit.component.ts | 48 +++++++-------- .../right/right_edit/right.edit.constant.ts | 1 + .../right_edit/right.edit.mysql.component.ts | 42 ++++++------- .../right/right_show/right.show.component.ts | 24 ++++---- .../right_title/right.title.component.ts | 11 ++-- src/app/link_set/select/select.component.ts | 12 ++-- src/app/link_set/select/select.service.ts | 4 +- src/app/link_status/left/left.service.ts | 2 +- src/app/link_status/link_status.component.ts | 4 +- .../link_status/right/right.card.component.ts | 4 +- src/app/link_status/right/right.component.ts | 4 +- src/app/title/title.component.ts | 4 +- .../title/title_item/title_item.component.ts | 2 +- src/demo/plugin.redis.edit.ts | 12 ++-- src/demo/plugin.redis.preview.ts | 6 +- src/demo/plugin.tedis.pool.ts | 3 +- src/index.html | 1 + src/index.ts | 1 + src/lib/locale/i18n_zh_CN.js | 61 +++++++++++++++++++ src/shared/service/dialog.service.ts | 12 ++-- types/globals.d.ts | 1 + 31 files changed, 188 insertions(+), 126 deletions(-) create mode 100644 src/lib/locale/i18n_zh_CN.js diff --git a/package.json b/package.json index b323524..716314e 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "author": "alan ", "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", diff --git a/src/app/app.model.ts b/src/app/app.model.ts index 2b57da2..6294f1e 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -7,7 +7,7 @@ const Model: ModelType = { childContext: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'moreLinkSelected', 'statusSelected', 'connectionNameErr'], state () { return { - tab: '数据连接管理', + tab: BI.i18nText('BI-Data_Connection_Management'), linkList, linkSelected: {}, linkUpdate: {}, diff --git a/src/app/link_set/left/left.service.ts b/src/app/link_set/left/left.service.ts index 9a915a3..9c8350e 100644 --- a/src/app/link_set/left/left.service.ts +++ b/src/app/link_set/left/left.service.ts @@ -10,7 +10,7 @@ export const getLinks = (linkList: LinkType[]): any => { title: item.connectionName, id: item.connectionId, creator: item.creator, - text: item.text ? item.text : '默认', + text: item.text ? item.text : BI.i18nText('BI-Default'), }); }); diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left.item.component.ts index dab4019..49fd551 100644 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ b/src/app/link_set/left/left_item/left.item.component.ts @@ -24,7 +24,7 @@ const Widget: WidgetType = { cls: 'link-font', height: 24, width: 26, - text: '连接', + text: BI.i18nText('BI-Connections'), title, }, { @@ -41,25 +41,25 @@ const Widget: WidgetType = { { type: ItemIcon, cls: 'link-text-font', - title: '测试连接', + title: BI.i18nText('BI-Test-Connection'), id, }, { type: ItemIcon, cls: 'copy-font', - title: '复制', + title: BI.i18nText('BI-Copy'), id, }, { type: ItemIcon, cls: 'info-font', - title: `类型:${text === 'DESIGNER' ? '其他' : text} \r\n创建者:${creator}`, + title: `${BI.i18nText('BI-Type')}:${text === 'DESIGNER' ? BI.i18nText('BI-Other') : text} \r\n${BI.i18nText('BI-Creator')}:${creator}`, id, }, { type: ItemIcon, cls: 'delete-font', - title: '删除', + title: BI.i18nText('BI-Delete'), id, }, ], diff --git a/src/app/link_set/left/left_item/left.item.icon.component.ts b/src/app/link_set/left/left_item/left.item.icon.component.ts index fa7354c..cded2ae 100644 --- a/src/app/link_set/left/left_item/left.item.icon.component.ts +++ b/src/app/link_set/left/left_item/left.item.icon.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { const that = this; let iconContent: any = null; let combo: any = null; - if (title === '删除') { + if (title === BI.i18nText('BI-Delete')) { return { type: BubbleCombo, direction: 'bottom', @@ -30,7 +30,7 @@ const Widget: WidgetType = { }, popup: { type: TextBubblePopupBarView, - text: '确定删除该数据连接?', + text: BI.i18nText('BI-Connection-Make-Sure-Delete'), listeners: [{ eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, action (type: boolean) { @@ -70,7 +70,7 @@ const Widget: WidgetType = { }, mounted() { const {title, id} = this.options; - if (title !== '删除') { + if (title !== BI.i18nText('BI-Delete')) { this.element.on('click', (event: any) => { event.stopPropagation(); this.store.onIconClick(title, id); diff --git a/src/app/link_set/link-set.component.ts b/src/app/link_set/link-set.component.ts index 9597ea3..8b89d13 100644 --- a/src/app/link_set/link-set.component.ts +++ b/src/app/link_set/link-set.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { }, watch:{ tab(tab: string) { - this.setVisible(tab === '数据连接管理'); + this.setVisible(tab === BI.i18nText('BI-Data_Connection_Management')); }, }, render() { diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts index f9761f0..45e1d2a 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link-set.model.ts @@ -33,17 +33,17 @@ const Model: ModelType = { }, onIconClick(title: string, id: string) { switch (title) { - case '删除': + case BI.i18nText('BI-Delete'): deleteConnection(id, () => { this.model.linkList = [...this.model.linkList.filter((item: LinkType) => item.connectionId !== id)]; this.model.linkSelected = {}; this.model.linkUpdate = {}; }); break; - case '测试连接': + case BI.i18nText('BI-Test-Connection'): this._textLink(id); break; - case '复制': + case BI.i18nText('BI-Copy'): this.noSaveConfirm(() => { this.copyLink(id); }); @@ -53,16 +53,16 @@ const Model: ModelType = { } }, _textLink(id: string) { - const loadingId = dialog.loading('正在测试连接,请稍候...'); + const loadingId = dialog.loading(BI.i18nText('BI-Connection-Testing')); const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); testConnection(link, (res: any) => { dialog.close(loadingId); if (res && res.errorCode) { - dialog.linkFail(`${link.connectionName}测试连接失败`, res.errorMsg, () => { + dialog.linkFail(`${link.connectionName}${BI.i18nText('BI-Connection-Test-Fail')}`, res.errorMsg, () => { this._textLink(id); }); } else { - dialog.success('连接成功'); + dialog.success(BI.i18nText('BI-Connection-Test-Success')); } }); }, @@ -125,7 +125,7 @@ const Model: ModelType = { }, setNewLink(value: string) { if (!databaseTyle.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { - dialog.error('找不到该连接的配置信息'); + dialog.error(BI.i18nText('BI-Connection-Option-Cannot-Find')); return; } @@ -167,7 +167,7 @@ const Model: ModelType = { }, noSaveConfirm(cb: Function) { if (this.model.linkSelected && this.model.linkSelected.isSelected) { - dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { + dialog.confirm(BI.i18nText('BI-Connection-Config-No-Save'), (isConfirm: boolean) => { if (isConfirm) { this.saveLink(); } else { diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 3c0eac4..163c5e0 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -15,7 +15,7 @@ const Widget: WidgetType = { items:[{ type: SearchEditor, width: 300, - watermark: '搜索', + watermark: BI.i18nText('BI-Search'), }], }, height: 30, diff --git a/src/app/link_set/more/more.link.service.ts b/src/app/link_set/more/more.link.service.ts index 1e4f9ca..247573d 100644 --- a/src/app/link_set/more/more.link.service.ts +++ b/src/app/link_set/more/more.link.service.ts @@ -7,7 +7,7 @@ export const moreLink = (onConfirm?: Function): void => { BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: '更多数据连接', + header: BI.i18nText('BI-Connection-More-Title'), width: 550, height: 500, body: { @@ -27,7 +27,7 @@ export const moreLink = (onConfirm?: Function): void => { lgap: 10, items: [{ type: 'bi.button', - text: '取消', + text: BI.i18nText('BI-Basic_Cancel'), value: 1, level: 'ignore', handler (v: any) { @@ -35,7 +35,7 @@ export const moreLink = (onConfirm?: Function): void => { }, }, { type: 'bi.button', - text: '确定', + text: BI.i18nText('BI-Basic_Sure'), disabled: true, value: 0, ref(ref: any) { diff --git a/src/app/link_set/right/nothing.component.ts b/src/app/link_set/right/nothing.component.ts index ef4d938..e18db76 100644 --- a/src/app/link_set/right/nothing.component.ts +++ b/src/app/link_set/right/nothing.component.ts @@ -19,13 +19,7 @@ const Widget: WidgetType = { type:Label, cls: 'bi-tips', height: 20, - text:'请选择左侧数据连接或点击新建数据连接', - }, - { - type:Label, - cls: 'bi-tips', - height: 20, - text:'平台仅支持使用JDBC的数据连接的管理', + text: BI.i18nText('BI-Connection-Plase-Add-One'), }, ], diff --git a/src/app/link_set/right/right_edit/right.edit.component.ts b/src/app/link_set/right/right_edit/right.edit.component.ts index 52dc0a8..4fb5312 100644 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.component.ts @@ -32,8 +32,8 @@ const Widget: WidgetType = { items: [ { type: FormItem, - text: '数据连接名', - hint: '*修改数据连接名会影响相关数据表和仪表板', + text: BI.i18nText('BI-Connection-Form-ConnectionName'), + hint: BI.i18nText('BI-Connection-Form-ConnectionName-Change-Confirm'), form:{ type: Editor, cls: 'bi-border', @@ -60,7 +60,7 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '第一步', + text: BI.i18nText('BI-First_Step'), height: 400, form:{ type: Vertical, @@ -68,7 +68,7 @@ const Widget: WidgetType = { items:[ { type: FormItem, - text: '驱动器', + text: BI.i18nText('BI-Connection-Form-Driver'), form:{ type: TextValueCombo, cls: 'bi-border', @@ -88,11 +88,11 @@ const Widget: WidgetType = { }, { type: FormItem, - text: 'URL', + text: BI.i18nText('BI-Connection-Form-URL'), form:{ type: Editor, cls: 'bi-border', - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -108,12 +108,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '编码', + text: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), form:{ type: TextValueCombo, cls: 'bi-border', width: 300, - text: linkSelected.originalCharsetName === '' ? '自动' : linkSelected.originalCharsetName, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, items: BI.Constants.getConstant(charset), listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, @@ -128,12 +128,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '用户名', + text: BI.i18nText('BI-Connection-Form-UserName'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -149,13 +149,13 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '密码', + text: BI.i18nText('BI-Connection-Form-Password'), form:{ type: Editor, cls: 'bi-border', inputType:'password', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -171,17 +171,17 @@ const Widget: WidgetType = { }, { type: Title, - text: '连接池属性', + text: BI.i18nText('BI-Connection-Form-Pool-Properties'), }, { type: FormItem, - text: 'SQL验证查询', + text: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), height: 100, form:{ type: TextAreaEditor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, height:100, value: linkSelected.validationQuery, @@ -198,10 +198,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '获取连接前校验', + text: BI.i18nText('BI-Connection-Form-Connection-Check'), form:{ type: MultiSelectItem, - text: '是', + text: BI.i18nText('BI-Yes'), selected: linkSelected.testOnBorrow, width: 60, listeners: [{ @@ -217,15 +217,15 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '最大活动连接数', + text: BI.i18nText('BI-Connection-Form-Connection-Max-Number'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 60, value: linkSelected.maxActive, - errorText: '请输入有效的正整数', + errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -249,19 +249,19 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '第二步', + text: BI.i18nText('BI-Second_Step'), form: { type: Button, - text: '测试连接', + text: BI.i18nText('BI-Test-Connection'), level: 'ignore', }, }, { type: FormItem, - text: '第三步', + text: BI.i18nText('BI-Third_Step'), form: { type: FormItem, - text: '模式', + text: BI.i18nText('BI-Connection-Form-Pattern'), form: { type: Editor, cls: 'bi-border', diff --git a/src/app/link_set/right/right_edit/right.edit.constant.ts b/src/app/link_set/right/right_edit/right.edit.constant.ts index 28a5dfe..d74d953 100644 --- a/src/app/link_set/right/right_edit/right.edit.constant.ts +++ b/src/app/link_set/right/right_edit/right.edit.constant.ts @@ -1,4 +1,5 @@ export const ConstantName = 'bi.constant.database.conf.charset.list'; + export const Constant = BI.constant(ConstantName, [ { text: '自动', diff --git a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts index 7fba51b..2486c13 100644 --- a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts @@ -20,8 +20,8 @@ const Widget: WidgetType = { items: [ { type: FormItem, - text: '数据连接名', - hint: '*修改数据连接名会影响相关数据表和仪表板', + text: BI.i18nText('BI-Connection-Form-ConnectionName'), + hint: BI.i18nText('BI-Connection-Form-ConnectionName-Change-Confirm'), form:{ type: Editor, cls: 'bi-border', @@ -40,7 +40,7 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '驱动器', + text: BI.i18nText('BI-Connection-Form-Driver'), form:{ type: TextValueCombo, cls: 'bi-border', @@ -60,11 +60,11 @@ const Widget: WidgetType = { }, { type: FormItem, - text: 'URL', + text: BI.i18nText('BI-Connection-Form-URL'), form:{ type: Editor, cls: 'bi-border', - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -80,12 +80,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '编码', + text: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), form:{ type: TextValueCombo, cls: 'bi-border', width: 300, - text: linkSelected.originalCharsetName === '' ? '自动' : linkSelected.originalCharsetName, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, items: BI.Constants.getConstant(charset), listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, @@ -100,12 +100,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '用户名', + text: BI.i18nText('BI-Connection-Form-UserName'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -121,13 +121,13 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '密码', + text: BI.i18nText('BI-Connection-Form-Password'), form:{ type: Editor, cls: 'bi-border', inputType:'password', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -143,17 +143,17 @@ const Widget: WidgetType = { }, { type: Title, - text: '连接池属性', + text: BI.i18nText('BI-Connection-Form-Pool-Properties'), }, { type: FormItem, - text: 'SQL验证查询', + text: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), height: 100, form:{ type: TextAreaEditor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 300, height:100, value: linkSelected.validationQuery, @@ -170,10 +170,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '获取连接前校验', + text: BI.i18nText('BI-Connection-Form-Connection-Check'), form:{ type: MultiSelectItem, - text: '是', + text: BI.i18nText('BI-Yes'), selected: linkSelected.testOnBorrow, width: 60, listeners: [{ @@ -189,15 +189,15 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '最大活动连接数', + text: BI.i18nText('BI-Connection-Form-Connection-Max-Number'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:'请输入', + watermark:BI.i18nText('BI-Connection-Form-Place-Input'), width: 60, value: linkSelected.maxActive, - errorText: '请输入有效的正整数', + errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -218,10 +218,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: '测试连接', + text: BI.i18nText('BI-Test-Connection'), form: { type: Button, - text: '测试连接', + text: BI.i18nText('BI-Test-Connection'), level: 'ignore', }, }, diff --git a/src/app/link_set/right/right_show/right.show.component.ts b/src/app/link_set/right/right_show/right.show.component.ts index fa6b668..ca7b736 100644 --- a/src/app/link_set/right/right_show/right.show.component.ts +++ b/src/app/link_set/right/right_show/right.show.component.ts @@ -17,51 +17,51 @@ const Widget: WidgetType = { items: [ { type: BothSide, - leftText: '数据连接名', + leftText: BI.i18nText('BI-Connection-Form-ConnectionName'), rightText: linkSelected.connectionName, }, { type: BothSide, - leftText: '驱动器', + leftText: BI.i18nText('BI-Connection-Form-Driver'), rightText: linkSelected.driver, }, { type: BothSide, - leftText: 'URL', + leftText: BI.i18nText('BI-Connection-Form-URL'), rightText: linkSelected.url, }, { type: BothSide, - leftText: '编码', - rightText: linkSelected.originalCharsetName === '' ? '自动' : linkSelected.originalCharsetName, + leftText: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), + rightText: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, }, { type: BothSide, - leftText: '用户名', + leftText: BI.i18nText('BI-Connection-Form-UserName'), rightText: linkSelected.user, }, { type: BothSide, - leftText: '密码', + leftText: BI.i18nText('BI-Connection-Form-Password'), rightText: linkSelected.password, }, { type: Title, - text: '连接池属性', + text: BI.i18nText('BI-Connection-Form-Pool-Properties'), }, { type: BothSide, - leftText: 'SQL验证查询', + leftText: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), rightText: linkSelected.validationQuery, }, { type: BothSide, - leftText: '获取连接前校验', - rightText: linkSelected.testOnBorrow ? '是' : '否', + leftText: BI.i18nText('BI-Connection-Form-Connection-Check'), + rightText: linkSelected.testOnBorrow ? BI.i18nText('BI-Yes') : BI.i18nText('BI-No'), }, { type: BothSide, - leftText: '最大连接数量', + leftText: BI.i18nText('BI-Connection-Form-Connection-Max-Number'), rightText: linkSelected.maxActive, }, ], diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts index 308ce12..95c4ca8 100644 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ b/src/app/link_set/right/right_title/right.title.component.ts @@ -12,6 +12,7 @@ const Widget: WidgetType = { const linkList: LinkType[] = this.model.linkList; const that = this; const {isEdit} = this.options; + const title = linkSelected.text === 'other' ? BI.i18nText('BI-Connection-Other') : linkSelected.text; return { type: Left, @@ -21,13 +22,13 @@ const Widget: WidgetType = { { type: Label, cls: 'right-title-text', - text: `数据连接(${linkSelected.text ? linkSelected.text : '默认'})`, + text: `${BI.i18nText('BI-Data_Connections')}(${title ? title : BI.i18nText('BI-Default')})`, }, { type: Button, cls:'right-title-button', invisible: isEdit, - text: '编辑', + text: BI.i18nText('BI-Edit'), handler() { that.store.setEdit(true); }, @@ -36,11 +37,11 @@ const Widget: WidgetType = { type: Button, cls:'right-title-button', invisible: !isEdit, - text: '保存', + text: BI.i18nText('BI-Save'), handler() { const result = BI.find(linkList, (idx: number, value: LinkType) => that.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== that.model.linkUpdate.connectionId); if (result) { - that.store.setConnectionNameErr('数据连接名已存在'); + that.store.setConnectionNameErr(BI.i18nText('BI-Connection-Is-Existence')); } else { that.store.saveLink(); } @@ -51,7 +52,7 @@ const Widget: WidgetType = { cls:'right-title-button', invisible: !isEdit, level: 'ignore', - text: '取消', + text: BI.i18nText('BI-Basic_Cancel'), handler() { that.store.setCancel(); }, diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.component.ts index cdbe8e6..ec26689 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.component.ts @@ -17,7 +17,7 @@ const Widget: WidgetType = { adjustYOffset: 4, el: { type: 'bi.button', - text: '新建数据连接', + text: BI.i18nText('BI-Connection-New'), height: 24, }, popup: { @@ -38,17 +38,17 @@ const Widget: WidgetType = { cls: 'link-item', height: 24, width: 152, - text: '更多数据连接...', - title:'更多数据连接...', + text: BI.i18nText('BI-Connection-More'), + title: BI.i18nText('BI-Connection-More'), value: 'more', }, { type: TextItem, cls: 'link-item', height: 24, width: 152, - text: '其他', - title:'其他', - value: '其他', + text: BI.i18nText('BI-Connection-Other'), + title: BI.i18nText('BI-Connection-Other'), + value: 'other', }], layouts: [{ type: Vertical, diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index 37d2b08..fe05085 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -70,7 +70,7 @@ export const databaseTyle = [ url: 'jdbc:mysql://localhost/dbname', }, { - text:'其他', + text:'other', databaseType: 'other', driver: 'org.h2.Driver', drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], @@ -266,7 +266,7 @@ export const getCnnectionName = (links: LinkType[], name: string): string => { 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 : '数据连接'; + const startWith = isPlugin ? title : BI.i18nText('BI-Data_Connections'); links.forEach(link => { link.isSelected = false; diff --git a/src/app/link_status/left/left.service.ts b/src/app/link_status/left/left.service.ts index 7df380c..e1de494 100644 --- a/src/app/link_status/left/left.service.ts +++ b/src/app/link_status/left/left.service.ts @@ -10,7 +10,7 @@ export const getLinks = (linkList: LinkType[], selectTitle = ''): any => { title: item.connectionName, id: item.connectionId, creator: item.creator, - text: item.text ? item.text : '默认', + text: item.text ? item.text : BI.i18nText('BI-Default'), }); }); diff --git a/src/app/link_status/link_status.component.ts b/src/app/link_status/link_status.component.ts index 196174d..bb09f96 100644 --- a/src/app/link_status/link_status.component.ts +++ b/src/app/link_status/link_status.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { }, watch:{ tab(tab: string) { - this.setVisible(tab === '连接池状态'); + this.setVisible(tab === BI.i18nText('BI-Pool_Connection_Management')); }, }, render() { @@ -30,7 +30,7 @@ const Widget: WidgetType = { { type: Label, cls:'status-title', - text: '数据连接', + text: BI.i18nText('BI-Data_Connections'), }, ], }, diff --git a/src/app/link_status/right/right.card.component.ts b/src/app/link_status/right/right.card.component.ts index 6249ced..ffce69a 100644 --- a/src/app/link_status/right/right.card.component.ts +++ b/src/app/link_status/right/right.card.component.ts @@ -40,7 +40,7 @@ const Widget: WidgetType = { { type: Label, height: 20, - text: '活动连接数', + text: BI.i18nText('BI-Active_Connections_Number'), }, ], }, @@ -79,7 +79,7 @@ const Widget: WidgetType = { { type: Label, height: 20, - text: '空闲连接数', + text: BI.i18nText('BI-Leisure_Connections_Number'), }, ], }, diff --git a/src/app/link_status/right/right.component.ts b/src/app/link_status/right/right.component.ts index 35c4122..31b638a 100644 --- a/src/app/link_status/right/right.component.ts +++ b/src/app/link_status/right/right.component.ts @@ -26,7 +26,7 @@ const Widget: WidgetType = { ...res, }])); }); - Title.setText(`数据连接(${title})`); + Title.setText(`${BI.i18nText('BI-Data_Connections')}(${title})`); }, }, render() { @@ -41,7 +41,7 @@ const Widget: WidgetType = { items:[ { type: Label, - text:'数据连接', + text:BI.i18nText('BI-Data_Connections'), }, ], ref(ref: any) { diff --git a/src/app/title/title.component.ts b/src/app/title/title.component.ts index 3aaa127..e8dd994 100644 --- a/src/app/title/title.component.ts +++ b/src/app/title/title.component.ts @@ -1,7 +1,7 @@ import {Left, WidgetType, IconButton} from '@ui/index'; import TitleItem from './title_item/title_item.component'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; -const tabs = ['数据连接管理', '连接池状态']; +const tabs = ['BI-Data_Connection_Management', 'BI-Pool_Connection_Management']; const className = 'fr.title'; const Widget: WidgetType = { render() { @@ -12,7 +12,7 @@ const Widget: WidgetType = { ...BI.map(tabs, (index: number, text: string) => { return { type: TitleItem, - text, + text: BI.i18nText(text), }; }), { diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts index 7a3adef..ffba11d 100644 --- a/src/app/title/title_item/title_item.component.ts +++ b/src/app/title/title_item/title_item.component.ts @@ -26,7 +26,7 @@ const Widget = BI.inherit(BI.Widget, { }, mounted() { const {text} = this.options; - this.element.css(getSelectStyle('数据连接管理', text)); + this.element.css(getSelectStyle(BI.i18nText('BI-Data_Connection_Management'), text)); this.element.on('click', () => { this.store.setTab(text); }); diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index 49a8f6b..c1630dd 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -20,7 +20,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '数据库地址:', + text: BI.i18nText('BI-Connection-Form-Database-Addr'), height: 24, width: 115, textAlign: 'left', @@ -28,7 +28,7 @@ const Widget = BI.inherit(BI.Widget, { { type: 'bi.editor', cls: 'bi-border', - watermark: '数据库地址', + watermark: BI.i18nText('BI-Connection-Form-Database-Addr'), value:form.url, allowBlank: true, width: 300, @@ -41,7 +41,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '端口:', + text: BI.i18nText('BI-Connection-Form-Database-Port'), height: 24, width: 115, textAlign: 'left', @@ -49,12 +49,12 @@ const Widget = BI.inherit(BI.Widget, { { type: 'bi.editor', cls: 'bi-border', - watermark: '端口', + watermark: BI.i18nText('BI-Connection-Form-Database-Port'), allowBlank: true, width: 300, height: 24, value: form.port, - errorText: '请输入有效的正整数', + errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -70,7 +70,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '密码:', + text: BI.i18nText('BI-Connection-Form-Password'), height: 24, width: 115, textAlign: 'left', diff --git a/src/demo/plugin.redis.preview.ts b/src/demo/plugin.redis.preview.ts index 7082bf3..ff12daa 100644 --- a/src/demo/plugin.redis.preview.ts +++ b/src/demo/plugin.redis.preview.ts @@ -15,7 +15,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '数据库地址:', + text: BI.i18nText('BI-Connection-Form-Database-Addr'), height: 24, width: 115, textAlign: 'left', @@ -32,7 +32,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '端口:', + text: BI.i18nText('BI-Connection-Form-Database-Port'), height: 24, width: 115, textAlign: 'left', @@ -49,7 +49,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: '密码:', + text: BI.i18nText('BI-Connection-Form-Password'), height: 24, width: 115, textAlign: 'left', diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 4dc1c0d..50d9ffd 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -39,7 +39,8 @@ const WidgetPool = BI.inherit(BI.Widget, { }, { type: 'bi.label', - text: 'Redis连接数', + height: 20, + text: BI.i18nText('BI-Active_Connections_Number'), }, ], }, diff --git a/src/index.html b/src/index.html index c4b8ed2..c402e16 100644 --- a/src/index.html +++ b/src/index.html @@ -7,6 +7,7 @@ + diff --git a/src/index.ts b/src/index.ts index 7a5ad89..7203543 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ BI.DOM.ready(() => { const app = require('./app/app.component').default; + BI.i18n = Store.i18n; BI.createWidget({ type:app, element: 'body', diff --git a/src/lib/locale/i18n_zh_CN.js b/src/lib/locale/i18n_zh_CN.js new file mode 100644 index 0000000..601c24c --- /dev/null +++ b/src/lib/locale/i18n_zh_CN.js @@ -0,0 +1,61 @@ +var Store = { + i18n : { + 'BI-Basic_Cancel': '取消', + 'BI-Basic_Sure': '确定', + 'BI-Data_Connection_Management': '数据连接管理', + 'BI-Pool_Connection_Management': '连接池管理', + 'BI-Data_Connections': '数据连接', + 'BI-Active_Connections_Number': '活动连接数', + 'BI-Leisure_Connections_Number': '空闲连接数', + 'BI-Connections': '连接', + 'BI-Default': '默认', + 'BI-Delete': '删除', + 'BI-Test-Connection': '测试连接', + 'BI-Copy': '复制', + 'BI-Edit': '编辑', + 'BI-Save': '保存', + 'BI-Yes': '是', + 'BI-No': '否', + 'BI-Search': '搜索', + 'BI-Type': '类型', + 'BI-Other': '其他', + 'BI-Tips': '提示', + 'BI-Back': '返回', + 'BI-Creator': '创建者', + 'BI-First_Step': '第一步', + 'BI-Second_Step': '第一步', + 'BI-Third_Step': '第一步', + 'BI-Connection-Detailed-Information': '详细信息', + 'BI-Connection-Handup-Information': '收起信息', + 'BI-Connection-Testing': '正在测试连接,请稍候...', + 'BI-Connection-Test-Fail': '测试连接失败', + 'BI-Connection-Test-Success': '连接成功', + 'BI-Connection-Option-Cannot-Find': '找不到该连接的配置信息', + 'BI-Connection-Config-No-Save': '当前设置尚未保存,是否保存?', + 'BI-Connection-New': '新建数据连接', + 'BI-Connection-More': '更多数据连接...', + 'BI-Connection-More-Title': '更多数据连接', + 'BI-Connection-Other': '其他', + 'BI-Connection-Plase-Add-One': '请选择左侧数据连接或点击新建数据连接', + 'BI-Connection-Is-Existence': '数据连接名已存在', + 'BI-Connection-Form-ConnectionName': '数据连接名', + 'BI-Connection-Form-ConnectionName-Change-Confirm': '*修改数据连接名会影响相关数据表和仪表板', + 'BI-Connection-Form-Driver': '驱动器', + 'BI-Connection-Form-URL': 'URL', + 'BI-Connection-Form-Place-Input': '请输入', + 'BI-Connection-Form-OriginalCharsetName': '编码', + 'BI-Connection-Form-Auto': '自动', + 'BI-Connection-Form-UserName': '用户名', + 'BI-Connection-Form-Password': '密码', + 'BI-Connection-Form-Pool-Properties': '连接池属性', + 'BI-Connection-Form-SQL-Validation-Query': 'SQL验证查询', + 'BI-Connection-Form-Connection-Check': '获取连接前校验', + 'BI-Connection-Form-Connection-Max-Number': '最大活动连接数', + 'BI-Connection-Form-Place-Input-Number': '请输入有效的正整数', + 'BI-Connection-Form-Pattern': '模式', + 'BI-Connection-Form-Database-Addr': '数据库地址', + 'BI-Connection-Form-Database-Port': '端口号', + 'BI-Connection-Make-Sure-Delete': '确定删除该数据连接?', + 'BI-Connection-ReConnect': '重新连接', + }} +window.Store = Store; \ No newline at end of file diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 349e25c..13e53ea 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -10,7 +10,7 @@ class Dialog { BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: '提示', + header: BI.i18nText('BI-Tips'), width: 450, height: 220, body: { @@ -156,20 +156,20 @@ class Dialog { items:[ { type: Button, - text:'详细信息', + text: BI.i18nText('BI-Connection-Detailed-Information'), level: 'ignore', handler() { - const isHide = this.getText() === '详细信息'; + const isHide = this.getText() === BI.i18nText('BI-Connection-Detailed-Information'); Popover.element.css({ height: isHide ? '290' : '220', }); More.setVisible(isHide); - this.setText(isHide ? '收起信息' : '详细信息'); + this.setText(isHide ? BI.i18nText('BI-Connection-Handup-Information') : BI.i18nText('BI-Connection-Detailed-Information')); }, }, { type: Button, - text:'返回', + text: BI.i18nText('BI-Back'), level: 'ignore', handler() { that.close(id); @@ -177,7 +177,7 @@ class Dialog { }, { type: Button, - text:'重新连接', + text: BI.i18nText('BI-Connection-ReConnect'), handler() { that.close(id); cb ? cb() : null; diff --git a/types/globals.d.ts b/types/globals.d.ts index 3a1bc4b..44cf726 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -6,3 +6,4 @@ declare let BI: Obj; declare const Fix: Obj; declare const Dec: Obj; declare const PluginHelper: Obj; +declare const Store: Obj; From 4caf1371494576c027ac44e5a1d290678d7c3113 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 17:16:06 +0800 Subject: [PATCH 05/12] =?UTF-8?q?refactor:=20=E6=A0=B9=E6=8D=AE=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E4=BF=AE=E6=94=B9=E5=9B=BD=E9=99=85=E5=8C=96=E7=9A=84?= =?UTF-8?q?key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.model.ts | 2 +- src/app/link_set/left/left.service.ts | 2 +- .../left/left_item/left.item.component.ts | 10 +- .../left_item/left.item.icon.component.ts | 6 +- src/app/link_set/link-set.component.ts | 2 +- src/app/link_set/link-set.model.ts | 16 +-- src/app/link_set/more/more.link.component.ts | 2 +- src/app/link_set/more/more.link.service.ts | 2 +- src/app/link_set/right/nothing.component.ts | 4 +- .../right/right_edit/right.edit.component.ts | 48 ++++---- .../right_edit/right.edit.mysql.component.ts | 42 +++---- .../right/right_show/right.show.component.ts | 24 ++-- .../right_title/right.title.component.ts | 10 +- src/app/link_set/select/select.component.ts | 10 +- src/app/link_set/select/select.service.ts | 2 +- src/app/link_status/left/left.service.ts | 2 +- src/app/link_status/link_status.component.ts | 4 +- .../link_status/right/right.card.component.ts | 4 +- src/app/link_status/right/right.component.ts | 4 +- src/app/title/title.component.ts | 2 +- .../title/title_item/title_item.component.ts | 2 +- src/demo/plugin.redis.edit.ts | 12 +- src/demo/plugin.redis.preview.ts | 6 +- src/demo/plugin.tedis.pool.ts | 2 +- src/lib/locale/i18n_zh_CN.js | 110 +++++++++--------- src/shared/service/dialog.service.ts | 12 +- 26 files changed, 171 insertions(+), 171 deletions(-) diff --git a/src/app/app.model.ts b/src/app/app.model.ts index 6294f1e..8e3d4e9 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -7,7 +7,7 @@ const Model: ModelType = { childContext: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'moreLinkSelected', 'statusSelected', 'connectionNameErr'], state () { return { - tab: BI.i18nText('BI-Data_Connection_Management'), + tab: BI.i18nText('Dec-Dcm_Connection_Management'), linkList, linkSelected: {}, linkUpdate: {}, diff --git a/src/app/link_set/left/left.service.ts b/src/app/link_set/left/left.service.ts index 9c8350e..8f792c4 100644 --- a/src/app/link_set/left/left.service.ts +++ b/src/app/link_set/left/left.service.ts @@ -10,7 +10,7 @@ export const getLinks = (linkList: LinkType[]): any => { title: item.connectionName, id: item.connectionId, creator: item.creator, - text: item.text ? item.text : BI.i18nText('BI-Default'), + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), }); }); diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left.item.component.ts index 49fd551..2134e59 100644 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ b/src/app/link_set/left/left_item/left.item.component.ts @@ -24,7 +24,7 @@ const Widget: WidgetType = { cls: 'link-font', height: 24, width: 26, - text: BI.i18nText('BI-Connections'), + text: BI.i18nText('Dec-Dcm_Connections'), title, }, { @@ -41,25 +41,25 @@ const Widget: WidgetType = { { type: ItemIcon, cls: 'link-text-font', - title: BI.i18nText('BI-Test-Connection'), + title: BI.i18nText('Dec-Dcm_Test_Connection'), id, }, { type: ItemIcon, cls: 'copy-font', - title: BI.i18nText('BI-Copy'), + title: BI.i18nText('Dec-Dcm_Copy'), id, }, { type: ItemIcon, cls: 'info-font', - title: `${BI.i18nText('BI-Type')}:${text === 'DESIGNER' ? BI.i18nText('BI-Other') : text} \r\n${BI.i18nText('BI-Creator')}:${creator}`, + title: `${BI.i18nText('Dec-Dcm_Type')}:${text === 'DESIGNER' ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, id, }, { type: ItemIcon, cls: 'delete-font', - title: BI.i18nText('BI-Delete'), + title: BI.i18nText('Dec-Dcm_Delete'), id, }, ], diff --git a/src/app/link_set/left/left_item/left.item.icon.component.ts b/src/app/link_set/left/left_item/left.item.icon.component.ts index cded2ae..f8e4300 100644 --- a/src/app/link_set/left/left_item/left.item.icon.component.ts +++ b/src/app/link_set/left/left_item/left.item.icon.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { const that = this; let iconContent: any = null; let combo: any = null; - if (title === BI.i18nText('BI-Delete')) { + if (title === BI.i18nText('Dec-Dcm_Delete')) { return { type: BubbleCombo, direction: 'bottom', @@ -30,7 +30,7 @@ const Widget: WidgetType = { }, popup: { type: TextBubblePopupBarView, - text: BI.i18nText('BI-Connection-Make-Sure-Delete'), + text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'), listeners: [{ eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, action (type: boolean) { @@ -70,7 +70,7 @@ const Widget: WidgetType = { }, mounted() { const {title, id} = this.options; - if (title !== BI.i18nText('BI-Delete')) { + if (title !== BI.i18nText('Dec-Dcm_Delete')) { this.element.on('click', (event: any) => { event.stopPropagation(); this.store.onIconClick(title, id); diff --git a/src/app/link_set/link-set.component.ts b/src/app/link_set/link-set.component.ts index 8b89d13..c39e192 100644 --- a/src/app/link_set/link-set.component.ts +++ b/src/app/link_set/link-set.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { }, watch:{ tab(tab: string) { - this.setVisible(tab === BI.i18nText('BI-Data_Connection_Management')); + this.setVisible(tab === BI.i18nText('Dec-Dcm_Connection_Management')); }, }, render() { diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts index 45e1d2a..ac0f912 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link-set.model.ts @@ -33,17 +33,17 @@ const Model: ModelType = { }, onIconClick(title: string, id: string) { switch (title) { - case BI.i18nText('BI-Delete'): + 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('BI-Test-Connection'): + case BI.i18nText('Dec-Dcm_Test_Connection'): this._textLink(id); break; - case BI.i18nText('BI-Copy'): + case BI.i18nText('Dec-Dcm_Copy'): this.noSaveConfirm(() => { this.copyLink(id); }); @@ -53,16 +53,16 @@ const Model: ModelType = { } }, _textLink(id: string) { - const loadingId = dialog.loading(BI.i18nText('BI-Connection-Testing')); + const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); testConnection(link, (res: any) => { dialog.close(loadingId); if (res && res.errorCode) { - dialog.linkFail(`${link.connectionName}${BI.i18nText('BI-Connection-Test-Fail')}`, res.errorMsg, () => { + dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { this._textLink(id); }); } else { - dialog.success(BI.i18nText('BI-Connection-Test-Success')); + dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success')); } }); }, @@ -125,7 +125,7 @@ const Model: ModelType = { }, setNewLink(value: string) { if (!databaseTyle.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { - dialog.error(BI.i18nText('BI-Connection-Option-Cannot-Find')); + dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find')); return; } @@ -167,7 +167,7 @@ const Model: ModelType = { }, noSaveConfirm(cb: Function) { if (this.model.linkSelected && this.model.linkSelected.isSelected) { - dialog.confirm(BI.i18nText('BI-Connection-Config-No-Save'), (isConfirm: boolean) => { + dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => { if (isConfirm) { this.saveLink(); } else { diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 163c5e0..4cfce6b 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -15,7 +15,7 @@ const Widget: WidgetType = { items:[{ type: SearchEditor, width: 300, - watermark: BI.i18nText('BI-Search'), + watermark: BI.i18nText('Dec-Dcm_Search'), }], }, height: 30, diff --git a/src/app/link_set/more/more.link.service.ts b/src/app/link_set/more/more.link.service.ts index 247573d..cf2c654 100644 --- a/src/app/link_set/more/more.link.service.ts +++ b/src/app/link_set/more/more.link.service.ts @@ -7,7 +7,7 @@ export const moreLink = (onConfirm?: Function): void => { BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: BI.i18nText('BI-Connection-More-Title'), + header: BI.i18nText('Dec-Dcm_Connection_More-Title'), width: 550, height: 500, body: { diff --git a/src/app/link_set/right/nothing.component.ts b/src/app/link_set/right/nothing.component.ts index e18db76..dd9268a 100644 --- a/src/app/link_set/right/nothing.component.ts +++ b/src/app/link_set/right/nothing.component.ts @@ -17,9 +17,9 @@ const Widget: WidgetType = { }, { type:Label, - cls: 'bi-tips', + cls: 'Dec-Dcm_Tips', height: 20, - text: BI.i18nText('BI-Connection-Plase-Add-One'), + text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, ], diff --git a/src/app/link_set/right/right_edit/right.edit.component.ts b/src/app/link_set/right/right_edit/right.edit.component.ts index 4fb5312..e7129d2 100644 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.component.ts @@ -32,8 +32,8 @@ const Widget: WidgetType = { items: [ { type: FormItem, - text: BI.i18nText('BI-Connection-Form-ConnectionName'), - hint: BI.i18nText('BI-Connection-Form-ConnectionName-Change-Confirm'), + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), + hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), form:{ type: Editor, cls: 'bi-border', @@ -60,7 +60,7 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-First_Step'), + text: BI.i18nText('Dec-Dcm_First_Step'), height: 400, form:{ type: Vertical, @@ -68,7 +68,7 @@ const Widget: WidgetType = { items:[ { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Driver'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form:{ type: TextValueCombo, cls: 'bi-border', @@ -88,11 +88,11 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-URL'), + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), form:{ type: Editor, cls: 'bi-border', - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -108,12 +108,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form:{ type: TextValueCombo, cls: 'bi-border', width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: BI.Constants.getConstant(charset), listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, @@ -128,12 +128,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-UserName'), + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -149,13 +149,13 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Password'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), form:{ type: Editor, cls: 'bi-border', inputType:'password', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -171,17 +171,17 @@ const Widget: WidgetType = { }, { type: Title, - text: BI.i18nText('BI-Connection-Form-Pool-Properties'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), height: 100, form:{ type: TextAreaEditor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, height:100, value: linkSelected.validationQuery, @@ -198,10 +198,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Connection-Check'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), form:{ type: MultiSelectItem, - text: BI.i18nText('BI-Yes'), + text: BI.i18nText('Dec-Dcm_Yes'), selected: linkSelected.testOnBorrow, width: 60, listeners: [{ @@ -217,15 +217,15 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Connection-Max-Number'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 60, value: linkSelected.maxActive, - errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -249,19 +249,19 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Second_Step'), + text: BI.i18nText('Dec-Dcm_Second_Step'), form: { type: Button, - text: BI.i18nText('BI-Test-Connection'), + text: BI.i18nText('Dec-Dcm_Test_Connection'), level: 'ignore', }, }, { type: FormItem, - text: BI.i18nText('BI-Third_Step'), + text: BI.i18nText('Dec-Dcm_Third_Step'), form: { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Pattern'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), form: { type: Editor, cls: 'bi-border', diff --git a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts index 2486c13..161a1f1 100644 --- a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts @@ -20,8 +20,8 @@ const Widget: WidgetType = { items: [ { type: FormItem, - text: BI.i18nText('BI-Connection-Form-ConnectionName'), - hint: BI.i18nText('BI-Connection-Form-ConnectionName-Change-Confirm'), + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), + hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), form:{ type: Editor, cls: 'bi-border', @@ -40,7 +40,7 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Driver'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form:{ type: TextValueCombo, cls: 'bi-border', @@ -60,11 +60,11 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-URL'), + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), form:{ type: Editor, cls: 'bi-border', - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -80,12 +80,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form:{ type: TextValueCombo, cls: 'bi-border', width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: BI.Constants.getConstant(charset), listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, @@ -100,12 +100,12 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-UserName'), + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -121,13 +121,13 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Password'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), form:{ type: Editor, cls: 'bi-border', inputType:'password', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -143,17 +143,17 @@ const Widget: WidgetType = { }, { type: Title, - text: BI.i18nText('BI-Connection-Form-Pool-Properties'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), height: 100, form:{ type: TextAreaEditor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, height:100, value: linkSelected.validationQuery, @@ -170,10 +170,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Connection-Check'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), form:{ type: MultiSelectItem, - text: BI.i18nText('BI-Yes'), + text: BI.i18nText('Dec-Dcm_Yes'), selected: linkSelected.testOnBorrow, width: 60, listeners: [{ @@ -189,15 +189,15 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Connection-Form-Connection-Max-Number'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), form:{ type: Editor, cls: 'bi-border', allowBlank:true, - watermark:BI.i18nText('BI-Connection-Form-Place-Input'), + watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 60, value: linkSelected.maxActive, - errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -218,10 +218,10 @@ const Widget: WidgetType = { }, { type: FormItem, - text: BI.i18nText('BI-Test-Connection'), + text: BI.i18nText('Dec-Dcm_Test_Connection'), form: { type: Button, - text: BI.i18nText('BI-Test-Connection'), + text: BI.i18nText('Dec-Dcm_Test_Connection'), level: 'ignore', }, }, diff --git a/src/app/link_set/right/right_show/right.show.component.ts b/src/app/link_set/right/right_show/right.show.component.ts index ca7b736..74d293f 100644 --- a/src/app/link_set/right/right_show/right.show.component.ts +++ b/src/app/link_set/right/right_show/right.show.component.ts @@ -17,51 +17,51 @@ const Widget: WidgetType = { items: [ { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-ConnectionName'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), rightText: linkSelected.connectionName, }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-Driver'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), rightText: linkSelected.driver, }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-URL'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_URL'), rightText: linkSelected.url, }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-OriginalCharsetName'), - rightText: linkSelected.originalCharsetName === '' ? BI.i18nText('BI-Connection-Form-Auto') : linkSelected.originalCharsetName, + 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('BI-Connection-Form-UserName'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), rightText: linkSelected.user, }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-Password'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_Password'), rightText: linkSelected.password, }, { type: Title, - text: BI.i18nText('BI-Connection-Form-Pool-Properties'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-SQL-Validation-Query'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), rightText: linkSelected.validationQuery, }, { type: BothSide, - leftText: BI.i18nText('BI-Connection-Form-Connection-Check'), - rightText: linkSelected.testOnBorrow ? BI.i18nText('BI-Yes') : BI.i18nText('BI-No'), + 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('BI-Connection-Form-Connection-Max-Number'), + leftText: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), rightText: linkSelected.maxActive, }, ], diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts index 95c4ca8..cb1d547 100644 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ b/src/app/link_set/right/right_title/right.title.component.ts @@ -12,7 +12,7 @@ const Widget: WidgetType = { const linkList: LinkType[] = this.model.linkList; const that = this; const {isEdit} = this.options; - const title = linkSelected.text === 'other' ? BI.i18nText('BI-Connection-Other') : linkSelected.text; + const title = linkSelected.text === 'other' ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; return { type: Left, @@ -22,13 +22,13 @@ const Widget: WidgetType = { { type: Label, cls: 'right-title-text', - text: `${BI.i18nText('BI-Data_Connections')}(${title ? title : BI.i18nText('BI-Default')})`, + text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`, }, { type: Button, cls:'right-title-button', invisible: isEdit, - text: BI.i18nText('BI-Edit'), + text: BI.i18nText('Dec-Dcm_Edit'), handler() { that.store.setEdit(true); }, @@ -37,11 +37,11 @@ const Widget: WidgetType = { type: Button, cls:'right-title-button', invisible: !isEdit, - text: BI.i18nText('BI-Save'), + text: BI.i18nText('Dec-Dcm_Save'), handler() { const result = BI.find(linkList, (idx: number, value: LinkType) => that.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== that.model.linkUpdate.connectionId); if (result) { - that.store.setConnectionNameErr(BI.i18nText('BI-Connection-Is-Existence')); + that.store.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); } else { that.store.saveLink(); } diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.component.ts index ec26689..cf3d65f 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.component.ts @@ -17,7 +17,7 @@ const Widget: WidgetType = { adjustYOffset: 4, el: { type: 'bi.button', - text: BI.i18nText('BI-Connection-New'), + text: BI.i18nText('Dec-Dcm_Connection_New'), height: 24, }, popup: { @@ -38,16 +38,16 @@ const Widget: WidgetType = { cls: 'link-item', height: 24, width: 152, - text: BI.i18nText('BI-Connection-More'), - title: BI.i18nText('BI-Connection-More'), + text: BI.i18nText('Dec-Dcm_Connection_More'), + title: BI.i18nText('Dec-Dcm_Connection_More'), value: 'more', }, { type: TextItem, cls: 'link-item', height: 24, width: 152, - text: BI.i18nText('BI-Connection-Other'), - title: BI.i18nText('BI-Connection-Other'), + text: BI.i18nText('Dec-Dcm_Connection_Other'), + title: BI.i18nText('Dec-Dcm_Connection_Other'), value: 'other', }], layouts: [{ diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index fe05085..7599ce3 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -266,7 +266,7 @@ export const getCnnectionName = (links: LinkType[], name: string): string => { 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('BI-Data_Connections'); + const startWith = isPlugin ? title : BI.i18nText('Dec-Dcm_Data_Connections'); links.forEach(link => { link.isSelected = false; diff --git a/src/app/link_status/left/left.service.ts b/src/app/link_status/left/left.service.ts index e1de494..2bfdf88 100644 --- a/src/app/link_status/left/left.service.ts +++ b/src/app/link_status/left/left.service.ts @@ -10,7 +10,7 @@ export const getLinks = (linkList: LinkType[], selectTitle = ''): any => { title: item.connectionName, id: item.connectionId, creator: item.creator, - text: item.text ? item.text : BI.i18nText('BI-Default'), + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), }); }); diff --git a/src/app/link_status/link_status.component.ts b/src/app/link_status/link_status.component.ts index bb09f96..6ff84da 100644 --- a/src/app/link_status/link_status.component.ts +++ b/src/app/link_status/link_status.component.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { }, watch:{ tab(tab: string) { - this.setVisible(tab === BI.i18nText('BI-Pool_Connection_Management')); + this.setVisible(tab === BI.i18nText('Dec-Dcm_Pool_Connection_Management')); }, }, render() { @@ -30,7 +30,7 @@ const Widget: WidgetType = { { type: Label, cls:'status-title', - text: BI.i18nText('BI-Data_Connections'), + text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], }, diff --git a/src/app/link_status/right/right.card.component.ts b/src/app/link_status/right/right.card.component.ts index ffce69a..fc73314 100644 --- a/src/app/link_status/right/right.card.component.ts +++ b/src/app/link_status/right/right.card.component.ts @@ -40,7 +40,7 @@ const Widget: WidgetType = { { type: Label, height: 20, - text: BI.i18nText('BI-Active_Connections_Number'), + text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), }, ], }, @@ -79,7 +79,7 @@ const Widget: WidgetType = { { type: Label, height: 20, - text: BI.i18nText('BI-Leisure_Connections_Number'), + text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), }, ], }, diff --git a/src/app/link_status/right/right.component.ts b/src/app/link_status/right/right.component.ts index 31b638a..c5da67c 100644 --- a/src/app/link_status/right/right.component.ts +++ b/src/app/link_status/right/right.component.ts @@ -26,7 +26,7 @@ const Widget: WidgetType = { ...res, }])); }); - Title.setText(`${BI.i18nText('BI-Data_Connections')}(${title})`); + Title.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`); }, }, render() { @@ -41,7 +41,7 @@ const Widget: WidgetType = { items:[ { type: Label, - text:BI.i18nText('BI-Data_Connections'), + text:BI.i18nText('Dec-Dcm_Data_Connections'), }, ], ref(ref: any) { diff --git a/src/app/title/title.component.ts b/src/app/title/title.component.ts index e8dd994..0e99285 100644 --- a/src/app/title/title.component.ts +++ b/src/app/title/title.component.ts @@ -1,7 +1,7 @@ import {Left, WidgetType, IconButton} from '@ui/index'; import TitleItem from './title_item/title_item.component'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; -const tabs = ['BI-Data_Connection_Management', 'BI-Pool_Connection_Management']; +const tabs = ['Dec-Dcm_Connection_Management', 'Dec-Dcm_Pool_Connection_Management']; const className = 'fr.title'; const Widget: WidgetType = { render() { diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts index ffba11d..056366a 100644 --- a/src/app/title/title_item/title_item.component.ts +++ b/src/app/title/title_item/title_item.component.ts @@ -26,7 +26,7 @@ const Widget = BI.inherit(BI.Widget, { }, mounted() { const {text} = this.options; - this.element.css(getSelectStyle(BI.i18nText('BI-Data_Connection_Management'), text)); + this.element.css(getSelectStyle(BI.i18nText('Dec-Dcm_Connection_Management'), text)); this.element.on('click', () => { this.store.setTab(text); }); diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index c1630dd..a785278 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -20,7 +20,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Database-Addr'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), height: 24, width: 115, textAlign: 'left', @@ -28,7 +28,7 @@ const Widget = BI.inherit(BI.Widget, { { type: 'bi.editor', cls: 'bi-border', - watermark: BI.i18nText('BI-Connection-Form-Database-Addr'), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), value:form.url, allowBlank: true, width: 300, @@ -41,7 +41,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Database-Port'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), height: 24, width: 115, textAlign: 'left', @@ -49,12 +49,12 @@ const Widget = BI.inherit(BI.Widget, { { type: 'bi.editor', cls: 'bi-border', - watermark: BI.i18nText('BI-Connection-Form-Database-Port'), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), allowBlank: true, width: 300, height: 24, value: form.port, - errorText: BI.i18nText('BI-Connection-Form-Place-Input-Number'), + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), validationChecker (v: string) { if (/^\+?[1-9][0-9]*$/.test(v)) { return true; @@ -70,7 +70,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Password'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), height: 24, width: 115, textAlign: 'left', diff --git a/src/demo/plugin.redis.preview.ts b/src/demo/plugin.redis.preview.ts index ff12daa..a3708e0 100644 --- a/src/demo/plugin.redis.preview.ts +++ b/src/demo/plugin.redis.preview.ts @@ -15,7 +15,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Database-Addr'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), height: 24, width: 115, textAlign: 'left', @@ -32,7 +32,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Database-Port'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), height: 24, width: 115, textAlign: 'left', @@ -49,7 +49,7 @@ const Widget = BI.inherit(BI.Widget, { items: [ { type: 'bi.label', - text: BI.i18nText('BI-Connection-Form-Password'), + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), height: 24, width: 115, textAlign: 'left', diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 50d9ffd..6469e88 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -40,7 +40,7 @@ const WidgetPool = BI.inherit(BI.Widget, { { type: 'bi.label', height: 20, - text: BI.i18nText('BI-Active_Connections_Number'), + text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), }, ], }, diff --git a/src/lib/locale/i18n_zh_CN.js b/src/lib/locale/i18n_zh_CN.js index 601c24c..0bec5ce 100644 --- a/src/lib/locale/i18n_zh_CN.js +++ b/src/lib/locale/i18n_zh_CN.js @@ -2,60 +2,60 @@ var Store = { i18n : { 'BI-Basic_Cancel': '取消', 'BI-Basic_Sure': '确定', - 'BI-Data_Connection_Management': '数据连接管理', - 'BI-Pool_Connection_Management': '连接池管理', - 'BI-Data_Connections': '数据连接', - 'BI-Active_Connections_Number': '活动连接数', - 'BI-Leisure_Connections_Number': '空闲连接数', - 'BI-Connections': '连接', - 'BI-Default': '默认', - 'BI-Delete': '删除', - 'BI-Test-Connection': '测试连接', - 'BI-Copy': '复制', - 'BI-Edit': '编辑', - 'BI-Save': '保存', - 'BI-Yes': '是', - 'BI-No': '否', - 'BI-Search': '搜索', - 'BI-Type': '类型', - 'BI-Other': '其他', - 'BI-Tips': '提示', - 'BI-Back': '返回', - 'BI-Creator': '创建者', - 'BI-First_Step': '第一步', - 'BI-Second_Step': '第一步', - 'BI-Third_Step': '第一步', - 'BI-Connection-Detailed-Information': '详细信息', - 'BI-Connection-Handup-Information': '收起信息', - 'BI-Connection-Testing': '正在测试连接,请稍候...', - 'BI-Connection-Test-Fail': '测试连接失败', - 'BI-Connection-Test-Success': '连接成功', - 'BI-Connection-Option-Cannot-Find': '找不到该连接的配置信息', - 'BI-Connection-Config-No-Save': '当前设置尚未保存,是否保存?', - 'BI-Connection-New': '新建数据连接', - 'BI-Connection-More': '更多数据连接...', - 'BI-Connection-More-Title': '更多数据连接', - 'BI-Connection-Other': '其他', - 'BI-Connection-Plase-Add-One': '请选择左侧数据连接或点击新建数据连接', - 'BI-Connection-Is-Existence': '数据连接名已存在', - 'BI-Connection-Form-ConnectionName': '数据连接名', - 'BI-Connection-Form-ConnectionName-Change-Confirm': '*修改数据连接名会影响相关数据表和仪表板', - 'BI-Connection-Form-Driver': '驱动器', - 'BI-Connection-Form-URL': 'URL', - 'BI-Connection-Form-Place-Input': '请输入', - 'BI-Connection-Form-OriginalCharsetName': '编码', - 'BI-Connection-Form-Auto': '自动', - 'BI-Connection-Form-UserName': '用户名', - 'BI-Connection-Form-Password': '密码', - 'BI-Connection-Form-Pool-Properties': '连接池属性', - 'BI-Connection-Form-SQL-Validation-Query': 'SQL验证查询', - 'BI-Connection-Form-Connection-Check': '获取连接前校验', - 'BI-Connection-Form-Connection-Max-Number': '最大活动连接数', - 'BI-Connection-Form-Place-Input-Number': '请输入有效的正整数', - 'BI-Connection-Form-Pattern': '模式', - 'BI-Connection-Form-Database-Addr': '数据库地址', - 'BI-Connection-Form-Database-Port': '端口号', - 'BI-Connection-Make-Sure-Delete': '确定删除该数据连接?', - 'BI-Connection-ReConnect': '重新连接', + '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': '重新连接', }} window.Store = Store; \ No newline at end of file diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 13e53ea..6a30e15 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -10,7 +10,7 @@ class Dialog { BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: BI.i18nText('BI-Tips'), + header: BI.i18nText('Dec-Dcm_Tips'), width: 450, height: 220, body: { @@ -156,20 +156,20 @@ class Dialog { items:[ { type: Button, - text: BI.i18nText('BI-Connection-Detailed-Information'), + text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), level: 'ignore', handler() { - const isHide = this.getText() === BI.i18nText('BI-Connection-Detailed-Information'); + const isHide = this.getText() === BI.i18nText('Dec-Dcm_Connection_Detailed_Information'); Popover.element.css({ height: isHide ? '290' : '220', }); More.setVisible(isHide); - this.setText(isHide ? BI.i18nText('BI-Connection-Handup-Information') : BI.i18nText('BI-Connection-Detailed-Information')); + this.setText(isHide ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information')); }, }, { type: Button, - text: BI.i18nText('BI-Back'), + text: BI.i18nText('Dec-Dcm_Back'), level: 'ignore', handler() { that.close(id); @@ -177,7 +177,7 @@ class Dialog { }, { type: Button, - text: BI.i18nText('BI-Connection-ReConnect'), + text: BI.i18nText('Dec-Dcm_Connection_ReConnect'), handler() { that.close(id); cb ? cb() : null; From a3274ac89074dd2fbc62bd80dae52aa6604d908f Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 17:23:10 +0800 Subject: [PATCH 06/12] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E7=9A=84=E5=BC=95=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 55 ++++++++++++++++++++++++++++++++ private/i18n.ts | 57 +++++++++++++++++++++++++++++++++ src/index.html | 3 +- src/index.ts | 4 ++- src/lib/locale/i18n_zh_CN.js | 61 ------------------------------------ 5 files changed, 117 insertions(+), 63 deletions(-) create mode 100644 i18n/zh_cn.properties create mode 100644 private/i18n.ts delete mode 100644 src/lib/locale/i18n_zh_CN.js diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties new file mode 100644 index 0000000..6509988 --- /dev/null +++ b/i18n/zh_cn.properties @@ -0,0 +1,55 @@ +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= 重新连接 \ No newline at end of file diff --git a/private/i18n.ts b/private/i18n.ts new file mode 100644 index 0000000..3f234ea --- /dev/null +++ b/private/i18n.ts @@ -0,0 +1,57 @@ +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': '重新连接', +}; diff --git a/src/index.html b/src/index.html index c402e16..f0a076b 100644 --- a/src/index.html +++ b/src/index.html @@ -5,9 +5,10 @@ 数据库连接设置 + + - diff --git a/src/index.ts b/src/index.ts index 7203543..6c892fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,8 @@ +import i18n from '../private/i18n'; BI.DOM.ready(() => { const app = require('./app/app.component').default; - BI.i18n = Store.i18n; + // TODO: 先采用这种方式方便前端调试 + BI.addI18n(i18n); BI.createWidget({ type:app, element: 'body', diff --git a/src/lib/locale/i18n_zh_CN.js b/src/lib/locale/i18n_zh_CN.js deleted file mode 100644 index 0bec5ce..0000000 --- a/src/lib/locale/i18n_zh_CN.js +++ /dev/null @@ -1,61 +0,0 @@ -var Store = { - i18n : { - 'BI-Basic_Cancel': '取消', - 'BI-Basic_Sure': '确定', - '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': '重新连接', - }} -window.Store = Store; \ No newline at end of file From 6188e34a449e266a29b57108aa2cfe695520bb9b Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 17 May 2019 17:31:00 +0800 Subject: [PATCH 07/12] =?UTF-8?q?refactor:=20=E5=B0=86=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E7=AC=A6=E9=85=8D=E7=BD=AE=E4=B8=BA=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/link_set/right/right_title/right.title.component.ts | 4 ++-- src/app/link_set/select/select.service.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts index cb1d547..11f690d 100644 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ b/src/app/link_set/right/right_title/right.title.component.ts @@ -1,7 +1,7 @@ import {WidgetType, Left, Label, Button} from '@ui/index'; import RightTitleModel from '../../link-set.model'; import {LinkType} from '@ui/type'; -import {saveConnection} from '../../link-set.service'; +import {OTHER_CONNECT} from '../../select/select.service'; const className = 'fr.component.right.title'; const Widget: WidgetType = { _store() { @@ -12,7 +12,7 @@ const Widget: WidgetType = { const linkList: LinkType[] = this.model.linkList; const that = this; const {isEdit} = this.options; - const title = linkSelected.text === 'other' ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; + const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; return { type: Left, diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index 7599ce3..0a01813 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -1,5 +1,9 @@ import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; +/** + * 其他连接方式 + */ +export const OTHER_CONNECT = 'other'; export const databaseTyle = [ { @@ -70,7 +74,7 @@ export const databaseTyle = [ url: 'jdbc:mysql://localhost/dbname', }, { - text:'other', + text: OTHER_CONNECT, databaseType: 'other', driver: 'org.h2.Driver', drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], From 9996539b5dc605b43d129fbc5f492d5a318e4dbb Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 20 May 2019 09:07:24 +0800 Subject: [PATCH 08/12] =?UTF-8?q?refactor:=20=E5=B0=86=E5=B8=B8=E9=87=8F?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 1 + src/app/link_set/right/right_title/right.title.component.ts | 2 +- src/app/link_set/select/select.service.ts | 5 +---- tsconfig.json | 2 ++ webpack.config.js | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 private/constants.ts diff --git a/private/constants.ts b/private/constants.ts new file mode 100644 index 0000000..000b796 --- /dev/null +++ b/private/constants.ts @@ -0,0 +1 @@ +export const OTHER_CONNECT = 'other'; diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts index 11f690d..5a1281f 100644 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ b/src/app/link_set/right/right_title/right.title.component.ts @@ -1,7 +1,7 @@ import {WidgetType, Left, Label, Button} from '@ui/index'; import RightTitleModel from '../../link-set.model'; import {LinkType} from '@ui/type'; -import {OTHER_CONNECT} from '../../select/select.service'; +import {OTHER_CONNECT} from '@private/constants'; const className = 'fr.component.right.title'; const Widget: WidgetType = { _store() { diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index 0a01813..99c5d9c 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -1,9 +1,6 @@ import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -/** - * 其他连接方式 - */ -export const OTHER_CONNECT = 'other'; +import {OTHER_CONNECT} from '@private/constants'; export const databaseTyle = [ { diff --git a/tsconfig.json b/tsconfig.json index 0aebbc0..22be292 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,8 @@ "@types": ["src/ui/index"], "@shared/*": ["src/shared/*"], "@shared": ["src/shared"], + "@private/*": ["private/*"], + "@private": ["private"], } }, "include": [ diff --git a/webpack.config.js b/webpack.config.js index 1eff132..d62ab3b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,6 +24,7 @@ module.exports = env => { "@ui": path.resolve("src/ui"), "@types": path.resolve("types"), "@shared": path.resolve("src/shared"), + "@private": path.resolve("private"), } }, plugins: [htmlWebpackPlugin, new MiniCssExtractPlugin({filename: `style.css`}), new CopyPlugin([ From a9f8d64cb3f5830941f05f9c292a4666b54be294 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 20 May 2019 10:13:19 +0800 Subject: [PATCH 09/12] =?UTF-8?q?refactor:=20=E5=8E=BB=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=BB=91=E5=AE=9A=E7=9A=84=E6=8C=89=E9=92=AE=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 4 +++ src/app/app.component.scss | 6 +++- .../left/left_item/left.item.component.ts | 19 ++++++------ .../left_item/left.item.icon.component.ts | 29 ++++++++----------- src/app/link_set/more/more.link.component.ts | 13 +++------ .../link_set/more/more.link.item.component.ts | 8 +---- src/app/link_set/right/nothing.component.ts | 1 - .../link_status/left/left.item.component.ts | 15 ++++------ src/app/title/title.component.ts | 28 +++++++++++++----- .../title/title_item/title_item.component.ts | 11 +++---- 10 files changed, 67 insertions(+), 67 deletions(-) diff --git a/private/constants.ts b/private/constants.ts index 000b796..04f5faa 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -1 +1,5 @@ export const OTHER_CONNECT = 'other'; +export const DEFAULT_INFO = 'DESIGNER'; +export const ACTION_DELETE = 'ACTION_DELETE'; +export const ACTION_COPY = 'ACTION_COPY'; +export const ACTION_TEST = 'ACTION_TEST'; diff --git a/src/app/app.component.scss b/src/app/app.component.scss index f974823..bbe7843 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -5,7 +5,7 @@ .title{ background-color: #fff; border-bottom: 1px solid #e8eaed; - .title-item{ + .dec-title-item{ height: 39px; line-height: 39px; padding-left: 15px; @@ -19,6 +19,10 @@ font-weight: 700; cursor: pointer; } + .dec-title-item-selected{ + color: '#3685f2'; + border-bottom: solid 2px #3685f2; + } .close-button { position: absolute !important; right: 5px; diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left.item.component.ts index 2134e59..6f33bc5 100644 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ b/src/app/link_set/left/left_item/left.item.component.ts @@ -1,6 +1,7 @@ -import {WidgetType, Left, Label, Icon} from '@ui'; +import {WidgetType, Left, Label, Icon, TextButton} from '@ui'; import ItemIcon from './left.item.icon.component'; import Model from '../../link-set.model'; +import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; const className = 'fr.component.linkSet.left.item'; const Widget: WidgetType = { props: { @@ -28,11 +29,14 @@ const Widget: WidgetType = { title, }, { - type: Label, + type: TextButton, cls:'link-title', textAlign: 'left', text: title, title, + handler: () => { + this.store.setLinkSelected(title); + }, }, { type: Left, @@ -42,24 +46,27 @@ const Widget: WidgetType = { type: ItemIcon, cls: 'link-text-font', title: BI.i18nText('Dec-Dcm_Test_Connection'), + value: ACTION_TEST, id, }, { type: ItemIcon, cls: 'copy-font', title: BI.i18nText('Dec-Dcm_Copy'), + value: ACTION_COPY, id, }, { type: ItemIcon, cls: 'info-font', - title: `${BI.i18nText('Dec-Dcm_Type')}:${text === 'DESIGNER' ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, + 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: ItemIcon, cls: 'delete-font', title: BI.i18nText('Dec-Dcm_Delete'), + value: ACTION_DELETE, id, }, ], @@ -68,12 +75,6 @@ const Widget: WidgetType = { ], }; }, - mounted() { - const {title} = this.options; - this.element.on('click', () => { - this.store.setLinkSelected(title); - }); - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_set/left/left_item/left.item.icon.component.ts b/src/app/link_set/left/left_item/left.item.icon.component.ts index f8e4300..f0ba3b7 100644 --- a/src/app/link_set/left/left_item/left.item.icon.component.ts +++ b/src/app/link_set/left/left_item/left.item.icon.component.ts @@ -1,16 +1,18 @@ -import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView} from '@ui/index'; +import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui/index'; import Model from '../../link-set.model'; +import {ACTION_DELETE} from '@private/constants'; + const className = 'fr.component.linkSet.left.item.icon'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, render() { - const {cls, title, id} = this.options; + const {cls, title, id, value} = this.options; const that = this; let iconContent: any = null; let combo: any = null; - if (title === BI.i18nText('Dec-Dcm_Delete')) { + if (value === ACTION_DELETE) { return { type: BubbleCombo, direction: 'bottom', @@ -60,27 +62,20 @@ const Widget: WidgetType = { } return { - type: Icon, + type: IconButton, cls, extraCls: 'action-icon', height: 24, width: 26, title, + handler: () => { + const {value, id, title} = this.options; + if (value !== ACTION_DELETE) { + this.store.onIconClick(title, id); + } + }, }; }, - mounted() { - const {title, id} = this.options; - if (title !== BI.i18nText('Dec-Dcm_Delete')) { - this.element.on('click', (event: any) => { - event.stopPropagation(); - this.store.onIconClick(title, id); - }); - } else { - this.element.on('click', (event: any) => { - event.stopPropagation(); - }); - } - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 4cfce6b..3db61cf 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -43,15 +43,10 @@ const Widget: WidgetType = { text: item.text, name: item.databaseType, selected: text === item.text, - listeners: [ - { - eventName: 'EVENT_SELECT', - action (text: string) { - that._renderItems(text); - that.fireEvent('EVENT_SELECT', text); - }, - }, - ], + handler: () => { + that._renderItems(item.text); + that.fireEvent('EVENT_SELECT', item.text); + }, }); }); morkLinkItem.populate(BI.createItems(items)); diff --git a/src/app/link_set/more/more.link.item.component.ts b/src/app/link_set/more/more.link.item.component.ts index 5e4a8ad..0b2724f 100644 --- a/src/app/link_set/more/more.link.item.component.ts +++ b/src/app/link_set/more/more.link.item.component.ts @@ -29,12 +29,6 @@ const Widget: WidgetType = { ], }; }, - mounted() { - const {text} = this.options; - this.element.on('click', () => { - this.fireEvent('EVENT_SELECT', text); - }); - }, }; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); export default className; diff --git a/src/app/link_set/right/nothing.component.ts b/src/app/link_set/right/nothing.component.ts index dd9268a..d3d4343 100644 --- a/src/app/link_set/right/nothing.component.ts +++ b/src/app/link_set/right/nothing.component.ts @@ -17,7 +17,6 @@ const Widget: WidgetType = { }, { type:Label, - cls: 'Dec-Dcm_Tips', height: 20, text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, diff --git a/src/app/link_status/left/left.item.component.ts b/src/app/link_status/left/left.item.component.ts index 59b1150..f5f9739 100644 --- a/src/app/link_status/left/left.item.component.ts +++ b/src/app/link_status/left/left.item.component.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, Label} from '@ui'; +import {WidgetType, Left, Label, TextButton} from '@ui'; import Model from './left.model'; const className = 'fr.component.linkStatus.left.item'; const Widget: WidgetType = { @@ -19,21 +19,18 @@ const Widget: WidgetType = { extraCls, items: [ { - type: Label, + type: TextButton, cls:'link-title', textAlign: 'left', text: title, title, + handler: () => { + this.store.setStatusSelected(title); + }, }, ], }; }, - mounted() { - const {title} = this.options; - this.element.on('click', () => { - this.store.setStatusSelected(title); - }); - }, }; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); export default className; diff --git a/src/app/title/title.component.ts b/src/app/title/title.component.ts index 0e99285..26de592 100644 --- a/src/app/title/title.component.ts +++ b/src/app/title/title.component.ts @@ -1,7 +1,6 @@ import {Left, WidgetType, IconButton} from '@ui/index'; import TitleItem from './title_item/title_item.component'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; -const tabs = ['Dec-Dcm_Connection_Management', 'Dec-Dcm_Pool_Connection_Management']; const className = 'fr.title'; const Widget: WidgetType = { render() { @@ -9,12 +8,27 @@ const Widget: WidgetType = { type: Left, cls: 'title', items: [ - ...BI.map(tabs, (index: number, text: string) => { - return { - type: TitleItem, - text: BI.i18nText(text), - }; - }), + { + type: TitleItem, + cls: 'dec-title-item-selected', + text: BI.i18nText('Dec-Dcm_Connection_Management'), + ref: _ref => { + this.ConnectSet = _ref; + }, + handler: () => { + this.ConnectSet.select(); + }, + }, + { + type: TitleItem, + text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + ref: _ref => { + this.ConnectPool = _ref; + }, + handler: () => { + this.ConnectPool.select(); + }, + }, { type:IconButton, cls:'close-button', diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts index 056366a..576c331 100644 --- a/src/app/title/title_item/title_item.component.ts +++ b/src/app/title/title_item/title_item.component.ts @@ -2,7 +2,7 @@ import {Label} from '@ui'; import tableItemModel from './title_item.model'; import {getSelectStyle} from './title_item.service'; const className = 'fr.title.item'; -const Widget = BI.inherit(BI.Widget, { +const Widget = BI.inherit(BI.BasicButton, { props: { text:'', }, @@ -20,16 +20,13 @@ const Widget = BI.inherit(BI.Widget, { return { type: Label, - cls: 'title-item', + cls: 'dec-title-item', text, }; }, - mounted() { + select() { const {text} = this.options; - this.element.css(getSelectStyle(BI.i18nText('Dec-Dcm_Connection_Management'), text)); - this.element.on('click', () => { - this.store.setTab(text); - }); + this.store.setTab(text); }, }); BI.shortcut(className, Widget); From 2334d1a06814b958a986f800e5ed1e46a8501657 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 20 May 2019 10:35:57 +0800 Subject: [PATCH 10/12] =?UTF-8?q?refactor:=20=E5=B0=86=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=8F=90=E5=8F=96=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 1 + .../left/left_item/left.item.component.ts | 6 +- .../left_item/left.item.icon.component.ts | 6 +- src/app/link_set/more/more.link.component.ts | 6 +- .../right/right_edit/right.edit.component.ts | 64 +++++++++---------- .../right/right_edit/right.edit.constant.ts | 4 -- .../right_edit/right.edit.mysql.component.ts | 58 ++++++++--------- .../right/right_edit/right.edit.service.ts | 4 ++ src/demo/plugin.redis.edit.ts | 16 ++--- 9 files changed, 81 insertions(+), 84 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e8772fa..d62bd01 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,6 +25,7 @@ module.exports = { 'for-direction': 2, // 关键字前后必须有空格 'keyword-spacing': 2, + 'key-spacing':2, // 最大块嵌套深度为 5 层 'max-depth': [2, 5], // 最大回调深度为 3 层 diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left.item.component.ts index 6f33bc5..660d803 100644 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ b/src/app/link_set/left/left_item/left.item.component.ts @@ -5,8 +5,8 @@ import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/co const className = 'fr.component.linkSet.left.item'; const Widget: WidgetType = { props: { - title:'', - id:'', + title: '', + id: '', creator: '', }, _store() { @@ -30,7 +30,7 @@ const Widget: WidgetType = { }, { type: TextButton, - cls:'link-title', + cls: 'link-title', textAlign: 'left', text: title, title, diff --git a/src/app/link_set/left/left_item/left.item.icon.component.ts b/src/app/link_set/left/left_item/left.item.icon.component.ts index f0ba3b7..3079d35 100644 --- a/src/app/link_set/left/left_item/left.item.icon.component.ts +++ b/src/app/link_set/left/left_item/left.item.icon.component.ts @@ -22,7 +22,7 @@ const Widget: WidgetType = { el: { type: Icon, cls, - extraCls: 'action-icon', + baseCls: 'action-icon', height: 24, width: 26, title, @@ -47,14 +47,14 @@ const Widget: WidgetType = { eventName: BI.BubbleCombo.EVENT_EXPAND, action () { iconContent.element.css({ - visibility:'visible', + visibility: 'visible', }); }, }, { eventName: BI.BubbleCombo.EVENT_AFTER_HIDEVIEW, action () { iconContent.element.css({ - visibility:'hidden', + visibility: 'hidden', }); }, }], diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 3db61cf..8644906 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -10,9 +10,9 @@ const Widget: WidgetType = { cls: 'more-link', items: [ { - el:{ + el: { type: Vertical, - items:[{ + items: [{ type: SearchEditor, width: 300, watermark: BI.i18nText('Dec-Dcm_Search'), @@ -22,7 +22,7 @@ const Widget: WidgetType = { }, { type: Left, - cls:'more-link-item', + cls: 'more-link-item', ref(ref: any) { morkLinkItem = ref; }, diff --git a/src/app/link_set/right/right_edit/right.edit.component.ts b/src/app/link_set/right/right_edit/right.edit.component.ts index e7129d2..539cccc 100644 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.component.ts @@ -4,14 +4,14 @@ import charset from './right.edit.constant'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; -import {getDrivers} from './right.edit.service'; +import {getDrivers, connectNameChecker} from './right.edit.service'; let ConnectionName: any = null; const className = 'fr.component.right.edit'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { connectionNameErr(msg: string) { if (msg) { BI.Bubbles.show('singleBubble', msg, ConnectionName, { @@ -34,7 +34,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form:{ + form: { type: Editor, cls: 'bi-border', width: 300, @@ -62,14 +62,14 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_First_Step'), height: 400, - form:{ + form: { type: Vertical, cls: 'right-form', - items:[ + items: [ { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form:{ + form: { type: TextValueCombo, cls: 'bi-border', width: 300, @@ -89,10 +89,10 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form:{ + form: { type: Editor, cls: 'bi-border', - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -109,12 +109,18 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form:{ + form: { type: TextValueCombo, cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, - items: BI.Constants.getConstant(charset), + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...BI.Constants.getConstant(charset), + ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, action() { @@ -129,11 +135,11 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form:{ + form: { type: Editor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -150,12 +156,12 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form:{ + form: { type: Editor, cls: 'bi-border', - inputType:'password', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -177,13 +183,13 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), height: 100, - form:{ + form: { type: TextAreaEditor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, - height:100, + height: 100, value: linkSelected.validationQuery, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, @@ -199,7 +205,7 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form:{ + form: { type: MultiSelectItem, text: BI.i18nText('Dec-Dcm_Yes'), selected: linkSelected.testOnBorrow, @@ -218,21 +224,15 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form:{ + form: { type: Editor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + 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 (v: string) { - if (/^\+?[1-9][0-9]*$/.test(v)) { - return true; - } - - return false; - }, + validationChecker: connectNameChecker, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, action() { diff --git a/src/app/link_set/right/right_edit/right.edit.constant.ts b/src/app/link_set/right/right_edit/right.edit.constant.ts index d74d953..27c3754 100644 --- a/src/app/link_set/right/right_edit/right.edit.constant.ts +++ b/src/app/link_set/right/right_edit/right.edit.constant.ts @@ -1,10 +1,6 @@ export const ConstantName = 'bi.constant.database.conf.charset.list'; export const Constant = BI.constant(ConstantName, [ - { - text: '自动', - value: '', - }, { text: 'GBK', value: 'GBK', diff --git a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts index 161a1f1..7b65bd5 100644 --- a/src/app/link_set/right/right_edit/right.edit.mysql.component.ts +++ b/src/app/link_set/right/right_edit/right.edit.mysql.component.ts @@ -4,7 +4,7 @@ import charset from './right.edit.constant'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; -import {getDrivers} from './right.edit.service'; +import {getDrivers, connectNameChecker} from './right.edit.service'; const className = 'fr.component.right.edit.mysql'; const Widget: WidgetType = { _store() { @@ -22,7 +22,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form:{ + form: { type: Editor, cls: 'bi-border', width: 300, @@ -41,7 +41,7 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form:{ + form: { type: TextValueCombo, cls: 'bi-border', width: 300, @@ -61,10 +61,10 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form:{ + form: { type: Editor, cls: 'bi-border', - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, listeners: [{ @@ -81,12 +81,18 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form:{ + form: { type: TextValueCombo, cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, - items: BI.Constants.getConstant(charset), + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...BI.Constants.getConstant(charset), + ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, action() { @@ -101,11 +107,11 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form:{ + form: { type: Editor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.user, listeners: [{ @@ -122,12 +128,12 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form:{ + form: { type: Editor, cls: 'bi-border', - inputType:'password', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.password, listeners: [{ @@ -149,13 +155,13 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), height: 100, - form:{ + form: { type: TextAreaEditor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, - height:100, + height: 100, value: linkSelected.validationQuery, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, @@ -171,7 +177,7 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form:{ + form: { type: MultiSelectItem, text: BI.i18nText('Dec-Dcm_Yes'), selected: linkSelected.testOnBorrow, @@ -190,21 +196,15 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form:{ + form: { type: Editor, cls: 'bi-border', - allowBlank:true, - watermark:BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + 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 (v: string) { - if (/^\+?[1-9][0-9]*$/.test(v)) { - return true; - } - - return false; - }, + validationChecker: connectNameChecker, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, action() { diff --git a/src/app/link_set/right/right_edit/right.edit.service.ts b/src/app/link_set/right/right_edit/right.edit.service.ts index 8d9fb89..90f2a9a 100644 --- a/src/app/link_set/right/right_edit/right.edit.service.ts +++ b/src/app/link_set/right/right_edit/right.edit.service.ts @@ -18,3 +18,7 @@ export function getDrivers(linkSelected: LinkType): {text: string; value: string return drivers; } + +export function connectNameChecker(name: string): boolean { + return /^\+?[1-9][0-9]*$/.test(name); +} diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index a785278..31e8802 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -1,7 +1,7 @@ import './style.scss'; const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value'; const form = { - url:'192.168.1.22', + url: '192.168.1.22', port: 6379, password: '123456', }; @@ -11,8 +11,8 @@ const Widget = BI.inherit(BI.Widget, { render() { return { type: 'bi.vertical', - cls:'bi-plugin-redis', - bgap:10, + cls: 'bi-plugin-redis', + bgap: 10, items: [ { type: 'bi.left', @@ -29,7 +29,7 @@ const Widget = BI.inherit(BI.Widget, { type: 'bi.editor', cls: 'bi-border', watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), - value:form.url, + value: form.url, allowBlank: true, width: 300, height: 24, @@ -56,11 +56,7 @@ const Widget = BI.inherit(BI.Widget, { value: form.port, errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), validationChecker (v: string) { - if (/^\+?[1-9][0-9]*$/.test(v)) { - return true; - } - - return false; + return /^\+?[1-9][0-9]*$/.test(v); }, }], }, @@ -78,7 +74,7 @@ const Widget = BI.inherit(BI.Widget, { { type: 'bi.editor', cls: 'bi-border', - inputType:'password', + inputType: 'password', value: form.password, allowBlank: true, width: 300, From 6f4ac864895ef9493eb1b8d5d153ff010d2dabf1 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 20 May 2019 10:57:53 +0800 Subject: [PATCH 11/12] =?UTF-8?q?style:=20=E5=86=92=E5=8F=B7=E5=90=8E?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.component.ts | 2 +- src/app/app.model.ts | 6 ++-- src/app/link_status/left/left.component.ts | 2 +- .../link_status/left/left.item.component.ts | 6 ++-- src/app/link_status/left/left.model.ts | 2 +- .../title/title_item/title_item.component.ts | 4 +-- src/demo/plugin.redis.preview.ts | 10 +++---- src/demo/plugin.tedis.pool.ts | 4 +-- src/shared/service/dialog.service.ts | 30 ++++++++++--------- 9 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7b9da73..2a42856 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -26,7 +26,7 @@ const Widget = BI.inherit(BI.Widget, { height: 40, }, { - type:linkSet, + type: linkSet, }, { type: linkStatus, diff --git a/src/app/app.model.ts b/src/app/app.model.ts index 8e3d4e9..761035a 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -11,9 +11,9 @@ const Model: ModelType = { linkList, linkSelected: {}, linkUpdate: {}, - moreLinkSelected:'', - statusSelected:'', - connectionNameErr:'', + moreLinkSelected: '', + statusSelected: '', + connectionNameErr: '', }; }, computed: { diff --git a/src/app/link_status/left/left.component.ts b/src/app/link_status/left/left.component.ts index 4068b29..0ce0fdf 100644 --- a/src/app/link_status/left/left.component.ts +++ b/src/app/link_status/left/left.component.ts @@ -8,7 +8,7 @@ const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { linkList(linkList: LinkType[]) { const title = linkList.length > 0 ? linkList[0].connectionName : ''; this.store.setStatusSelected(title); diff --git a/src/app/link_status/left/left.item.component.ts b/src/app/link_status/left/left.item.component.ts index f5f9739..b568ab8 100644 --- a/src/app/link_status/left/left.item.component.ts +++ b/src/app/link_status/left/left.item.component.ts @@ -3,8 +3,8 @@ import Model from './left.model'; const className = 'fr.component.linkStatus.left.item'; const Widget: WidgetType = { props: { - title:'', - id:'', + title: '', + id: '', creator: '', }, _store() { @@ -20,7 +20,7 @@ const Widget: WidgetType = { items: [ { type: TextButton, - cls:'link-title', + cls: 'link-title', textAlign: 'left', text: title, title, diff --git a/src/app/link_status/left/left.model.ts b/src/app/link_status/left/left.model.ts index 37419a9..d2633ef 100644 --- a/src/app/link_status/left/left.model.ts +++ b/src/app/link_status/left/left.model.ts @@ -4,7 +4,7 @@ const Model: ModelType = { context: ['tab', 'linkList', 'statusSelected'], state () { return { - selected:'', + selected: '', }; }, actions: { diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts index 576c331..7ee5f28 100644 --- a/src/app/title/title_item/title_item.component.ts +++ b/src/app/title/title_item/title_item.component.ts @@ -4,12 +4,12 @@ import {getSelectStyle} from './title_item.service'; const className = 'fr.title.item'; const Widget = BI.inherit(BI.BasicButton, { props: { - text:'', + text: '', }, _store() { return BI.Models.getModel(tableItemModel); }, - watch:{ + watch: { tab(tab: string) { const {text} = this.options; this.element.css(getSelectStyle(text, tab)); diff --git a/src/demo/plugin.redis.preview.ts b/src/demo/plugin.redis.preview.ts index a3708e0..9dfd4df 100644 --- a/src/demo/plugin.redis.preview.ts +++ b/src/demo/plugin.redis.preview.ts @@ -6,8 +6,8 @@ const Widget = BI.inherit(BI.Widget, { render() { return { type: 'bi.vertical', - cls:'bi-plugin-redis', - bgap:10, + cls: 'bi-plugin-redis', + bgap: 10, items: [ { type: 'bi.left', @@ -22,7 +22,7 @@ const Widget = BI.inherit(BI.Widget, { }, { type: 'bi.label', - text:form.url, + text: form.url, height: 24, }], }, @@ -39,7 +39,7 @@ const Widget = BI.inherit(BI.Widget, { }, { type: 'bi.label', - text:form.port, + text: form.port, height: 24, }], }, @@ -56,7 +56,7 @@ const Widget = BI.inherit(BI.Widget, { }, { type: 'bi.label', - text:'********', + text: '********', height: 24, }], }, diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 6469e88..26410b3 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -13,11 +13,11 @@ const WidgetPool = BI.inherit(BI.Widget, { items: [ { type: 'bi.vertical', - cls:'right-status-board', + cls: 'right-status-board', items: [ { type: 'bi.vertical', - cls:'right-status-board-item', + cls: 'right-status-board-item', items: [ { type: 'bi.label', diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 6a30e15..a3fd4f2 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -54,7 +54,7 @@ class Dialog { items: [ { type: Vertical, - items:[ + items: [ { type: 'bi.layout', cls: 'loading-icon', @@ -80,7 +80,7 @@ class Dialog { items: [ { type: Vertical, - items:[ + items: [ { type: 'bi.layout', cls: 'success-icon', @@ -105,7 +105,7 @@ class Dialog { items: [ { type: Vertical, - items:[ + items: [ { type: 'bi.layout', cls: 'error-icon', @@ -135,11 +135,11 @@ class Dialog { { type: 'bi.center_adapt', cls: 'show-content', - tgap:10, + tgap: 10, items: [ { type: Vertical, - items:[ + items: [ { type: Layout, cls: 'error-icon', @@ -152,14 +152,14 @@ class Dialog { }, { type: Left, - cls:'buttons', - items:[ + cls: 'buttons', + items: [ { type: Button, text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), level: 'ignore', handler() { - const isHide = this.getText() === BI.i18nText('Dec-Dcm_Connection_Detailed_Information'); + const isHide = !More.isVisible(); Popover.element.css({ height: isHide ? '290' : '220', }); @@ -191,9 +191,11 @@ class Dialog { ], }, { type: Label, - cls:'show-more', - text:more, + cls: 'show-more', + text: more, invisible: true, + height: 73, + value: false, ref(ref: any) { More = ref; }, @@ -202,8 +204,8 @@ class Dialog { }; BI.Popovers.create(id, { type: 'bi.popover', - cls:'popover-notitle', - extraCls:'bi-custom-show', + cls: 'popover-notitle', + extraCls: 'bi-custom-show', size: 'normal', width: 450, height: 220, @@ -223,8 +225,8 @@ class Dialog { const id = BI.UUID(); BI.Popovers.create(id, { type: 'bi.popover', - cls:'popover-notitle', - extraCls:'bi-custom-show', + cls: 'popover-notitle', + extraCls: 'bi-custom-show', size: 'normal', width: 450, height: 220, From c77db613e9348db5327eeb528bfbe57126986b82 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 20 May 2019 14:05:37 +0800 Subject: [PATCH 12/12] =?UTF-8?q?refactor:=20=E9=81=BF=E5=85=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=A1=B5=E9=9D=A2=E4=B8=8A=E7=9A=84text=E5=81=9A?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 3 +++ src/app/app.component.scss | 2 +- src/app/link_set/link-set.component.ts | 9 +++++---- src/app/link_status/link_status.component.ts | 11 ++++++----- src/app/title/title.component.ts | 7 +++++-- src/app/title/title_item/title_item.component.ts | 8 ++++---- src/shared/service/dialog.service.ts | 6 ++---- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/private/constants.ts b/private/constants.ts index 04f5faa..69ddc79 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -3,3 +3,6 @@ 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'; diff --git a/src/app/app.component.scss b/src/app/app.component.scss index bbe7843..84bed04 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -20,7 +20,7 @@ cursor: pointer; } .dec-title-item-selected{ - color: '#3685f2'; + color: #3685f2; border-bottom: solid 2px #3685f2; } .close-button { diff --git a/src/app/link_set/link-set.component.ts b/src/app/link_set/link-set.component.ts index c39e192..4795ca7 100644 --- a/src/app/link_set/link-set.component.ts +++ b/src/app/link_set/link-set.component.ts @@ -3,14 +3,15 @@ import LeftList from './left/left.component'; import linkSetModel from './link-set.model'; import Select from './select/select.component'; import Right from './right/right.component'; +import {TAB_LINK_SET} from '@private/constants'; const className = 'fr.linkset'; const Widget: WidgetType = { _store() { return BI.Models.getModel(linkSetModel); }, - watch:{ + watch: { tab(tab: string) { - this.setVisible(tab === BI.i18nText('Dec-Dcm_Connection_Management')); + this.setVisible(tab === TAB_LINK_SET); }, }, render() { @@ -25,8 +26,8 @@ const Widget: WidgetType = { { el: { type: Left, - cls:'select-group', - items:[ + cls: 'select-group', + items: [ { type: Select, }, diff --git a/src/app/link_status/link_status.component.ts b/src/app/link_status/link_status.component.ts index 6ff84da..c68caaf 100644 --- a/src/app/link_status/link_status.component.ts +++ b/src/app/link_status/link_status.component.ts @@ -2,15 +2,16 @@ import {WidgetType, Htape, Vtape, Left, Label} from '@ui'; import linkStatusModel from './link_status.model'; import LeftList from './left/left.component'; import Right from './right/right.component'; +import {TAB_LINK_POOL} from '@private/constants'; const className = 'fr.linkstatus'; const Widget: WidgetType = { _store() { return BI.Models.getModel(linkStatusModel); }, - watch:{ + watch: { tab(tab: string) { - this.setVisible(tab === BI.i18nText('Dec-Dcm_Pool_Connection_Management')); + this.setVisible(tab === TAB_LINK_POOL); }, }, render() { @@ -25,11 +26,11 @@ const Widget: WidgetType = { { el: { type: Left, - cls:'select-group', - items:[ + cls: 'select-group', + items: [ { type: Label, - cls:'status-title', + cls: 'status-title', text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], diff --git a/src/app/title/title.component.ts b/src/app/title/title.component.ts index 26de592..7a7afb6 100644 --- a/src/app/title/title.component.ts +++ b/src/app/title/title.component.ts @@ -1,6 +1,7 @@ import {Left, WidgetType, IconButton} from '@ui/index'; import TitleItem from './title_item/title_item.component'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; +import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'fr.title'; const Widget: WidgetType = { render() { @@ -12,6 +13,7 @@ const Widget: WidgetType = { type: TitleItem, cls: 'dec-title-item-selected', text: BI.i18nText('Dec-Dcm_Connection_Management'), + value: TAB_LINK_SET, ref: _ref => { this.ConnectSet = _ref; }, @@ -22,6 +24,7 @@ const Widget: WidgetType = { { type: TitleItem, text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + value: TAB_LINK_POOL, ref: _ref => { this.ConnectPool = _ref; }, @@ -30,8 +33,8 @@ const Widget: WidgetType = { }, }, { - type:IconButton, - cls:'close-button', + type: IconButton, + cls: 'close-button', handler() { closeWindow(); }, diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.component.ts index 7ee5f28..84b0981 100644 --- a/src/app/title/title_item/title_item.component.ts +++ b/src/app/title/title_item/title_item.component.ts @@ -11,8 +11,8 @@ const Widget = BI.inherit(BI.BasicButton, { }, watch: { tab(tab: string) { - const {text} = this.options; - this.element.css(getSelectStyle(text, tab)); + const {value} = this.options; + this.element.css(getSelectStyle(value, tab)); }, }, render() { @@ -25,8 +25,8 @@ const Widget = BI.inherit(BI.BasicButton, { }; }, select() { - const {text} = this.options; - this.store.setTab(text); + const {value} = this.options; + this.store.setTab(value); }, }); BI.shortcut(className, Widget); diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index a3fd4f2..4f087ae 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -204,8 +204,7 @@ class Dialog { }; BI.Popovers.create(id, { type: 'bi.popover', - cls: 'popover-notitle', - extraCls: 'bi-custom-show', + cls: 'popover-notitle bi-custom-show', size: 'normal', width: 450, height: 220, @@ -225,8 +224,7 @@ class Dialog { const id = BI.UUID(); BI.Popovers.create(id, { type: 'bi.popover', - cls: 'popover-notitle', - extraCls: 'bi-custom-show', + cls: 'popover-notitle bi-custom-show', size: 'normal', width: 450, height: 220,