From 38dfec8d7f4ac839205d8bbef06725273ad62694 Mon Sep 17 00:00:00 2001 From: langwenda Date: Fri, 17 May 2019 11:06:15 +0800 Subject: [PATCH 01/44] 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/44] 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/44] 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/44] =?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/44] =?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/44] =?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/44] =?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/44] =?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/44] =?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/44] =?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/44] =?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/44] =?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, From 16263ffd981364379fe08bb74642bdc9e6dfecaf Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 22 May 2019 11:59:02 +0800 Subject: [PATCH 13/44] =?UTF-8?q?feat:=20=E5=8A=A0=E5=85=A5jdni=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 7 +- private/i18n.ts | 6 + src/app/app.component.ts | 6 +- src/plugins/jndi/jdni.scss | 3 + src/plugins/jndi/jdni.typing.d.ts | 25 +++ src/plugins/jndi/jndi.edit.ts | 187 +++++++++++++++++++ src/plugins/jndi/jndi.pool.ts | 54 ++++++ src/plugins/jndi/jndi.preview.ts | 139 ++++++++++++++ src/plugins/jndi/jndi.service.ts | 87 +++++++++ src/shared/components/form.item.component.ts | 6 +- 10 files changed, 513 insertions(+), 7 deletions(-) create mode 100644 src/plugins/jndi/jdni.scss create mode 100644 src/plugins/jndi/jdni.typing.d.ts create mode 100644 src/plugins/jndi/jndi.edit.ts create mode 100644 src/plugins/jndi/jndi.pool.ts create mode 100644 src/plugins/jndi/jndi.preview.ts create mode 100644 src/plugins/jndi/jndi.service.ts diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 6509988..32d7ec2 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -52,4 +52,9 @@ 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 +Dec-Dcm_Connection_ReConnect= 重新连接 +Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字 +Dec-Dcm_Connection_Form_JNDI_Context= 上下文 +Dec-Dcm_Connection_Form_JNDI_Advanced= 高级 +Dec-Dcm_Connection_Form_JNDI_Other_Attributes= 其他属性 +Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes= 收起 \ No newline at end of file diff --git a/private/i18n.ts b/private/i18n.ts index 3f234ea..a5bc85b 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -54,4 +54,10 @@ export default { 'Dec-Dcm_Connection_Form_Database_Port': '端口号', 'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?', 'Dec-Dcm_Connection_ReConnect': '重新连接', + 'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字', + 'Dec-Dcm_Connection_Form_JNDI_Context': '上下文', + 'Dec-Dcm_Connection_Form_JNDI_Advanced': '高级', + 'Dec-Dcm_Connection_Form_JNDI_Other_Attributes': '其他属性', + 'Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes': '收起', + 'Dec-Dcm_Connection_Form_JNDI_Notice': '注意:需要把包含INITIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下.', }; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2a42856..c0806e2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,9 +4,9 @@ import appModel from './app.model'; import title from './title/title.component'; import linkSet from './link_set/link-set.component'; import linkStatus from './link_status/link_status.component'; -import '../demo/plugin.redis.edit'; -import '../demo/plugin.redis.preview'; -import '../demo/plugin.tedis.pool'; +import '../plugins/jndi/jndi.edit'; +import '../plugins/jndi/jndi.pool'; +import '../plugins/jndi/jndi.preview'; import {fetchLinkList} from '../shared/crud/crud.request'; import './app.component.scss'; diff --git a/src/plugins/jndi/jdni.scss b/src/plugins/jndi/jdni.scss new file mode 100644 index 0000000..a3294bb --- /dev/null +++ b/src/plugins/jndi/jdni.scss @@ -0,0 +1,3 @@ +.jndi-notice{ + color: red; +} \ No newline at end of file diff --git a/src/plugins/jndi/jdni.typing.d.ts b/src/plugins/jndi/jdni.typing.d.ts new file mode 100644 index 0000000..060bd1a --- /dev/null +++ b/src/plugins/jndi/jdni.typing.d.ts @@ -0,0 +1,25 @@ +export interface AttributeType { + text: string; + name: string; +} + +export interface FormType { + connectionName?: string; + factory?: string; + url?: string; + principal?: string; + credentials?: string; + originalCharsetName?: string; + + objectFactories?: string; + stateFactories?: string; + urlPkgPrefixes?: string; + dnsUrl?: string; + authoritative?: string; + batchSize?: string; + referral?: string; + securityProtocol?: string; + securityAuthentication?: string; + language?: string; + applet?: string; +} diff --git a/src/plugins/jndi/jndi.edit.ts b/src/plugins/jndi/jndi.edit.ts new file mode 100644 index 0000000..2dcc7d3 --- /dev/null +++ b/src/plugins/jndi/jndi.edit.ts @@ -0,0 +1,187 @@ +import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; +import {factorys, otherAttributes, originalCharsetNames} from './jndi.service'; +import FormItem from '@shared/components/form.item.component'; +import {AttributeType, FormType} from './jdni.typing'; +import './jdni.scss'; +const RedisConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; +const form: FormType = { + url: '192.168.1.22', +}; + +const classNameEdit = 'dec.plugin.jndi.edit'; +const Widget = BI.inherit(BI.Widget, { + render() { + return { + type: Vertical, + cls: 'right-show', + items: [ + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + form: { + type: Editor, + cls: 'bi-border', + width: 300, + allowBlank: true, + value: form.connectionName, + }, + }, + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + height: 160, + ref: _ref => { + this.JndiForm = _ref; + }, + form: { + type: Vertical, + cls: 'right-form', + items: [ + { + type: FormItem, + text: 'INTIAL_CONTEXT_FACTORY', + width: 180, + form: { + type: TextValueCombo, + cls: 'bi-border', + width: 300, + value: form.factory, + items: BI.map(factorys, (index: number, item: string) => { + return { + text: item, + value: item, + }; + }), + }, + }, + { + type: FormItem, + text: 'PROVIDER_URL', + width: 180, + form: { + type: Editor, + cls: 'bi-border', + width: 300, + allowBlank: true, + value: form.url, + }, + }, + { + type: FormItem, + text: 'SECURITY_PRINCIPAL', + width: 180, + form: { + type: Editor, + cls: 'bi-border', + width: 300, + allowBlank: true, + value: form.principal, + }, + }, + { + type: FormItem, + text: 'SECURITY_CREDENTIALS', + width: 180, + form: { + type: Editor, + cls: 'bi-border', + width: 300, + allowBlank: true, + value: form.credentials, + }, + }, + { + type: FormItem, + width: 180, + form: { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 300, + textAlign: 'right', + value: true, + ref: _ref => { + this.Collapse = _ref; + }, + handler: () => { + const isCollapse = this.Collapse.getValue(); + const height = isCollapse ? 550 : 160; + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.JndiForm.setHeight(height); + this.Collapse.setValue(!isCollapse); + this.Collapse.setText(text); + this.OtherAttributes.setVisible(isCollapse); + }, + }, + }, + { + type: Vertical, + cls: 'right-form', + invisible: false, + ref: _ref => { + this.OtherAttributes = _ref; + }, + items: BI.map(otherAttributes, (index: number, item: AttributeType) => { + return { + type: FormItem, + text: item.text, + width: 180, + form: { + type: Editor, + cls: 'bi-border', + width: 300, + allowBlank: true, + value: form[item.name], + }, + }; + }), + }, + ], + }, + }, + { + type: FormItem, + text: '', + height: 25, + form: { + type: Label, + cls: 'jndi-notice', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), + }, + }, + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), + height: 25, + form: { + type: Vertical, + cls: 'right-form', + items: [ + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + width: 180, + form: { + type: TextValueCombo, + cls: 'bi-border', + width: 300, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: form.originalCharsetName, + }, + ...originalCharsetNames, + ], + }, + }, + ], + }, + }, + ], + }; + }, +}); +BI.shortcut(classNameEdit, Widget); +export default classNameEdit; +export const ConstantName = 'dec.constant.database.conf.connect.list'; +BI.config(ConstantName, (datas: string[]) => [...datas, 'JNDI']); +BI.constant(RedisConstantName, form); +BI.constant('dec.constant.database.conf.connect.form.jndi.edit', classNameEdit); diff --git a/src/plugins/jndi/jndi.pool.ts b/src/plugins/jndi/jndi.pool.ts new file mode 100644 index 0000000..ba12135 --- /dev/null +++ b/src/plugins/jndi/jndi.pool.ts @@ -0,0 +1,54 @@ +const JndiPool = 'fr.plugin.jndi.pool'; + +const JndiWidget = BI.inherit(BI.Widget, { + render() { + const {maxActive, numActive} = 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', + height: 20, + text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), + }, + ], + }, + ], + }, + ], + }; + }, +}); +BI.shortcut(JndiPool, JndiWidget); +BI.constant('dec.constant.database.conf.connect.form.jndi.pool', JndiPool); diff --git a/src/plugins/jndi/jndi.preview.ts b/src/plugins/jndi/jndi.preview.ts new file mode 100644 index 0000000..31f2ccc --- /dev/null +++ b/src/plugins/jndi/jndi.preview.ts @@ -0,0 +1,139 @@ +import {Vertical, Label, TextButton} from '@ui'; +import FormItem from '@shared/components/form.item.component'; +import {FormType, AttributeType} from './jdni.typing'; +import {otherAttributes} from './jndi.service'; + +const JndiPreview = 'fr.plugin.jndi.preview'; +const JndiConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; +const jndiForm: FormType = BI.Constants.getConstant(JndiConstantName); + +const jndiWidget = BI.inherit(BI.Widget, { + render() { + return { + type: Vertical, + cls: 'right-show', + items: [ + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + form: { + type: Label, + text: jndiForm.connectionName, + }, + }, + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + height: 160, + ref: _ref => { + this.JndiForm = _ref; + }, + form: { + type: Vertical, + cls: 'right-form', + items: [ + { + type: FormItem, + text: 'INTIAL_CONTEXT_FACTORY', + width: 180, + form: { + type: Label, + text: jndiForm.factory, + }, + }, + { + type: FormItem, + text: 'PROVIDER_URL', + width: 180, + form: { + type: Label, + text: jndiForm.url, + }, + }, + { + type: FormItem, + text: 'SECURITY_PRINCIPAL', + width: 180, + form: { + type: Label, + text: jndiForm.principal, + }, + }, + { + type: FormItem, + text: 'SECURITY_CREDENTIALS', + width: 180, + form: { + type: Label, + text: jndiForm.credentials, + }, + }, + { + type: FormItem, + width: 180, + form: { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 300, + textAlign: 'right', + value: true, + ref: _ref => { + this.Collapse = _ref; + }, + handler: () => { + const isCollapse = this.Collapse.getValue(); + const height = isCollapse ? 550 : 160; + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.JndiForm.setHeight(height); + this.Collapse.setValue(!isCollapse); + this.Collapse.setText(text); + this.OtherAttributes.setVisible(isCollapse); + }, + }, + }, + { + type: Vertical, + cls: 'right-form', + invisible: false, + ref: _ref => { + this.OtherAttributes = _ref; + }, + items: BI.map(otherAttributes, (index: number, item: AttributeType) => { + return { + type: FormItem, + text: item.text, + width: 180, + form: { + type: Label, + text: jndiForm[item.name], + }, + }; + }), + }, + ], + }, + }, + { + type: FormItem, + text: '', + height: 25, + form: { + type: Label, + cls: 'jndi-notice', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), + }, + }, + { + type: FormItem, + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + form: { + type: Label, + text: jndiForm.originalCharsetName ? jndiForm.originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + }, + }, + ], + }; + }, +}); +BI.shortcut(JndiPreview, jndiWidget); +BI.constant('dec.constant.database.conf.connect.form.jndi.preview', JndiPreview); diff --git a/src/plugins/jndi/jndi.service.ts b/src/plugins/jndi/jndi.service.ts new file mode 100644 index 0000000..381e827 --- /dev/null +++ b/src/plugins/jndi/jndi.service.ts @@ -0,0 +1,87 @@ +import {AttributeType} from './jdni.typing'; + +export const factorys = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; + +export const otherAttributes: AttributeType[] = [ + { + text: 'OBJECT_FACTORIES', + name: 'objectFactories', + }, + { + text: 'STATE_FACTORIES', + name: 'stateFactories', + }, + { + text: 'URL_PKG_PREFIXES', + name: 'urlPkgPrefixes', + }, + { + text: 'DNS_URL', + name: 'dnsUrl', + }, + { + text: 'AUTHORITATIVE', + name: 'authoritative', + }, + { + text: 'BATCHSIZE', + name: 'batchSize', + }, + { + text: 'REFERRAL', + name: 'referral', + }, + { + text: 'SECURITY_PROTOCOL', + name: 'securityProtocol', + }, + { + text: 'SECURITY_AUTHENTICATION', + name: 'securityAuthentication', + }, + { + text: 'LANGUAGE', + name: 'language', + }, + { + text: 'APPLET', + name: 'applet', + }, +]; + + +export const originalCharsetNames = [ + { + text: 'GBK', + value: 'GBK', + }, + { + text: 'BIG5', + value: 'BIG5', + }, + { + text: 'ISO-8859-1', + value: 'ISO-8859-1', + }, + { + text: 'UTF-8', + value: 'UTF-8', + }, + { + text: 'UTF-16', + value: 'UTF-16', + }, + { + text: 'EUC_JP', + value: 'EUC_JP', + }, + { + text: 'EUC_KR', + value: 'EUC_KR', + }, + { + text: 'CP850', + value: 'CP850', + }, +] +; diff --git a/src/shared/components/form.item.component.ts b/src/shared/components/form.item.component.ts index bc88f74..b15f3db 100644 --- a/src/shared/components/form.item.component.ts +++ b/src/shared/components/form.item.component.ts @@ -2,12 +2,12 @@ import {WidgetType, Htape, Label} from '@ui/index'; const className = 'fr.shared.component.form.item'; const Widget: WidgetType = { render() { - const {text, form, hint, height} = this.options; + const {text, form, hint, height, width = 115} = this.options; return { type: Htape, cls: 'both-side', - height:height ? height : 24, + height: height ? height : 24, items: [{ el: { type: Label, @@ -15,7 +15,7 @@ const Widget: WidgetType = { textAlign: 'left', text, }, - width: 115, + width, }, form, { type: Label, cls: 'hint', From f83871023f195a7d4853e8e791933c062ad72d7a Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 22 May 2019 12:28:41 +0800 Subject: [PATCH 14/44] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/jndi/jndi.edit.ts | 16 ++++++++-------- src/plugins/jndi/jndi.preview.ts | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/plugins/jndi/jndi.edit.ts b/src/plugins/jndi/jndi.edit.ts index 2dcc7d3..8d13b46 100644 --- a/src/plugins/jndi/jndi.edit.ts +++ b/src/plugins/jndi/jndi.edit.ts @@ -31,7 +31,7 @@ const Widget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), height: 160, ref: _ref => { - this.JndiForm = _ref; + this.jndiFormRef = _ref; }, form: { type: Vertical, @@ -100,16 +100,16 @@ const Widget = BI.inherit(BI.Widget, { textAlign: 'right', value: true, ref: _ref => { - this.Collapse = _ref; + this.collapseRef = _ref; }, handler: () => { - const isCollapse = this.Collapse.getValue(); + const isCollapse = this.collapseRef.getValue(); const height = isCollapse ? 550 : 160; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.JndiForm.setHeight(height); - this.Collapse.setValue(!isCollapse); - this.Collapse.setText(text); - this.OtherAttributes.setVisible(isCollapse); + this.jndiFormRef.setHeight(height); + this.collapseRef.setValue(!isCollapse); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); }, }, }, @@ -118,7 +118,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'right-form', invisible: false, ref: _ref => { - this.OtherAttributes = _ref; + this.otherAttributesRef = _ref; }, items: BI.map(otherAttributes, (index: number, item: AttributeType) => { return { diff --git a/src/plugins/jndi/jndi.preview.ts b/src/plugins/jndi/jndi.preview.ts index 31f2ccc..a474182 100644 --- a/src/plugins/jndi/jndi.preview.ts +++ b/src/plugins/jndi/jndi.preview.ts @@ -26,7 +26,7 @@ const jndiWidget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), height: 160, ref: _ref => { - this.JndiForm = _ref; + this.jndiFormRef = _ref; }, form: { type: Vertical, @@ -78,16 +78,16 @@ const jndiWidget = BI.inherit(BI.Widget, { textAlign: 'right', value: true, ref: _ref => { - this.Collapse = _ref; + this.collapseRef = _ref; }, handler: () => { - const isCollapse = this.Collapse.getValue(); + const isCollapse = this.collapseRef.getValue(); const height = isCollapse ? 550 : 160; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.JndiForm.setHeight(height); - this.Collapse.setValue(!isCollapse); - this.Collapse.setText(text); - this.OtherAttributes.setVisible(isCollapse); + this.jndiFormRef.setHeight(height); + this.collapseRef.setValue(!isCollapse); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); }, }, }, @@ -96,7 +96,7 @@ const jndiWidget = BI.inherit(BI.Widget, { cls: 'right-form', invisible: false, ref: _ref => { - this.OtherAttributes = _ref; + this.otherAttributesRef = _ref; }, items: BI.map(otherAttributes, (index: number, item: AttributeType) => { return { From 880d7846337e282afb21e20613fde3d593456aa9 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 22 May 2019 14:24:54 +0800 Subject: [PATCH 15/44] =?UTF-8?q?refactor:=20=E5=B8=B8=E9=87=8F=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=A4=A7=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/jndi/jndi.edit.ts | 8 ++++---- src/plugins/jndi/jndi.preview.ts | 4 ++-- src/plugins/jndi/jndi.service.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/jndi/jndi.edit.ts b/src/plugins/jndi/jndi.edit.ts index 8d13b46..a4283f3 100644 --- a/src/plugins/jndi/jndi.edit.ts +++ b/src/plugins/jndi/jndi.edit.ts @@ -1,5 +1,5 @@ import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; -import {factorys, otherAttributes, originalCharsetNames} from './jndi.service'; +import {FACTORYS, OTHER_ATTRIBUTES, ORIGINAL_CHARSET_NAMES} from './jndi.service'; import FormItem from '@shared/components/form.item.component'; import {AttributeType, FormType} from './jdni.typing'; import './jdni.scss'; @@ -46,7 +46,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, value: form.factory, - items: BI.map(factorys, (index: number, item: string) => { + items: BI.map(FACTORYS, (index: number, item: string) => { return { text: item, value: item, @@ -120,7 +120,7 @@ const Widget = BI.inherit(BI.Widget, { ref: _ref => { this.otherAttributesRef = _ref; }, - items: BI.map(otherAttributes, (index: number, item: AttributeType) => { + items: BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { return { type: FormItem, text: item.text, @@ -168,7 +168,7 @@ const Widget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: form.originalCharsetName, }, - ...originalCharsetNames, + ...ORIGINAL_CHARSET_NAMES, ], }, }, diff --git a/src/plugins/jndi/jndi.preview.ts b/src/plugins/jndi/jndi.preview.ts index a474182..5000f20 100644 --- a/src/plugins/jndi/jndi.preview.ts +++ b/src/plugins/jndi/jndi.preview.ts @@ -1,7 +1,7 @@ import {Vertical, Label, TextButton} from '@ui'; import FormItem from '@shared/components/form.item.component'; import {FormType, AttributeType} from './jdni.typing'; -import {otherAttributes} from './jndi.service'; +import {OTHER_ATTRIBUTES} from './jndi.service'; const JndiPreview = 'fr.plugin.jndi.preview'; const JndiConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; @@ -98,7 +98,7 @@ const jndiWidget = BI.inherit(BI.Widget, { ref: _ref => { this.otherAttributesRef = _ref; }, - items: BI.map(otherAttributes, (index: number, item: AttributeType) => { + items: BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { return { type: FormItem, text: item.text, diff --git a/src/plugins/jndi/jndi.service.ts b/src/plugins/jndi/jndi.service.ts index 381e827..d1ff6d0 100644 --- a/src/plugins/jndi/jndi.service.ts +++ b/src/plugins/jndi/jndi.service.ts @@ -1,8 +1,8 @@ import {AttributeType} from './jdni.typing'; -export const factorys = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; +export const FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; -export const otherAttributes: AttributeType[] = [ +export const OTHER_ATTRIBUTES: AttributeType[] = [ { text: 'OBJECT_FACTORIES', name: 'objectFactories', @@ -50,7 +50,7 @@ export const otherAttributes: AttributeType[] = [ ]; -export const originalCharsetNames = [ +export const ORIGINAL_CHARSET_NAMES = [ { text: 'GBK', value: 'GBK', From 8329155fe4bdbfb9d2b7cc15461eac2b9e34ad86 Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 23 May 2019 14:34:42 +0800 Subject: [PATCH 16/44] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4JNDI?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 351 ++++++++++++++++++ src/app/app.component.scss | 3 + src/app/app.component.ts | 3 - src/app/app.constant.ts | 1 - src/app/link_set/link-set.model.ts | 15 +- src/app/link_set/more/more.link.component.ts | 4 +- .../link_set/right/right.typing.d.ts} | 0 .../right_detail/right.detail.component.ts | 40 +- .../right_detail/right.detail.service.ts | 43 +++ .../right/right_edit/right.edit.component.ts | 4 +- .../right/right_edit/right.edit.constant.ts | 38 -- .../right_edit/right.edit.jndi.component.ts} | 35 +- .../right_edit/right.edit.mysql.component.ts | 4 +- .../right_show/right.show.jndi.component.ts} | 33 +- src/app/link_set/select/select.component.ts | 11 +- src/app/link_set/select/select.service.ts | 261 ------------- src/plugins/jndi/jdni.scss | 3 - src/plugins/jndi/jndi.pool.ts | 54 --- src/plugins/jndi/jndi.service.ts | 87 ----- 19 files changed, 456 insertions(+), 534 deletions(-) rename src/{plugins/jndi/jdni.typing.d.ts => app/link_set/right/right.typing.d.ts} (100%) create mode 100644 src/app/link_set/right/right_detail/right.detail.service.ts delete mode 100644 src/app/link_set/right/right_edit/right.edit.constant.ts rename src/{plugins/jndi/jndi.edit.ts => app/link_set/right/right_edit/right.edit.jndi.component.ts} (83%) rename src/{plugins/jndi/jndi.preview.ts => app/link_set/right/right_show/right.show.jndi.component.ts} (79%) delete mode 100644 src/plugins/jndi/jdni.scss delete mode 100644 src/plugins/jndi/jndi.pool.ts delete mode 100644 src/plugins/jndi/jndi.service.ts diff --git a/private/constants.ts b/private/constants.ts index 69ddc79..7c1a515 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -1,4 +1,6 @@ export const OTHER_CONNECT = 'other'; +export const JNDI_CONNECT = 'JNDI'; +export const MYSQL_CONNECT = 'mysql'; export const DEFAULT_INFO = 'DESIGNER'; export const ACTION_DELETE = 'ACTION_DELETE'; export const ACTION_COPY = 'ACTION_COPY'; @@ -6,3 +8,352 @@ export const ACTION_TEST = 'ACTION_TEST'; export const TAB_LINK_SET = 'TAB_LINK_SET'; export const TAB_LINK_POOL = 'TAB_LINK_POOL'; + + +export const DATA_LINKS = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', 'JNDI']; + +export const DATA_BASE_TYPE = [ + { + text: 'APACHE KYLIN', + databaseType: 'apache-kylin', + driver: 'org.apache.kylin.jdbc.Driver', + url: 'jdbc:kylin://:/', + }, + { + text: 'DERBY', + databaseType: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + url: 'jdbc:derby://localhost:1527/', + }, + { + text: 'HP Vertica', + databaseType: 'hp-vertica', + driver: 'com.vertica.jdbc.Driver', + url: 'jdbc:vertica://ip:port/databaseName', + }, + { + text: 'IBM DB2', + databaseType: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + url: 'jdbc:db2://hostname:port/dbname', + }, + { + text: 'INFORMIX', + databaseType: 'informix', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, + { + text: 'Microsoft SQL Server', + databaseType: 'sql-server', + driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + url: 'jdbc:sqlserver://localhost:1433;databaseName=', + }, + { + text: 'Oracle', + databaseType: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + url: 'jdbc:oracle:thin:@localhost:1521:databaseName', + }, + { + text: 'Privotal Greenplum Database', + databaseType: 'pivotal-greenplum-database', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'Postgresql', + databaseType: 'postgresql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'GaussDB 200', + databaseType: 'hw-libr-a', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'MySQL', + databaseType: 'mysql', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], + url: 'jdbc:mysql://localhost/dbname', + }, + { + text: OTHER_CONNECT, + databaseType: 'other', + driver: 'org.h2.Driver', + drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], + url: 'jdbc:h2://${ENV_HOME}/../databaseName', + }, + { + text: 'ADS', + databaseType: 'ads', + driver: 'com.mysql.jdbc.Driver', + url: 'jdbc:mysql://hostname:port/my_ads_db', + }, + { + text: 'Amazon Redshift', + databaseType: 'amazon-redshift', + driver: 'com.amazon.redshift.jdbc4.Driver', + drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], + url: 'jdbc:redshift://endpoint:port/database', + }, + { + text: 'APACHE IMPALA', + databaseType: 'apache-impala', + driver: 'com.cloudera.impala.jdbc41.Driver', + url: 'jdbc:impala://hostname:port/_impala_builtins', + }, + { + text: 'APACHE KYLIN', + databaseType: 'apache-kylin', + driver: 'org.apache.kylin.jdbc.Driver', + url: 'jdbc:kylin://:/', + }, + { + text: 'APACHE Phoenix', + databaseType: 'apache-phoenix', + driver: 'org.apache.phoenix.jdbc.PhoenixDriver', + url: 'jdbc:phoenix:hostname:port/dbname', + }, + { + text: 'DERBY', + databaseType: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + url: 'jdbc:derby://localhost:1527/', + }, + { + text: 'Gbase 8A', + databaseType: 'gbase-8a', + driver: 'com.gbase.jdbc.Driver', + url: 'jdbc:gbase://hostname:port/dbname', + }, + { + text: 'Gbase 8S', + databaseType: 'gbase-8s', + driver: 'com.gbasedbt.jdbc.IfxDriver', + url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}', + }, + { + text: 'Gbase 8T', + databaseType: 'gbase-8t', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, + { + text: 'H2', + databaseType: 'h2', + driver: 'org.h2.Driver', + url: 'jdbc:h2://${ENV_HOME}/../databaseName', + }, + { + text: '华为云DWS', + databaseType: 'hw-dws', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'FusionInsight elk', + databaseType: 'hw-elk', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'FusionInsight HD', + databaseType: 'hw-fusioninsight-hd', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;', + }, + { + text: 'GaussDB 200', + databaseType: 'hw-libr-a', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Hadoop Hive', + databaseType: 'hadoop-hive', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: 'Hbase', + databaseType: 'hbase', + driver: 'org.apache.phoenix.jdbc.PhoenixDriver', + url: 'jdbc:phoenix:hostname:port/dbname', + }, { + text: 'HP Vertica', + databaseType: 'hp-vertica', + driver: 'com.vertica.jdbc.Driver', + url: 'jdbc:vertica://ip:port/databaseName', + }, { + text: 'Hsql', + databaseType: 'hsql', + driver: 'com.fr.third.org.hsqldb.jdbcDriver', + url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]', + }, { + text: 'IBM DB2', + databaseType: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + url: 'jdbc:db2://hostname:port/dbname', + }, { + text: 'INFORMIX', + databaseType: 'informix', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, { + text: 'KINGBASE', + databaseType: 'kingbase', + driver: 'com.kingbase.Driver', + url: 'jdbc:kingbase://hostname:port', + }, { + text: 'Microsoft SQL Server', + databaseType: 'sql-server', + driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + url: 'jdbc:sqlserver://localhost:1433;databaseName=', + }, { + text: 'MySQL', + databaseType: 'mysql', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], + url: 'jdbc:mysql://localhost/dbname', + }, + { + text: 'Oracle', + databaseType: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + url: 'jdbc:oracle:thin:@localhost:1521:databaseName', + }, + { + text: 'Pivotal Greenplum Database', + databaseType: 'pivotal-greenplum-database', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Postgresql', + databaseType: 'postgresql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, { + text: 'Presto', + databaseType: 'presto', + driver: 'com.facebook.presto.jdbc.PrestoDriver', + url: 'jdbc:presto://host:port/catalog', + }, { + text: 'SAP HANA', + databaseType: 'sap-hana', + driver: 'com.sap.db.jdbc.Driver', + url: 'jdbc:sap://hostname:port?reconnect=true', + }, { + text: 'SAP Sybase', + databaseType: 'sap-sybase', + driver: 'com.sybase.jdbc4.jdbc.SybDriver', + url: 'jdbc:sybase:Tds:hostname:2638/databasename', + }, { + text: 'SPARK', + databaseType: 'spark', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: 'Sqlite', + databaseType: 'sqlite', + driver: 'org.sqlite.JDBC', + url: 'jdbc:sqlite:[PATH_TO_DB_FILES]', + }, { + text: 'TeraData', + databaseType: 'teradata', + driver: 'com.ncr.teradata.TeraDriver', + url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT', + }, { + text: 'TRANSWARP INCEPTOR', + databaseType: 'transwarp-inceptor', + driver: 'org.apache.hive.jdbc.HiveDriver', + url: 'jdbc:hive2://hostname:port/databasename', + }, { + text: JNDI_CONNECT, + }, +]; + +export const JNDI_FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; + +export const OTHER_ATTRIBUTES = [ + { + text: 'OBJECT_FACTORIES', + name: 'objectFactories', + }, + { + text: 'STATE_FACTORIES', + name: 'stateFactories', + }, + { + text: 'URL_PKG_PREFIXES', + name: 'urlPkgPrefixes', + }, + { + text: 'DNS_URL', + name: 'dnsUrl', + }, + { + text: 'AUTHORITATIVE', + name: 'authoritative', + }, + { + text: 'BATCHSIZE', + name: 'batchSize', + }, + { + text: 'REFERRAL', + name: 'referral', + }, + { + text: 'SECURITY_PROTOCOL', + name: 'securityProtocol', + }, + { + text: 'SECURITY_AUTHENTICATION', + name: 'securityAuthentication', + }, + { + text: 'LANGUAGE', + name: 'language', + }, + { + text: 'APPLET', + name: 'applet', + }, +]; + +export const CONNECT_CHARSET = [ + { + text: 'GBK', + value: 'GBK', + }, + { + text: 'BIG5', + value: 'BIG5', + }, + { + text: 'ISO-8859-1', + value: 'ISO-8859-1', + }, + { + text: 'UTF-8', + value: 'UTF-8', + }, + { + text: 'UTF-16', + value: 'UTF-16', + }, + { + text: 'EUC_JP', + value: 'EUC_JP', + }, + { + text: 'EUC_KR', + value: 'EUC_KR', + }, + { + text: 'CP850', + value: 'CP850', + }, +]; diff --git a/src/app/app.component.scss b/src/app/app.component.scss index 84bed04..b6cfed3 100644 --- a/src/app/app.component.scss +++ b/src/app/app.component.scss @@ -326,4 +326,7 @@ .delete-font .b-font:before { content: "\e6c4"; color: inherit; +} +.jndi-notice{ + color: red; } \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c0806e2..96b5730 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,9 +4,6 @@ import appModel from './app.model'; import title from './title/title.component'; import linkSet from './link_set/link-set.component'; import linkStatus from './link_status/link_status.component'; -import '../plugins/jndi/jndi.edit'; -import '../plugins/jndi/jndi.pool'; -import '../plugins/jndi/jndi.preview'; import {fetchLinkList} from '../shared/crud/crud.request'; import './app.component.scss'; diff --git a/src/app/app.constant.ts b/src/app/app.constant.ts index 0c25e29..fa584b2 100644 --- a/src/app/app.constant.ts +++ b/src/app/app.constant.ts @@ -1,5 +1,4 @@ export const ConstantName = 'dec.constant.database.conf.connect.list'; -export const links = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200']; BI.constant(ConstantName, [ ]); export default ConstantName; diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link-set.model.ts index ac0f912..2ce1b2b 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link-set.model.ts @@ -1,7 +1,8 @@ import {ModelType} from '@ui/index'; import {LinkType} from '@ui/type'; import {deleteConnection, testConnection} from '@shared/crud/crud.request'; -import {databaseTyle, getCnnectionName} from './select/select.service'; +import {getCnnectionName} from './select/select.service'; +import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; import {saveConnection} from './link-set.service'; @@ -78,7 +79,7 @@ const Model: ModelType = { const newCopy = { ...data, isSelected: true, - connectionName:name, + connectionName: name, connectionId: '', }; this.model.linkList = [ @@ -124,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`)) { + if (!DATA_BASE_TYPE.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find')); return; @@ -136,14 +137,14 @@ const Model: ModelType = { _setNewLink(value: string) { const name = getCnnectionName(this.model.linkList, value); let data = {}; - databaseTyle.forEach(item => { + DATA_BASE_TYPE.forEach(item => { if (item.text === value) { data = item; } }); this.model.linkList = [ { - connectionName:name, + connectionName: name, isSelected: true, ...data, text: value, @@ -152,13 +153,13 @@ const Model: ModelType = { ]; this.model.linkSelected = { ...data, - connectionName:name, + connectionName: name, isSelected: true, text: value, }; this.model.linkUpdate = { ...data, - connectionName:name, + connectionName: name, text: value, }; }, diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more.link.component.ts index 8644906..32fbc90 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more.link.component.ts @@ -1,5 +1,5 @@ import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; -import {databaseTyle} from '../select/select.service'; +import {DATA_BASE_TYPE} from '@private/constants'; import MoreLinkItem from './more.link.item.component'; const className = 'fr.component.linkSet.morelink'; let morkLinkItem: any = null; @@ -34,7 +34,7 @@ const Widget: WidgetType = { this._renderItems(); }, _renderItems(text = '') { - const databaseLink = databaseTyle.slice(12, 12 + 33); + const databaseLink = DATA_BASE_TYPE.slice(12, 12 + 33); const items: any[] = []; const that = this; databaseLink.forEach(item => { diff --git a/src/plugins/jndi/jdni.typing.d.ts b/src/app/link_set/right/right.typing.d.ts similarity index 100% rename from src/plugins/jndi/jdni.typing.d.ts rename to src/app/link_set/right/right.typing.d.ts diff --git a/src/app/link_set/right/right_detail/right.detail.component.ts b/src/app/link_set/right/right_detail/right.detail.component.ts index c801ea1..ed73d26 100644 --- a/src/app/link_set/right/right_detail/right.detail.component.ts +++ b/src/app/link_set/right/right_detail/right.detail.component.ts @@ -1,53 +1,31 @@ import {WidgetType, Vertical} from '@ui/index'; import Model from '../../link-set.model'; -import Title from '../right_title/right.title.component'; -import RightShow from '../right_show/right.show.component'; -import RightEdit from '../right_edit/right.edit.component'; -import RightEditMysql from '../right_edit/right.edit.mysql.component'; +import {renderEdit} from './right.detail.service'; import {LinkType} from '@ui/type'; -import pluginListConstant from '../../../app.constant'; + const className = 'fr.component.right.detail'; -let rightDetail: any = null; -const renderEdit = (linkSelected: LinkType): void => { - const plugins: string[] = BI.Constants.getConstant(pluginListConstant); - const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); - let typeEdit = linkSelected.databaseType === 'mysql' ? RightEditMysql : RightEdit; - if (isPlugin) { - typeEdit = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); - } - const showPage = !isPlugin ? RightShow : BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); - rightDetail.populate(BI.createItems([ - { - type: Title, - isEdit: linkSelected.isSelected, - linkSelected, - }, { - type: linkSelected.isSelected ? typeEdit : showPage, - linkSelected, - }, - ])); -}; + const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { linkSelected(linkSelected: LinkType) { - renderEdit(linkSelected); + renderEdit(this.rightDetail, linkSelected); }, }, render() { return { type: Vertical, - cls:'right-content', - ref(_ref: any) { - rightDetail = _ref; + cls: 'right-content', + ref: _ref => { + this.rightDetail = _ref; }, }; }, mounted() { const linkSelected: LinkType = this.model.linkSelected; - renderEdit(linkSelected); + renderEdit(this.rightDetail, linkSelected); }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_set/right/right_detail/right.detail.service.ts b/src/app/link_set/right/right_detail/right.detail.service.ts new file mode 100644 index 0000000..b1b2dd5 --- /dev/null +++ b/src/app/link_set/right/right_detail/right.detail.service.ts @@ -0,0 +1,43 @@ +import Title from '../right_title/right.title.component'; +import RightShow from '../right_show/right.show.component'; +import RightShowJndi from '../right_show/right.show.jndi.component'; +import RightEdit from '../right_edit/right.edit.component'; +import RightEditMysql from '../right_edit/right.edit.mysql.component'; +import RightEditJndi from '../right_edit/right.edit.jndi.component'; +import {LinkType} from '@ui/type'; +import pluginListConstant from '../../../app.constant'; +import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; + +export const renderEdit = (rightDetail, linkSelected: LinkType): void => { + const plugins: string[] = BI.Constants.getConstant(pluginListConstant); + const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); + let editPage = null; + let showPage = null; + switch (linkSelected.text) { + case (MYSQL_CONNECT): + editPage = RightEditMysql; + showPage = RightShow; + break; + case (JNDI_CONNECT): + editPage = RightEditJndi; + showPage = RightShowJndi; + break; + default: + editPage = RightEdit; + showPage = RightShow; + } + if (isPlugin) { + editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); + showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); + } + rightDetail.populate(BI.createItems([ + { + type: Title, + isEdit: linkSelected.isSelected, + linkSelected, + }, { + type: linkSelected.isSelected ? editPage : showPage, + linkSelected, + }, + ])); +}; 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 539cccc..0b943bd 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 @@ -1,6 +1,6 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; +import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; @@ -119,7 +119,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: '', }, - ...BI.Constants.getConstant(charset), + ...CONNECT_CHARSET, ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, 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 deleted file mode 100644 index 27c3754..0000000 --- a/src/app/link_set/right/right_edit/right.edit.constant.ts +++ /dev/null @@ -1,38 +0,0 @@ -export const ConstantName = 'bi.constant.database.conf.charset.list'; - -export const Constant = BI.constant(ConstantName, [ - { - text: 'GBK', - value: 'GBK', - }, - { - text: 'BIG5', - value: 'BIG5', - }, - { - text: 'ISO-8859-1', - value: 'ISO-8859-1', - }, - { - text: 'UTF-8', - value: 'UTF-8', - }, - { - text: 'UTF-16', - value: 'UTF-16', - }, - { - text: 'EUC_JP', - value: 'EUC_JP', - }, - { - text: 'EUC_KR', - value: 'EUC_KR', - }, - { - text: 'CP850', - value: 'CP850', - }, -]); - -export default ConstantName; diff --git a/src/plugins/jndi/jndi.edit.ts b/src/app/link_set/right/right_edit/right.edit.jndi.component.ts similarity index 83% rename from src/plugins/jndi/jndi.edit.ts rename to src/app/link_set/right/right_edit/right.edit.jndi.component.ts index a4283f3..02d0e76 100644 --- a/src/plugins/jndi/jndi.edit.ts +++ b/src/app/link_set/right/right_edit/right.edit.jndi.component.ts @@ -1,16 +1,13 @@ import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; -import {FACTORYS, OTHER_ATTRIBUTES, ORIGINAL_CHARSET_NAMES} from './jndi.service'; import FormItem from '@shared/components/form.item.component'; -import {AttributeType, FormType} from './jdni.typing'; -import './jdni.scss'; -const RedisConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; -const form: FormType = { - url: '192.168.1.22', -}; +import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; +import {AttributeType} from '../right.typing'; -const classNameEdit = 'dec.plugin.jndi.edit'; +const classNameEdit = 'fr.component.right.edit.jndi'; const Widget = BI.inherit(BI.Widget, { render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + return { type: Vertical, cls: 'right-show', @@ -23,7 +20,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.connectionName, + value: connectionName, }, }, { @@ -45,8 +42,8 @@ const Widget = BI.inherit(BI.Widget, { type: TextValueCombo, cls: 'bi-border', width: 300, - value: form.factory, - items: BI.map(FACTORYS, (index: number, item: string) => { + value: factory, + items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { return { text: item, value: item, @@ -63,7 +60,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.url, + value: url, }, }, { @@ -75,7 +72,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.principal, + value: principal, }, }, { @@ -87,7 +84,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form.credentials, + value: credentials, }, }, { @@ -130,7 +127,7 @@ const Widget = BI.inherit(BI.Widget, { cls: 'bi-border', width: 300, allowBlank: true, - value: form[item.name], + value: this.options[item.name], }, }; }), @@ -166,9 +163,9 @@ const Widget = BI.inherit(BI.Widget, { width: 300, items: [{ text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: form.originalCharsetName, + value: originalCharsetName, }, - ...ORIGINAL_CHARSET_NAMES, + ...CONNECT_CHARSET, ], }, }, @@ -181,7 +178,3 @@ const Widget = BI.inherit(BI.Widget, { }); BI.shortcut(classNameEdit, Widget); export default classNameEdit; -export const ConstantName = 'dec.constant.database.conf.connect.list'; -BI.config(ConstantName, (datas: string[]) => [...datas, 'JNDI']); -BI.constant(RedisConstantName, form); -BI.constant('dec.constant.database.conf.connect.form.jndi.edit', classNameEdit); 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 7b65bd5..b7b55a5 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 @@ -1,6 +1,6 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; -import charset from './right.edit.constant'; +import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link-set.model'; import FormItem from '@shared/components/form.item.component'; import Title from '@shared/components/title.component'; @@ -91,7 +91,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: '', }, - ...BI.Constants.getConstant(charset), + ...CONNECT_CHARSET, ], listeners: [{ eventName: BI.TextValueCombo.EVENT_CHANGE, diff --git a/src/plugins/jndi/jndi.preview.ts b/src/app/link_set/right/right_show/right.show.jndi.component.ts similarity index 79% rename from src/plugins/jndi/jndi.preview.ts rename to src/app/link_set/right/right_show/right.show.jndi.component.ts index 5000f20..b102726 100644 --- a/src/plugins/jndi/jndi.preview.ts +++ b/src/app/link_set/right/right_show/right.show.jndi.component.ts @@ -1,14 +1,13 @@ -import {Vertical, Label, TextButton} from '@ui'; +import {Vertical, TextButton, Label} from '@ui'; import FormItem from '@shared/components/form.item.component'; -import {FormType, AttributeType} from './jdni.typing'; -import {OTHER_ATTRIBUTES} from './jndi.service'; +import {OTHER_ATTRIBUTES} from '@private/constants'; +import {AttributeType} from '../right.typing'; -const JndiPreview = 'fr.plugin.jndi.preview'; -const JndiConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; -const jndiForm: FormType = BI.Constants.getConstant(JndiConstantName); - -const jndiWidget = BI.inherit(BI.Widget, { +const className = 'fr.component.right.show.jndi'; +const Widget = BI.inherit(BI.Widget, { render() { + const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; + return { type: Vertical, cls: 'right-show', @@ -18,7 +17,7 @@ const jndiWidget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), form: { type: Label, - text: jndiForm.connectionName, + text: connectionName, }, }, { @@ -38,7 +37,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.factory, + text: factory, }, }, { @@ -47,7 +46,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.url, + text: url, }, }, { @@ -56,7 +55,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.principal, + text: principal, }, }, { @@ -65,7 +64,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm.credentials, + text: credentials, }, }, { @@ -105,7 +104,7 @@ const jndiWidget = BI.inherit(BI.Widget, { width: 180, form: { type: Label, - text: jndiForm[item.name], + text: this.options[item.name], }, }; }), @@ -128,12 +127,12 @@ const jndiWidget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: Label, - text: jndiForm.originalCharsetName ? jndiForm.originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), }, }, ], }; }, }); -BI.shortcut(JndiPreview, jndiWidget); -BI.constant('dec.constant.database.conf.connect.form.jndi.preview', JndiPreview); +BI.shortcut(className, Widget); +export default className; diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.component.ts index cf3d65f..243dc04 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.component.ts @@ -1,7 +1,8 @@ import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui'; import selectModel from '../link-set.model'; import {moreLink} from '../more/more.link.service'; -import connectList, {links} from '../../app.constant'; +import connectList from '../../app.constant'; +import {DATA_LINKS} from '@private/constants'; const className = 'fr.linkset.select'; const Widget: WidgetType = { _store() { @@ -12,7 +13,7 @@ const Widget: WidgetType = { return { type: Combo, - cls:'select', + cls: 'select', trigger: 'click', adjustYOffset: 4, el: { @@ -23,8 +24,8 @@ const Widget: WidgetType = { popup: { el: { type: ButtonGroup, - cls:'database-link-items', - items: [...BI.map([...links, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { + cls: 'database-link-items', + items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { return { type: TextItem, height: 24, @@ -56,7 +57,7 @@ const Widget: WidgetType = { }, maxHeight: 400, }, - listeners:[{ + listeners: [{ eventName: 'EVENT_CHANGE', action: (v: string) => { if (v === 'more') { diff --git a/src/app/link_set/select/select.service.ts b/src/app/link_set/select/select.service.ts index 99c5d9c..0e11c16 100644 --- a/src/app/link_set/select/select.service.ts +++ b/src/app/link_set/select/select.service.ts @@ -1,266 +1,5 @@ import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -import {OTHER_CONNECT} from '@private/constants'; - -export const databaseTyle = [ - { - text:'APACHE KYLIN', - databaseType: 'apache-kylin', - driver: 'org.apache.kylin.jdbc.Driver', - url: 'jdbc:kylin://:/', - }, - { - text:'DERBY', - databaseType: 'derby', - driver: 'org.apache.derby.jdbc.ClientDriver', - url: 'jdbc:derby://localhost:1527/', - }, - { - text:'HP Vertica', - databaseType: 'hp-vertica', - driver: 'com.vertica.jdbc.Driver', - url: 'jdbc:vertica://ip:port/databaseName', - }, - { - text:'IBM DB2', - databaseType: 'ibm-db2', - driver: 'com.ibm.db2.jcc.DB2Driver', - url: 'jdbc:db2://hostname:port/dbname', - }, - { - text:'INFORMIX', - databaseType: 'informix', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, - { - text:'Microsoft SQL Server', - databaseType: 'sql-server', - driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - url: 'jdbc:sqlserver://localhost:1433;databaseName=', - }, - { - text:'Oracle', - databaseType: 'oracle', - driver: 'oracle.jdbc.driver.OracleDriver', - url: 'jdbc:oracle:thin:@localhost:1521:databaseName', - }, - { - text:'Privotal Greenplum Database', - databaseType: 'pivotal-greenplum-database', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'Postgresql', - databaseType: 'postgresql', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'GaussDB 200', - databaseType: 'hw-libr-a', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'MySQL', - databaseType: 'mysql', - driver: 'com.mysql.jdbc.Driver', - drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], - url: 'jdbc:mysql://localhost/dbname', - }, - { - text: OTHER_CONNECT, - databaseType: 'other', - driver: 'org.h2.Driver', - drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], - url: 'jdbc:h2://${ENV_HOME}/../databaseName', - }, - { - text:'ADS', - databaseType:'ads', - driver:'com.mysql.jdbc.Driver', - url:'jdbc:mysql://hostname:port/my_ads_db', - }, - { - text:'Amazon Redshift', - databaseType:'amazon-redshift', - driver: 'com.amazon.redshift.jdbc4.Driver', - drivers:['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], - url:'jdbc:redshift://endpoint:port/database', - }, - { - text:'APACHE IMPALA', - databaseType:'apache-impala', - driver:'com.cloudera.impala.jdbc41.Driver', - url:'jdbc:impala://hostname:port/_impala_builtins', - }, - { - text:'APACHE KYLIN', - databaseType:'apache-kylin', - driver:'org.apache.kylin.jdbc.Driver', - url:'jdbc:kylin://:/', - }, - { - text:'APACHE Phoenix', - databaseType: 'apache-phoenix', - driver: 'org.apache.phoenix.jdbc.PhoenixDriver', - url: 'jdbc:phoenix:hostname:port/dbname', - }, - { - text:'DERBY', - databaseType: 'derby', - driver: 'org.apache.derby.jdbc.ClientDriver', - url: 'jdbc:derby://localhost:1527/', - }, - { - text:'Gbase 8A', - databaseType: 'gbase-8a', - driver: 'com.gbase.jdbc.Driver', - url: 'jdbc:gbase://hostname:port/dbname', - }, - { - text:'Gbase 8S', - databaseType: 'gbase-8s', - driver: 'com.gbasedbt.jdbc.IfxDriver', - url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}', - }, - { - text:'Gbase 8T', - databaseType: 'gbase-8t', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, - { - text:'H2', - databaseType: 'h2', - driver: 'org.h2.Driver', - url: 'jdbc:h2://${ENV_HOME}/../databaseName', - }, - { - text:'华为云DWS', - databaseType: 'hw-dws', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'FusionInsight elk', - databaseType: 'hw-elk', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text:'FusionInsight HD', - databaseType: 'hw-fusioninsight-hd', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;', - }, - { - text:'GaussDB 200', - databaseType: 'hw-libr-a', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Hadoop Hive', - databaseType: 'hadoop-hive', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, { - text:'Hbase', - databaseType: 'hbase', - driver: 'org.apache.phoenix.jdbc.PhoenixDriver', - url: 'jdbc:phoenix:hostname:port/dbname', - }, { - text:'HP Vertica', - databaseType: 'hp-vertica', - driver: 'com.vertica.jdbc.Driver', - url: 'jdbc:vertica://ip:port/databaseName', - }, { - text:'Hsql', - databaseType: 'hsql', - driver: 'com.fr.third.org.hsqldb.jdbcDriver', - url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]', - }, { - text:'IBM DB2', - databaseType: 'ibm-db2', - driver: 'com.ibm.db2.jcc.DB2Driver', - url: 'jdbc:db2://hostname:port/dbname', - }, { - text:'INFORMIX', - databaseType: 'informix', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, { - text:'KINGBASE', - databaseType: 'kingbase', - driver: 'com.kingbase.Driver', - url: 'jdbc:kingbase://hostname:port', - }, { - text:'Microsoft SQL Server', - databaseType: 'sql-server', - driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - url: 'jdbc:sqlserver://localhost:1433;databaseName=', - }, { - text:'MySQL', - databaseType: 'mysql', - driver: 'com.mysql.jdbc.Driver', - drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], - url: 'jdbc:mysql://localhost/dbname', - }, - { - text:'Oracle', - databaseType: 'oracle', - driver: 'oracle.jdbc.driver.OracleDriver', - url: 'jdbc:oracle:thin:@localhost:1521:databaseName', - }, - { - text:'Pivotal Greenplum Database', - databaseType: 'pivotal-greenplum-database', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Postgresql', - databaseType: 'postgresql', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, { - text:'Presto', - databaseType: 'presto', - driver: 'com.facebook.presto.jdbc.PrestoDriver', - url: 'jdbc:presto://host:port/catalog', - }, { - text:'SAP HANA', - databaseType: 'sap-hana', - driver: 'com.sap.db.jdbc.Driver', - url: 'jdbc:sap://hostname:port?reconnect=true', - }, { - text:'SAP Sybase', - databaseType: 'sap-sybase', - driver: 'com.sybase.jdbc4.jdbc.SybDriver', - url: 'jdbc:sybase:Tds:hostname:2638/databasename', - }, { - text:'SPARK', - databaseType: 'spark', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, { - text:'Sqlite', - databaseType: 'sqlite', - driver: 'org.sqlite.JDBC', - url: 'jdbc:sqlite:[PATH_TO_DB_FILES]', - }, { - text:'TeraData', - databaseType: 'teradata', - driver: 'com.ncr.teradata.TeraDriver', - url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT', - }, { - text:'TRANSWARP INCEPTOR', - databaseType: 'transwarp-inceptor', - driver: 'org.apache.hive.jdbc.HiveDriver', - url: 'jdbc:hive2://hostname:port/databasename', - }, -]; export const getCnnectionName = (links: LinkType[], name: string): string => { const plugins: string[] = BI.Constants.getConstant(pluginListConstant); diff --git a/src/plugins/jndi/jdni.scss b/src/plugins/jndi/jdni.scss deleted file mode 100644 index a3294bb..0000000 --- a/src/plugins/jndi/jdni.scss +++ /dev/null @@ -1,3 +0,0 @@ -.jndi-notice{ - color: red; -} \ No newline at end of file diff --git a/src/plugins/jndi/jndi.pool.ts b/src/plugins/jndi/jndi.pool.ts deleted file mode 100644 index ba12135..0000000 --- a/src/plugins/jndi/jndi.pool.ts +++ /dev/null @@ -1,54 +0,0 @@ -const JndiPool = 'fr.plugin.jndi.pool'; - -const JndiWidget = BI.inherit(BI.Widget, { - render() { - const {maxActive, numActive} = 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', - height: 20, - text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), - }, - ], - }, - ], - }, - ], - }; - }, -}); -BI.shortcut(JndiPool, JndiWidget); -BI.constant('dec.constant.database.conf.connect.form.jndi.pool', JndiPool); diff --git a/src/plugins/jndi/jndi.service.ts b/src/plugins/jndi/jndi.service.ts deleted file mode 100644 index d1ff6d0..0000000 --- a/src/plugins/jndi/jndi.service.ts +++ /dev/null @@ -1,87 +0,0 @@ -import {AttributeType} from './jdni.typing'; - -export const FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory']; - -export const OTHER_ATTRIBUTES: AttributeType[] = [ - { - text: 'OBJECT_FACTORIES', - name: 'objectFactories', - }, - { - text: 'STATE_FACTORIES', - name: 'stateFactories', - }, - { - text: 'URL_PKG_PREFIXES', - name: 'urlPkgPrefixes', - }, - { - text: 'DNS_URL', - name: 'dnsUrl', - }, - { - text: 'AUTHORITATIVE', - name: 'authoritative', - }, - { - text: 'BATCHSIZE', - name: 'batchSize', - }, - { - text: 'REFERRAL', - name: 'referral', - }, - { - text: 'SECURITY_PROTOCOL', - name: 'securityProtocol', - }, - { - text: 'SECURITY_AUTHENTICATION', - name: 'securityAuthentication', - }, - { - text: 'LANGUAGE', - name: 'language', - }, - { - text: 'APPLET', - name: 'applet', - }, -]; - - -export const ORIGINAL_CHARSET_NAMES = [ - { - text: 'GBK', - value: 'GBK', - }, - { - text: 'BIG5', - value: 'BIG5', - }, - { - text: 'ISO-8859-1', - value: 'ISO-8859-1', - }, - { - text: 'UTF-8', - value: 'UTF-8', - }, - { - text: 'UTF-16', - value: 'UTF-16', - }, - { - text: 'EUC_JP', - value: 'EUC_JP', - }, - { - text: 'EUC_KR', - value: 'EUC_KR', - }, - { - text: 'CP850', - value: 'CP850', - }, -] -; From 0c7bc0425d51303940aa8f21ad56901144cfbda6 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 24 May 2019 10:05:03 +0800 Subject: [PATCH 17/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 157 +++++++++--------- src/app/{app.component.ts => app.ts} | 6 +- src/app/link_set/left/left.service.ts | 2 +- .../left/{left.component.ts => left.ts} | 4 +- .../{left.item.component.ts => left_item.ts} | 4 +- ...em.icon.component.ts => left_item_icon.ts} | 2 +- .../{link-set.model.ts => link_set.model.ts} | 2 +- ...ink-set.service.ts => link_set.service.ts} | 0 .../{link-set.component.ts => link_set.ts} | 8 +- ...e.link.service.ts => more_link.service.ts} | 4 +- .../{more.link.component.ts => more_link.ts} | 6 +- ...nk.item.component.ts => more_link_item.ts} | 10 +- .../{nothing.component.ts => nothing.ts} | 4 +- .../right/{right.component.ts => right.ts} | 12 +- ...ail.service.ts => right_detail.service.ts} | 12 +- ...ht.detail.component.ts => right_detail.ts} | 4 +- ....edit.service.ts => right_edit.service.ts} | 0 ...{right.edit.component.ts => right_edit.ts} | 8 +- ...t.jndi.component.ts => right_edit_jndi.ts} | 2 +- ...mysql.component.ts => right_edit_mysql.ts} | 8 +- ...{right.show.component.ts => right_show.ts} | 6 +- ...w.jndi.component.ts => right_show_jndi.ts} | 2 +- ...ight.title.component.ts => right_title.ts} | 8 +- .../select/{select.component.ts => select.ts} | 4 +- src/app/link_status/left/left.service.ts | 2 +- .../left/{left.component.ts => left.ts} | 0 .../{left.item.component.ts => left_item.ts} | 0 ...ink_status.component.ts => link_status.ts} | 4 +- .../right/{right.component.ts => right.ts} | 14 +- ...{right.card.component.ts => right_card.ts} | 8 +- .../title/{title.component.ts => title.ts} | 2 +- ...{title_item.component.ts => title_item.ts} | 0 src/index.ts | 4 +- .../{both.side.component.ts => both_side.ts} | 2 +- .../{form.item.component.ts => form_item.ts} | 0 .../{title.component.ts => title.ts} | 0 36 files changed, 158 insertions(+), 153 deletions(-) rename src/app/{app.component.ts => app.ts} (83%) rename src/app/link_set/left/{left.component.ts => left.ts} (92%) rename src/app/link_set/left/left_item/{left.item.component.ts => left_item.ts} (95%) rename src/app/link_set/left/left_item/{left.item.icon.component.ts => left_item_icon.ts} (98%) rename src/app/link_set/{link-set.model.ts => link_set.model.ts} (99%) rename src/app/link_set/{link-set.service.ts => link_set.service.ts} (100%) rename src/app/link_set/{link-set.component.ts => link_set.ts} (84%) rename src/app/link_set/more/{more.link.service.ts => more_link.service.ts} (95%) rename src/app/link_set/more/{more.link.component.ts => more_link.ts} (88%) rename src/app/link_set/more/{more.link.item.component.ts => more_link_item.ts} (84%) rename src/app/link_set/right/{nothing.component.ts => nothing.ts} (94%) rename src/app/link_set/right/{right.component.ts => right.ts} (78%) rename src/app/link_set/right/right_detail/{right.detail.service.ts => right_detail.service.ts} (76%) rename src/app/link_set/right/right_detail/{right.detail.component.ts => right_detail.ts} (88%) rename src/app/link_set/right/right_edit/{right.edit.service.ts => right_edit.service.ts} (100%) rename src/app/link_set/right/right_edit/{right.edit.component.ts => right_edit.ts} (97%) rename src/app/link_set/right/right_edit/{right.edit.jndi.component.ts => right_edit_jndi.ts} (98%) rename src/app/link_set/right/right_edit/{right.edit.mysql.component.ts => right_edit_mysql.ts} (96%) rename src/app/link_set/right/right_show/{right.show.component.ts => right_show.ts} (92%) rename src/app/link_set/right/right_show/{right.show.jndi.component.ts => right_show_jndi.ts} (98%) rename src/app/link_set/right/right_title/{right.title.component.ts => right_title.ts} (92%) rename src/app/link_set/select/{select.component.ts => select.ts} (95%) rename src/app/link_status/left/{left.component.ts => left.ts} (100%) rename src/app/link_status/left/{left.item.component.ts => left_item.ts} (100%) rename src/app/link_status/{link_status.component.ts => link_status.ts} (93%) rename src/app/link_status/right/{right.component.ts => right.ts} (89%) rename src/app/link_status/right/{right.card.component.ts => right_card.ts} (93%) rename src/app/title/{title.component.ts => title.ts} (95%) rename src/app/title/title_item/{title_item.component.ts => title_item.ts} (100%) rename src/shared/components/{both.side.component.ts => both_side.ts} (97%) rename src/shared/components/{form.item.component.ts => form_item.ts} (100%) rename src/shared/components/{title.component.ts => title.ts} (100%) diff --git a/private/constants.ts b/private/constants.ts index 7c1a515..68aa3a3 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -12,81 +12,7 @@ export const TAB_LINK_POOL = 'TAB_LINK_POOL'; export const DATA_LINKS = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', 'JNDI']; -export const DATA_BASE_TYPE = [ - { - text: 'APACHE KYLIN', - databaseType: 'apache-kylin', - driver: 'org.apache.kylin.jdbc.Driver', - url: 'jdbc:kylin://:/', - }, - { - text: 'DERBY', - databaseType: 'derby', - driver: 'org.apache.derby.jdbc.ClientDriver', - url: 'jdbc:derby://localhost:1527/', - }, - { - text: 'HP Vertica', - databaseType: 'hp-vertica', - driver: 'com.vertica.jdbc.Driver', - url: 'jdbc:vertica://ip:port/databaseName', - }, - { - text: 'IBM DB2', - databaseType: 'ibm-db2', - driver: 'com.ibm.db2.jcc.DB2Driver', - url: 'jdbc:db2://hostname:port/dbname', - }, - { - text: 'INFORMIX', - databaseType: 'informix', - driver: 'com.informix.jdbc.IfxDriver', - url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', - }, - { - text: 'Microsoft SQL Server', - databaseType: 'sql-server', - driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - url: 'jdbc:sqlserver://localhost:1433;databaseName=', - }, - { - text: 'Oracle', - databaseType: 'oracle', - driver: 'oracle.jdbc.driver.OracleDriver', - url: 'jdbc:oracle:thin:@localhost:1521:databaseName', - }, - { - text: 'Privotal Greenplum Database', - databaseType: 'pivotal-greenplum-database', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text: 'Postgresql', - databaseType: 'postgresql', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text: 'GaussDB 200', - databaseType: 'hw-libr-a', - driver: 'org.postgresql.Driver', - url: 'jdbc:postgresql://hostname:port/dbname', - }, - { - text: 'MySQL', - databaseType: 'mysql', - driver: 'com.mysql.jdbc.Driver', - drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], - url: 'jdbc:mysql://localhost/dbname', - }, - { - text: OTHER_CONNECT, - databaseType: 'other', - driver: 'org.h2.Driver', - drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], - url: 'jdbc:h2://${ENV_HOME}/../databaseName', - }, +export const DATA_BASE_TYPE_OTHER = [ { text: 'ADS', databaseType: 'ads', @@ -269,7 +195,86 @@ export const DATA_BASE_TYPE = [ databaseType: 'transwarp-inceptor', driver: 'org.apache.hive.jdbc.HiveDriver', url: 'jdbc:hive2://hostname:port/databasename', - }, { + }, +]; + +export const DATA_BASE_TYPE = [ + { + text: 'APACHE KYLIN', + databaseType: 'apache-kylin', + driver: 'org.apache.kylin.jdbc.Driver', + url: 'jdbc:kylin://:/', + }, + { + text: 'DERBY', + databaseType: 'derby', + driver: 'org.apache.derby.jdbc.ClientDriver', + url: 'jdbc:derby://localhost:1527/', + }, + { + text: 'HP Vertica', + databaseType: 'hp-vertica', + driver: 'com.vertica.jdbc.Driver', + url: 'jdbc:vertica://ip:port/databaseName', + }, + { + text: 'IBM DB2', + databaseType: 'ibm-db2', + driver: 'com.ibm.db2.jcc.DB2Driver', + url: 'jdbc:db2://hostname:port/dbname', + }, + { + text: 'INFORMIX', + databaseType: 'informix', + driver: 'com.informix.jdbc.IfxDriver', + url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}', + }, + { + text: 'Microsoft SQL Server', + databaseType: 'sql-server', + driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + url: 'jdbc:sqlserver://localhost:1433;databaseName=', + }, + { + text: 'Oracle', + databaseType: 'oracle', + driver: 'oracle.jdbc.driver.OracleDriver', + url: 'jdbc:oracle:thin:@localhost:1521:databaseName', + }, + { + text: 'Privotal Greenplum Database', + databaseType: 'pivotal-greenplum-database', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'Postgresql', + databaseType: 'postgresql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'GaussDB 200', + databaseType: 'hw-libr-a', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/dbname', + }, + { + text: 'MySQL', + databaseType: 'mysql', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'], + url: 'jdbc:mysql://localhost/dbname', + }, + { + text: OTHER_CONNECT, + databaseType: 'other', + driver: 'org.h2.Driver', + drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], + url: 'jdbc:h2://${ENV_HOME}/../databaseName', + }, + ...DATA_BASE_TYPE_OTHER, + { text: JNDI_CONNECT, }, ]; diff --git a/src/app/app.component.ts b/src/app/app.ts similarity index 83% rename from src/app/app.component.ts rename to src/app/app.ts index 96b5730..6682d8d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.ts @@ -1,9 +1,9 @@ import {Vtape} from '../ui/index'; import {LinkType} from '@ui/type'; import appModel from './app.model'; -import title from './title/title.component'; -import linkSet from './link_set/link-set.component'; -import linkStatus from './link_status/link_status.component'; +import title from './title/title'; +import linkSet from './link_set/link_set'; +import linkStatus from './link_status/link_status'; import {fetchLinkList} from '../shared/crud/crud.request'; import './app.component.scss'; diff --git a/src/app/link_set/left/left.service.ts b/src/app/link_set/left/left.service.ts index 8f792c4..4d8c58f 100644 --- a/src/app/link_set/left/left.service.ts +++ b/src/app/link_set/left/left.service.ts @@ -1,5 +1,5 @@ import {LinkType} from '@ui/type'; -import LeftItem from './left_item/left.item.component'; +import LeftItem from './left_item/left_item'; export const getLinks = (linkList: LinkType[]): any => { const links: any[] = []; diff --git a/src/app/link_set/left/left.component.ts b/src/app/link_set/left/left.ts similarity index 92% rename from src/app/link_set/left/left.component.ts rename to src/app/link_set/left/left.ts index 0d4c53a..dad09bd 100644 --- a/src/app/link_set/left/left.component.ts +++ b/src/app/link_set/left/left.ts @@ -1,5 +1,5 @@ import {WidgetType, Vertical} from '@ui'; -import Model from '../link-set.model'; +import Model from '../link_set.model'; import {LinkType} from '@ui/type'; import {getLinks} from './left.service'; const className = 'fr.component.linkset.left'; @@ -8,7 +8,7 @@ const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { linkList(linkList: LinkType[]) { leftContent.populate(BI.createItems(getLinks(linkList))); }, diff --git a/src/app/link_set/left/left_item/left.item.component.ts b/src/app/link_set/left/left_item/left_item.ts similarity index 95% rename from src/app/link_set/left/left_item/left.item.component.ts rename to src/app/link_set/left/left_item/left_item.ts index 660d803..c75dfa6 100644 --- a/src/app/link_set/left/left_item/left.item.component.ts +++ b/src/app/link_set/left/left_item/left_item.ts @@ -1,6 +1,6 @@ import {WidgetType, Left, Label, Icon, TextButton} from '@ui'; -import ItemIcon from './left.item.icon.component'; -import Model from '../../link-set.model'; +import ItemIcon from './left_item_icon'; +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 = { 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.ts similarity index 98% rename from src/app/link_set/left/left_item/left.item.icon.component.ts rename to src/app/link_set/left/left_item/left_item_icon.ts index 3079d35..9bffb2e 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.ts @@ -1,5 +1,5 @@ import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui/index'; -import Model from '../../link-set.model'; +import Model from '../../link_set.model'; import {ACTION_DELETE} from '@private/constants'; const className = 'fr.component.linkSet.left.item.icon'; diff --git a/src/app/link_set/link-set.model.ts b/src/app/link_set/link_set.model.ts similarity index 99% rename from src/app/link_set/link-set.model.ts rename to src/app/link_set/link_set.model.ts index 2ce1b2b..ba8aae4 100644 --- a/src/app/link_set/link-set.model.ts +++ b/src/app/link_set/link_set.model.ts @@ -4,7 +4,7 @@ import {deleteConnection, testConnection} from '@shared/crud/crud.request'; import {getCnnectionName} from './select/select.service'; import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; -import {saveConnection} from './link-set.service'; +import {saveConnection} from './link_set.service'; const className = 'fr.model.linkset'; const Model: ModelType = { diff --git a/src/app/link_set/link-set.service.ts b/src/app/link_set/link_set.service.ts similarity index 100% rename from src/app/link_set/link-set.service.ts rename to src/app/link_set/link_set.service.ts diff --git a/src/app/link_set/link-set.component.ts b/src/app/link_set/link_set.ts similarity index 84% rename from src/app/link_set/link-set.component.ts rename to src/app/link_set/link_set.ts index 4795ca7..599efb2 100644 --- a/src/app/link_set/link-set.component.ts +++ b/src/app/link_set/link_set.ts @@ -1,8 +1,8 @@ import {Htape, WidgetType, Vtape, Left} from '@ui'; -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 LeftList from './left/left'; +import linkSetModel from './link_set.model'; +import Select from './select/select'; +import Right from './right/right'; import {TAB_LINK_SET} from '@private/constants'; const className = 'fr.linkset'; const Widget: WidgetType = { diff --git a/src/app/link_set/more/more.link.service.ts b/src/app/link_set/more/more_link.service.ts similarity index 95% rename from src/app/link_set/more/more.link.service.ts rename to src/app/link_set/more/more_link.service.ts index cf2c654..b225ccc 100644 --- a/src/app/link_set/more/more.link.service.ts +++ b/src/app/link_set/more/more_link.service.ts @@ -1,4 +1,4 @@ -import MoreLink from './more.link.component'; +import MoreLink from './more_link'; let SubbitButton: any = null; let selectKey = ''; export const moreLink = (onConfirm?: Function): void => { @@ -22,7 +22,7 @@ export const moreLink = (onConfirm?: Function): void => { }, ], }, - footer:{ + footer: { type: 'bi.right_vertical_adapt', lgap: 10, items: [{ diff --git a/src/app/link_set/more/more.link.component.ts b/src/app/link_set/more/more_link.ts similarity index 88% rename from src/app/link_set/more/more.link.component.ts rename to src/app/link_set/more/more_link.ts index 32fbc90..00715c2 100644 --- a/src/app/link_set/more/more.link.component.ts +++ b/src/app/link_set/more/more_link.ts @@ -1,6 +1,6 @@ import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; -import {DATA_BASE_TYPE} from '@private/constants'; -import MoreLinkItem from './more.link.item.component'; +import {DATA_BASE_TYPE_OTHER} from '@private/constants'; +import MoreLinkItem from './more_link_item'; const className = 'fr.component.linkSet.morelink'; let morkLinkItem: any = null; const Widget: WidgetType = { @@ -34,7 +34,7 @@ const Widget: WidgetType = { this._renderItems(); }, _renderItems(text = '') { - const databaseLink = DATA_BASE_TYPE.slice(12, 12 + 33); + const databaseLink = DATA_BASE_TYPE_OTHER; const items: any[] = []; const that = this; databaseLink.forEach(item => { diff --git a/src/app/link_set/more/more.link.item.component.ts b/src/app/link_set/more/more_link_item.ts similarity index 84% rename from src/app/link_set/more/more.link.item.component.ts rename to src/app/link_set/more/more_link_item.ts index 0b2724f..1f5f187 100644 --- a/src/app/link_set/more/more.link.item.component.ts +++ b/src/app/link_set/more/more_link_item.ts @@ -6,24 +6,24 @@ const Widget: WidgetType = { return { type: Vertical, - cls:'link-item', + cls: 'link-item', width: 120, height: 117, - items:[ + items: [ { type: Img, width: 120, height: 90, - src:`./img/${name}.jpg`, + src: `./img/${name}.jpg`, }, { type: Layout, cls: 'selected', invisible: !selected, - width:30, + width: 30, height: 30, }, { type: Label, - cls:'text', + cls: 'text', text, }, ], diff --git a/src/app/link_set/right/nothing.component.ts b/src/app/link_set/right/nothing.ts similarity index 94% rename from src/app/link_set/right/nothing.component.ts rename to src/app/link_set/right/nothing.ts index d3d4343..b98307f 100644 --- a/src/app/link_set/right/nothing.component.ts +++ b/src/app/link_set/right/nothing.ts @@ -8,7 +8,7 @@ const Widget: WidgetType = { type: Vertical, width: 260, height: 180, - items:[ + items: [ { type: Layout, cls: 'data-connection-background', @@ -16,7 +16,7 @@ const Widget: WidgetType = { height: 130, }, { - type:Label, + type: Label, height: 20, text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, diff --git a/src/app/link_set/right/right.component.ts b/src/app/link_set/right/right.ts similarity index 78% rename from src/app/link_set/right/right.component.ts rename to src/app/link_set/right/right.ts index 060a7fd..3daed45 100644 --- a/src/app/link_set/right/right.component.ts +++ b/src/app/link_set/right/right.ts @@ -1,15 +1,15 @@ import {WidgetType, Vertical} from '@ui'; import {LinkType} from '@ui/type'; -import Nothing from './nothing.component'; -import RightDetail from './right_detail/right.detail.component'; -import Model from '../link-set.model'; +import Nothing from './nothing'; +import RightDetail from './right_detail/right_detail'; +import Model from '../link_set.model'; let rightContent: any = null; const className = 'fr.component.right'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { linkSelected(linkSelected: LinkType) { rightContent.populate(BI.createItems([ { @@ -20,8 +20,8 @@ const Widget: WidgetType = { }, render() { return { - type:Vertical, - cls:'database-right', + type: Vertical, + cls: 'database-right', ref(_ref: any) { rightContent = _ref; }, diff --git a/src/app/link_set/right/right_detail/right.detail.service.ts b/src/app/link_set/right/right_detail/right_detail.service.ts similarity index 76% rename from src/app/link_set/right/right_detail/right.detail.service.ts rename to src/app/link_set/right/right_detail/right_detail.service.ts index b1b2dd5..392a317 100644 --- a/src/app/link_set/right/right_detail/right.detail.service.ts +++ b/src/app/link_set/right/right_detail/right_detail.service.ts @@ -1,9 +1,9 @@ -import Title from '../right_title/right.title.component'; -import RightShow from '../right_show/right.show.component'; -import RightShowJndi from '../right_show/right.show.jndi.component'; -import RightEdit from '../right_edit/right.edit.component'; -import RightEditMysql from '../right_edit/right.edit.mysql.component'; -import RightEditJndi from '../right_edit/right.edit.jndi.component'; +import Title from '../right_title/right_title'; +import RightShow from '../right_show/right_show'; +import RightShowJndi from '../right_show/right_show_jndi'; +import RightEdit from '../right_edit/right_edit'; +import RightEditMysql from '../right_edit/right_edit_mysql'; +import RightEditJndi from '../right_edit/right_edit_jndi'; import {LinkType} from '@ui/type'; import pluginListConstant from '../../../app.constant'; import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; diff --git a/src/app/link_set/right/right_detail/right.detail.component.ts b/src/app/link_set/right/right_detail/right_detail.ts similarity index 88% rename from src/app/link_set/right/right_detail/right.detail.component.ts rename to src/app/link_set/right/right_detail/right_detail.ts index ed73d26..66f546d 100644 --- a/src/app/link_set/right/right_detail/right.detail.component.ts +++ b/src/app/link_set/right/right_detail/right_detail.ts @@ -1,6 +1,6 @@ import {WidgetType, Vertical} from '@ui/index'; -import Model from '../../link-set.model'; -import {renderEdit} from './right.detail.service'; +import Model from '../../link_set.model'; +import {renderEdit} from './right_detail.service'; import {LinkType} from '@ui/type'; const className = 'fr.component.right.detail'; 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 similarity index 100% rename from src/app/link_set/right/right_edit/right.edit.service.ts rename to src/app/link_set/right/right_edit/right_edit.service.ts diff --git a/src/app/link_set/right/right_edit/right.edit.component.ts b/src/app/link_set/right/right_edit/right_edit.ts similarity index 97% rename from src/app/link_set/right/right_edit/right.edit.component.ts rename to src/app/link_set/right/right_edit/right_edit.ts index 0b943bd..b9bc1c2 100644 --- a/src/app/link_set/right/right_edit/right.edit.component.ts +++ b/src/app/link_set/right/right_edit/right_edit.ts @@ -1,10 +1,10 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; -import Model from '../../link-set.model'; -import FormItem from '@shared/components/form.item.component'; -import Title from '@shared/components/title.component'; -import {getDrivers, connectNameChecker} from './right.edit.service'; +import Model from '../../link_set.model'; +import FormItem from '@shared/components/form_item'; +import Title from '@shared/components/title'; +import {getDrivers, connectNameChecker} from './right_edit.service'; let ConnectionName: any = null; const className = 'fr.component.right.edit'; const Widget: WidgetType = { diff --git a/src/app/link_set/right/right_edit/right.edit.jndi.component.ts b/src/app/link_set/right/right_edit/right_edit_jndi.ts similarity index 98% rename from src/app/link_set/right/right_edit/right.edit.jndi.component.ts rename to src/app/link_set/right/right_edit/right_edit_jndi.ts index 02d0e76..cfb252b 100644 --- a/src/app/link_set/right/right_edit/right.edit.jndi.component.ts +++ b/src/app/link_set/right/right_edit/right_edit_jndi.ts @@ -1,5 +1,5 @@ import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; -import FormItem from '@shared/components/form.item.component'; +import FormItem from '@shared/components/form_item'; import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; import {AttributeType} from '../right.typing'; 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.ts similarity index 96% rename from src/app/link_set/right/right_edit/right.edit.mysql.component.ts rename to src/app/link_set/right/right_edit/right_edit_mysql.ts index b7b55a5..8ed5437 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.ts @@ -1,10 +1,10 @@ import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; -import Model from '../../link-set.model'; -import FormItem from '@shared/components/form.item.component'; -import Title from '@shared/components/title.component'; -import {getDrivers, connectNameChecker} from './right.edit.service'; +import Model from '../../link_set.model'; +import FormItem from '@shared/components/form_item'; +import Title from '@shared/components/title'; +import {getDrivers, connectNameChecker} from './right_edit.service'; const className = 'fr.component.right.edit.mysql'; const Widget: WidgetType = { _store() { diff --git a/src/app/link_set/right/right_show/right.show.component.ts b/src/app/link_set/right/right_show/right_show.ts similarity index 92% rename from src/app/link_set/right/right_show/right.show.component.ts rename to src/app/link_set/right/right_show/right_show.ts index 74d293f..57b34cc 100644 --- a/src/app/link_set/right/right_show/right.show.component.ts +++ b/src/app/link_set/right/right_show/right_show.ts @@ -1,7 +1,7 @@ import {WidgetType, Vertical} from '@ui/index'; -import RightShowModel from '../../link-set.model'; -import BothSide from '@shared/components/both.side.component'; -import Title from '@shared/components/title.component'; +import RightShowModel from '../../link_set.model'; +import BothSide from '@shared/components/both_side'; +import Title from '@shared/components/title'; import {LinkType} from '@ui/type'; const className = 'fr.component.right.show'; const Widget: WidgetType = { diff --git a/src/app/link_set/right/right_show/right.show.jndi.component.ts b/src/app/link_set/right/right_show/right_show_jndi.ts similarity index 98% rename from src/app/link_set/right/right_show/right.show.jndi.component.ts rename to src/app/link_set/right/right_show/right_show_jndi.ts index b102726..a1365eb 100644 --- a/src/app/link_set/right/right_show/right.show.jndi.component.ts +++ b/src/app/link_set/right/right_show/right_show_jndi.ts @@ -1,5 +1,5 @@ import {Vertical, TextButton, Label} from '@ui'; -import FormItem from '@shared/components/form.item.component'; +import FormItem from '@shared/components/form_item'; import {OTHER_ATTRIBUTES} from '@private/constants'; import {AttributeType} from '../right.typing'; diff --git a/src/app/link_set/right/right_title/right.title.component.ts b/src/app/link_set/right/right_title/right_title.ts similarity index 92% rename from src/app/link_set/right/right_title/right.title.component.ts rename to src/app/link_set/right/right_title/right_title.ts index 5a1281f..1e44851 100644 --- a/src/app/link_set/right/right_title/right.title.component.ts +++ b/src/app/link_set/right/right_title/right_title.ts @@ -1,5 +1,5 @@ import {WidgetType, Left, Label, Button} from '@ui/index'; -import RightTitleModel from '../../link-set.model'; +import RightTitleModel from '../../link_set.model'; import {LinkType} from '@ui/type'; import {OTHER_CONNECT} from '@private/constants'; const className = 'fr.component.right.title'; @@ -26,7 +26,7 @@ const Widget: WidgetType = { }, { type: Button, - cls:'right-title-button', + cls: 'right-title-button', invisible: isEdit, text: BI.i18nText('Dec-Dcm_Edit'), handler() { @@ -35,7 +35,7 @@ const Widget: WidgetType = { }, { type: Button, - cls:'right-title-button', + cls: 'right-title-button', invisible: !isEdit, text: BI.i18nText('Dec-Dcm_Save'), handler() { @@ -49,7 +49,7 @@ const Widget: WidgetType = { }, { type: Button, - cls:'right-title-button', + cls: 'right-title-button', invisible: !isEdit, level: 'ignore', text: BI.i18nText('BI-Basic_Cancel'), diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.ts similarity index 95% rename from src/app/link_set/select/select.component.ts rename to src/app/link_set/select/select.ts index 243dc04..ce333c9 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.ts @@ -1,6 +1,6 @@ import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui'; -import selectModel from '../link-set.model'; -import {moreLink} from '../more/more.link.service'; +import selectModel from '../link_set.model'; +import {moreLink} from '../more/more_link.service'; import connectList from '../../app.constant'; import {DATA_LINKS} from '@private/constants'; const className = 'fr.linkset.select'; diff --git a/src/app/link_status/left/left.service.ts b/src/app/link_status/left/left.service.ts index 2bfdf88..e2863e7 100644 --- a/src/app/link_status/left/left.service.ts +++ b/src/app/link_status/left/left.service.ts @@ -1,5 +1,5 @@ import {LinkType} from '@ui/type'; -import LeftItem from './left.item.component'; +import LeftItem from './left_item'; export const getLinks = (linkList: LinkType[], selectTitle = ''): any => { const links: any[] = []; diff --git a/src/app/link_status/left/left.component.ts b/src/app/link_status/left/left.ts similarity index 100% rename from src/app/link_status/left/left.component.ts rename to src/app/link_status/left/left.ts diff --git a/src/app/link_status/left/left.item.component.ts b/src/app/link_status/left/left_item.ts similarity index 100% rename from src/app/link_status/left/left.item.component.ts rename to src/app/link_status/left/left_item.ts diff --git a/src/app/link_status/link_status.component.ts b/src/app/link_status/link_status.ts similarity index 93% rename from src/app/link_status/link_status.component.ts rename to src/app/link_status/link_status.ts index c68caaf..85579d3 100644 --- a/src/app/link_status/link_status.component.ts +++ b/src/app/link_status/link_status.ts @@ -1,7 +1,7 @@ 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 LeftList from './left/left'; +import Right from './right/right'; import {TAB_LINK_POOL} from '@private/constants'; const className = 'fr.linkstatus'; diff --git a/src/app/link_status/right/right.component.ts b/src/app/link_status/right/right.ts similarity index 89% rename from src/app/link_status/right/right.component.ts rename to src/app/link_status/right/right.ts index c5da67c..22d73db 100644 --- a/src/app/link_status/right/right.component.ts +++ b/src/app/link_status/right/right.ts @@ -1,7 +1,7 @@ import {WidgetType, Vertical, Left, Label} from '@ui/index'; import Model from './right.model'; import {info} from '@shared/crud/crud.request'; -import RightCard from './right.card.component'; +import RightCard from './right_card'; import {InfoType} from './right.typings'; import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; @@ -14,7 +14,7 @@ const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, - watch:{ + watch: { statusSelected(title: string) { const link = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionName === title); const plugins: string[] = BI.Constants.getConstant(pluginListConstant); @@ -31,17 +31,17 @@ const Widget: WidgetType = { }, render() { return { - type:Vertical, - cls:'database-right', - items:[ + type: Vertical, + cls: 'database-right', + items: [ { type: Left, height: 40, cls: 'right-status-title', - items:[ + items: [ { type: Label, - text:BI.i18nText('Dec-Dcm_Data_Connections'), + text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], ref(ref: any) { diff --git a/src/app/link_status/right/right.card.component.ts b/src/app/link_status/right/right_card.ts similarity index 93% rename from src/app/link_status/right/right.card.component.ts rename to src/app/link_status/right/right_card.ts index fc73314..3b9f86c 100644 --- a/src/app/link_status/right/right.card.component.ts +++ b/src/app/link_status/right/right_card.ts @@ -13,11 +13,11 @@ const Widget: WidgetType = { items: [ { type: Vertical, - cls:'right-status-board', + cls: 'right-status-board', items: [ { type: Vertical, - cls:'right-status-board-item', + cls: 'right-status-board-item', items: [ { type: Label, @@ -52,11 +52,11 @@ const Widget: WidgetType = { items: [ { type: Vertical, - cls:'right-status-board', + cls: 'right-status-board', items: [ { type: Vertical, - cls:'right-status-board-item', + cls: 'right-status-board-item', items: [ { type: Label, diff --git a/src/app/title/title.component.ts b/src/app/title/title.ts similarity index 95% rename from src/app/title/title.component.ts rename to src/app/title/title.ts index 7a7afb6..fafcbd7 100644 --- a/src/app/title/title.component.ts +++ b/src/app/title/title.ts @@ -1,5 +1,5 @@ import {Left, WidgetType, IconButton} from '@ui/index'; -import TitleItem from './title_item/title_item.component'; +import TitleItem from './title_item/title_item'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'fr.title'; diff --git a/src/app/title/title_item/title_item.component.ts b/src/app/title/title_item/title_item.ts similarity index 100% rename from src/app/title/title_item/title_item.component.ts rename to src/app/title/title_item/title_item.ts diff --git a/src/index.ts b/src/index.ts index 6c892fe..ceb3a40 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ import i18n from '../private/i18n'; BI.DOM.ready(() => { - const app = require('./app/app.component').default; + const app = require('./app/app').default; // TODO: 先采用这种方式方便前端调试 BI.addI18n(i18n); BI.createWidget({ - type:app, + type: app, element: 'body', }); }); diff --git a/src/shared/components/both.side.component.ts b/src/shared/components/both_side.ts similarity index 97% rename from src/shared/components/both.side.component.ts rename to src/shared/components/both_side.ts index 819f2f9..5e7b654 100644 --- a/src/shared/components/both.side.component.ts +++ b/src/shared/components/both_side.ts @@ -7,7 +7,7 @@ const Widget: WidgetType = { return { type: Htape, cls: 'both-side', - height:24, + height: 24, items: [{ el: { type: Label, diff --git a/src/shared/components/form.item.component.ts b/src/shared/components/form_item.ts similarity index 100% rename from src/shared/components/form.item.component.ts rename to src/shared/components/form_item.ts diff --git a/src/shared/components/title.component.ts b/src/shared/components/title.ts similarity index 100% rename from src/shared/components/title.component.ts rename to src/shared/components/title.ts From 91412faaad4cc69210335a51f028b489347e1ff1 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 24 May 2019 11:04:06 +0800 Subject: [PATCH 18/44] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4color?= =?UTF-8?q?=E5=92=8Cfont=E4=BB=A5=E7=AC=A6=E5=90=88=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/app/app.ts | 2 +- src/app/link_set/left/left_item/left_item.ts | 2 +- src/less/index.less | 4 + src/less/lib/color.less | 4 + src/less/lib/constant.less | 106 ++++++++++++++++++ src/less/lib/font.less | 4 + src/less/lib/image.less | 18 +++ .../resource/app.less} | 90 ++++++--------- src/less/resource/font.less | 7 ++ src/less/resource/jndi.less | 3 + webpack.config.js | 13 +++ 12 files changed, 198 insertions(+), 57 deletions(-) create mode 100644 src/less/index.less create mode 100644 src/less/lib/color.less create mode 100644 src/less/lib/constant.less create mode 100644 src/less/lib/font.less create mode 100644 src/less/lib/image.less rename src/{app/app.component.scss => less/resource/app.less} (74%) create mode 100644 src/less/resource/font.less create mode 100644 src/less/resource/jndi.less diff --git a/package.json b/package.json index 716314e..ec4a42a 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "eslint": "^5.16.0", "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", + "less": "^3.9.0", + "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.6.0", "node-sass": "^4.11.0", "path": "^0.12.7", diff --git a/src/app/app.ts b/src/app/app.ts index 6682d8d..ef48ad2 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -5,7 +5,7 @@ import title from './title/title'; import linkSet from './link_set/link_set'; import linkStatus from './link_status/link_status'; import {fetchLinkList} from '../shared/crud/crud.request'; -import './app.component.scss'; +import '../less/index.less'; const className = 'fr.main'; const Widget = BI.inherit(BI.Widget, { diff --git a/src/app/link_set/left/left_item/left_item.ts b/src/app/link_set/left/left_item/left_item.ts index c75dfa6..9b8b06c 100644 --- a/src/app/link_set/left/left_item/left_item.ts +++ b/src/app/link_set/left/left_item/left_item.ts @@ -44,7 +44,7 @@ const Widget: WidgetType = { items: [ { type: ItemIcon, - cls: 'link-text-font', + cls: 'test-font', title: BI.i18nText('Dec-Dcm_Test_Connection'), value: ACTION_TEST, id, diff --git a/src/less/index.less b/src/less/index.less new file mode 100644 index 0000000..cebf288 --- /dev/null +++ b/src/less/index.less @@ -0,0 +1,4 @@ +@import "lib/color"; +@import "resource/app"; +@import "resource/jndi"; +@import "resource/font"; \ No newline at end of file diff --git a/src/less/lib/color.less b/src/less/lib/color.less new file mode 100644 index 0000000..604b677 --- /dev/null +++ b/src/less/lib/color.less @@ -0,0 +1,4 @@ +@import "constant"; + +@color-jndi-notice: @font-color-negative; +@background-color-blue-transparent: rgba(54,133,242,.05); \ No newline at end of file diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less new file mode 100644 index 0000000..671ec05 --- /dev/null +++ b/src/less/lib/constant.less @@ -0,0 +1,106 @@ +//常量库 + +//classified + +// +@font-size-12: 12px; +@font-size-13: 13px; +@font-size-14: 14px; +@font-size-16: 16px; +@font-size-18: 18px; +@font-size-22: 22px; +@font-size-24: 24px; +@font-size-30: 30px; +@font-size-40: 40px; +@font-size-50: 50px; +@font-size-60: 60px; +@font-size-70: 70px; +@radius-2: 2px; +@radius-6: 6px; + +@opacity-15: 0.15; +@opacity-20: 0.2; + +//font color +@font-color-black: #232e40;// +@font-color-normal: #3d4d66;// +@font-color-normal-theme-dark: #d6e0dc;// +@font-color-light-gray: #647185; +@font-color-light-gray-theme-dark: #afb7c6; +@font-color-disabled: #9ea6b2;// +@font-color-disabled-theme-dark: #878d9f;// +@font-color-tips: #9ea6b2;// +@font-color-tips-theme-dark: #6b7084;// +@font-color-light-disabled: #d0d4da;// +@font-color-light-disabled-theme-dark: #606479; +@font-color-gray: #999999; +@font-color-white: #ffffff;// +@font-color-white-theme-dark: #242640;// +@font-color-light-highlight: #eaf2fd; +@font-color-medium-highlight: #d7e7fc; +@font-color-highlight: #3685f2; +@font-color-blue: #23beef; +@font-color-light-blue: #e9f8fd; +@font-color-success: #13cd66; +@font-color-warning: #faaa39;// +@font-color-negative: #ff4949;// +@font-color-yellow: #ffc101;// + +//background color +@background-color-black: #232E40;// +@background-color-light-black: #3d4d66; +@background-color-light-black-theme-dark: #d6e0dc;// +@background-color-default: #ffffff;// +@background-color-default-theme-dark: #242640;// +@background-color-normal: #f7f8fa;// +@background-color-normal-theme-dark: #191B2B;// +@background-color-light-highlight: #eaf2fd; +@background-color-medium-highlight: #d7e7fc; +@background-color-highlight: #3685f2; +@background-color-blue: #23beef; +@background-color-light-blue: #e9f8fd; +@background-color-dark: #d4dadd; +@background-color-light-gray: #F2F4F7; +@background-color-light-gray-theme-dark: #2F3149; +@background-color-dark-gray: #d0d4da; +@background-color-dark-gray-theme-dark: #606479; +@background-color-disabled: #F2F4F7; +@background-color-disabled-theme-dark: #2F3149; +@background-color-yellow: #ffc101;// + +@background-color-negative: #ff4949; +@background-color-light-negative: #ffecec; +@background-color-dark-negative: #3A2940; +@background-color-light-warning: #feeed7; +@background-color-warning: #faaa39; + +@background-color-dark-success: #13cd66; +@background-color-light-success: #e1f4e7; +@background-color-normal-success: #647185; + +//border color +@border-color-default: #ffffff; +@border-color-black: #232e40; +@border-color-line: #e8eaed; +@border-color-line-theme-dark: #3a3c53; +@border-color-light-line: #f2f4f7; +@border-color-light-line-theme-dark: #2F3149; +@border-color-dark-line: #9EA6B2; +@border-color-dark-line-theme-dark: #878D9F; +@border-color-highlight: #3685f2; + +@border-color-warning: #fbb03b; +@border-color-negative: #FF4949; +@border-color-success: #13cd66; +@border-color-light-negative: #f4cbcb; +@border-color-normal-success: #eddea2; + +//split color +@border-color-disabled: #d0d4da; +@border-color-disabled-theme-dark: #606479; + +//scroll color +@scroll-color: #3d4d66; +@scroll-color-theme-dark: #ffffff; + +@water-mark-color-theme-dark: #878d9f; diff --git a/src/less/lib/font.less b/src/less/lib/font.less new file mode 100644 index 0000000..751359f --- /dev/null +++ b/src/less/lib/font.less @@ -0,0 +1,4 @@ +@font-link: "e759"; +@font-link-test: "e763"; +@font-link-info: "e63c"; +@font-link-delete: "e6c4"; \ No newline at end of file diff --git a/src/less/lib/image.less b/src/less/lib/image.less new file mode 100644 index 0000000..232beba --- /dev/null +++ b/src/less/lib/image.less @@ -0,0 +1,18 @@ +@color-bi-font-native: inherit; + +.font(@class,@content, @color: @color-bi-font-native) { + @fc: "\@{content}"; + .@{class} { + & .b-font { + *zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')"; + } + & .b-font:before { + content: @fc; + color: @color; + } + &.disabled .b-font:before { + content: @fc; + color: @color; + } + } +} \ No newline at end of file diff --git a/src/app/app.component.scss b/src/less/resource/app.less similarity index 74% rename from src/app/app.component.scss rename to src/less/resource/app.less index b6cfed3..7610631 100644 --- a/src/app/app.component.scss +++ b/src/less/resource/app.less @@ -1,10 +1,10 @@ .database-connection-layout{ width: 100%; height: 100%; - background-color: #f7f8fa; + background-color: @background-color-normal; .title{ - background-color: #fff; - border-bottom: 1px solid #e8eaed; + background-color: @background-color-default; + border-bottom: 1px solid @border-color-line; .dec-title-item{ height: 39px; line-height: 39px; @@ -20,8 +20,8 @@ cursor: pointer; } .dec-title-item-selected{ - color: #3685f2; - border-bottom: solid 2px #3685f2; + color: @background-color-highlight; + border-bottom: @border-color-highlight; } .close-button { position: absolute !important; @@ -30,7 +30,7 @@ width: 30px; height: 30px; cursor: pointer; - background-image: url("../img/icon_close9x9_normal.png"); + background-image: url("../../img/icon_close9x9_normal.png"); background-repeat: no-repeat; background-position: center; } @@ -38,25 +38,25 @@ .linkset{ margin: 10px; bottom: 0px; - background-color: #ffffff; + background-color: @background-color-default; } .linkStatus{ margin: 10px; top: 40px; - background-color: #ffffff; + background-color: @background-color-default; } } .database-left{ - border-right: 1px solid #e8eaed; + border-right: 1px solid @border-color-line; .select-group{ - border-bottom: 1px solid #e8eaed; + border-bottom: 1px solid @border-color-line; .select{ margin: 10px; .database-link-items{ padding-left:10px; .link-item{ - border-top: 1px solid #e8eaed; + border-top: 1px solid @border-color-line; } } } @@ -73,7 +73,7 @@ line-height: 24px; cursor: pointer; &:hover{ - background-color: rgba(54,133,242,.05); + background-color: @background-color-blue-transparent; .icons{ .action-icon{ visibility: visible !important; @@ -92,9 +92,9 @@ } } .left-item-selected{ - background-color: rgba(54,133,242,.05); + background-color: @background-color-blue-transparent; .link-title{ - color: #3685f2; + color: @font-color-highlight; } } } @@ -105,13 +105,13 @@ .bi-flex-center-adapt-layout{ height: 100%; .data-connection-background{ - background: url(../img/resources.png) center center no-repeat; + background: url(../../img/resources.png) center center no-repeat; background-size: contain; } } .right-status-title{ - border-bottom: 1px solid #e8eaed; - color: #3d4d66; + border-bottom: 1px solid @border-color-line; + color: @font-color-normal; line-height: 40px; padding-left: 10px; font-weight: 700; @@ -134,8 +134,8 @@ .right-status-board { margin-right: 25px; position: relative !important; left: 25px; } } .right-status-board{ - background-color: #f7f8fa; - color: #3d4d66; + background-color: @background-color-normal; + color: @font-color-normal; width: 100%; height: 100%; .right-status-board-item{ @@ -145,11 +145,11 @@ display: inline-block; } .card-font1{ - color: #13CD66; + color: @font-color-success; font-size: 32px; } .card-font2{ - color: #3685F2; + color: @font-color-highlight; font-size: 32px; } } @@ -159,8 +159,8 @@ .right-content{ height: 100%; .right-title{ - border-bottom: 1px solid #e8eaed; - color: #3d4d66; + border-bottom: 1px solid @border-color-line; + color: @font-color-normal; line-height: 40px; padding-left: 10px; .right-title-text{ @@ -198,21 +198,21 @@ position: relative; flex-shrink: 0; margin-left: 5px; - color: #9ea6b2; + color: @font-color-disabled; } } .shared-component-title{ height: 24px; line-height: 24px; margin-bottom: 10px; - color: #9ea6b2; - border-bottom: 1px solid #e8eaed; + color: @font-color-disabled; + border-bottom: 1px solid @border-color-line; } .comfirm-content{ margin-top: 40px; margin-left: 20px; .comfirm-icon{ - background-image: url("../img/warning.png"); + background-image: url("../../img/warning.png"); background-size: contain; margin-right: 12px; } @@ -236,9 +236,9 @@ margin-left: 10px; margin-bottom: 10px; cursor: pointer; - border: solid 1px #fff; + border: solid 1px @border-color-default; &:hover{ - border: solid 1px #3480f2; + border: solid 1px @border-color-highlight; } .selected{ position: absolute !important; @@ -246,7 +246,7 @@ top: -1px; height: 30px; width: 30px; - background: url(../img/database-selected.png) center center no-repeat; + background: url(../../img/database-selected.png) center center no-repeat; background-size: contain; } .text{ @@ -256,7 +256,7 @@ padding-right: 2px; text-align: center; white-space: nowrap; - background: #F0F3F7; + background: @background-color-light-gray; } } @@ -275,21 +275,21 @@ text-align: center; .loading-icon{ display: block; - background: url(../img/loading.gif) center center no-repeat; + background: url(../../img/loading.gif) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; } .success-icon{ display: block; - background: url(../img/success.png) center center no-repeat; + background: url(../../img/success.png) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; } .error-icon{ display: block; - background: url(../img/error.png) center center no-repeat; + background: url(../../img/error.png) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; @@ -304,29 +304,9 @@ .show-more{ text-align: left !important; height: 73px; - background: #F2F4F7; + background: @background-color-light-gray; margin-bottom: 10px; padding: 5px; margin-top: 10px; } -} - -.link-font .b-font:before { - content: "\e759"; - color: inherit; -} -.link-text-font .b-font:before { - content: "\e763"; - color: inherit; -} -.info-font .b-font:before { - content: "\e63c"; - color: inherit; -} -.delete-font .b-font:before { - content: "\e6c4"; - color: inherit; -} -.jndi-notice{ - color: red; } \ No newline at end of file diff --git a/src/less/resource/font.less b/src/less/resource/font.less new file mode 100644 index 0000000..15cca2e --- /dev/null +++ b/src/less/resource/font.less @@ -0,0 +1,7 @@ +@import "../lib/font"; +@import "../lib//image"; + +.font(link-font, @font-link); +.font(info-font, @font-link-info); +.font(test-font, @font-link-test); +.font(delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/resource/jndi.less b/src/less/resource/jndi.less new file mode 100644 index 0000000..570167f --- /dev/null +++ b/src/less/resource/jndi.less @@ -0,0 +1,3 @@ +.jndi-notice{ + color: @color-jndi-notice; +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index d62ab3b..128091d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -51,6 +51,19 @@ module.exports = env => { }, 'css-loader','sass-loader' ] + },{ + test:/\.less$/, + exclude: /node_modules/, + use: [ + { + loader: MiniCssExtractPlugin.loader, + options: { + publicPath: './', + hmr: process.env.NODE_ENV === 'development', + }, + }, + 'css-loader','less-loader' + ] },{ test:/(\.jpg|\.png|\.gif|\.svg)$/, exclude: /node_modules/, From 0c6d8d845cda5893fc2b2a78d5a2ba73f57d5952 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 24 May 2019 14:59:12 +0800 Subject: [PATCH 19/44] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BB=A5=E7=AC=A6=E5=90=88=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.model.ts | 13 ++++- src/app/app.ts | 9 +-- src/app/link_set/left/left.ts | 4 +- .../more/{ => item}/more_link_item.ts | 18 +++++- .../more/item/more_link_litem.model.ts | 6 ++ src/app/link_set/more/more_link.model.ts | 16 ++++++ src/app/link_set/more/more_link.ts | 31 ++++------ src/app/link_set/right/right.ts | 14 ++--- .../right/right_detail/right_detail.model.ts | 10 ++++ .../right_detail/right_detail.service.ts | 43 -------------- .../right/right_detail/right_detail.ts | 57 ++++++++++++++++--- .../right/right_edit/right_edit.model.ts | 20 +++++++ .../right/right_edit/right_edit_jndi.ts | 22 ++++--- src/app/link_status/left/left.ts | 4 +- src/app/link_status/right/right.ts | 4 +- src/less/resource/app.less | 3 + src/ui/fineui.ts | 2 + 17 files changed, 171 insertions(+), 105 deletions(-) rename src/app/link_set/more/{ => item}/more_link_item.ts (63%) create mode 100644 src/app/link_set/more/item/more_link_litem.model.ts create mode 100644 src/app/link_set/more/more_link.model.ts create mode 100644 src/app/link_set/right/right_detail/right_detail.model.ts delete mode 100644 src/app/link_set/right/right_detail/right_detail.service.ts create mode 100644 src/app/link_set/right/right_edit/right_edit.model.ts diff --git a/src/app/app.model.ts b/src/app/app.model.ts index 761035a..a71c953 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -1,13 +1,16 @@ const className = 'fr.model.main'; import {ModelType} from '@ui'; import {LinkType} from '@ui/type'; +import {fetchLinkList} from '../shared/crud/crud.request'; +import {TAB_LINK_SET} from '@private/constants'; + const linkList: LinkType[] = []; const Model: ModelType = { childContext: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'moreLinkSelected', 'statusSelected', 'connectionNameErr'], state () { return { - tab: BI.i18nText('Dec-Dcm_Connection_Management'), + tab: '', linkList, linkSelected: {}, linkUpdate: {}, @@ -17,12 +20,18 @@ const Model: ModelType = { }; }, computed: { - + }, actions: { setLinkList(value: LinkType[]) { this.model.linkList = value; + this.model.tab = TAB_LINK_SET; + }, + initData() { + fetchLinkList((linkList: LinkType[]) => { + this.setLinkList(linkList); + }); }, }, }; diff --git a/src/app/app.ts b/src/app/app.ts index ef48ad2..2a11d1c 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,10 +1,8 @@ import {Vtape} from '../ui/index'; -import {LinkType} from '@ui/type'; import appModel from './app.model'; import title from './title/title'; import linkSet from './link_set/link_set'; import linkStatus from './link_status/link_status'; -import {fetchLinkList} from '../shared/crud/crud.request'; import '../less/index.less'; const className = 'fr.main'; @@ -32,12 +30,7 @@ const Widget = BI.inherit(BI.Widget, { }; }, mounted() { - /** - * 获取数据连接列表 - */ - fetchLinkList((linkList: LinkType[]) => { - this.store.setLinkList(linkList); - }); + this.store.initData(); }, }); BI.shortcut(className, Widget); diff --git a/src/app/link_set/left/left.ts b/src/app/link_set/left/left.ts index dad09bd..03d726c 100644 --- a/src/app/link_set/left/left.ts +++ b/src/app/link_set/left/left.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical} from '@ui'; +import {WidgetType, ListView} from '@ui'; import Model from '../link_set.model'; import {LinkType} from '@ui/type'; import {getLinks} from './left.service'; @@ -15,7 +15,7 @@ const Widget: WidgetType = { }, render() { return { - type: Vertical, + type: ListView, ref(_ref: any) { leftContent = _ref; }, diff --git a/src/app/link_set/more/more_link_item.ts b/src/app/link_set/more/item/more_link_item.ts similarity index 63% rename from src/app/link_set/more/more_link_item.ts rename to src/app/link_set/more/item/more_link_item.ts index 1f5f187..9764053 100644 --- a/src/app/link_set/more/more_link_item.ts +++ b/src/app/link_set/more/item/more_link_item.ts @@ -1,8 +1,19 @@ import {WidgetType, Vertical, Img, Label, Layout} from '@ui/index'; +import ModelName from './more_link_litem.model'; + const className = 'fr.component.linkSet.morelink.item'; const Widget: WidgetType = { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + otherSelected(otherSelected: string) { + const {text} = this.options; + this.selected.setVisible(text === otherSelected); + }, + }, render() { - const {text, name, selected} = this.options; + const {text, name} = this.options; return { type: Vertical, @@ -18,9 +29,12 @@ const Widget: WidgetType = { }, { type: Layout, cls: 'selected', - invisible: !selected, + invisible: true, width: 30, height: 30, + ref: _ref => { + this.selected = _ref; + }, }, { type: Label, cls: 'text', diff --git a/src/app/link_set/more/item/more_link_litem.model.ts b/src/app/link_set/more/item/more_link_litem.model.ts new file mode 100644 index 0000000..87203e6 --- /dev/null +++ b/src/app/link_set/more/item/more_link_litem.model.ts @@ -0,0 +1,6 @@ +const className = 'fr.model.link_set.more_link_item'; +export const Model = BI.inherit(Fix.Model, { + context: ['otherSelected'], +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/more/more_link.model.ts b/src/app/link_set/more/more_link.model.ts new file mode 100644 index 0000000..73e243b --- /dev/null +++ b/src/app/link_set/more/more_link.model.ts @@ -0,0 +1,16 @@ +const className = 'fr.model.link_set.more_link'; +export const Model = BI.inherit(Fix.Model, { + childContext: ['otherSelected'], + state() { + return { + otherSelected: '', + }; + }, + actions: { + setOtherSelected(name: string) { + this.model.otherSelected = name; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/more/more_link.ts b/src/app/link_set/more/more_link.ts index 00715c2..2a9ff9b 100644 --- a/src/app/link_set/more/more_link.ts +++ b/src/app/link_set/more/more_link.ts @@ -1,9 +1,12 @@ import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; import {DATA_BASE_TYPE_OTHER} from '@private/constants'; -import MoreLinkItem from './more_link_item'; +import MoreLinkItem from './item/more_link_item'; +import ModelName from './more_link.model'; const className = 'fr.component.linkSet.morelink'; -let morkLinkItem: any = null; const Widget: WidgetType = { + _store() { + return BI.Models.getModel(ModelName); + }, render() { return { type: Vtape, @@ -23,33 +26,23 @@ const Widget: WidgetType = { { type: Left, cls: 'more-link-item', - ref(ref: any) { - morkLinkItem = ref; - }, + items: this._createItems(), }, ], }; }, - mounted() { - this._renderItems(); - }, - _renderItems(text = '') { - const databaseLink = DATA_BASE_TYPE_OTHER; - const items: any[] = []; - const that = this; - databaseLink.forEach(item => { - items.push({ + _createItems() { + return BI.map(DATA_BASE_TYPE_OTHER, (index: number, item) => { + return { type: MoreLinkItem, text: item.text, name: item.databaseType, - selected: text === item.text, handler: () => { - that._renderItems(item.text); - that.fireEvent('EVENT_SELECT', item.text); + this.store.setOtherSelected(item.text); + this.fireEvent('EVENT_SELECT', item.text); }, - }); + }; }); - morkLinkItem.populate(BI.createItems(items)); }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_set/right/right.ts b/src/app/link_set/right/right.ts index 3daed45..59429bf 100644 --- a/src/app/link_set/right/right.ts +++ b/src/app/link_set/right/right.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical} from '@ui'; +import {WidgetType, Vertical, ListView} from '@ui'; import {LinkType} from '@ui/type'; import Nothing from './nothing'; import RightDetail from './right_detail/right_detail'; @@ -20,19 +20,15 @@ const Widget: WidgetType = { }, render() { return { - type: Vertical, + type: ListView, cls: 'database-right', ref(_ref: any) { rightContent = _ref; }, - }; - }, - mounted() { - rightContent.populate(BI.createItems([ - { + items: [{ type: Nothing, - }, - ])); + }], + }; }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_set/right/right_detail/right_detail.model.ts b/src/app/link_set/right/right_detail/right_detail.model.ts new file mode 100644 index 0000000..67b4afe --- /dev/null +++ b/src/app/link_set/right/right_detail/right_detail.model.ts @@ -0,0 +1,10 @@ +const className = 'fr.model.link.set.right.detail'; +export const Model = BI.inherit(Fix.Model, { + + context: ['linkSelected'], + actions: { + + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/right/right_detail/right_detail.service.ts b/src/app/link_set/right/right_detail/right_detail.service.ts deleted file mode 100644 index 392a317..0000000 --- a/src/app/link_set/right/right_detail/right_detail.service.ts +++ /dev/null @@ -1,43 +0,0 @@ -import Title from '../right_title/right_title'; -import RightShow from '../right_show/right_show'; -import RightShowJndi from '../right_show/right_show_jndi'; -import RightEdit from '../right_edit/right_edit'; -import RightEditMysql from '../right_edit/right_edit_mysql'; -import RightEditJndi from '../right_edit/right_edit_jndi'; -import {LinkType} from '@ui/type'; -import pluginListConstant from '../../../app.constant'; -import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; - -export const renderEdit = (rightDetail, linkSelected: LinkType): void => { - const plugins: string[] = BI.Constants.getConstant(pluginListConstant); - const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); - let editPage = null; - let showPage = null; - switch (linkSelected.text) { - case (MYSQL_CONNECT): - editPage = RightEditMysql; - showPage = RightShow; - break; - case (JNDI_CONNECT): - editPage = RightEditJndi; - showPage = RightShowJndi; - break; - default: - editPage = RightEdit; - showPage = RightShow; - } - if (isPlugin) { - editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); - showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); - } - rightDetail.populate(BI.createItems([ - { - type: Title, - isEdit: linkSelected.isSelected, - linkSelected, - }, { - type: linkSelected.isSelected ? editPage : showPage, - linkSelected, - }, - ])); -}; diff --git a/src/app/link_set/right/right_detail/right_detail.ts b/src/app/link_set/right/right_detail/right_detail.ts index 66f546d..86e3d3c 100644 --- a/src/app/link_set/right/right_detail/right_detail.ts +++ b/src/app/link_set/right/right_detail/right_detail.ts @@ -1,7 +1,14 @@ -import {WidgetType, Vertical} from '@ui/index'; -import Model from '../../link_set.model'; -import {renderEdit} from './right_detail.service'; +import {WidgetType, ListView, Left} from '@ui/index'; +import Model from './right_detail.model'; import {LinkType} from '@ui/type'; +import Title from '../right_title/right_title'; +import RightShow from '../right_show/right_show'; +import RightShowJndi from '../right_show/right_show_jndi'; +import RightEdit from '../right_edit/right_edit'; +import RightEditMysql from '../right_edit/right_edit_mysql'; +import RightEditJndi from '../right_edit/right_edit_jndi'; +import pluginListConstant from '../../../app.constant'; +import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; const className = 'fr.component.right.detail'; @@ -11,21 +18,55 @@ const Widget: WidgetType = { }, watch: { linkSelected(linkSelected: LinkType) { - renderEdit(this.rightDetail, linkSelected); + const showPage = this._createItems(linkSelected); + this.rightDetail.populate(BI.createItems(showPage)); }, }, render() { + const linkSelected = this.model.linkSelected; + return { - type: Vertical, + type: ListView, cls: 'right-content', ref: _ref => { this.rightDetail = _ref; }, + items: this._createItems(linkSelected), }; }, - mounted() { - const linkSelected: LinkType = this.model.linkSelected; - renderEdit(this.rightDetail, linkSelected); + _createItems(linkSelected: LinkType) { + const plugins: string[] = BI.Constants.getConstant(pluginListConstant); + const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text); + let editPage = null; + let showPage = null; + switch (linkSelected.text) { + case (MYSQL_CONNECT): + editPage = RightEditMysql; + showPage = RightShow; + break; + case (JNDI_CONNECT): + editPage = RightEditJndi; + showPage = RightShowJndi; + break; + default: + editPage = RightEdit; + showPage = RightShow; + } + if (isPlugin) { + editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`); + showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`); + } + + return [ + { + type: Title, + isEdit: linkSelected.isSelected, + linkSelected, + }, { + type: linkSelected.isSelected ? editPage : showPage, + linkSelected, + }, + ]; }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_set/right/right_edit/right_edit.model.ts b/src/app/link_set/right/right_edit/right_edit.model.ts new file mode 100644 index 0000000..54e1f91 --- /dev/null +++ b/src/app/link_set/right/right_edit/right_edit.model.ts @@ -0,0 +1,20 @@ +export const className = 'report.model.components.right.edit'; +export const Model = BI.inherit(Fix.Model, { + state() { + return { + isCollapse: false, + }; + }, + + computed: { + + }, + + actions: { + setIsCollapse(status: boolean) { + this.model.isCollapse = status; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/link_set/right/right_edit/right_edit_jndi.ts b/src/app/link_set/right/right_edit/right_edit_jndi.ts index cfb252b..68f7398 100644 --- a/src/app/link_set/right/right_edit/right_edit_jndi.ts +++ b/src/app/link_set/right/right_edit/right_edit_jndi.ts @@ -2,9 +2,22 @@ import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; import FormItem from '@shared/components/form_item'; import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; import {AttributeType} from '../right.typing'; +import ModelName from './right_edit.model'; const classNameEdit = 'fr.component.right.edit.jndi'; const Widget = BI.inherit(BI.Widget, { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + isCollapse(isCollapse) { + const height = isCollapse ? 550 : 160; + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.jndiFormRef.setHeight(height); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); + }, + }, render() { const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; @@ -95,18 +108,11 @@ const Widget = BI.inherit(BI.Widget, { text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), width: 300, textAlign: 'right', - value: true, ref: _ref => { this.collapseRef = _ref; }, handler: () => { - const isCollapse = this.collapseRef.getValue(); - const height = isCollapse ? 550 : 160; - const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.jndiFormRef.setHeight(height); - this.collapseRef.setValue(!isCollapse); - this.collapseRef.setText(text); - this.otherAttributesRef.setVisible(isCollapse); + this.store.setIsCollapse(!this.model.isCollapse); }, }, }, diff --git a/src/app/link_status/left/left.ts b/src/app/link_status/left/left.ts index 0ce0fdf..39587ab 100644 --- a/src/app/link_status/left/left.ts +++ b/src/app/link_status/left/left.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical} from '@ui'; +import {WidgetType, ListView} from '@ui'; import Model from './left.model'; import {LinkType} from '@ui/type'; import {getLinks} from './left.service'; @@ -20,7 +20,7 @@ const Widget: WidgetType = { }, render() { return { - type: Vertical, + type: ListView, ref(_ref: any) { leftContent = _ref; }, diff --git a/src/app/link_status/right/right.ts b/src/app/link_status/right/right.ts index 22d73db..d4f50ee 100644 --- a/src/app/link_status/right/right.ts +++ b/src/app/link_status/right/right.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, Left, Label} from '@ui/index'; +import {WidgetType, Vertical, Left, Label, ListView} from '@ui/index'; import Model from './right.model'; import {info} from '@shared/crud/crud.request'; import RightCard from './right_card'; @@ -48,7 +48,7 @@ const Widget: WidgetType = { Title = ref; }, }, { - type: Vertical, + type: ListView, cls: 'right-status-body', ref(ref: any) { Group = ref; diff --git a/src/less/resource/app.less b/src/less/resource/app.less index 7610631..114a1ac 100644 --- a/src/less/resource/app.less +++ b/src/less/resource/app.less @@ -102,6 +102,9 @@ .database-right{ min-width: 400px; overflow: auto; + >.bi-vertical-layout{ + height: 100%; + } .bi-flex-center-adapt-layout{ height: 100%; .data-connection-background{ diff --git a/src/ui/fineui.ts b/src/ui/fineui.ts index b0b7cc3..2b2dcd5 100644 --- a/src/ui/fineui.ts +++ b/src/ui/fineui.ts @@ -35,6 +35,8 @@ export const BubbleCombo = 'bi.bubble_combo'; export const SearchEditor = 'bi.search_editor'; export const Img = 'bi.img'; export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; +export const VertualGroup = 'bi.virtual_group'; +export const ListView = 'bi.list_view'; // 布局 export const VerticalAdapt = 'bi.vertical_adapt'; From 1f7d27bc5bc47659e54b127b0d3cc4d6d5e4abd0 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 24 May 2019 17:18:16 +0800 Subject: [PATCH 20/44] =?UTF-8?q?feat:=20=E5=BC=95=E7=94=A8finui=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 + src/less/{resource => }/app.less | 17 +++-- src/less/color.less | 3 + src/less/font.less | 7 ++ src/less/index.less | 7 +- src/less/lib/color.less | 4 -- src/less/lib/constant.less | 106 ------------------------------- src/less/lib/image.less | 18 ------ src/less/resource/font.less | 7 -- src/less/resource/jndi.less | 3 - 10 files changed, 26 insertions(+), 149 deletions(-) rename src/less/{resource => }/app.less (92%) create mode 100644 src/less/color.less create mode 100644 src/less/font.less delete mode 100644 src/less/lib/color.less delete mode 100644 src/less/lib/constant.less delete mode 100644 src/less/lib/image.less delete mode 100644 src/less/resource/font.less delete mode 100644 src/less/resource/jndi.less diff --git a/package.json b/package.json index ec4a42a..8c5a597 100644 --- a/package.json +++ b/package.json @@ -31,5 +31,8 @@ "webpack-cli": "^3.3.0", "webpack-dev-server": "^3.2.1", "webpack-stream": "^5.2.1" + }, + "optionalDependencies": { + "fineui": "git+ssh://git@cloud.finedevelop.com:7999/visual/fineui.git" } } diff --git a/src/less/resource/app.less b/src/less/app.less similarity index 92% rename from src/less/resource/app.less rename to src/less/app.less index 114a1ac..c30e453 100644 --- a/src/less/resource/app.less +++ b/src/less/app.less @@ -30,7 +30,7 @@ width: 30px; height: 30px; cursor: pointer; - background-image: url("../../img/icon_close9x9_normal.png"); + background-image: url("../img/icon_close9x9_normal.png"); background-repeat: no-repeat; background-position: center; } @@ -108,7 +108,7 @@ .bi-flex-center-adapt-layout{ height: 100%; .data-connection-background{ - background: url(../../img/resources.png) center center no-repeat; + background: url(../img/resources.png) center center no-repeat; background-size: contain; } } @@ -215,7 +215,7 @@ margin-top: 40px; margin-left: 20px; .comfirm-icon{ - background-image: url("../../img/warning.png"); + background-image: url("../img/warning.png"); background-size: contain; margin-right: 12px; } @@ -249,7 +249,7 @@ top: -1px; height: 30px; width: 30px; - background: url(../../img/database-selected.png) center center no-repeat; + background: url(../img/database-selected.png) center center no-repeat; background-size: contain; } .text{ @@ -278,21 +278,21 @@ text-align: center; .loading-icon{ display: block; - background: url(../../img/loading.gif) center center no-repeat; + background: url(../img/loading.gif) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; } .success-icon{ display: block; - background: url(../../img/success.png) center center no-repeat; + background: url(../img/success.png) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; } .error-icon{ display: block; - background: url(../../img/error.png) center center no-repeat; + background: url(../img/error.png) center center no-repeat; background-size: contain; margin: 0 auto; margin-bottom: 18px; @@ -312,4 +312,7 @@ padding: 5px; margin-top: 10px; } +} +.jndi-notice{ + color: @color-jndi-notice; } \ No newline at end of file diff --git a/src/less/color.less b/src/less/color.less new file mode 100644 index 0000000..a1a49e7 --- /dev/null +++ b/src/less/color.less @@ -0,0 +1,3 @@ +@import "../../node_modules/fineui/src/less/lib/colors.less"; +@color-jndi-notice: @font-color-negative; +@background-color-blue-transparent: rgba(54,133,242,.05); \ No newline at end of file diff --git a/src/less/font.less b/src/less/font.less new file mode 100644 index 0000000..1c9d074 --- /dev/null +++ b/src/less/font.less @@ -0,0 +1,7 @@ +@import "../../node_modules/fineui/src/less/image.less"; +@import "./lib/font.less"; + +.font(link-font, @font-link); +.font(info-font, @font-link-info); +.font(test-font, @font-link-test); +.font(delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/index.less b/src/less/index.less index cebf288..e866921 100644 --- a/src/less/index.less +++ b/src/less/index.less @@ -1,4 +1,3 @@ -@import "lib/color"; -@import "resource/app"; -@import "resource/jndi"; -@import "resource/font"; \ No newline at end of file +@import "color"; +@import "app"; +@import "font"; \ No newline at end of file diff --git a/src/less/lib/color.less b/src/less/lib/color.less deleted file mode 100644 index 604b677..0000000 --- a/src/less/lib/color.less +++ /dev/null @@ -1,4 +0,0 @@ -@import "constant"; - -@color-jndi-notice: @font-color-negative; -@background-color-blue-transparent: rgba(54,133,242,.05); \ No newline at end of file diff --git a/src/less/lib/constant.less b/src/less/lib/constant.less deleted file mode 100644 index 671ec05..0000000 --- a/src/less/lib/constant.less +++ /dev/null @@ -1,106 +0,0 @@ -//常量库 - -//classified - -// -@font-size-12: 12px; -@font-size-13: 13px; -@font-size-14: 14px; -@font-size-16: 16px; -@font-size-18: 18px; -@font-size-22: 22px; -@font-size-24: 24px; -@font-size-30: 30px; -@font-size-40: 40px; -@font-size-50: 50px; -@font-size-60: 60px; -@font-size-70: 70px; -@radius-2: 2px; -@radius-6: 6px; - -@opacity-15: 0.15; -@opacity-20: 0.2; - -//font color -@font-color-black: #232e40;// -@font-color-normal: #3d4d66;// -@font-color-normal-theme-dark: #d6e0dc;// -@font-color-light-gray: #647185; -@font-color-light-gray-theme-dark: #afb7c6; -@font-color-disabled: #9ea6b2;// -@font-color-disabled-theme-dark: #878d9f;// -@font-color-tips: #9ea6b2;// -@font-color-tips-theme-dark: #6b7084;// -@font-color-light-disabled: #d0d4da;// -@font-color-light-disabled-theme-dark: #606479; -@font-color-gray: #999999; -@font-color-white: #ffffff;// -@font-color-white-theme-dark: #242640;// -@font-color-light-highlight: #eaf2fd; -@font-color-medium-highlight: #d7e7fc; -@font-color-highlight: #3685f2; -@font-color-blue: #23beef; -@font-color-light-blue: #e9f8fd; -@font-color-success: #13cd66; -@font-color-warning: #faaa39;// -@font-color-negative: #ff4949;// -@font-color-yellow: #ffc101;// - -//background color -@background-color-black: #232E40;// -@background-color-light-black: #3d4d66; -@background-color-light-black-theme-dark: #d6e0dc;// -@background-color-default: #ffffff;// -@background-color-default-theme-dark: #242640;// -@background-color-normal: #f7f8fa;// -@background-color-normal-theme-dark: #191B2B;// -@background-color-light-highlight: #eaf2fd; -@background-color-medium-highlight: #d7e7fc; -@background-color-highlight: #3685f2; -@background-color-blue: #23beef; -@background-color-light-blue: #e9f8fd; -@background-color-dark: #d4dadd; -@background-color-light-gray: #F2F4F7; -@background-color-light-gray-theme-dark: #2F3149; -@background-color-dark-gray: #d0d4da; -@background-color-dark-gray-theme-dark: #606479; -@background-color-disabled: #F2F4F7; -@background-color-disabled-theme-dark: #2F3149; -@background-color-yellow: #ffc101;// - -@background-color-negative: #ff4949; -@background-color-light-negative: #ffecec; -@background-color-dark-negative: #3A2940; -@background-color-light-warning: #feeed7; -@background-color-warning: #faaa39; - -@background-color-dark-success: #13cd66; -@background-color-light-success: #e1f4e7; -@background-color-normal-success: #647185; - -//border color -@border-color-default: #ffffff; -@border-color-black: #232e40; -@border-color-line: #e8eaed; -@border-color-line-theme-dark: #3a3c53; -@border-color-light-line: #f2f4f7; -@border-color-light-line-theme-dark: #2F3149; -@border-color-dark-line: #9EA6B2; -@border-color-dark-line-theme-dark: #878D9F; -@border-color-highlight: #3685f2; - -@border-color-warning: #fbb03b; -@border-color-negative: #FF4949; -@border-color-success: #13cd66; -@border-color-light-negative: #f4cbcb; -@border-color-normal-success: #eddea2; - -//split color -@border-color-disabled: #d0d4da; -@border-color-disabled-theme-dark: #606479; - -//scroll color -@scroll-color: #3d4d66; -@scroll-color-theme-dark: #ffffff; - -@water-mark-color-theme-dark: #878d9f; diff --git a/src/less/lib/image.less b/src/less/lib/image.less deleted file mode 100644 index 232beba..0000000 --- a/src/less/lib/image.less +++ /dev/null @@ -1,18 +0,0 @@ -@color-bi-font-native: inherit; - -.font(@class,@content, @color: @color-bi-font-native) { - @fc: "\@{content}"; - .@{class} { - & .b-font { - *zoom: ~"expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#x@{content};')"; - } - & .b-font:before { - content: @fc; - color: @color; - } - &.disabled .b-font:before { - content: @fc; - color: @color; - } - } -} \ No newline at end of file diff --git a/src/less/resource/font.less b/src/less/resource/font.less deleted file mode 100644 index 15cca2e..0000000 --- a/src/less/resource/font.less +++ /dev/null @@ -1,7 +0,0 @@ -@import "../lib/font"; -@import "../lib//image"; - -.font(link-font, @font-link); -.font(info-font, @font-link-info); -.font(test-font, @font-link-test); -.font(delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/resource/jndi.less b/src/less/resource/jndi.less deleted file mode 100644 index 570167f..0000000 --- a/src/less/resource/jndi.less +++ /dev/null @@ -1,3 +0,0 @@ -.jndi-notice{ - color: @color-jndi-notice; -} \ No newline at end of file From 92cd25ae044feae8d1528cacdb7893aa4b7abb42 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 10:25:19 +0800 Subject: [PATCH 21/44] =?UTF-8?q?refactor:=20=E5=B0=86=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=9A=84=E5=B8=83=E5=B1=80=E7=A7=BB=E5=87=BAcss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 9 + src/app/app.ts | 41 ++- src/app/link_set/left/left_item/left_item.ts | 109 +++--- src/app/link_set/link_set.model.ts | 5 +- src/app/link_set/link_set.ts | 10 +- src/app/link_set/more/item/more_link_item.ts | 34 +- src/app/link_set/more/more_link.service.ts | 2 +- src/app/link_set/more/more_link.ts | 9 +- src/app/link_set/right/nothing.ts | 2 +- src/app/link_set/right/right.ts | 3 +- .../right/right_detail/right_detail.ts | 3 +- .../link_set/right/right_edit/right_edit.ts | 7 +- .../right/right_edit/right_edit_jndi.ts | 13 +- .../right/right_edit/right_edit_mysql.ts | 2 +- .../link_set/right/right_show/right_show.ts | 2 +- .../right/right_show/right_show_jndi.ts | 4 +- .../link_set/right/right_title/right_title.ts | 86 ++--- src/app/link_set/select/select.ts | 8 +- src/app/link_status/left/left_item.ts | 5 +- src/app/link_status/link_status.ts | 10 +- src/app/link_status/right/right.ts | 10 +- src/app/link_status/right/right_card.ts | 87 +++-- src/app/title/title.ts | 79 +++-- src/app/title/title_item/title_item.ts | 4 +- src/less/app.less | 318 ------------------ src/less/color.less | 3 - src/less/font.less | 7 - src/less/index.less | 8 +- src/less/lib/background.less | 7 + src/less/lib/color.less | 1 + src/less/resource/background.less | 23 ++ src/less/resource/common.less | 66 ++++ src/less/resource/font.less | 7 + src/less/var.less | 3 + src/shared/components/both_side.ts | 2 +- src/shared/components/form_item.ts | 9 +- src/shared/components/title.ts | 5 +- src/shared/crud/crud.request.ts | 6 +- src/shared/service/dialog.service.ts | 85 +++-- src/ui/fineui.ts | 9 +- 40 files changed, 511 insertions(+), 592 deletions(-) delete mode 100644 src/less/app.less delete mode 100644 src/less/color.less delete mode 100644 src/less/font.less create mode 100644 src/less/lib/background.less create mode 100644 src/less/lib/color.less create mode 100644 src/less/resource/background.less create mode 100644 src/less/resource/common.less create mode 100644 src/less/resource/font.less create mode 100644 src/less/var.less diff --git a/private/constants.ts b/private/constants.ts index 68aa3a3..80ba494 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -362,3 +362,12 @@ export const CONNECT_CHARSET = [ value: 'CP850', }, ]; + + +const DecDcm = { + TEST_STATUS_WAITING: 1, + TEST_STATUS_SUCCESS: 2, + TEST_STATUS_FAIL: 3, +}; + +export default DecDcm; diff --git a/src/app/app.ts b/src/app/app.ts index 2a11d1c..baafeba 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,4 +1,4 @@ -import {Vtape} from '../ui/index'; +import {Vtape, Left, Vertical, Absolute} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; import linkSet from './link_set/link_set'; @@ -13,19 +13,34 @@ const Widget = BI.inherit(BI.Widget, { render() { return { type: Vtape, - cls: 'database-connection-layout', - items: [{ - el: { - type: title, + cls: 'dec-webui-dcm-layout', + items: [ + { + el: { + type: title, + }, + height: 40, + }, + { + type: Absolute, + items: [{ + el: { + type: linkSet, + }, + left: 10, + top: 10, + right: 10, + bottom: 10, + }, { + el: { + type: linkStatus, + }, + left: 10, + top: 10, + right: 10, + bottom: 10, + }], }, - height: 40, - }, - { - type: linkSet, - }, - { - type: linkStatus, - }, ], }; }, diff --git a/src/app/link_set/left/left_item/left_item.ts b/src/app/link_set/left/left_item/left_item.ts index 9b8b06c..65d85ee 100644 --- a/src/app/link_set/left/left_item/left_item.ts +++ b/src/app/link_set/left/left_item/left_item.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, Label, Icon, TextButton} from '@ui'; +import {WidgetType, Left, Label, Icon, TextButton, Right, LeftRightVerticalAdapt} from '@ui'; import ItemIcon from './left_item_icon'; import Model from '../../link_set.model'; import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; @@ -16,63 +16,62 @@ const Widget: WidgetType = { const {title, extraCls, creator, text, id} = this.options; return { - type: Left, - cls: 'left-item', + type: LeftRightVerticalAdapt, + cls: 'link-item cursor-pointer', + height: 24, extraCls, - items: [ - { - type: Icon, - cls: 'link-font', - height: 24, - width: 26, - text: BI.i18nText('Dec-Dcm_Connections'), - title, - }, - { - type: TextButton, - cls: 'link-title', - textAlign: 'left', - text: title, - title, - handler: () => { - this.store.setLinkSelected(title); + items: { + left: [ + { + type: Icon, + cls: 'link-font', + height: 24, + width: 26, + text: BI.i18nText('Dec-Dcm_Connections'), + title, }, - }, - { - type: Left, - cls: 'icons', - items: [ - { - type: ItemIcon, - cls: 'test-font', - title: BI.i18nText('Dec-Dcm_Test_Connection'), - value: ACTION_TEST, - id, + { + type: TextButton, + cls: 'link-title', + textHeight: 24, + textAlign: 'left', + text: title, + title, + handler: () => { + this.store.setLinkSelected(title); }, - { - 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 === 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, - }, - ], - }, - - ], + }, + ], + right: [ + { + type: ItemIcon, + cls: 'link-item-icon test-font', + title: BI.i18nText('Dec-Dcm_Test_Connection'), + value: ACTION_TEST, + id, + }, + { + type: ItemIcon, + cls: 'link-item-icon copy-font', + title: BI.i18nText('Dec-Dcm_Copy'), + value: ACTION_COPY, + id, + }, + { + type: ItemIcon, + cls: 'link-item-icon info-font', + title: `${BI.i18nText('Dec-Dcm_Type')}:${text === DEFAULT_INFO ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, + id, + }, + { + type: ItemIcon, + cls: 'link-item-icon delete-font', + title: BI.i18nText('Dec-Dcm_Delete'), + value: ACTION_DELETE, + id, + }, + ], + }, }; }, }; diff --git a/src/app/link_set/link_set.model.ts b/src/app/link_set/link_set.model.ts index ba8aae4..04b0cf8 100644 --- a/src/app/link_set/link_set.model.ts +++ b/src/app/link_set/link_set.model.ts @@ -5,7 +5,6 @@ import {getCnnectionName} from './select/select.service'; import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; import {saveConnection} from './link_set.service'; - const className = 'fr.model.linkset'; const Model: ModelType = { context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], @@ -54,10 +53,10 @@ const Model: ModelType = { } }, _textLink(id: string) { - const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); + const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); testConnection(link, (res: any) => { - dialog.close(loadingId); + dialog.remove(loadingId); if (res && res.errorCode) { dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { this._textLink(id); diff --git a/src/app/link_set/link_set.ts b/src/app/link_set/link_set.ts index 599efb2..3a810db 100644 --- a/src/app/link_set/link_set.ts +++ b/src/app/link_set/link_set.ts @@ -17,19 +17,21 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'linkset', + cls: 'dcm-link-group', items: [{ el: { type: Vtape, - cls: 'database-left', + cls: 'dcm-link-left bi-border-right', items: [ { el: { type: Left, - cls: 'select-group', + cls: 'bi-border-bottom', items: [ { type: Select, + hgap: 10, + tgap: 10, }, ], }, @@ -37,6 +39,8 @@ const Widget: WidgetType = { }, { type: LeftList, cls: 'left-list', + vgap: 10, + hgap: 10, }, ], }, diff --git a/src/app/link_set/more/item/more_link_item.ts b/src/app/link_set/more/item/more_link_item.ts index 9764053..7e4715c 100644 --- a/src/app/link_set/more/item/more_link_item.ts +++ b/src/app/link_set/more/item/more_link_item.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, Img, Label, Layout} from '@ui/index'; +import {WidgetType, Vertical, Img, Label, Layout, Absolute} from '@ui/index'; import ModelName from './more_link_litem.model'; const className = 'fr.component.linkSet.morelink.item'; @@ -17,7 +17,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'link-item', + cls: 'dcm-link-more bi-border cursor-pointer', width: 120, height: 117, items: [ @@ -25,19 +25,29 @@ const Widget: WidgetType = { type: Img, width: 120, height: 90, - src: `./img/${name}.jpg`, + src: `img/${name}.jpg`, }, { - type: Layout, - cls: 'selected', - invisible: true, - width: 30, - height: 30, - ref: _ref => { - this.selected = _ref; - }, + type: Absolute, + left: 90, + top: -90, + items: [ + { + el: { + type: Layout, + cls: 'dcm-link-more-selected', + invisible: true, + width: 30, + height: 30, + ref: _ref => { + this.selected = _ref; + }, + }, + }, + ], }, { type: Label, - cls: 'text', + cls: 'dcm-link-more-text', + height: 27, text, }, ], diff --git a/src/app/link_set/more/more_link.service.ts b/src/app/link_set/more/more_link.service.ts index b225ccc..e9a11da 100644 --- a/src/app/link_set/more/more_link.service.ts +++ b/src/app/link_set/more/more_link.service.ts @@ -8,7 +8,7 @@ export const moreLink = (onConfirm?: Function): void => { type: 'bi.bar_popover', size: 'normal', header: BI.i18nText('Dec-Dcm_Connection_More-Title'), - width: 550, + width: 560, height: 500, body: { type: MoreLink, diff --git a/src/app/link_set/more/more_link.ts b/src/app/link_set/more/more_link.ts index 2a9ff9b..ad1ca97 100644 --- a/src/app/link_set/more/more_link.ts +++ b/src/app/link_set/more/more_link.ts @@ -10,7 +10,6 @@ const Widget: WidgetType = { render() { return { type: Vtape, - cls: 'more-link', items: [ { el: { @@ -25,7 +24,13 @@ const Widget: WidgetType = { }, { type: Left, - cls: 'more-link-item', + scrolly: true, + width: 528, + height: 380, + tgap: 2, + rgap: 2, + bgap: 2, + lgap: 2, items: this._createItems(), }, ], diff --git a/src/app/link_set/right/nothing.ts b/src/app/link_set/right/nothing.ts index b98307f..81fc1c2 100644 --- a/src/app/link_set/right/nothing.ts +++ b/src/app/link_set/right/nothing.ts @@ -4,6 +4,7 @@ const Widget: WidgetType = { render() { return { type: CenterAdapt, + top: 200, items: [{ type: Vertical, width: 260, @@ -21,7 +22,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, ], - }], }; }, diff --git a/src/app/link_set/right/right.ts b/src/app/link_set/right/right.ts index 59429bf..f969c23 100644 --- a/src/app/link_set/right/right.ts +++ b/src/app/link_set/right/right.ts @@ -21,7 +21,8 @@ const Widget: WidgetType = { render() { return { type: ListView, - cls: 'database-right', + cls: 'dcm-link-form', + minWidth: 400, ref(_ref: any) { rightContent = _ref; }, diff --git a/src/app/link_set/right/right_detail/right_detail.ts b/src/app/link_set/right/right_detail/right_detail.ts index 86e3d3c..44b1c8a 100644 --- a/src/app/link_set/right/right_detail/right_detail.ts +++ b/src/app/link_set/right/right_detail/right_detail.ts @@ -27,7 +27,6 @@ const Widget: WidgetType = { return { type: ListView, - cls: 'right-content', ref: _ref => { this.rightDetail = _ref; }, @@ -64,6 +63,8 @@ const Widget: WidgetType = { linkSelected, }, { type: linkSelected.isSelected ? editPage : showPage, + vgap: 10, + hgap: 10, linkSelected, }, ]; diff --git a/src/app/link_set/right/right_edit/right_edit.ts b/src/app/link_set/right/right_edit/right_edit.ts index b9bc1c2..16ac610 100644 --- a/src/app/link_set/right/right_edit/right_edit.ts +++ b/src/app/link_set/right/right_edit/right_edit.ts @@ -28,7 +28,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: FormItem, @@ -61,10 +61,10 @@ const Widget: WidgetType = { { type: FormItem, text: BI.i18nText('Dec-Dcm_First_Step'), - height: 400, + height: 420, form: { type: Vertical, - cls: 'right-form', + vgap: 10, items: [ { type: FormItem, @@ -252,6 +252,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Second_Step'), form: { type: Button, + width: 80, text: BI.i18nText('Dec-Dcm_Test_Connection'), level: 'ignore', }, diff --git a/src/app/link_set/right/right_edit/right_edit_jndi.ts b/src/app/link_set/right/right_edit/right_edit_jndi.ts index 68f7398..7278121 100644 --- a/src/app/link_set/right/right_edit/right_edit_jndi.ts +++ b/src/app/link_set/right/right_edit/right_edit_jndi.ts @@ -11,7 +11,7 @@ const Widget = BI.inherit(BI.Widget, { }, watch: { isCollapse(isCollapse) { - const height = isCollapse ? 550 : 160; + const height = isCollapse ? 550 : 180; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); this.jndiFormRef.setHeight(height); this.collapseRef.setText(text); @@ -23,7 +23,7 @@ const Widget = BI.inherit(BI.Widget, { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: FormItem, @@ -39,13 +39,12 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 160, + height: 180, ref: _ref => { this.jndiFormRef = _ref; }, form: { type: Vertical, - cls: 'right-form', items: [ { type: FormItem, @@ -118,8 +117,7 @@ const Widget = BI.inherit(BI.Widget, { }, { type: Vertical, - cls: 'right-form', - invisible: false, + invisible: true, ref: _ref => { this.otherAttributesRef = _ref; }, @@ -154,10 +152,9 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), - height: 25, + height: 40, form: { type: Vertical, - cls: 'right-form', items: [ { type: FormItem, diff --git a/src/app/link_set/right/right_edit/right_edit_mysql.ts b/src/app/link_set/right/right_edit/right_edit_mysql.ts index 8ed5437..56b3718 100644 --- a/src/app/link_set/right/right_edit/right_edit_mysql.ts +++ b/src/app/link_set/right/right_edit/right_edit_mysql.ts @@ -16,7 +16,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: FormItem, diff --git a/src/app/link_set/right/right_show/right_show.ts b/src/app/link_set/right/right_show/right_show.ts index 57b34cc..53f8b34 100644 --- a/src/app/link_set/right/right_show/right_show.ts +++ b/src/app/link_set/right/right_show/right_show.ts @@ -13,7 +13,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: BothSide, diff --git a/src/app/link_set/right/right_show/right_show_jndi.ts b/src/app/link_set/right/right_show/right_show_jndi.ts index a1365eb..6a28a1a 100644 --- a/src/app/link_set/right/right_show/right_show_jndi.ts +++ b/src/app/link_set/right/right_show/right_show_jndi.ts @@ -10,7 +10,7 @@ const Widget = BI.inherit(BI.Widget, { return { type: Vertical, - cls: 'right-show', + vgap: 10, items: [ { type: FormItem, @@ -29,7 +29,6 @@ const Widget = BI.inherit(BI.Widget, { }, form: { type: Vertical, - cls: 'right-form', items: [ { type: FormItem, @@ -92,7 +91,6 @@ const Widget = BI.inherit(BI.Widget, { }, { type: Vertical, - cls: 'right-form', invisible: false, ref: _ref => { this.otherAttributesRef = _ref; diff --git a/src/app/link_set/right/right_title/right_title.ts b/src/app/link_set/right/right_title/right_title.ts index 1e44851..04b8d5d 100644 --- a/src/app/link_set/right/right_title/right_title.ts +++ b/src/app/link_set/right/right_title/right_title.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, Label, Button} from '@ui/index'; +import {WidgetType, Left, Label, Button, LeftRightVerticalAdapt} from '@ui/index'; import RightTitleModel from '../../link_set.model'; import {LinkType} from '@ui/type'; import {OTHER_CONNECT} from '@private/constants'; @@ -15,49 +15,55 @@ const Widget: WidgetType = { const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; return { - type: Left, + type: LeftRightVerticalAdapt, height: 40, - cls: 'right-title', - items: [ - { - type: Label, - cls: 'right-title-text', - 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('Dec-Dcm_Edit'), - handler() { - that.store.setEdit(true); + cls: 'bi-border-bottom', + items: { + left: [ + { + type: Label, + cls: 'bi-font-bold', + hgap: 10, + textHeight: 40, + 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('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('Dec-Dcm_Connection_Is_Existence')); - } else { - that.store.saveLink(); - } + ], + right: [ + { + type: Button, + hgap: 10, + invisible: isEdit, + text: BI.i18nText('Dec-Dcm_Edit'), + handler() { + that.store.setEdit(true); + }, }, - }, - { - type: Button, - cls: 'right-title-button', - invisible: !isEdit, - level: 'ignore', - text: BI.i18nText('BI-Basic_Cancel'), - handler() { - that.store.setCancel(); + { + type: Button, + hgap: 10, + invisible: !isEdit, + level: 'ignore', + text: BI.i18nText('BI-Basic_Cancel'), + handler() { + that.store.setCancel(); + }, }, - }, - ], + { + type: Button, + hgap: 10, + invisible: !isEdit, + text: BI.i18nText('Dec-Dcm_Save'), + handler() { + 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('Dec-Dcm_Connection_Is_Existence')); + } else { + that.store.saveLink(); + } + }, + }, + ], + }, }; }, }; diff --git a/src/app/link_set/select/select.ts b/src/app/link_set/select/select.ts index ce333c9..5ee9ad8 100644 --- a/src/app/link_set/select/select.ts +++ b/src/app/link_set/select/select.ts @@ -13,7 +13,6 @@ const Widget: WidgetType = { return { type: Combo, - cls: 'select', trigger: 'click', adjustYOffset: 4, el: { @@ -24,29 +23,30 @@ const Widget: WidgetType = { popup: { el: { type: ButtonGroup, - cls: 'database-link-items', items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { return { type: TextItem, height: 24, width: 152, + textLgap: 10, text: item, title: item, value: item, }; }), { type: TextItem, - cls: 'link-item', height: 24, width: 152, + textLgap: 10, text: BI.i18nText('Dec-Dcm_Connection_More'), title: BI.i18nText('Dec-Dcm_Connection_More'), value: 'more', }, { type: TextItem, - cls: 'link-item', + cls: 'bi-border-top', height: 24, width: 152, + textLgap: 10, text: BI.i18nText('Dec-Dcm_Connection_Other'), title: BI.i18nText('Dec-Dcm_Connection_Other'), value: 'other', diff --git a/src/app/link_status/left/left_item.ts b/src/app/link_status/left/left_item.ts index b568ab8..13ff6b3 100644 --- a/src/app/link_status/left/left_item.ts +++ b/src/app/link_status/left/left_item.ts @@ -15,12 +15,15 @@ const Widget: WidgetType = { return { type: Left, - cls: 'left-item', + cls: 'left-item cursor-pointer', + height: 30, extraCls, items: [ { type: TextButton, cls: 'link-title', + textHeight: 30, + lgap: 10, textAlign: 'left', text: title, title, diff --git a/src/app/link_status/link_status.ts b/src/app/link_status/link_status.ts index 85579d3..3d26c88 100644 --- a/src/app/link_status/link_status.ts +++ b/src/app/link_status/link_status.ts @@ -17,20 +17,22 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'linkStatus', + cls: 'dcm-link-group', items: [{ el: { type: Vtape, - cls: 'database-left', + cls: 'dcm-link-left bi-border-right', items: [ { el: { type: Left, - cls: 'select-group', + cls: 'bi-border-bottom', items: [ { type: Label, - cls: 'status-title', + cls: 'bi-font-bold', + hgap: 6, + vgap: 6, text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], diff --git a/src/app/link_status/right/right.ts b/src/app/link_status/right/right.ts index d4f50ee..8f1d945 100644 --- a/src/app/link_status/right/right.ts +++ b/src/app/link_status/right/right.ts @@ -32,15 +32,19 @@ const Widget: WidgetType = { render() { return { type: Vertical, - cls: 'database-right', + cls: 'dcm-link-form', + minWidth: 400, items: [ { type: Left, + cls: 'right-status-title bi-border-bottom', height: 40, - cls: 'right-status-title', items: [ { type: Label, + cls: 'bi-font-bold', + textHeight: 40, + lgap: 10, text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], @@ -50,6 +54,8 @@ const Widget: WidgetType = { }, { type: ListView, cls: 'right-status-body', + vgap: 10, + hgap: 10, ref(ref: any) { Group = ref; }, diff --git a/src/app/link_status/right/right_card.ts b/src/app/link_status/right/right_card.ts index 3b9f86c..64c73fc 100644 --- a/src/app/link_status/right/right_card.ts +++ b/src/app/link_status/right/right_card.ts @@ -1,39 +1,50 @@ -import {WidgetType, Left, Label, Vertical} from '@ui/index'; +import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt} from '@ui/index'; const className = 'fr.component.linkStatus.right.card'; const Widget: WidgetType = { render() { const {maxActive, maxIdle, numActive, numIdle} = this.options; return { - type: Left, + type: FloatCenter, + height: 150, + hgap: 20, items: [ { type: Left, - cls: 'right-status-item', items: [ { type: Vertical, cls: 'right-status-board', + height: 150, + width: '100%', items: [ { - type: Vertical, + type: CenterAdapt, cls: 'right-status-board-item', + tgap: 40, items: [ { - type: Label, - cls: 'right-status-text', - extraCls: 'card-font1', - text: numActive, - }, - { - type: Label, - cls: 'right-status-text', - text: '/', - }, - { - type: Label, - cls: 'right-status-text', - text: maxActive, + type: Left, + items: [ + { + type: Label, + cls: 'right-status-text card-font-success', + textHeight: 40, + text: numActive, + }, + { + type: Label, + cls: 'right-status-text', + textHeight: 40, + text: '/', + }, + { + type: Label, + cls: 'right-status-text', + textHeight: 40, + text: maxActive, + }, + ], }, ], }, @@ -53,26 +64,36 @@ const Widget: WidgetType = { { type: Vertical, cls: 'right-status-board', + height: 150, + width: '100%', items: [ { - type: Vertical, + type: CenterAdapt, + tgap: 40, cls: 'right-status-board-item', items: [ { - type: Label, - cls: 'right-status-text', - extraCls: 'card-font2', - text: numIdle, - }, - { - type: Label, - cls: 'right-status-text', - text: '/', - }, - { - type: Label, - cls: 'right-status-text', - text: maxIdle, + type: Left, + items: [ + { + type: Label, + cls: 'right-status-text card-font-heighlight', + textHeight: 40, + text: numIdle, + }, + { + type: Label, + cls: 'right-status-text', + textHeight: 40, + text: '/', + }, + { + type: Label, + cls: 'right-status-text', + textHeight: 40, + text: maxIdle, + }, + ], }, ], }, diff --git a/src/app/title/title.ts b/src/app/title/title.ts index fafcbd7..8013461 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -1,4 +1,4 @@ -import {Left, WidgetType, IconButton} from '@ui/index'; +import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; import TitleItem from './title_item/title_item'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; @@ -6,44 +6,51 @@ const className = 'fr.title'; const Widget: WidgetType = { render() { return { - type: Left, - cls: 'title', - items: [ - { - type: TitleItem, - cls: 'dec-title-item-selected', - text: BI.i18nText('Dec-Dcm_Connection_Management'), - value: TAB_LINK_SET, - ref: _ref => { - this.ConnectSet = _ref; + type: LeftRightVerticalAdapt, + cls: 'dcm-title bi-border-bottom bi-font-bold', + items: { + left: [ + { + type: TitleItem, + cls: 'title-item-selected', + text: BI.i18nText('Dec-Dcm_Connection_Management'), + value: TAB_LINK_SET, + ref: _ref => { + this.ConnectSet = _ref; + }, + handler: () => { + this.ConnectSet.select(); + }, }, - handler: () => { - this.ConnectSet.select(); + { + type: TitleItem, + text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + value: TAB_LINK_POOL, + ref: _ref => { + this.ConnectPool = _ref; + }, + handler: () => { + this.ConnectPool.select(); + }, }, - }, - { - type: TitleItem, - text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), - value: TAB_LINK_POOL, - ref: _ref => { - this.ConnectPool = _ref; + ], + right: [ + { + type: IconButton, + cls: 'close-ha-font', + invisible: true, + width: 30, + height: 30, + rgap: 10, + handler() { + closeWindow(); + }, + ref: _ref => { + this.CloseButton = _ref; + }, }, - handler: () => { - this.ConnectPool.select(); - }, - }, - { - type: IconButton, - cls: 'close-button', - handler() { - closeWindow(); - }, - invisible: true, - ref: _ref => { - this.CloseButton = _ref; - }, - }, - ], + ], + }, }; }, mounted() { diff --git a/src/app/title/title_item/title_item.ts b/src/app/title/title_item/title_item.ts index 84b0981..1dcb198 100644 --- a/src/app/title/title_item/title_item.ts +++ b/src/app/title/title_item/title_item.ts @@ -20,7 +20,9 @@ const Widget = BI.inherit(BI.BasicButton, { return { type: Label, - cls: 'dec-title-item', + cls: 'dcm-title-item cursor-pointer', + height: 39, + hgap: 15, text, }; }, diff --git a/src/less/app.less b/src/less/app.less deleted file mode 100644 index c30e453..0000000 --- a/src/less/app.less +++ /dev/null @@ -1,318 +0,0 @@ -.database-connection-layout{ - width: 100%; - height: 100%; - background-color: @background-color-normal; - .title{ - background-color: @background-color-default; - border-bottom: 1px solid @border-color-line; - .dec-title-item{ - height: 39px; - line-height: 39px; - padding-left: 15px; - padding-right: 15px; - text-align: center; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - position: relative; - flex-shrink: 0; - font-weight: 700; - cursor: pointer; - } - .dec-title-item-selected{ - color: @background-color-highlight; - border-bottom: @border-color-highlight; - } - .close-button { - position: absolute !important; - right: 5px; - top: 5px; - width: 30px; - height: 30px; - cursor: pointer; - background-image: url("../img/icon_close9x9_normal.png"); - background-repeat: no-repeat; - background-position: center; - } - } - .linkset{ - margin: 10px; - bottom: 0px; - background-color: @background-color-default; - } - .linkStatus{ - margin: 10px; - top: 40px; - background-color: @background-color-default; - } -} - -.database-left{ - border-right: 1px solid @border-color-line; - .select-group{ - border-bottom: 1px solid @border-color-line; - .select{ - margin: 10px; - .database-link-items{ - padding-left:10px; - .link-item{ - border-top: 1px solid @border-color-line; - } - } - } - .status-title{ - font-weight: 700; - margin-left: 12px; - margin-top: 12px; - } - } - .left-list{ - margin: 10px; - .left-item{ - height: 24px; - line-height: 24px; - cursor: pointer; - &:hover{ - background-color: @background-color-blue-transparent; - .icons{ - .action-icon{ - visibility: visible !important; - } - - } - } - .icons{ - float: right !important; - .action-icon{ - visibility: hidden; - } - .b-font{ - font-size: 16px; - } - } - } - .left-item-selected{ - background-color: @background-color-blue-transparent; - .link-title{ - color: @font-color-highlight; - } - } - } -} -.database-right{ - min-width: 400px; - overflow: auto; - >.bi-vertical-layout{ - height: 100%; - } - .bi-flex-center-adapt-layout{ - height: 100%; - .data-connection-background{ - background: url(../img/resources.png) center center no-repeat; - background-size: contain; - } - } - .right-status-title{ - border-bottom: 1px solid @border-color-line; - color: @font-color-normal; - line-height: 40px; - padding-left: 10px; - font-weight: 700; - } - .right-status-body{ - margin: 10px 30px 0px 30px; - height: 50%; - .right-status-item{ - height: 150px; - width: 50%; - top: 0; left: 0; - position: absolute !important; - .right-status-board { margin-left: 25px; position: relative !important; left: -25px;} - } - .right-status-right{ - height: 150px; - width: 50%; - top: 0; right:0; - position: absolute !important; - .right-status-board { margin-right: 25px; position: relative !important; left: 25px; } - } - .right-status-board{ - background-color: @background-color-normal; - color: @font-color-normal; - width: 100%; - height: 100%; - .right-status-board-item{ - text-align: center; - margin-top: 38px; - .right-status-text{ - display: inline-block; - } - .card-font1{ - color: @font-color-success; - font-size: 32px; - } - .card-font2{ - color: @font-color-highlight; - font-size: 32px; - } - } - - } - } - .right-content{ - height: 100%; - .right-title{ - border-bottom: 1px solid @border-color-line; - color: @font-color-normal; - line-height: 40px; - padding-left: 10px; - .right-title-text{ - font-weight: 700; - } - .right-title-button{ - float: right !important; - margin-right: 10px; - margin-top: 8px; - } - } - .right-show{ - margin: 10px; - .right-form{ - width: 100%; - } - } - } -} -.both-side{ - line-height: 24px; - margin-bottom: 10px; - .left{ - white-space: nowrap; - text-overflow: ellipsis; - position: relative; - flex-shrink: 0; - font-weight: 700; - } - .hint{ - padding-left: 5px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - position: relative; - flex-shrink: 0; - margin-left: 5px; - color: @font-color-disabled; - } -} -.shared-component-title{ - height: 24px; - line-height: 24px; - margin-bottom: 10px; - color: @font-color-disabled; - border-bottom: 1px solid @border-color-line; -} -.comfirm-content{ - margin-top: 40px; - margin-left: 20px; - .comfirm-icon{ - background-image: url("../img/warning.png"); - background-size: contain; - margin-right: 12px; - } - .bi-text{ - height: 50px; - line-height: 50px; - margin-left: 12px; - } -} -.more-link{ - .more-link-item{ - width: 538px; - overflow: hidden auto; - left: -10px !important; - right: 0px; - top: 10px; - bottom: 0px; - position: absolute; - height: 380px; - .link-item{ - margin-left: 10px; - margin-bottom: 10px; - cursor: pointer; - border: solid 1px @border-color-default; - &:hover{ - border: solid 1px @border-color-highlight; - } - .selected{ - position: absolute !important; - right: -1px; - top: -1px; - height: 30px; - width: 30px; - background: url(../img/database-selected.png) center center no-repeat; - background-size: contain; - } - .text{ - height: 27px; - line-height: 27px; - padding-left: 2px; - padding-right: 2px; - text-align: center; - white-space: nowrap; - background: @background-color-light-gray; - } - } - - } -} -.popover-notitle{ - .bi-header-background{ - display: none; - } - .bi-absolute-layout{ - top:0px !important; - } -} -.bi-custom-show{ - .show-content{ - text-align: center; - .loading-icon{ - display: block; - background: url(../img/loading.gif) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .success-icon{ - display: block; - background: url(../img/success.png) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .error-icon{ - display: block; - background: url(../img/error.png) center center no-repeat; - background-size: contain; - margin: 0 auto; - margin-bottom: 18px; - } - .buttons{ - margin-top: 18px; - div{ - margin: 0 4px; - } - } - } - .show-more{ - text-align: left !important; - height: 73px; - background: @background-color-light-gray; - margin-bottom: 10px; - padding: 5px; - margin-top: 10px; - } -} -.jndi-notice{ - color: @color-jndi-notice; -} \ No newline at end of file diff --git a/src/less/color.less b/src/less/color.less deleted file mode 100644 index a1a49e7..0000000 --- a/src/less/color.less +++ /dev/null @@ -1,3 +0,0 @@ -@import "../../node_modules/fineui/src/less/lib/colors.less"; -@color-jndi-notice: @font-color-negative; -@background-color-blue-transparent: rgba(54,133,242,.05); \ No newline at end of file diff --git a/src/less/font.less b/src/less/font.less deleted file mode 100644 index 1c9d074..0000000 --- a/src/less/font.less +++ /dev/null @@ -1,7 +0,0 @@ -@import "../../node_modules/fineui/src/less/image.less"; -@import "./lib/font.less"; - -.font(link-font, @font-link); -.font(info-font, @font-link-info); -.font(test-font, @font-link-test); -.font(delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/index.less b/src/less/index.less index e866921..7a227dc 100644 --- a/src/less/index.less +++ b/src/less/index.less @@ -1,3 +1,5 @@ -@import "color"; -@import "app"; -@import "font"; \ No newline at end of file +@import "lib/background"; +@import "lib/color"; +@import "resource/background"; +@import "resource/font"; +@import "resource/common"; \ No newline at end of file diff --git a/src/less/lib/background.less b/src/less/lib/background.less new file mode 100644 index 0000000..e5baaf9 --- /dev/null +++ b/src/less/lib/background.less @@ -0,0 +1,7 @@ +@background-color-blue-transparent: @color-bi-blue-5; +@background-resources: "resources.png"; +@background-warning: "warning.png"; +@background-database-selected: "database-selected.png"; +@background-loading-gif: "loading.gif"; +@background-success: "success.png"; +@background-error: "error.png"; \ No newline at end of file diff --git a/src/less/lib/color.less b/src/less/lib/color.less new file mode 100644 index 0000000..3b63c6d --- /dev/null +++ b/src/less/lib/color.less @@ -0,0 +1 @@ +@import "../../../node_modules/fineui/src/less/lib/colors"; \ No newline at end of file diff --git a/src/less/resource/background.less b/src/less/resource/background.less new file mode 100644 index 0000000..ffec451 --- /dev/null +++ b/src/less/resource/background.less @@ -0,0 +1,23 @@ +@import "../lib/background"; +@import "../var"; + +.data-connection-background { + .image2xPath(@background-resources) +} + +.dcm-comfirm-icon{ + .image2xPath(@background-warning) +} +.dcm-link-more-selected{ + .image2xPath(@background-database-selected) +} + +.dcm-loading-icon{ + .image2xPath(@background-loading-gif) +} +.dcm-success-icon{ + .image2xPath(@background-success) +} +.dcm-error-icon{ + .image2xPath(@background-error) +} \ No newline at end of file diff --git a/src/less/resource/common.less b/src/less/resource/common.less new file mode 100644 index 0000000..c43b34a --- /dev/null +++ b/src/less/resource/common.less @@ -0,0 +1,66 @@ +.dec-webui-dcm-layout{ + background-color: @background-color-normal; + .dcm-title{ + background-color: @background-color-default; + } + .dcm-link-group{ + background-color: @background-color-default; + .dcm-link-left{ + .link-item{ + &:hover{ + background-color: @background-color-blue-transparent; + .link-item-icon{ + visibility: visible; + } + } + .link-item-icon{ + visibility: hidden; + } + } + .left-item-selected{ + background-color: @background-color-blue-transparent; + .link-title{ + color: @font-color-highlight; + } + } + } + } + .dcm-link-form{ + .right-status-title{ + color: @font-color-normal; + } + .right-status-board{ + background-color: @background-color-normal; + color: @font-color-normal; + .card-font-success{ + color: @font-color-success; + font-size: @font-size-30; + } + .card-font-heighlight{ + color: @font-color-highlight; + font-size: @font-size-30; + } + } + .form-item-hint{ + color: @font-color-disabled; + } + .jndi-notice{ + color: @font-color-negative; + } + } +} + +.dcm-link-more{ + &:hover{ + border: solid 1px @border-color-highlight; + } + .dcm-link-more-text{ + background: @background-color-light-gray; + } +} +.show-content{ + background-color: @background-color-default; + .show-more{ + background: @background-color-light-gray; + } +} \ No newline at end of file diff --git a/src/less/resource/font.less b/src/less/resource/font.less new file mode 100644 index 0000000..db1fd98 --- /dev/null +++ b/src/less/resource/font.less @@ -0,0 +1,7 @@ +@import "../../../node_modules/fineui/src/less/image.less"; +@import "../lib/font.less"; + +.font(link-font, @font-link); +.font(info-font, @font-link-info); +.font(test-font, @font-link-test); +.font(delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/less/var.less b/src/less/var.less new file mode 100644 index 0000000..964e94b --- /dev/null +++ b/src/less/var.less @@ -0,0 +1,3 @@ +@import "../../node_modules/fineui/src/less/var"; +@imageUrl: '/img/'; +@image2xUrl: '/img/'; \ No newline at end of file diff --git a/src/shared/components/both_side.ts b/src/shared/components/both_side.ts index 5e7b654..4db6c94 100644 --- a/src/shared/components/both_side.ts +++ b/src/shared/components/both_side.ts @@ -11,7 +11,7 @@ const Widget: WidgetType = { items: [{ el: { type: Label, - cls: 'left', + cls: 'bi-font-bold', textAlign: 'left', text: leftText, }, diff --git a/src/shared/components/form_item.ts b/src/shared/components/form_item.ts index b15f3db..133ee89 100644 --- a/src/shared/components/form_item.ts +++ b/src/shared/components/form_item.ts @@ -11,17 +11,18 @@ const Widget: WidgetType = { items: [{ el: { type: Label, - cls: 'left', + cls: 'bi-font-bold', textAlign: 'left', text, }, width, - }, form, { + }, form, hint ? { type: Label, - cls: 'hint', + cls: 'form-item-hint', + lgap: 5, textAlign: 'left', text: hint, - }], + } : null], }; }, }; diff --git a/src/shared/components/title.ts b/src/shared/components/title.ts index df1bc8a..0dbef68 100644 --- a/src/shared/components/title.ts +++ b/src/shared/components/title.ts @@ -6,7 +6,10 @@ const Widget: WidgetType = { return { type: Label, - cls: 'shared-component-title', + cls: 'form-item-hint bi-border-bottom', + height: 24, + textHeight: 24, + bgap: 10, textAlign: 'left', text, }; diff --git a/src/shared/crud/crud.request.ts b/src/shared/crud/crud.request.ts index 63d6495..de71075 100644 --- a/src/shared/crud/crud.request.ts +++ b/src/shared/crud/crud.request.ts @@ -11,7 +11,7 @@ export function isDesigner(): boolean { return PluginHelper.isDesigner(); } - return false; + return true; } /** @@ -82,7 +82,7 @@ export function testConnection(data: LinkType, cb: Function): void{ }); } else { setTimeout(() => { - cb({errorCode:'500', errorMsg:'createConnectionThread not start!'}); + cb({errorCode: '500', errorMsg: 'createConnectionThread not start!'}); }, 2000); } } @@ -125,6 +125,6 @@ export function info(name: string, cb: Function): void{ cb(res.data); }); } else { - cb({maxActive:50, maxIdle:10, numActive:0, numIdle:0}); + cb({maxActive: 50, maxIdle: 10, numActive: 0, numIdle: 0}); } } diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 4f087ae..3863982 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -1,4 +1,4 @@ -import {Label, Vertical, Left, Button, Layout} from '@ui/index'; +import {Label, Vertical, Left, Button, Layout, Absolute, CenterAdapt} from '@ui/index'; class Dialog { /** * 提示 @@ -16,15 +16,19 @@ class Dialog { body: { type: 'bi.left', cls: 'comfirm-content', + vgap: 40, + hgap: 20, items: [ { type: 'bi.layout', - cls: 'comfirm-icon', + cls: 'dcm-comfirm-icon', width: 50, height: 50, }, { type: 'bi.label', + textHeight: 50, + lgap: 10, text: message, }, ], @@ -51,13 +55,15 @@ class Dialog { const body = { type: 'bi.center_adapt', cls: 'show-content', + width: 450, + height: 220, items: [ { type: Vertical, items: [ { type: 'bi.layout', - cls: 'loading-icon', + cls: 'dcm-loading-icon', width: 100, height: 100, }, @@ -83,7 +89,7 @@ class Dialog { items: [ { type: 'bi.layout', - cls: 'success-icon', + cls: 'dcm-success-icon', width: 100, height: 100, }, @@ -108,7 +114,7 @@ class Dialog { items: [ { type: 'bi.layout', - cls: 'error-icon', + cls: 'dcm-error-icon', width: 100, height: 100, }, @@ -139,12 +145,14 @@ class Dialog { items: [ { type: Vertical, + vgap: 10, items: [ { type: Layout, - cls: 'error-icon', - width: 100, + cls: 'dcm-error-icon', + width: 270, height: 100, + textAlign: 'center', }, { type: Label, @@ -153,6 +161,7 @@ class Dialog { { type: Left, cls: 'buttons', + hgap: 5, items: [ { type: Button, @@ -172,7 +181,7 @@ class Dialog { text: BI.i18nText('Dec-Dcm_Back'), level: 'ignore', handler() { - that.close(id); + that.remove(id); }, }, { @@ -195,6 +204,7 @@ class Dialog { text: more, invisible: true, height: 73, + width: 400, value: false, ref(ref: any) { More = ref; @@ -202,17 +212,26 @@ class Dialog { }, ], }; - BI.Popovers.create(id, { - type: 'bi.popover', - cls: 'popover-notitle bi-custom-show', - size: 'normal', - width: 450, - height: 220, - body, - ref(ref: any) { - Popover = ref; + + BI.Maskers.create(id, null, { + render: { + type: CenterAdapt, + cls: 'bi-z-index-mask', + items: [{ + el: { + type: 'bi.center_adapt', + cls: 'show-content', + width: 450, + height: 220, + items: [body], + ref(ref: any) { + Popover = ref; + }, + }, + }], }, - }).open(id); + }); + BI.Maskers.show(id); return id; } @@ -220,12 +239,15 @@ class Dialog { public close(id: string): void{ BI.Popovers.close(id); } - public show(body: any, autoClose = 0): string { + public remove(id: string): void{ + BI.Maskers.remove(id); + } + public show1(body: any, autoClose = 0): string { const id = BI.UUID(); BI.Popovers.create(id, { type: 'bi.popover', cls: 'popover-notitle bi-custom-show', - size: 'normal', + size: 'small', width: 450, height: 220, body, @@ -238,6 +260,29 @@ class Dialog { return id; } + + public show(body: any, autoClose = 0): string { + const name = BI.UUID(); + BI.Maskers.create(name, null, { + render: { + type: CenterAdapt, + cls: 'bi-z-index-mask', + items: [{ + el: { + ...body, + }, + }], + }, + }); + BI.Maskers.show(name); + if (autoClose > 0) { + setTimeout(() => { + BI.Maskers.remove(name); + }, autoClose); + } + + return name; + } } export default new Dialog(); diff --git a/src/ui/fineui.ts b/src/ui/fineui.ts index 2b2dcd5..8653849 100644 --- a/src/ui/fineui.ts +++ b/src/ui/fineui.ts @@ -34,9 +34,6 @@ export const TextBubblePopupBarView = 'bi.text_bubble_bar_popup_view'; export const BubbleCombo = 'bi.bubble_combo'; export const SearchEditor = 'bi.search_editor'; export const Img = 'bi.img'; -export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; -export const VertualGroup = 'bi.virtual_group'; -export const ListView = 'bi.list_view'; // 布局 export const VerticalAdapt = 'bi.vertical_adapt'; @@ -47,3 +44,9 @@ export const Layout = 'bi.layout'; export const Absolute = 'bi.absolute'; export const Vertical = 'bi.vertical'; export const Left = 'bi.left'; +export const Right = 'bi.right'; +export const LeftRightVerticalAdapt = 'bi.left_right_vertical_adapt'; +export const VertualGroup = 'bi.virtual_group'; +export const ListView = 'bi.list_view'; +export const FloatCenter = 'bi.float_center'; +export const HorizotalAdapt = 'bi.horizontal_adapt'; From cbc562ff9410d7c7ff6bccfdc095672f04cdf86b Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 10:49:36 +0800 Subject: [PATCH 22/44] =?UTF-8?q?refactor:=20=E7=94=A8beforeInit=20?= =?UTF-8?q?=E4=BB=A3=E6=9B=BF=20mounted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.model.ts | 3 ++- src/app/app.ts | 7 ++++--- src/app/link_set/left/left.service.ts | 18 ------------------ src/app/link_set/left/left.ts | 18 ++++++++++++++++-- src/app/link_status/left/left.service.ts | 18 ------------------ src/app/link_status/left/left.ts | 18 ++++++++++++++++-- src/app/link_status/link_status.ts | 3 --- src/app/link_status/right/right.ts | 3 --- src/app/title/title.ts | 9 +++------ src/less/resource/common.less | 4 ++++ 10 files changed, 45 insertions(+), 56 deletions(-) delete mode 100644 src/app/link_set/left/left.service.ts delete mode 100644 src/app/link_status/left/left.service.ts diff --git a/src/app/app.model.ts b/src/app/app.model.ts index a71c953..dd87952 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -28,9 +28,10 @@ const Model: ModelType = { this.model.linkList = value; this.model.tab = TAB_LINK_SET; }, - initData() { + initData(callback: Function) { fetchLinkList((linkList: LinkType[]) => { this.setLinkList(linkList); + callback(); }); }, }, diff --git a/src/app/app.ts b/src/app/app.ts index baafeba..57e2812 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -10,6 +10,9 @@ const Widget = BI.inherit(BI.Widget, { _store() { return BI.Models.getModel(appModel); }, + beforeInit (callback) { + this.store.initData(callback); + }, render() { return { type: Vtape, @@ -34,6 +37,7 @@ const Widget = BI.inherit(BI.Widget, { }, { el: { type: linkStatus, + invisible: true, }, left: 10, top: 10, @@ -44,9 +48,6 @@ const Widget = BI.inherit(BI.Widget, { ], }; }, - mounted() { - this.store.initData(); - }, }); BI.shortcut(className, Widget); diff --git a/src/app/link_set/left/left.service.ts b/src/app/link_set/left/left.service.ts deleted file mode 100644 index 4d8c58f..0000000 --- a/src/app/link_set/left/left.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {LinkType} from '@ui/type'; -import LeftItem from './left_item/left_item'; - -export const getLinks = (linkList: LinkType[]): any => { - const links: any[] = []; - linkList.forEach((item: LinkType) => { - links.push({ - type: LeftItem, - extraCls: item.isSelected ? 'left-item-selected' : '', - title: item.connectionName, - id: item.connectionId, - creator: item.creator, - text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), - }); - }); - - return links; -}; diff --git a/src/app/link_set/left/left.ts b/src/app/link_set/left/left.ts index 03d726c..20e4af8 100644 --- a/src/app/link_set/left/left.ts +++ b/src/app/link_set/left/left.ts @@ -1,7 +1,8 @@ import {WidgetType, ListView} from '@ui'; import Model from '../link_set.model'; import {LinkType} from '@ui/type'; -import {getLinks} from './left.service'; +import LeftItem from './left_item/left_item'; + const className = 'fr.component.linkset.left'; let leftContent: any = null; const Widget: WidgetType = { @@ -10,7 +11,7 @@ const Widget: WidgetType = { }, watch: { linkList(linkList: LinkType[]) { - leftContent.populate(BI.createItems(getLinks(linkList))); + leftContent.populate(BI.createItems(this._renderItems(linkList))); }, }, render() { @@ -19,8 +20,21 @@ const Widget: WidgetType = { ref(_ref: any) { leftContent = _ref; }, + items: this._renderItems(this.model.linkList), }; }, + _renderItems(linkList: LinkType[]) { + return BI.map(linkList, (index: number, item: LinkType) => { + return { + type: LeftItem, + cls: item.isSelected ? 'left-item-selected' : '', + title: item.connectionName, + id: item.connectionId, + creator: item.creator, + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), + }; + }); + }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_status/left/left.service.ts b/src/app/link_status/left/left.service.ts deleted file mode 100644 index e2863e7..0000000 --- a/src/app/link_status/left/left.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {LinkType} from '@ui/type'; -import LeftItem from './left_item'; - -export const getLinks = (linkList: LinkType[], selectTitle = ''): any => { - const links: any[] = []; - linkList.forEach((item: LinkType) => { - links.push({ - type: LeftItem, - extraCls: item.connectionName === selectTitle ? 'left-item-selected' : '', - title: item.connectionName, - id: item.connectionId, - creator: item.creator, - text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), - }); - }); - - return links; -}; diff --git a/src/app/link_status/left/left.ts b/src/app/link_status/left/left.ts index 39587ab..2a125b0 100644 --- a/src/app/link_status/left/left.ts +++ b/src/app/link_status/left/left.ts @@ -1,7 +1,8 @@ import {WidgetType, ListView} from '@ui'; import Model from './left.model'; import {LinkType} from '@ui/type'; -import {getLinks} from './left.service'; +import LeftItem from './left_item'; + const className = 'fr.component.linkStatus.left'; let leftContent: any = null; const Widget: WidgetType = { @@ -15,7 +16,7 @@ const Widget: WidgetType = { }, statusSelected(title: string) { const linkList = this.model.linkList; - leftContent.populate(BI.createItems(getLinks(linkList, title))); + leftContent.populate(BI.createItems(this._renderItems(linkList, title))); }, }, render() { @@ -24,8 +25,21 @@ const Widget: WidgetType = { ref(_ref: any) { leftContent = _ref; }, + items: this._renderItems(this.model.linkList, this.model.statusSelected), }; }, + _renderItems(linkList: LinkType[], selectTitle = '') { + return BI.map(linkList, (index: number, item: LinkType) => { + return { + type: LeftItem, + extraCls: item.connectionName === selectTitle ? 'left-item-selected' : '', + title: item.connectionName, + id: item.connectionId, + creator: item.creator, + text: item.text ? item.text : BI.i18nText('Dec-Dcm_Default'), + }; + }); + }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_status/link_status.ts b/src/app/link_status/link_status.ts index 3d26c88..1d122d4 100644 --- a/src/app/link_status/link_status.ts +++ b/src/app/link_status/link_status.ts @@ -50,9 +50,6 @@ const Widget: WidgetType = { }], }; }, - mounted() { - this.setVisible(false); - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/app/link_status/right/right.ts b/src/app/link_status/right/right.ts index 8f1d945..21c16ec 100644 --- a/src/app/link_status/right/right.ts +++ b/src/app/link_status/right/right.ts @@ -63,9 +63,6 @@ const Widget: WidgetType = { ], }; }, - mounted() { - - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 8013461..c322fc3 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -5,6 +5,8 @@ import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'fr.title'; const Widget: WidgetType = { render() { + const hideCloseButton = isDesigner(); + return { type: LeftRightVerticalAdapt, cls: 'dcm-title bi-border-bottom bi-font-bold', @@ -38,7 +40,7 @@ const Widget: WidgetType = { { type: IconButton, cls: 'close-ha-font', - invisible: true, + invisible: !hideCloseButton, width: 30, height: 30, rgap: 10, @@ -53,11 +55,6 @@ const Widget: WidgetType = { }, }; }, - mounted() { - if (isDesigner()) { - this.CloseButton.setVisible(true); - } - }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); diff --git a/src/less/resource/common.less b/src/less/resource/common.less index c43b34a..9a78a2c 100644 --- a/src/less/resource/common.less +++ b/src/less/resource/common.less @@ -2,6 +2,10 @@ background-color: @background-color-normal; .dcm-title{ background-color: @background-color-default; + .title-item-selected{ + color: @background-color-highlight; + border-bottom: solid 2px @border-color-highlight; + } } .dcm-link-group{ background-color: @background-color-default; From d8584caa2c91a50e299e306d1e63fbbebbd22e97 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 10:53:07 +0800 Subject: [PATCH 23/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.model.ts | 2 +- src/app/app.ts | 2 +- src/app/link_set/left/left.ts | 2 +- src/app/link_set/left/left_item/left_item.ts | 2 +- src/app/link_set/left/left_item/left_item_icon.ts | 2 +- src/app/link_set/link_set.model.ts | 2 +- src/app/link_set/link_set.ts | 2 +- src/app/link_set/more/item/more_link_item.ts | 2 +- src/app/link_set/more/item/more_link_litem.model.ts | 2 +- src/app/link_set/more/more_link.model.ts | 2 +- src/app/link_set/more/more_link.ts | 2 +- src/app/link_set/right/nothing.ts | 2 +- src/app/link_set/right/right.ts | 2 +- src/app/link_set/right/right_detail/right_detail.model.ts | 2 +- src/app/link_set/right/right_detail/right_detail.ts | 2 +- src/app/link_set/right/right_edit/right_edit.ts | 2 +- src/app/link_set/right/right_edit/right_edit_jndi.ts | 2 +- src/app/link_set/right/right_edit/right_edit_mysql.ts | 2 +- src/app/link_set/right/right_show/right_show.ts | 2 +- src/app/link_set/right/right_show/right_show_jndi.ts | 2 +- src/app/link_set/right/right_title/right_title.ts | 2 +- src/app/link_set/select/select.ts | 2 +- src/app/link_status/left/left.model.ts | 2 +- src/app/link_status/left/left.ts | 2 +- src/app/link_status/left/left_item.ts | 6 +++--- src/app/link_status/link_status.model.ts | 2 +- src/app/link_status/link_status.ts | 2 +- src/app/link_status/right/right.model.ts | 4 ++-- src/app/link_status/right/right.ts | 2 +- src/app/link_status/right/right_card.ts | 2 +- src/app/title/title.ts | 2 +- src/app/title/title_item/title_item.model.ts | 2 +- src/app/title/title_item/title_item.ts | 2 +- src/demo/plugin.redis.edit.ts | 2 +- src/demo/plugin.redis.preview.ts | 2 +- src/demo/plugin.tedis.pool.ts | 2 +- src/shared/components/both_side.ts | 2 +- src/shared/components/form_item.ts | 2 +- src/shared/components/title.ts | 2 +- 39 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/app/app.model.ts b/src/app/app.model.ts index dd87952..cec44fe 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.main'; +const className = 'dec.dcm.model.main'; import {ModelType} from '@ui'; import {LinkType} from '@ui/type'; import {fetchLinkList} from '../shared/crud/crud.request'; diff --git a/src/app/app.ts b/src/app/app.ts index 57e2812..97d114c 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -5,7 +5,7 @@ import linkSet from './link_set/link_set'; import linkStatus from './link_status/link_status'; import '../less/index.less'; -const className = 'fr.main'; +const className = 'dec.dcm.main'; const Widget = BI.inherit(BI.Widget, { _store() { return BI.Models.getModel(appModel); diff --git a/src/app/link_set/left/left.ts b/src/app/link_set/left/left.ts index 20e4af8..85aebd8 100644 --- a/src/app/link_set/left/left.ts +++ b/src/app/link_set/left/left.ts @@ -3,7 +3,7 @@ import Model from '../link_set.model'; import {LinkType} from '@ui/type'; import LeftItem from './left_item/left_item'; -const className = 'fr.component.linkset.left'; +const className = 'dec.dcm.component.linkset.left'; let leftContent: any = null; const Widget: WidgetType = { _store() { diff --git a/src/app/link_set/left/left_item/left_item.ts b/src/app/link_set/left/left_item/left_item.ts index 65d85ee..dcda05f 100644 --- a/src/app/link_set/left/left_item/left_item.ts +++ b/src/app/link_set/left/left_item/left_item.ts @@ -2,7 +2,7 @@ import {WidgetType, Left, Label, Icon, TextButton, Right, LeftRightVerticalAdapt import ItemIcon from './left_item_icon'; 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 className = 'dec.dcm.component.linkSet.left.item'; const Widget: WidgetType = { props: { title: '', diff --git a/src/app/link_set/left/left_item/left_item_icon.ts b/src/app/link_set/left/left_item/left_item_icon.ts index 9bffb2e..10e1a27 100644 --- a/src/app/link_set/left/left_item/left_item_icon.ts +++ b/src/app/link_set/left/left_item/left_item_icon.ts @@ -2,7 +2,7 @@ import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from import Model from '../../link_set.model'; import {ACTION_DELETE} from '@private/constants'; -const className = 'fr.component.linkSet.left.item.icon'; +const className = 'dec.dcm.component.linkSet.left.item.icon'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); diff --git a/src/app/link_set/link_set.model.ts b/src/app/link_set/link_set.model.ts index 04b0cf8..6cc14f9 100644 --- a/src/app/link_set/link_set.model.ts +++ b/src/app/link_set/link_set.model.ts @@ -5,7 +5,7 @@ import {getCnnectionName} from './select/select.service'; import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; import {saveConnection} from './link_set.service'; -const className = 'fr.model.linkset'; +const className = 'dec.dcm.model.linkset'; const Model: ModelType = { context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], actions: { diff --git a/src/app/link_set/link_set.ts b/src/app/link_set/link_set.ts index 3a810db..82b25d2 100644 --- a/src/app/link_set/link_set.ts +++ b/src/app/link_set/link_set.ts @@ -4,7 +4,7 @@ import linkSetModel from './link_set.model'; import Select from './select/select'; import Right from './right/right'; import {TAB_LINK_SET} from '@private/constants'; -const className = 'fr.linkset'; +const className = 'dec.dcm.linkset'; const Widget: WidgetType = { _store() { return BI.Models.getModel(linkSetModel); diff --git a/src/app/link_set/more/item/more_link_item.ts b/src/app/link_set/more/item/more_link_item.ts index 7e4715c..c609f1e 100644 --- a/src/app/link_set/more/item/more_link_item.ts +++ b/src/app/link_set/more/item/more_link_item.ts @@ -1,7 +1,7 @@ import {WidgetType, Vertical, Img, Label, Layout, Absolute} from '@ui/index'; import ModelName from './more_link_litem.model'; -const className = 'fr.component.linkSet.morelink.item'; +const className = 'dec.dcm.component.linkSet.morelink.item'; const Widget: WidgetType = { _store() { return BI.Models.getModel(ModelName); diff --git a/src/app/link_set/more/item/more_link_litem.model.ts b/src/app/link_set/more/item/more_link_litem.model.ts index 87203e6..599711f 100644 --- a/src/app/link_set/more/item/more_link_litem.model.ts +++ b/src/app/link_set/more/item/more_link_litem.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.link_set.more_link_item'; +const className = 'dec.dcm.model.link_set.more_link_item'; export const Model = BI.inherit(Fix.Model, { context: ['otherSelected'], }); diff --git a/src/app/link_set/more/more_link.model.ts b/src/app/link_set/more/more_link.model.ts index 73e243b..c9c1e13 100644 --- a/src/app/link_set/more/more_link.model.ts +++ b/src/app/link_set/more/more_link.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.link_set.more_link'; +const className = 'dec.dcm.model.link_set.more_link'; export const Model = BI.inherit(Fix.Model, { childContext: ['otherSelected'], state() { diff --git a/src/app/link_set/more/more_link.ts b/src/app/link_set/more/more_link.ts index ad1ca97..bde8e09 100644 --- a/src/app/link_set/more/more_link.ts +++ b/src/app/link_set/more/more_link.ts @@ -2,7 +2,7 @@ import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; import {DATA_BASE_TYPE_OTHER} from '@private/constants'; import MoreLinkItem from './item/more_link_item'; import ModelName from './more_link.model'; -const className = 'fr.component.linkSet.morelink'; +const className = 'dec.dcm.component.linkSet.morelink'; const Widget: WidgetType = { _store() { return BI.Models.getModel(ModelName); diff --git a/src/app/link_set/right/nothing.ts b/src/app/link_set/right/nothing.ts index 81fc1c2..425ba85 100644 --- a/src/app/link_set/right/nothing.ts +++ b/src/app/link_set/right/nothing.ts @@ -1,5 +1,5 @@ import {WidgetType, CenterAdapt, Vertical, Layout, Label} from '@ui/index'; -const className = 'fr.component.right.nothing'; +const className = 'dec.dcm.component.right.nothing'; const Widget: WidgetType = { render() { return { diff --git a/src/app/link_set/right/right.ts b/src/app/link_set/right/right.ts index f969c23..92b69f4 100644 --- a/src/app/link_set/right/right.ts +++ b/src/app/link_set/right/right.ts @@ -4,7 +4,7 @@ import Nothing from './nothing'; import RightDetail from './right_detail/right_detail'; import Model from '../link_set.model'; let rightContent: any = null; -const className = 'fr.component.right'; +const className = 'dec.dcm.component.right'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); diff --git a/src/app/link_set/right/right_detail/right_detail.model.ts b/src/app/link_set/right/right_detail/right_detail.model.ts index 67b4afe..fed6e29 100644 --- a/src/app/link_set/right/right_detail/right_detail.model.ts +++ b/src/app/link_set/right/right_detail/right_detail.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.link.set.right.detail'; +const className = 'dec.dcm.model.link.set.right.detail'; export const Model = BI.inherit(Fix.Model, { context: ['linkSelected'], diff --git a/src/app/link_set/right/right_detail/right_detail.ts b/src/app/link_set/right/right_detail/right_detail.ts index 44b1c8a..3a8b596 100644 --- a/src/app/link_set/right/right_detail/right_detail.ts +++ b/src/app/link_set/right/right_detail/right_detail.ts @@ -10,7 +10,7 @@ import RightEditJndi from '../right_edit/right_edit_jndi'; import pluginListConstant from '../../../app.constant'; import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants'; -const className = 'fr.component.right.detail'; +const className = 'dec.dcm.component.right.detail'; const Widget: WidgetType = { _store() { diff --git a/src/app/link_set/right/right_edit/right_edit.ts b/src/app/link_set/right/right_edit/right_edit.ts index 16ac610..251d1d2 100644 --- a/src/app/link_set/right/right_edit/right_edit.ts +++ b/src/app/link_set/right/right_edit/right_edit.ts @@ -6,7 +6,7 @@ import FormItem from '@shared/components/form_item'; import Title from '@shared/components/title'; import {getDrivers, connectNameChecker} from './right_edit.service'; let ConnectionName: any = null; -const className = 'fr.component.right.edit'; +const className = 'dec.dcm.component.right.edit'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); diff --git a/src/app/link_set/right/right_edit/right_edit_jndi.ts b/src/app/link_set/right/right_edit/right_edit_jndi.ts index 7278121..2173e00 100644 --- a/src/app/link_set/right/right_edit/right_edit_jndi.ts +++ b/src/app/link_set/right/right_edit/right_edit_jndi.ts @@ -4,7 +4,7 @@ import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constan import {AttributeType} from '../right.typing'; import ModelName from './right_edit.model'; -const classNameEdit = 'fr.component.right.edit.jndi'; +const classNameEdit = 'dec.dcm.component.right.edit.jndi'; const Widget = BI.inherit(BI.Widget, { _store() { return BI.Models.getModel(ModelName); diff --git a/src/app/link_set/right/right_edit/right_edit_mysql.ts b/src/app/link_set/right/right_edit/right_edit_mysql.ts index 56b3718..bd3cc7f 100644 --- a/src/app/link_set/right/right_edit/right_edit_mysql.ts +++ b/src/app/link_set/right/right_edit/right_edit_mysql.ts @@ -5,7 +5,7 @@ import Model from '../../link_set.model'; import FormItem from '@shared/components/form_item'; import Title from '@shared/components/title'; import {getDrivers, connectNameChecker} from './right_edit.service'; -const className = 'fr.component.right.edit.mysql'; +const className = 'dec.dcm.component.right.edit.mysql'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); diff --git a/src/app/link_set/right/right_show/right_show.ts b/src/app/link_set/right/right_show/right_show.ts index 53f8b34..590efe1 100644 --- a/src/app/link_set/right/right_show/right_show.ts +++ b/src/app/link_set/right/right_show/right_show.ts @@ -3,7 +3,7 @@ import RightShowModel from '../../link_set.model'; import BothSide from '@shared/components/both_side'; import Title from '@shared/components/title'; import {LinkType} from '@ui/type'; -const className = 'fr.component.right.show'; +const className = 'dec.dcm.component.right.show'; const Widget: WidgetType = { _store() { return BI.Models.getModel(RightShowModel); diff --git a/src/app/link_set/right/right_show/right_show_jndi.ts b/src/app/link_set/right/right_show/right_show_jndi.ts index 6a28a1a..41d6efb 100644 --- a/src/app/link_set/right/right_show/right_show_jndi.ts +++ b/src/app/link_set/right/right_show/right_show_jndi.ts @@ -3,7 +3,7 @@ import FormItem from '@shared/components/form_item'; import {OTHER_ATTRIBUTES} from '@private/constants'; import {AttributeType} from '../right.typing'; -const className = 'fr.component.right.show.jndi'; +const className = 'dec.dcm.component.right.show.jndi'; const Widget = BI.inherit(BI.Widget, { render() { const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; diff --git a/src/app/link_set/right/right_title/right_title.ts b/src/app/link_set/right/right_title/right_title.ts index 04b8d5d..ea60e76 100644 --- a/src/app/link_set/right/right_title/right_title.ts +++ b/src/app/link_set/right/right_title/right_title.ts @@ -2,7 +2,7 @@ import {WidgetType, Left, Label, Button, LeftRightVerticalAdapt} from '@ui/index import RightTitleModel from '../../link_set.model'; import {LinkType} from '@ui/type'; import {OTHER_CONNECT} from '@private/constants'; -const className = 'fr.component.right.title'; +const className = 'dec.dcm.component.right.title'; const Widget: WidgetType = { _store() { return BI.Models.getModel(RightTitleModel); diff --git a/src/app/link_set/select/select.ts b/src/app/link_set/select/select.ts index 5ee9ad8..56a82ed 100644 --- a/src/app/link_set/select/select.ts +++ b/src/app/link_set/select/select.ts @@ -3,7 +3,7 @@ import selectModel from '../link_set.model'; import {moreLink} from '../more/more_link.service'; import connectList from '../../app.constant'; import {DATA_LINKS} from '@private/constants'; -const className = 'fr.linkset.select'; +const className = 'dec.dcm.linkset.select'; const Widget: WidgetType = { _store() { return BI.Models.getModel(selectModel); diff --git a/src/app/link_status/left/left.model.ts b/src/app/link_status/left/left.model.ts index d2633ef..fb06170 100644 --- a/src/app/link_status/left/left.model.ts +++ b/src/app/link_status/left/left.model.ts @@ -1,5 +1,5 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus.left'; +const className = 'dec.dcm.model.linkstatus.left'; const Model: ModelType = { context: ['tab', 'linkList', 'statusSelected'], state () { diff --git a/src/app/link_status/left/left.ts b/src/app/link_status/left/left.ts index 2a125b0..bf552b6 100644 --- a/src/app/link_status/left/left.ts +++ b/src/app/link_status/left/left.ts @@ -3,7 +3,7 @@ import Model from './left.model'; import {LinkType} from '@ui/type'; import LeftItem from './left_item'; -const className = 'fr.component.linkStatus.left'; +const className = 'dec.dcm.component.linkStatus.left'; let leftContent: any = null; const Widget: WidgetType = { _store() { diff --git a/src/app/link_status/left/left_item.ts b/src/app/link_status/left/left_item.ts index 13ff6b3..18c3a95 100644 --- a/src/app/link_status/left/left_item.ts +++ b/src/app/link_status/left/left_item.ts @@ -1,6 +1,6 @@ -import {WidgetType, Left, Label, TextButton} from '@ui'; +import {WidgetType, Left, TextButton} from '@ui'; import Model from './left.model'; -const className = 'fr.component.linkStatus.left.item'; +const className = 'dec.dcm.component.linkStatus.left.item'; const Widget: WidgetType = { props: { title: '', @@ -11,7 +11,7 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, extraCls, creator, text, id} = this.options; + const {title, extraCls} = this.options; return { type: Left, diff --git a/src/app/link_status/link_status.model.ts b/src/app/link_status/link_status.model.ts index ecdda3c..c4e7467 100644 --- a/src/app/link_status/link_status.model.ts +++ b/src/app/link_status/link_status.model.ts @@ -1,5 +1,5 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus'; +const className = 'dec.dcm.model.linkstatus'; const Model: ModelType = { context: ['tab', 'linkList'], actions: { diff --git a/src/app/link_status/link_status.ts b/src/app/link_status/link_status.ts index 1d122d4..594468a 100644 --- a/src/app/link_status/link_status.ts +++ b/src/app/link_status/link_status.ts @@ -3,7 +3,7 @@ import linkStatusModel from './link_status.model'; import LeftList from './left/left'; import Right from './right/right'; import {TAB_LINK_POOL} from '@private/constants'; -const className = 'fr.linkstatus'; +const className = 'dec.dcm.linkstatus'; const Widget: WidgetType = { _store() { diff --git a/src/app/link_status/right/right.model.ts b/src/app/link_status/right/right.model.ts index aa49c71..d5f06a8 100644 --- a/src/app/link_status/right/right.model.ts +++ b/src/app/link_status/right/right.model.ts @@ -1,10 +1,10 @@ import {ModelType} from '@ui'; -const className = 'fr.model.linkstatus.right'; +const className = 'dec.dcm.model.linkstatus.right'; const Model: ModelType = { context: ['linkList', 'statusSelected'], state () { return { - selected:'', + selected: '', }; }, actions: { diff --git a/src/app/link_status/right/right.ts b/src/app/link_status/right/right.ts index 21c16ec..69c54ef 100644 --- a/src/app/link_status/right/right.ts +++ b/src/app/link_status/right/right.ts @@ -6,7 +6,7 @@ import {InfoType} from './right.typings'; import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -const className = 'fr.component.linkStatus.right'; +const className = 'dec.dcm.component.linkStatus.right'; let Title: any = null; let Group: any = null; diff --git a/src/app/link_status/right/right_card.ts b/src/app/link_status/right/right_card.ts index 64c73fc..b4fbbb6 100644 --- a/src/app/link_status/right/right_card.ts +++ b/src/app/link_status/right/right_card.ts @@ -1,5 +1,5 @@ import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt} from '@ui/index'; -const className = 'fr.component.linkStatus.right.card'; +const className = 'dec.dcm.component.linkStatus.right.card'; const Widget: WidgetType = { render() { const {maxActive, maxIdle, numActive, numIdle} = this.options; diff --git a/src/app/title/title.ts b/src/app/title/title.ts index c322fc3..c9e577c 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -2,7 +2,7 @@ import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; import TitleItem from './title_item/title_item'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; -const className = 'fr.title'; +const className = 'dec.dcm.title'; const Widget: WidgetType = { render() { const hideCloseButton = isDesigner(); diff --git a/src/app/title/title_item/title_item.model.ts b/src/app/title/title_item/title_item.model.ts index f8d1923..97efd09 100644 --- a/src/app/title/title_item/title_item.model.ts +++ b/src/app/title/title_item/title_item.model.ts @@ -1,4 +1,4 @@ -const className = 'fr.model.title.item'; +const className = 'dec.dcm.model.title.item'; const Model = BI.inherit(Fix.Model, { context: ['tab'], actions: { diff --git a/src/app/title/title_item/title_item.ts b/src/app/title/title_item/title_item.ts index 1dcb198..b75537b 100644 --- a/src/app/title/title_item/title_item.ts +++ b/src/app/title/title_item/title_item.ts @@ -1,7 +1,7 @@ import {Label} from '@ui'; import tableItemModel from './title_item.model'; import {getSelectStyle} from './title_item.service'; -const className = 'fr.title.item'; +const className = 'dec.dcm.title.item'; const Widget = BI.inherit(BI.BasicButton, { props: { text: '', diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index 31e8802..c010093 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -6,7 +6,7 @@ const form = { password: '123456', }; -const classNameEdit = 'fr.plugin.redis.edit'; +const classNameEdit = 'dec.dcm.plugin.redis.edit'; const Widget = BI.inherit(BI.Widget, { render() { return { diff --git a/src/demo/plugin.redis.preview.ts b/src/demo/plugin.redis.preview.ts index 9dfd4df..b90b318 100644 --- a/src/demo/plugin.redis.preview.ts +++ b/src/demo/plugin.redis.preview.ts @@ -1,4 +1,4 @@ -const classNamePreview = 'fr.plugin.redis.preview'; +const classNamePreview = 'dec.dcm.plugin.redis.preview'; const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value'; const form = BI.Constants.getConstant(RedisConstantName); diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 26410b3..541c943 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -1,4 +1,4 @@ -const classNamePool = 'fr.plugin.redis.pool'; +const classNamePool = 'dec.dcm.plugin.redis.pool'; const WidgetPool = BI.inherit(BI.Widget, { render() { diff --git a/src/shared/components/both_side.ts b/src/shared/components/both_side.ts index 4db6c94..452b33b 100644 --- a/src/shared/components/both_side.ts +++ b/src/shared/components/both_side.ts @@ -1,5 +1,5 @@ import {WidgetType, Htape, Label} from '@ui/index'; -const BothSide = 'fr.shared.component.both.side'; +const BothSide = 'dec.dcm.shared.component.both.side'; const Widget: WidgetType = { render() { const {leftText, rightText} = this.options; diff --git a/src/shared/components/form_item.ts b/src/shared/components/form_item.ts index 133ee89..65689fd 100644 --- a/src/shared/components/form_item.ts +++ b/src/shared/components/form_item.ts @@ -1,5 +1,5 @@ import {WidgetType, Htape, Label} from '@ui/index'; -const className = 'fr.shared.component.form.item'; +const className = 'dec.dcm.shared.component.form.item'; const Widget: WidgetType = { render() { const {text, form, hint, height, width = 115} = this.options; diff --git a/src/shared/components/title.ts b/src/shared/components/title.ts index 0dbef68..41f405a 100644 --- a/src/shared/components/title.ts +++ b/src/shared/components/title.ts @@ -1,5 +1,5 @@ import {WidgetType, Label} from '@ui/index'; -const className = 'fr.shared.component.title'; +const className = 'dec.dcm.shared.component.title'; const Widget: WidgetType = { render() { const {text} = this.options; From 85e8155d697f01a81824121604eb6f12731e9225 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 11:14:45 +0800 Subject: [PATCH 24/44] =?UTF-8?q?refactor:=20=E6=95=B4=E7=90=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.ts | 4 ++-- .../left/left_item => connection/left/item}/left_item.ts | 0 .../left/left_item => connection/left/item}/left_item_icon.ts | 2 +- src/app/{link_set => connection}/left/left.ts | 2 +- src/app/{link_set => connection}/link_set.model.ts | 0 src/app/{link_set => connection}/link_set.service.ts | 0 src/app/{link_set => connection}/link_set.ts | 0 src/app/{link_set => connection}/more/item/more_link_item.ts | 0 .../more/item/more_link_litem.model.ts | 0 src/app/{link_set => connection}/more/more_link.model.ts | 0 src/app/{link_set => connection}/more/more_link.service.ts | 0 src/app/{link_set => connection}/more/more_link.ts | 0 src/app/{link_set => connection}/right/nothing.ts | 0 src/app/{link_set => connection}/right/right.ts | 0 src/app/{link_set => connection}/right/right.typing.d.ts | 0 .../right/right_detail/right_detail.model.ts | 0 .../right/right_detail/right_detail.ts | 0 .../right/right_edit/right_edit.model.ts | 0 .../right/right_edit/right_edit.service.ts | 0 .../{link_set => connection}/right/right_edit/right_edit.ts | 0 .../right/right_edit/right_edit_jndi.ts | 0 .../right/right_edit/right_edit_mysql.ts | 0 .../{link_set => connection}/right/right_show/right_show.ts | 0 .../right/right_show/right_show_jndi.ts | 0 .../{link_set => connection}/right/right_title/right_title.ts | 0 src/app/{link_set => connection}/select/select.service.ts | 0 src/app/{link_set => connection}/select/select.ts | 0 src/app/{link_status => status}/left/left.model.ts | 0 src/app/{link_status => status}/left/left.ts | 0 src/app/{link_status => status}/left/left_item.ts | 0 src/app/{link_status => status}/link_status.model.ts | 0 src/app/{link_status => status}/link_status.ts | 0 src/app/{link_status => status}/right/right.model.ts | 0 src/app/{link_status => status}/right/right.ts | 0 src/app/{link_status => status}/right/right.typings.d.ts | 0 src/app/{link_status => status}/right/right_card.ts | 0 src/app/title/{title_item => item}/title_item.model.ts | 0 src/app/title/{title_item => item}/title_item.service.ts | 0 src/app/title/{title_item => item}/title_item.ts | 0 src/app/title/title.ts | 2 +- 40 files changed, 5 insertions(+), 5 deletions(-) rename src/app/{link_set/left/left_item => connection/left/item}/left_item.ts (100%) rename src/app/{link_set/left/left_item => connection/left/item}/left_item_icon.ts (98%) rename src/app/{link_set => connection}/left/left.ts (95%) rename src/app/{link_set => connection}/link_set.model.ts (100%) rename src/app/{link_set => connection}/link_set.service.ts (100%) rename src/app/{link_set => connection}/link_set.ts (100%) rename src/app/{link_set => connection}/more/item/more_link_item.ts (100%) rename src/app/{link_set => connection}/more/item/more_link_litem.model.ts (100%) rename src/app/{link_set => connection}/more/more_link.model.ts (100%) rename src/app/{link_set => connection}/more/more_link.service.ts (100%) rename src/app/{link_set => connection}/more/more_link.ts (100%) rename src/app/{link_set => connection}/right/nothing.ts (100%) rename src/app/{link_set => connection}/right/right.ts (100%) rename src/app/{link_set => connection}/right/right.typing.d.ts (100%) rename src/app/{link_set => connection}/right/right_detail/right_detail.model.ts (100%) rename src/app/{link_set => connection}/right/right_detail/right_detail.ts (100%) rename src/app/{link_set => connection}/right/right_edit/right_edit.model.ts (100%) rename src/app/{link_set => connection}/right/right_edit/right_edit.service.ts (100%) rename src/app/{link_set => connection}/right/right_edit/right_edit.ts (100%) rename src/app/{link_set => connection}/right/right_edit/right_edit_jndi.ts (100%) rename src/app/{link_set => connection}/right/right_edit/right_edit_mysql.ts (100%) rename src/app/{link_set => connection}/right/right_show/right_show.ts (100%) rename src/app/{link_set => connection}/right/right_show/right_show_jndi.ts (100%) rename src/app/{link_set => connection}/right/right_title/right_title.ts (100%) rename src/app/{link_set => connection}/select/select.service.ts (100%) rename src/app/{link_set => connection}/select/select.ts (100%) rename src/app/{link_status => status}/left/left.model.ts (100%) rename src/app/{link_status => status}/left/left.ts (100%) rename src/app/{link_status => status}/left/left_item.ts (100%) rename src/app/{link_status => status}/link_status.model.ts (100%) rename src/app/{link_status => status}/link_status.ts (100%) rename src/app/{link_status => status}/right/right.model.ts (100%) rename src/app/{link_status => status}/right/right.ts (100%) rename src/app/{link_status => status}/right/right.typings.d.ts (100%) rename src/app/{link_status => status}/right/right_card.ts (100%) rename src/app/title/{title_item => item}/title_item.model.ts (100%) rename src/app/title/{title_item => item}/title_item.service.ts (100%) rename src/app/title/{title_item => item}/title_item.ts (100%) diff --git a/src/app/app.ts b/src/app/app.ts index 97d114c..88015b2 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,8 +1,8 @@ import {Vtape, Left, Vertical, Absolute} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; -import linkSet from './link_set/link_set'; -import linkStatus from './link_status/link_status'; +import linkSet from './connection/link_set'; +import linkStatus from './status/link_status'; import '../less/index.less'; const className = 'dec.dcm.main'; diff --git a/src/app/link_set/left/left_item/left_item.ts b/src/app/connection/left/item/left_item.ts similarity index 100% rename from src/app/link_set/left/left_item/left_item.ts rename to src/app/connection/left/item/left_item.ts diff --git a/src/app/link_set/left/left_item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts similarity index 98% rename from src/app/link_set/left/left_item/left_item_icon.ts rename to src/app/connection/left/item/left_item_icon.ts index 10e1a27..eca442b 100644 --- a/src/app/link_set/left/left_item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -1,4 +1,4 @@ -import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui/index'; +import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui'; import Model from '../../link_set.model'; import {ACTION_DELETE} from '@private/constants'; diff --git a/src/app/link_set/left/left.ts b/src/app/connection/left/left.ts similarity index 95% rename from src/app/link_set/left/left.ts rename to src/app/connection/left/left.ts index 85aebd8..547d572 100644 --- a/src/app/link_set/left/left.ts +++ b/src/app/connection/left/left.ts @@ -1,7 +1,7 @@ import {WidgetType, ListView} from '@ui'; import Model from '../link_set.model'; import {LinkType} from '@ui/type'; -import LeftItem from './left_item/left_item'; +import LeftItem from './item/left_item'; const className = 'dec.dcm.component.linkset.left'; let leftContent: any = null; diff --git a/src/app/link_set/link_set.model.ts b/src/app/connection/link_set.model.ts similarity index 100% rename from src/app/link_set/link_set.model.ts rename to src/app/connection/link_set.model.ts diff --git a/src/app/link_set/link_set.service.ts b/src/app/connection/link_set.service.ts similarity index 100% rename from src/app/link_set/link_set.service.ts rename to src/app/connection/link_set.service.ts diff --git a/src/app/link_set/link_set.ts b/src/app/connection/link_set.ts similarity index 100% rename from src/app/link_set/link_set.ts rename to src/app/connection/link_set.ts diff --git a/src/app/link_set/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts similarity index 100% rename from src/app/link_set/more/item/more_link_item.ts rename to src/app/connection/more/item/more_link_item.ts diff --git a/src/app/link_set/more/item/more_link_litem.model.ts b/src/app/connection/more/item/more_link_litem.model.ts similarity index 100% rename from src/app/link_set/more/item/more_link_litem.model.ts rename to src/app/connection/more/item/more_link_litem.model.ts diff --git a/src/app/link_set/more/more_link.model.ts b/src/app/connection/more/more_link.model.ts similarity index 100% rename from src/app/link_set/more/more_link.model.ts rename to src/app/connection/more/more_link.model.ts diff --git a/src/app/link_set/more/more_link.service.ts b/src/app/connection/more/more_link.service.ts similarity index 100% rename from src/app/link_set/more/more_link.service.ts rename to src/app/connection/more/more_link.service.ts diff --git a/src/app/link_set/more/more_link.ts b/src/app/connection/more/more_link.ts similarity index 100% rename from src/app/link_set/more/more_link.ts rename to src/app/connection/more/more_link.ts diff --git a/src/app/link_set/right/nothing.ts b/src/app/connection/right/nothing.ts similarity index 100% rename from src/app/link_set/right/nothing.ts rename to src/app/connection/right/nothing.ts diff --git a/src/app/link_set/right/right.ts b/src/app/connection/right/right.ts similarity index 100% rename from src/app/link_set/right/right.ts rename to src/app/connection/right/right.ts diff --git a/src/app/link_set/right/right.typing.d.ts b/src/app/connection/right/right.typing.d.ts similarity index 100% rename from src/app/link_set/right/right.typing.d.ts rename to src/app/connection/right/right.typing.d.ts diff --git a/src/app/link_set/right/right_detail/right_detail.model.ts b/src/app/connection/right/right_detail/right_detail.model.ts similarity index 100% rename from src/app/link_set/right/right_detail/right_detail.model.ts rename to src/app/connection/right/right_detail/right_detail.model.ts diff --git a/src/app/link_set/right/right_detail/right_detail.ts b/src/app/connection/right/right_detail/right_detail.ts similarity index 100% rename from src/app/link_set/right/right_detail/right_detail.ts rename to src/app/connection/right/right_detail/right_detail.ts diff --git a/src/app/link_set/right/right_edit/right_edit.model.ts b/src/app/connection/right/right_edit/right_edit.model.ts similarity index 100% rename from src/app/link_set/right/right_edit/right_edit.model.ts rename to src/app/connection/right/right_edit/right_edit.model.ts diff --git a/src/app/link_set/right/right_edit/right_edit.service.ts b/src/app/connection/right/right_edit/right_edit.service.ts similarity index 100% rename from src/app/link_set/right/right_edit/right_edit.service.ts rename to src/app/connection/right/right_edit/right_edit.service.ts diff --git a/src/app/link_set/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts similarity index 100% rename from src/app/link_set/right/right_edit/right_edit.ts rename to src/app/connection/right/right_edit/right_edit.ts diff --git a/src/app/link_set/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts similarity index 100% rename from src/app/link_set/right/right_edit/right_edit_jndi.ts rename to src/app/connection/right/right_edit/right_edit_jndi.ts diff --git a/src/app/link_set/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts similarity index 100% rename from src/app/link_set/right/right_edit/right_edit_mysql.ts rename to src/app/connection/right/right_edit/right_edit_mysql.ts diff --git a/src/app/link_set/right/right_show/right_show.ts b/src/app/connection/right/right_show/right_show.ts similarity index 100% rename from src/app/link_set/right/right_show/right_show.ts rename to src/app/connection/right/right_show/right_show.ts diff --git a/src/app/link_set/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts similarity index 100% rename from src/app/link_set/right/right_show/right_show_jndi.ts rename to src/app/connection/right/right_show/right_show_jndi.ts diff --git a/src/app/link_set/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts similarity index 100% rename from src/app/link_set/right/right_title/right_title.ts rename to src/app/connection/right/right_title/right_title.ts diff --git a/src/app/link_set/select/select.service.ts b/src/app/connection/select/select.service.ts similarity index 100% rename from src/app/link_set/select/select.service.ts rename to src/app/connection/select/select.service.ts diff --git a/src/app/link_set/select/select.ts b/src/app/connection/select/select.ts similarity index 100% rename from src/app/link_set/select/select.ts rename to src/app/connection/select/select.ts diff --git a/src/app/link_status/left/left.model.ts b/src/app/status/left/left.model.ts similarity index 100% rename from src/app/link_status/left/left.model.ts rename to src/app/status/left/left.model.ts diff --git a/src/app/link_status/left/left.ts b/src/app/status/left/left.ts similarity index 100% rename from src/app/link_status/left/left.ts rename to src/app/status/left/left.ts diff --git a/src/app/link_status/left/left_item.ts b/src/app/status/left/left_item.ts similarity index 100% rename from src/app/link_status/left/left_item.ts rename to src/app/status/left/left_item.ts diff --git a/src/app/link_status/link_status.model.ts b/src/app/status/link_status.model.ts similarity index 100% rename from src/app/link_status/link_status.model.ts rename to src/app/status/link_status.model.ts diff --git a/src/app/link_status/link_status.ts b/src/app/status/link_status.ts similarity index 100% rename from src/app/link_status/link_status.ts rename to src/app/status/link_status.ts diff --git a/src/app/link_status/right/right.model.ts b/src/app/status/right/right.model.ts similarity index 100% rename from src/app/link_status/right/right.model.ts rename to src/app/status/right/right.model.ts diff --git a/src/app/link_status/right/right.ts b/src/app/status/right/right.ts similarity index 100% rename from src/app/link_status/right/right.ts rename to src/app/status/right/right.ts diff --git a/src/app/link_status/right/right.typings.d.ts b/src/app/status/right/right.typings.d.ts similarity index 100% rename from src/app/link_status/right/right.typings.d.ts rename to src/app/status/right/right.typings.d.ts diff --git a/src/app/link_status/right/right_card.ts b/src/app/status/right/right_card.ts similarity index 100% rename from src/app/link_status/right/right_card.ts rename to src/app/status/right/right_card.ts diff --git a/src/app/title/title_item/title_item.model.ts b/src/app/title/item/title_item.model.ts similarity index 100% rename from src/app/title/title_item/title_item.model.ts rename to src/app/title/item/title_item.model.ts diff --git a/src/app/title/title_item/title_item.service.ts b/src/app/title/item/title_item.service.ts similarity index 100% rename from src/app/title/title_item/title_item.service.ts rename to src/app/title/item/title_item.service.ts diff --git a/src/app/title/title_item/title_item.ts b/src/app/title/item/title_item.ts similarity index 100% rename from src/app/title/title_item/title_item.ts rename to src/app/title/item/title_item.ts diff --git a/src/app/title/title.ts b/src/app/title/title.ts index c9e577c..6d11acd 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -1,5 +1,5 @@ import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; -import TitleItem from './title_item/title_item'; +import TitleItem from './item/title_item'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.title'; From 976895cbd81c3b6cac7aa731c9059a5b145c1060 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 11:27:45 +0800 Subject: [PATCH 25/44] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89=20extraCls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.ts | 5 ++--- src/app/connection/left/item/left_item_icon.ts | 3 +-- src/app/status/left/left.ts | 2 +- src/app/status/left/left_item.ts | 5 ++--- src/demo/plugin.tedis.pool.ts | 1 - 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index dcda05f..775b6f2 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -13,13 +13,12 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, extraCls, creator, text, id} = this.options; + const {title, cls, creator, text, id} = this.options; return { type: LeftRightVerticalAdapt, - cls: 'link-item cursor-pointer', + cls: `link-item cursor-pointer ${cls}`, height: 24, - extraCls, items: { left: [ { diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index eca442b..9478c1b 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -63,8 +63,7 @@ const Widget: WidgetType = { return { type: IconButton, - cls, - extraCls: 'action-icon', + cls: `action-icon ${cls}`, height: 24, width: 26, title, diff --git a/src/app/status/left/left.ts b/src/app/status/left/left.ts index bf552b6..06f3259 100644 --- a/src/app/status/left/left.ts +++ b/src/app/status/left/left.ts @@ -32,7 +32,7 @@ const Widget: WidgetType = { return BI.map(linkList, (index: number, item: LinkType) => { return { type: LeftItem, - extraCls: item.connectionName === selectTitle ? 'left-item-selected' : '', + cls: item.connectionName === selectTitle ? 'left-item-selected' : '', title: item.connectionName, id: item.connectionId, creator: item.creator, diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index 18c3a95..4d57865 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -11,13 +11,12 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, extraCls} = this.options; + const {title, cls} = this.options; return { type: Left, - cls: 'left-item cursor-pointer', + cls: `left-item cursor-pointer ${cls}`, height: 30, - extraCls, items: [ { type: TextButton, diff --git a/src/demo/plugin.tedis.pool.ts b/src/demo/plugin.tedis.pool.ts index 541c943..8ce7df5 100644 --- a/src/demo/plugin.tedis.pool.ts +++ b/src/demo/plugin.tedis.pool.ts @@ -22,7 +22,6 @@ const WidgetPool = BI.inherit(BI.Widget, { { type: 'bi.label', cls: 'right-status-text', - extraCls: 'card-font1', text: numActive, }, { From d0a59ac4fb7cb66e87bc90a8c069a491e7cb604b Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 11:45:20 +0800 Subject: [PATCH 26/44] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8BI.Popovers?= =?UTF-8?q?.close(id)=E6=96=B9=E5=BC=8F=E5=85=B3=E9=97=ADPopovers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/more/more_link.service.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/app/connection/more/more_link.service.ts b/src/app/connection/more/more_link.service.ts index e9a11da..acfac03 100644 --- a/src/app/connection/more/more_link.service.ts +++ b/src/app/connection/more/more_link.service.ts @@ -3,7 +3,6 @@ let SubbitButton: any = null; let selectKey = ''; export const moreLink = (onConfirm?: Function): void => { const id = BI.UUID(); - let Popovers: any = null; BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', @@ -31,7 +30,7 @@ export const moreLink = (onConfirm?: Function): void => { value: 1, level: 'ignore', handler (v: any) { - Popovers.close(v); + BI.Popovers.close(id); }, }, { type: 'bi.button', @@ -42,13 +41,10 @@ export const moreLink = (onConfirm?: Function): void => { SubbitButton = ref; }, handler (v: any) { - Popovers.close(v); + BI.Popovers.close(id); onConfirm ? onConfirm(selectKey) : null; }, }], }, - ref(ref: any) { - Popovers = ref; - }, }).open(id); }; From 6cea4063fcc76db46cac5def1e4aeb8b811bdca5 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 11:50:53 +0800 Subject: [PATCH 27/44] refactor: update --- src/app/connection/more/item/more_link_item.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index c609f1e..11b772d 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -25,11 +25,9 @@ const Widget: WidgetType = { type: Img, width: 120, height: 90, - src: `img/${name}.jpg`, + src: this._buildResourceUrl(name), }, { type: Absolute, - left: 90, - top: -90, items: [ { el: { @@ -42,6 +40,8 @@ const Widget: WidgetType = { this.selected = _ref; }, }, + left: 90, + top: -90, }, ], }, { @@ -53,6 +53,10 @@ const Widget: WidgetType = { ], }; }, + _buildResourceUrl(name: string) { + // TODO: 目前不知道生产环境下的图片的绝对地址,先这样写用于测试。 + return `img/${name}.jpg`; + }, }; BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); export default className; From 4696a2553f0e708e5527c202ace1b23d2bed3269 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 12:00:15 +0800 Subject: [PATCH 28/44] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89text=5Fvalu?= =?UTF-8?q?e=5Fcombo=E7=9A=84boder=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E5=B7=B2=E7=BB=8F=E8=87=AA=E5=B8=A6=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../right/right_edit/right_edit.model.ts | 2 +- .../connection/right/right_edit/right_edit.ts | 2 -- .../right/right_edit/right_edit_jndi.ts | 7 +++-- .../right/right_edit/right_edit_mysql.ts | 2 -- .../right/right_show/right_show.model.ts | 20 ++++++++++++++ .../right/right_show/right_show_jndi.ts | 26 ++++++++++++------- 6 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 src/app/connection/right/right_show/right_show.model.ts diff --git a/src/app/connection/right/right_edit/right_edit.model.ts b/src/app/connection/right/right_edit/right_edit.model.ts index 54e1f91..21f99ed 100644 --- a/src/app/connection/right/right_edit/right_edit.model.ts +++ b/src/app/connection/right/right_edit/right_edit.model.ts @@ -1,4 +1,4 @@ -export const className = 'report.model.components.right.edit'; +export const className = 'dec.dcm.model.components.right.edit'; export const Model = BI.inherit(Fix.Model, { state() { return { diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index 251d1d2..8393f0b 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -71,7 +71,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.driver, items: getDrivers(linkSelected), @@ -111,7 +110,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: [ diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts index 2173e00..deb3836 100644 --- a/src/app/connection/right/right_edit/right_edit_jndi.ts +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -11,7 +11,7 @@ const Widget = BI.inherit(BI.Widget, { }, watch: { isCollapse(isCollapse) { - const height = isCollapse ? 550 : 180; + const height = isCollapse ? 550 : 200; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); this.jndiFormRef.setHeight(height); this.collapseRef.setText(text); @@ -39,12 +39,13 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 180, + height: 200, ref: _ref => { this.jndiFormRef = _ref; }, form: { type: Vertical, + vgap: 10, items: [ { type: FormItem, @@ -52,7 +53,6 @@ const Widget = BI.inherit(BI.Widget, { width: 180, form: { type: TextValueCombo, - cls: 'bi-border', width: 300, value: factory, items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { @@ -162,7 +162,6 @@ const Widget = BI.inherit(BI.Widget, { width: 180, form: { type: TextValueCombo, - cls: 'bi-border', width: 300, items: [{ text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), diff --git a/src/app/connection/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts index bd3cc7f..ab3fe3e 100644 --- a/src/app/connection/right/right_edit/right_edit_mysql.ts +++ b/src/app/connection/right/right_edit/right_edit_mysql.ts @@ -43,7 +43,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.driver, items: getDrivers(linkSelected), @@ -83,7 +82,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: [ diff --git a/src/app/connection/right/right_show/right_show.model.ts b/src/app/connection/right/right_show/right_show.model.ts new file mode 100644 index 0000000..4209415 --- /dev/null +++ b/src/app/connection/right/right_show/right_show.model.ts @@ -0,0 +1,20 @@ +export const className = 'dec.dcm.model.components.right.show'; +export const Model = BI.inherit(Fix.Model, { + state() { + return { + isCollapse: false, + }; + }, + + computed: { + + }, + + actions: { + setIsCollapse(status: boolean) { + this.model.isCollapse = status; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/connection/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts index 41d6efb..8ac6b8c 100644 --- a/src/app/connection/right/right_show/right_show_jndi.ts +++ b/src/app/connection/right/right_show/right_show_jndi.ts @@ -2,9 +2,22 @@ import {Vertical, TextButton, Label} from '@ui'; import FormItem from '@shared/components/form_item'; import {OTHER_ATTRIBUTES} from '@private/constants'; import {AttributeType} from '../right.typing'; +import ModelName from './right_show.model'; const className = 'dec.dcm.component.right.show.jndi'; const Widget = BI.inherit(BI.Widget, { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + isCollapse(isCollapse) { + const height = isCollapse ? 550 : 200; + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.jndiFormRef.setHeight(height); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); + }, + }, render() { const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; @@ -23,12 +36,13 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 160, + height: 200, ref: _ref => { this.jndiFormRef = _ref; }, form: { type: Vertical, + vgap: 10, items: [ { type: FormItem, @@ -79,19 +93,13 @@ const Widget = BI.inherit(BI.Widget, { this.collapseRef = _ref; }, handler: () => { - const isCollapse = this.collapseRef.getValue(); - const height = isCollapse ? 550 : 160; - const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.jndiFormRef.setHeight(height); - this.collapseRef.setValue(!isCollapse); - this.collapseRef.setText(text); - this.otherAttributesRef.setVisible(isCollapse); + this.store.setIsCollapse(!this.model.isCollapse); }, }, }, { type: Vertical, - invisible: false, + invisible: true, ref: _ref => { this.otherAttributesRef = _ref; }, From 6b35ea1bca32977642d156e4a55144db9af6e6bc Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 14:28:07 +0800 Subject: [PATCH 29/44] =?UTF-8?q?refactor:=20=E5=B0=BD=E9=87=8F=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=80=9A=E7=94=A8=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.ts | 4 +- src/app/connection/left/item/left_item.ts | 12 +- .../connection/left/item/left_item_icon.ts | 4 +- src/app/connection/link_set.ts | 8 +- .../connection/more/item/more_link_item.ts | 2 +- src/app/connection/right/right.ts | 3 +- .../right/right_edit/right_edit_jndi.ts | 2 +- .../right/right_show/right_show_jndi.ts | 2 +- src/app/status/left/left_item.ts | 8 +- src/app/status/link_status.ts | 6 +- src/app/status/right/right.ts | 7 +- src/app/status/right/right_card.ts | 123 ++++++++---------- src/app/title/item/title_item.ts | 4 +- src/app/title/title.ts | 16 +-- src/less/resource/common.less | 79 ++++------- src/less/resource/font.less | 8 +- src/shared/components/form_item.ts | 2 +- src/shared/components/title.ts | 3 +- src/shared/service/dialog.service.ts | 16 +-- 19 files changed, 125 insertions(+), 184 deletions(-) diff --git a/src/app/app.ts b/src/app/app.ts index 88015b2..f44392b 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,4 +1,4 @@ -import {Vtape, Left, Vertical, Absolute} from '../ui/index'; +import {Vtape, Vertical, Absolute} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; import linkSet from './connection/link_set'; @@ -16,7 +16,7 @@ const Widget = BI.inherit(BI.Widget, { render() { return { type: Vtape, - cls: 'dec-webui-dcm-layout', + cls: 'dec-webui-dcm-layout bi-background', items: [ { el: { diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index 775b6f2..23e53a5 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -13,17 +13,17 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, cls, creator, text, id} = this.options; + const {title, creator, text, id} = this.options; return { type: LeftRightVerticalAdapt, - cls: `link-item cursor-pointer ${cls}`, + cls: `link-item cursor-pointer`, height: 24, items: { left: [ { type: Icon, - cls: 'link-font', + cls: 'dcm-link-font', height: 24, width: 26, text: BI.i18nText('Dec-Dcm_Connections'), @@ -44,7 +44,7 @@ const Widget: WidgetType = { right: [ { type: ItemIcon, - cls: 'link-item-icon test-font', + cls: 'link-item-icon dcm-test-font', title: BI.i18nText('Dec-Dcm_Test_Connection'), value: ACTION_TEST, id, @@ -58,13 +58,13 @@ const Widget: WidgetType = { }, { type: ItemIcon, - cls: 'link-item-icon info-font', + cls: 'link-item-icon dcm-info-font', title: `${BI.i18nText('Dec-Dcm_Type')}:${text === DEFAULT_INFO ? BI.i18nText('Dec-Dcm_Other') : text} \r\n${BI.i18nText('Dec-Dcm_Creator')}:${creator}`, id, }, { type: ItemIcon, - cls: 'link-item-icon delete-font', + cls: 'link-item-icon dcm-delete-font', title: BI.i18nText('Dec-Dcm_Delete'), value: ACTION_DELETE, id, diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index 9478c1b..91c7a05 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -8,7 +8,7 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {cls, title, id, value} = this.options; + const {title, id, value} = this.options; const that = this; let iconContent: any = null; let combo: any = null; @@ -21,7 +21,6 @@ const Widget: WidgetType = { }, el: { type: Icon, - cls, baseCls: 'action-icon', height: 24, width: 26, @@ -63,7 +62,6 @@ const Widget: WidgetType = { return { type: IconButton, - cls: `action-icon ${cls}`, height: 24, width: 26, title, diff --git a/src/app/connection/link_set.ts b/src/app/connection/link_set.ts index 82b25d2..ab3b8c5 100644 --- a/src/app/connection/link_set.ts +++ b/src/app/connection/link_set.ts @@ -1,4 +1,4 @@ -import {Htape, WidgetType, Vtape, Left} from '@ui'; +import {Htape, WidgetType, Vtape, VerticalAdapt} from '@ui'; import LeftList from './left/left'; import linkSetModel from './link_set.model'; import Select from './select/select'; @@ -17,7 +17,7 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'dcm-link-group', + cls: 'bi-card', items: [{ el: { type: Vtape, @@ -25,13 +25,13 @@ const Widget: WidgetType = { items: [ { el: { - type: Left, + type: VerticalAdapt, cls: 'bi-border-bottom', items: [ { type: Select, hgap: 10, - tgap: 10, + vgap: 10, }, ], }, diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index 11b772d..f9a7212 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -46,7 +46,7 @@ const Widget: WidgetType = { ], }, { type: Label, - cls: 'dcm-link-more-text', + cls: 'bi-header-background', height: 27, text, }, diff --git a/src/app/connection/right/right.ts b/src/app/connection/right/right.ts index 92b69f4..961cabc 100644 --- a/src/app/connection/right/right.ts +++ b/src/app/connection/right/right.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, ListView} from '@ui'; +import {WidgetType, ListView} from '@ui'; import {LinkType} from '@ui/type'; import Nothing from './nothing'; import RightDetail from './right_detail/right_detail'; @@ -22,7 +22,6 @@ const Widget: WidgetType = { return { type: ListView, cls: 'dcm-link-form', - minWidth: 400, ref(_ref: any) { rightContent = _ref; }, diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts index deb3836..aad12e3 100644 --- a/src/app/connection/right/right_edit/right_edit_jndi.ts +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -145,7 +145,7 @@ const Widget = BI.inherit(BI.Widget, { height: 25, form: { type: Label, - cls: 'jndi-notice', + cls: 'bi-error', text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), }, }, diff --git a/src/app/connection/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts index 8ac6b8c..65967b0 100644 --- a/src/app/connection/right/right_show/right_show_jndi.ts +++ b/src/app/connection/right/right_show/right_show_jndi.ts @@ -124,7 +124,7 @@ const Widget = BI.inherit(BI.Widget, { height: 25, form: { type: Label, - cls: 'jndi-notice', + cls: 'bi-error', text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), }, }, diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index 4d57865..36b62b0 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, TextButton} from '@ui'; +import {WidgetType, TextButton, VerticalAdapt} from '@ui'; import Model from './left.model'; const className = 'dec.dcm.component.linkStatus.left.item'; const Widget: WidgetType = { @@ -11,11 +11,11 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, cls} = this.options; + const {title} = this.options; return { - type: Left, - cls: `left-item cursor-pointer ${cls}`, + type: VerticalAdapt, + cls: `left-item cursor-pointer`, height: 30, items: [ { diff --git a/src/app/status/link_status.ts b/src/app/status/link_status.ts index 594468a..66c56a5 100644 --- a/src/app/status/link_status.ts +++ b/src/app/status/link_status.ts @@ -1,4 +1,4 @@ -import {WidgetType, Htape, Vtape, Left, Label} from '@ui'; +import {WidgetType, Htape, Vtape, Left, Label, VerticalAdapt} from '@ui'; import linkStatusModel from './link_status.model'; import LeftList from './left/left'; import Right from './right/right'; @@ -17,7 +17,7 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'dcm-link-group', + cls: 'bi-card', items: [{ el: { type: Vtape, @@ -25,7 +25,7 @@ const Widget: WidgetType = { items: [ { el: { - type: Left, + type: VerticalAdapt, cls: 'bi-border-bottom', items: [ { diff --git a/src/app/status/right/right.ts b/src/app/status/right/right.ts index 69c54ef..5e9fa42 100644 --- a/src/app/status/right/right.ts +++ b/src/app/status/right/right.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, Left, Label, ListView} from '@ui/index'; +import {WidgetType, Vertical, Left, Label, ListView, VerticalAdapt} from '@ui/index'; import Model from './right.model'; import {info} from '@shared/crud/crud.request'; import RightCard from './right_card'; @@ -33,11 +33,10 @@ const Widget: WidgetType = { return { type: Vertical, cls: 'dcm-link-form', - minWidth: 400, items: [ { - type: Left, - cls: 'right-status-title bi-border-bottom', + type: VerticalAdapt, + cls: 'bi-border-bottom', height: 40, items: [ { diff --git a/src/app/status/right/right_card.ts b/src/app/status/right/right_card.ts index b4fbbb6..00bc02d 100644 --- a/src/app/status/right/right_card.ts +++ b/src/app/status/right/right_card.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt} from '@ui/index'; +import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt, VerticalAdapt} from '@ui/index'; const className = 'dec.dcm.component.linkStatus.right.card'; const Widget: WidgetType = { render() { @@ -10,100 +10,83 @@ const Widget: WidgetType = { hgap: 20, items: [ { - type: Left, + type: Vertical, + cls: 'bi-background', + height: 150, items: [ { - type: Vertical, - cls: 'right-status-board', - height: 150, - width: '100%', + type: CenterAdapt, + cls: 'right-status-board-item', + tgap: 40, items: [ { - type: CenterAdapt, - cls: 'right-status-board-item', - tgap: 40, + type: VerticalAdapt, items: [ { - type: Left, - items: [ - { - type: Label, - cls: 'right-status-text card-font-success', - textHeight: 40, - text: numActive, - }, - { - type: Label, - cls: 'right-status-text', - textHeight: 40, - text: '/', - }, - { - type: Label, - cls: 'right-status-text', - textHeight: 40, - text: maxActive, - }, - ], + type: Label, + cls: 'bi-high-light card-font-success', + textHeight: 40, + text: numActive, + }, + { + type: Label, + textHeight: 40, + text: '/', + }, + { + type: Label, + textHeight: 40, + text: maxActive, }, ], }, - { - type: Label, - height: 20, - text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), - }, ], }, + { + type: Label, + height: 20, + text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), + }, ], }, { - type: Left, - cls: 'right-status-right', + type: Vertical, + cls: 'bi-background', + height: 150, items: [ { - type: Vertical, - cls: 'right-status-board', - height: 150, - width: '100%', + type: CenterAdapt, + tgap: 40, + cls: 'right-status-board-item', items: [ { - type: CenterAdapt, - tgap: 40, - cls: 'right-status-board-item', + type: VerticalAdapt, items: [ { - type: Left, - items: [ - { - type: Label, - cls: 'right-status-text card-font-heighlight', - textHeight: 40, - text: numIdle, - }, - { - type: Label, - cls: 'right-status-text', - textHeight: 40, - text: '/', - }, - { - type: Label, - cls: 'right-status-text', - textHeight: 40, - text: maxIdle, - }, - ], + type: Label, + cls: 'bi-high-light card-font-heighlight', + textHeight: 40, + text: numIdle, + }, + { + type: Label, + textHeight: 40, + text: '/', + }, + { + type: Label, + textHeight: 40, + text: maxIdle, }, ], }, - { - type: Label, - height: 20, - text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), - }, ], }, + { + type: Label, + height: 20, + text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), + }, ], }, ], diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts index b75537b..bc52f81 100644 --- a/src/app/title/item/title_item.ts +++ b/src/app/title/item/title_item.ts @@ -20,8 +20,8 @@ const Widget = BI.inherit(BI.BasicButton, { return { type: Label, - cls: 'dcm-title-item cursor-pointer', - height: 39, + cls: 'cursor-pointer bi-font-bold', + height: 40, hgap: 15, text, }; diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 6d11acd..0b993eb 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -9,7 +9,7 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, - cls: 'dcm-title bi-border-bottom bi-font-bold', + cls: 'bi-card bi-border-bottom', items: { left: [ { @@ -17,22 +17,16 @@ const Widget: WidgetType = { cls: 'title-item-selected', text: BI.i18nText('Dec-Dcm_Connection_Management'), value: TAB_LINK_SET, - ref: _ref => { - this.ConnectSet = _ref; - }, - handler: () => { - this.ConnectSet.select(); + handler() { + this.select(); }, }, { type: TitleItem, text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), value: TAB_LINK_POOL, - ref: _ref => { - this.ConnectPool = _ref; - }, - handler: () => { - this.ConnectPool.select(); + handler() { + this.select(); }, }, ], diff --git a/src/less/resource/common.less b/src/less/resource/common.less index 9a78a2c..2021202 100644 --- a/src/less/resource/common.less +++ b/src/less/resource/common.less @@ -1,70 +1,39 @@ .dec-webui-dcm-layout{ - background-color: @background-color-normal; - .dcm-title{ - background-color: @background-color-default; - .title-item-selected{ - color: @background-color-highlight; - border-bottom: solid 2px @border-color-highlight; - } + .title-item-selected{ + color: @background-color-highlight; + border-bottom: solid 2px @border-color-highlight; } - .dcm-link-group{ - background-color: @background-color-default; - .dcm-link-left{ - .link-item{ - &:hover{ - background-color: @background-color-blue-transparent; - .link-item-icon{ - visibility: visible; - } - } + .dcm-link-left{ + .link-item{ + &:hover{ + background-color: @background-color-blue-transparent; .link-item-icon{ - visibility: hidden; + visibility: visible; } } - .left-item-selected{ - background-color: @background-color-blue-transparent; - .link-title{ - color: @font-color-highlight; - } + .link-item-icon{ + visibility: hidden; } } - } - .dcm-link-form{ - .right-status-title{ - color: @font-color-normal; - } - .right-status-board{ - background-color: @background-color-normal; - color: @font-color-normal; - .card-font-success{ - color: @font-color-success; - font-size: @font-size-30; - } - .card-font-heighlight{ + .left-item-selected{ + background-color: @background-color-blue-transparent; + .link-title{ color: @font-color-highlight; - font-size: @font-size-30; } } - .form-item-hint{ - color: @font-color-disabled; + } + .dcm-link-form{ + .card-font-success{ + font-size: @font-size-30; } - .jndi-notice{ - color: @font-color-negative; + .card-font-heighlight{ + font-size: @font-size-30; } } -} - -.dcm-link-more{ - &:hover{ - border: solid 1px @border-color-highlight; - } - .dcm-link-more-text{ - background: @background-color-light-gray; + .dcm-link-more{ + &:hover{ + border: solid 1px @border-color-highlight; + } } } -.show-content{ - background-color: @background-color-default; - .show-more{ - background: @background-color-light-gray; - } -} \ No newline at end of file + diff --git a/src/less/resource/font.less b/src/less/resource/font.less index db1fd98..9605c6f 100644 --- a/src/less/resource/font.less +++ b/src/less/resource/font.less @@ -1,7 +1,7 @@ @import "../../../node_modules/fineui/src/less/image.less"; @import "../lib/font.less"; -.font(link-font, @font-link); -.font(info-font, @font-link-info); -.font(test-font, @font-link-test); -.font(delete-font, @font-link-delete); \ No newline at end of file +.font(dcm-link-font, @font-link); +.font(dcm-info-font, @font-link-info); +.font(dcm-test-font, @font-link-test); +.font(dcm-delete-font, @font-link-delete); \ No newline at end of file diff --git a/src/shared/components/form_item.ts b/src/shared/components/form_item.ts index 65689fd..8cd1341 100644 --- a/src/shared/components/form_item.ts +++ b/src/shared/components/form_item.ts @@ -18,7 +18,7 @@ const Widget: WidgetType = { width, }, form, hint ? { type: Label, - cls: 'form-item-hint', + cls: 'bi-water-mark', lgap: 5, textAlign: 'left', text: hint, diff --git a/src/shared/components/title.ts b/src/shared/components/title.ts index 41f405a..0cda0af 100644 --- a/src/shared/components/title.ts +++ b/src/shared/components/title.ts @@ -6,9 +6,8 @@ const Widget: WidgetType = { return { type: Label, - cls: 'form-item-hint bi-border-bottom', + cls: 'bi-water-mark bi-border-bottom', height: 24, - textHeight: 24, bgap: 10, textAlign: 'left', text, diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index 3863982..d9eb404 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -1,4 +1,4 @@ -import {Label, Vertical, Left, Button, Layout, Absolute, CenterAdapt} from '@ui/index'; +import {Label, Vertical, Button, Layout, CenterAdapt, VerticalAdapt} from '@ui/index'; class Dialog { /** * 提示 @@ -54,7 +54,7 @@ class Dialog { public loading(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', width: 450, height: 220, items: [ @@ -82,7 +82,7 @@ class Dialog { public success(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', items: [ { type: Vertical, @@ -107,7 +107,7 @@ class Dialog { public error(message: string): string { const body = { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', items: [ { type: Vertical, @@ -140,7 +140,7 @@ class Dialog { items: [ { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', tgap: 10, items: [ { @@ -159,7 +159,7 @@ class Dialog { text, }, { - type: Left, + type: VerticalAdapt, cls: 'buttons', hgap: 5, items: [ @@ -200,7 +200,7 @@ class Dialog { ], }, { type: Label, - cls: 'show-more', + cls: 'bi-header-background', text: more, invisible: true, height: 73, @@ -220,7 +220,7 @@ class Dialog { items: [{ el: { type: 'bi.center_adapt', - cls: 'show-content', + cls: 'bi-card', width: 450, height: 220, items: [body], From a99a87d3368f70bb4cd2dc769f206343d0ab3304 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 29 May 2019 09:37:09 +0800 Subject: [PATCH 30/44] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96BI.BasicBut?= =?UTF-8?q?ton=E7=9A=84=E7=94=A8=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.ts | 11 ++++++----- src/app/connection/left/item/left_item_icon.ts | 1 + src/app/status/left/left_item.ts | 7 ++++--- src/app/title/item/title_item.ts | 2 +- src/app/title/title.ts | 6 ------ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index 23e53a5..621b1a3 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -1,4 +1,4 @@ -import {WidgetType, Left, Label, Icon, TextButton, Right, LeftRightVerticalAdapt} from '@ui'; +import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui'; import ItemIcon from './left_item_icon'; import Model from '../../link_set.model'; import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; @@ -36,9 +36,6 @@ const Widget: WidgetType = { textAlign: 'left', text: title, title, - handler: () => { - this.store.setLinkSelected(title); - }, }, ], right: [ @@ -73,6 +70,10 @@ const Widget: WidgetType = { }, }; }, + doClick() { + const {title} = this.options; + this.store.setLinkSelected(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/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index 91c7a05..094b8b6 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -64,6 +64,7 @@ const Widget: WidgetType = { type: IconButton, height: 24, width: 26, + stopEvent: true, title, handler: () => { const {value, id, title} = this.options; diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index 36b62b0..8936982 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -26,13 +26,14 @@ const Widget: WidgetType = { textAlign: 'left', text: title, title, - handler: () => { - this.store.setStatusSelected(title); - }, }, ], }; }, + doClick() { + const {title} = this.options; + this.store.setStatusSelected(title); + }, }; BI.shortcut(className, BI.inherit(BI.BasicButton, Widget)); export default className; diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts index bc52f81..31fdd44 100644 --- a/src/app/title/item/title_item.ts +++ b/src/app/title/item/title_item.ts @@ -26,7 +26,7 @@ const Widget = BI.inherit(BI.BasicButton, { text, }; }, - select() { + doClick() { const {value} = this.options; this.store.setTab(value); }, diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 0b993eb..1fae123 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -17,17 +17,11 @@ const Widget: WidgetType = { cls: 'title-item-selected', text: BI.i18nText('Dec-Dcm_Connection_Management'), value: TAB_LINK_SET, - handler() { - this.select(); - }, }, { type: TitleItem, text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), value: TAB_LINK_POOL, - handler() { - this.select(); - }, }, ], right: [ From 8a21f4ee55b6a1ff985aca0b48b2f3a2d16393a7 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 29 May 2019 10:01:30 +0800 Subject: [PATCH 31/44] =?UTF-8?q?refactor:=20=E5=BA=94=E8=AF=A5=E6=98=AF?= =?UTF-8?q?=E9=98=BB=E6=AD=A2=E5=86=92=E6=B3=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item_icon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index 094b8b6..2d3cd84 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -64,7 +64,7 @@ const Widget: WidgetType = { type: IconButton, height: 24, width: 26, - stopEvent: true, + stopPropagation: true, title, handler: () => { const {value, id, title} = this.options; From e7f6c4c14377b01d9b82d1bd96a93a523c0a31bd Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 29 May 2019 10:12:33 +0800 Subject: [PATCH 32/44] =?UTF-8?q?refactor:=20=E6=8A=8A=E5=86=85=E9=83=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=A7=BB=E5=87=BAactions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.model.ts | 7 +- src/app/connection/link_set.model.ts | 151 ++++++++++++++------------- src/app/title/title.ts | 3 - 3 files changed, 78 insertions(+), 83 deletions(-) diff --git a/src/app/app.model.ts b/src/app/app.model.ts index cec44fe..0698887 100644 --- a/src/app/app.model.ts +++ b/src/app/app.model.ts @@ -24,13 +24,10 @@ const Model: ModelType = { }, actions: { - setLinkList(value: LinkType[]) { - this.model.linkList = value; - this.model.tab = TAB_LINK_SET; - }, initData(callback: Function) { fetchLinkList((linkList: LinkType[]) => { - this.setLinkList(linkList); + this.model.linkList = linkList; + this.model.tab = TAB_LINK_SET; callback(); }); }, diff --git a/src/app/connection/link_set.model.ts b/src/app/connection/link_set.model.ts index 6cc14f9..3144f41 100644 --- a/src/app/connection/link_set.model.ts +++ b/src/app/connection/link_set.model.ts @@ -1,4 +1,3 @@ -import {ModelType} from '@ui/index'; import {LinkType} from '@ui/type'; import {deleteConnection, testConnection} from '@shared/crud/crud.request'; import {getCnnectionName} from './select/select.service'; @@ -6,7 +5,7 @@ import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; import {saveConnection} from './link_set.service'; const className = 'dec.dcm.model.linkset'; -const Model: ModelType = { +const Model = { context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], actions: { /** @@ -14,23 +13,10 @@ const Model: ModelType = { * @param name */ setLinkSelected(name: string) { - this.noSaveConfirm(() => { + this._noSaveConfirm(() => { this._setLinkSelected(name); }); }, - _setLinkSelected(name: string) { - this.model.linkList.forEach((item: LinkType) => { - item.isSelected = item.connectionName === name; - if (item.connectionName === name) { - this.model.linkSelected = { - ...item, - isSelected: false, - }; - } - }); - this.model.linkList = [...this.model.linkList]; - this.model.linkUpdate = this.model.linkSelected; - }, onIconClick(title: string, id: string) { switch (title) { case BI.i18nText('Dec-Dcm_Delete'): @@ -44,7 +30,7 @@ const Model: ModelType = { this._textLink(id); break; case BI.i18nText('Dec-Dcm_Copy'): - this.noSaveConfirm(() => { + this._noSaveConfirm(() => { this.copyLink(id); }); break; @@ -52,20 +38,7 @@ const Model: ModelType = { break; } }, - _textLink(id: string) { - const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); - const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); - testConnection(link, (res: any) => { - dialog.remove(loadingId); - if (res && res.errorCode) { - dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { - this._textLink(id); - }); - } else { - dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success')); - } - }); - }, + copyLink(id: string) { const connectionName = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionId === id).connectionName; const name = getCnnectionName(this.model.linkList, connectionName); @@ -129,56 +102,14 @@ const Model: ModelType = { return; } - this.noSaveConfirm(() => { + this._noSaveConfirm(() => { this._setNewLink(value); }); }, - _setNewLink(value: string) { - const name = getCnnectionName(this.model.linkList, value); - let data = {}; - DATA_BASE_TYPE.forEach(item => { - if (item.text === value) { - data = item; - } - }); - this.model.linkList = [ - { - connectionName: name, - isSelected: true, - ...data, - text: value, - }, - ...this.model.linkList, - ]; - this.model.linkSelected = { - ...data, - connectionName: name, - isSelected: true, - text: value, - }; - this.model.linkUpdate = { - ...data, - connectionName: name, - text: value, - }; - }, + setConnectionNameErr(err: string) { this.model.connectionNameErr = err; }, - noSaveConfirm(cb: Function) { - if (this.model.linkSelected && this.model.linkSelected.isSelected) { - dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => { - if (isConfirm) { - this.saveLink(); - } else { - this.setCancel(); - } - cb(); - }); - } else { - cb(); - } - }, saveLink() { const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {}; const update = { @@ -190,6 +121,76 @@ const Model: ModelType = { }); }, }, + _setLinkSelected(name: string) { + this.model.linkList.forEach((item: LinkType) => { + item.isSelected = item.connectionName === name; + if (item.connectionName === name) { + this.model.linkSelected = { + ...item, + isSelected: false, + }; + } + }); + this.model.linkList = [...this.model.linkList]; + this.model.linkUpdate = this.model.linkSelected; + }, + _textLink(id: string) { + const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); + const loadingId = dialog.loading(BI.i18nText('Dec-Dcm_Connection_Testing')); + testConnection(link, (res: any) => { + dialog.remove(loadingId); + if (res && res.errorCode) { + dialog.linkFail(`${link.connectionName}${BI.i18nText('Dec-Dcm_Connection_Test_Fail')}`, res.errorMsg, () => { + this._textLink(id); + }); + } else { + dialog.success(BI.i18nText('Dec-Dcm_Connection_Test_Success')); + } + }); + }, + _setNewLink(value: string) { + const name = getCnnectionName(this.model.linkList, value); + let data = {}; + DATA_BASE_TYPE.forEach(item => { + if (item.text === value) { + data = item; + } + }); + this.model.linkList = [ + { + connectionName: name, + isSelected: true, + ...data, + text: value, + }, + ...this.model.linkList, + ]; + this.model.linkSelected = { + ...data, + connectionName: name, + isSelected: true, + text: value, + }; + this.model.linkUpdate = { + ...data, + connectionName: name, + text: value, + }; + }, + _noSaveConfirm(cb: Function) { + if (this.model.linkSelected && this.model.linkSelected.isSelected) { + dialog.confirm(BI.i18nText('Dec-Dcm_Connection_Config_No_Save'), (isConfirm: boolean) => { + if (isConfirm) { + this.saveLink(); + } else { + this.setCancel(); + } + cb(); + }); + } else { + cb(); + } + }, }; BI.model(className, BI.inherit(Fix.Model, Model)); export default className; diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 1fae123..c00ba63 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -35,9 +35,6 @@ const Widget: WidgetType = { handler() { closeWindow(); }, - ref: _ref => { - this.CloseButton = _ref; - }, }, ], }, From 3f31d0f210c8d2e4c1e616603915dadeceb70a49 Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 30 May 2019 09:23:06 +0800 Subject: [PATCH 33/44] =?UTF-8?q?refactor:=20=E5=B0=86=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=94=BE=E5=88=B0=E7=BB=84=E4=BB=B6=E5=90=8C=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.less | 18 +++++++++ src/app/connection/left/item/left_item.ts | 4 +- .../connection/left/item/left_item_icon.ts | 1 + src/app/connection/left/left.ts | 2 +- .../connection/more/item/more_link_item.less | 6 +++ .../connection/more/item/more_link_item.ts | 6 ++- src/app/connection/right/right.ts | 1 - src/app/status/left/left.ts | 2 +- src/app/status/left/left_item.less | 9 +++++ src/app/status/left/left_item.ts | 1 + src/app/status/right/right_card.less | 9 +++++ src/app/status/right/right_card.ts | 4 ++ src/app/title/title.less | 7 ++++ src/app/title/title.ts | 4 ++ src/less/index.less | 3 +- src/less/lib/background.less | 1 - src/less/lib/color.less | 3 +- src/less/resource/common.less | 39 ------------------- 18 files changed, 72 insertions(+), 48 deletions(-) create mode 100644 src/app/connection/left/item/left_item.less create mode 100644 src/app/connection/more/item/more_link_item.less create mode 100644 src/app/status/left/left_item.less create mode 100644 src/app/status/right/right_card.less create mode 100644 src/app/title/title.less delete mode 100644 src/less/resource/common.less diff --git a/src/app/connection/left/item/left_item.less b/src/app/connection/left/item/left_item.less new file mode 100644 index 0000000..998a760 --- /dev/null +++ b/src/app/connection/left/item/left_item.less @@ -0,0 +1,18 @@ +@import '../../../../less/index.less'; +.dec-webui-dcm-connection-left-item{ + &-selected{ + background-color: @background-color-blue-transparent; + .link-title{ + color: @font-color-highlight; + } + } + &:hover{ + background-color: @background-color-blue-transparent; + .link-item-icon{ + visibility: visible; + } + } + .link-item-icon{ + visibility: hidden; + } +} \ No newline at end of file diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index 621b1a3..48680fc 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -1,3 +1,4 @@ +import './left_item.less'; import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui'; import ItemIcon from './left_item_icon'; import Model from '../../link_set.model'; @@ -8,6 +9,7 @@ const Widget: WidgetType = { title: '', id: '', creator: '', + baseCls: 'dec-webui-dcm-connection-left-item', }, _store() { return BI.Models.getModel(Model); @@ -17,7 +19,7 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, - cls: `link-item cursor-pointer`, + cls: `cursor-pointer`, height: 24, items: { left: [ diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index 2d3cd84..d8fd1d5 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -15,6 +15,7 @@ const Widget: WidgetType = { if (value === ACTION_DELETE) { return { type: BubbleCombo, + stopPropagation: true, direction: 'bottom', ref () { combo = this; diff --git a/src/app/connection/left/left.ts b/src/app/connection/left/left.ts index 547d572..afcf09f 100644 --- a/src/app/connection/left/left.ts +++ b/src/app/connection/left/left.ts @@ -27,7 +27,7 @@ const Widget: WidgetType = { return BI.map(linkList, (index: number, item: LinkType) => { return { type: LeftItem, - cls: item.isSelected ? 'left-item-selected' : '', + cls: item.isSelected ? 'dec-webui-dcm-connection-left-item-selected' : '', title: item.connectionName, id: item.connectionId, creator: item.creator, diff --git a/src/app/connection/more/item/more_link_item.less b/src/app/connection/more/item/more_link_item.less new file mode 100644 index 0000000..8bcc779 --- /dev/null +++ b/src/app/connection/more/item/more_link_item.less @@ -0,0 +1,6 @@ +@import '../../../../less/index.less'; +.dec-webui-dcm-connection-more-link-item{ + &:hover{ + border: solid 1px @border-color-highlight; + } +} \ No newline at end of file diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index f9a7212..9604b42 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -1,8 +1,12 @@ +import './more_link_item.less'; import {WidgetType, Vertical, Img, Label, Layout, Absolute} from '@ui/index'; import ModelName from './more_link_litem.model'; const className = 'dec.dcm.component.linkSet.morelink.item'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-connection-more-link-item', + }, _store() { return BI.Models.getModel(ModelName); }, @@ -17,7 +21,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'dcm-link-more bi-border cursor-pointer', + cls: 'bi-border cursor-pointer', width: 120, height: 117, items: [ diff --git a/src/app/connection/right/right.ts b/src/app/connection/right/right.ts index 961cabc..16ef861 100644 --- a/src/app/connection/right/right.ts +++ b/src/app/connection/right/right.ts @@ -21,7 +21,6 @@ const Widget: WidgetType = { render() { return { type: ListView, - cls: 'dcm-link-form', ref(_ref: any) { rightContent = _ref; }, diff --git a/src/app/status/left/left.ts b/src/app/status/left/left.ts index 06f3259..cfe6a5e 100644 --- a/src/app/status/left/left.ts +++ b/src/app/status/left/left.ts @@ -32,7 +32,7 @@ const Widget: WidgetType = { return BI.map(linkList, (index: number, item: LinkType) => { return { type: LeftItem, - cls: item.connectionName === selectTitle ? 'left-item-selected' : '', + cls: item.connectionName === selectTitle ? 'dec-webui-dcm-status-left-item-selected' : '', title: item.connectionName, id: item.connectionId, creator: item.creator, diff --git a/src/app/status/left/left_item.less b/src/app/status/left/left_item.less new file mode 100644 index 0000000..458769f --- /dev/null +++ b/src/app/status/left/left_item.less @@ -0,0 +1,9 @@ +@import '../../../less/index.less'; +.dec-webui-dcm-status-left-item{ + &-selected{ + background-color: @background-color-blue-transparent; + .link-title{ + color: @font-color-highlight; + } + } +} \ No newline at end of file diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index 8936982..abc9b9a 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -1,3 +1,4 @@ +import './left_item.less'; import {WidgetType, TextButton, VerticalAdapt} from '@ui'; import Model from './left.model'; const className = 'dec.dcm.component.linkStatus.left.item'; diff --git a/src/app/status/right/right_card.less b/src/app/status/right/right_card.less new file mode 100644 index 0000000..6b121b9 --- /dev/null +++ b/src/app/status/right/right_card.less @@ -0,0 +1,9 @@ +@import '../../../less/index.less'; +.dec-webui-dcm-status-right-card{ + .card-font-success{ + font-size: @font-size-30; + } + .card-font-heighlight{ + font-size: @font-size-30; + } +} \ No newline at end of file diff --git a/src/app/status/right/right_card.ts b/src/app/status/right/right_card.ts index 00bc02d..1cdb719 100644 --- a/src/app/status/right/right_card.ts +++ b/src/app/status/right/right_card.ts @@ -1,6 +1,10 @@ +import './right_card.less'; import {WidgetType, Left, Label, Vertical, FloatCenter, CenterAdapt, VerticalAdapt} from '@ui/index'; const className = 'dec.dcm.component.linkStatus.right.card'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-status-right-card', + }, render() { const {maxActive, maxIdle, numActive, numIdle} = this.options; diff --git a/src/app/title/title.less b/src/app/title/title.less new file mode 100644 index 0000000..7137334 --- /dev/null +++ b/src/app/title/title.less @@ -0,0 +1,7 @@ +@import '../../less/index.less'; +.dec-webui-dcm-title{ + .title-item-selected{ + color: @background-color-highlight; + border-bottom: solid 2px @border-color-highlight; + } +} \ No newline at end of file diff --git a/src/app/title/title.ts b/src/app/title/title.ts index c00ba63..7647265 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -1,9 +1,13 @@ +import './title.less'; import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; import TitleItem from './item/title_item'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.title'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-title', + }, render() { const hideCloseButton = isDesigner(); diff --git a/src/less/index.less b/src/less/index.less index 7a227dc..9d67e74 100644 --- a/src/less/index.less +++ b/src/less/index.less @@ -1,5 +1,4 @@ @import "lib/background"; @import "lib/color"; @import "resource/background"; -@import "resource/font"; -@import "resource/common"; \ No newline at end of file +@import "resource/font"; \ No newline at end of file diff --git a/src/less/lib/background.less b/src/less/lib/background.less index e5baaf9..bff78bf 100644 --- a/src/less/lib/background.less +++ b/src/less/lib/background.less @@ -1,4 +1,3 @@ -@background-color-blue-transparent: @color-bi-blue-5; @background-resources: "resources.png"; @background-warning: "warning.png"; @background-database-selected: "database-selected.png"; diff --git a/src/less/lib/color.less b/src/less/lib/color.less index 3b63c6d..ca1c3a1 100644 --- a/src/less/lib/color.less +++ b/src/less/lib/color.less @@ -1 +1,2 @@ -@import "../../../node_modules/fineui/src/less/lib/colors"; \ No newline at end of file +@import "../../../node_modules/fineui/src/less/lib/colors"; +@background-color-blue-transparent: @color-bi-blue-5; \ No newline at end of file diff --git a/src/less/resource/common.less b/src/less/resource/common.less deleted file mode 100644 index 2021202..0000000 --- a/src/less/resource/common.less +++ /dev/null @@ -1,39 +0,0 @@ -.dec-webui-dcm-layout{ - .title-item-selected{ - color: @background-color-highlight; - border-bottom: solid 2px @border-color-highlight; - } - .dcm-link-left{ - .link-item{ - &:hover{ - background-color: @background-color-blue-transparent; - .link-item-icon{ - visibility: visible; - } - } - .link-item-icon{ - visibility: hidden; - } - } - .left-item-selected{ - background-color: @background-color-blue-transparent; - .link-title{ - color: @font-color-highlight; - } - } - } - .dcm-link-form{ - .card-font-success{ - font-size: @font-size-30; - } - .card-font-heighlight{ - font-size: @font-size-30; - } - } - .dcm-link-more{ - &:hover{ - border: solid 1px @border-color-highlight; - } - } -} - From ee75344a33ce1864e1f0b4e3cb2a6796ddb15b81 Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 30 May 2019 15:39:41 +0800 Subject: [PATCH 34/44] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=20cursor-pointer=EF=BC=8C=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20hover-visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.less | 16 +--------------- src/app/connection/left/item/left_item.ts | 2 +- src/app/connection/left/left.ts | 2 +- src/app/connection/more/item/more_link_item.ts | 2 +- src/app/status/left/left.ts | 2 +- src/app/status/left/left_item.less | 9 --------- src/app/status/left/left_item.ts | 3 +-- src/app/title/item/title_item.ts | 2 +- src/less/var.less | 1 + 9 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 src/app/status/left/left_item.less diff --git a/src/app/connection/left/item/left_item.less b/src/app/connection/left/item/left_item.less index 998a760..a3d0766 100644 --- a/src/app/connection/left/item/left_item.less +++ b/src/app/connection/left/item/left_item.less @@ -1,18 +1,4 @@ @import '../../../../less/index.less'; .dec-webui-dcm-connection-left-item{ - &-selected{ - background-color: @background-color-blue-transparent; - .link-title{ - color: @font-color-highlight; - } - } - &:hover{ - background-color: @background-color-blue-transparent; - .link-item-icon{ - visibility: visible; - } - } - .link-item-icon{ - visibility: hidden; - } + .hover-visible(link-item-icon); } \ No newline at end of file diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index 48680fc..ba31418 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -19,7 +19,7 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, - cls: `cursor-pointer`, + cls: 'bi-list-item-active', height: 24, items: { left: [ diff --git a/src/app/connection/left/left.ts b/src/app/connection/left/left.ts index afcf09f..d9c2b85 100644 --- a/src/app/connection/left/left.ts +++ b/src/app/connection/left/left.ts @@ -27,7 +27,7 @@ const Widget: WidgetType = { return BI.map(linkList, (index: number, item: LinkType) => { return { type: LeftItem, - cls: item.isSelected ? 'dec-webui-dcm-connection-left-item-selected' : '', + selected: item.isSelected, title: item.connectionName, id: item.connectionId, creator: item.creator, diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index 9604b42..61e2e17 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -21,7 +21,7 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'bi-border cursor-pointer', + cls: 'bi-border', width: 120, height: 117, items: [ diff --git a/src/app/status/left/left.ts b/src/app/status/left/left.ts index cfe6a5e..fa07593 100644 --- a/src/app/status/left/left.ts +++ b/src/app/status/left/left.ts @@ -32,7 +32,7 @@ const Widget: WidgetType = { return BI.map(linkList, (index: number, item: LinkType) => { return { type: LeftItem, - cls: item.connectionName === selectTitle ? 'dec-webui-dcm-status-left-item-selected' : '', + selected: item.connectionName === selectTitle, title: item.connectionName, id: item.connectionId, creator: item.creator, diff --git a/src/app/status/left/left_item.less b/src/app/status/left/left_item.less deleted file mode 100644 index 458769f..0000000 --- a/src/app/status/left/left_item.less +++ /dev/null @@ -1,9 +0,0 @@ -@import '../../../less/index.less'; -.dec-webui-dcm-status-left-item{ - &-selected{ - background-color: @background-color-blue-transparent; - .link-title{ - color: @font-color-highlight; - } - } -} \ No newline at end of file diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index abc9b9a..fe90df6 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -1,4 +1,3 @@ -import './left_item.less'; import {WidgetType, TextButton, VerticalAdapt} from '@ui'; import Model from './left.model'; const className = 'dec.dcm.component.linkStatus.left.item'; @@ -16,7 +15,7 @@ const Widget: WidgetType = { return { type: VerticalAdapt, - cls: `left-item cursor-pointer`, + cls: 'bi-list-item-active', height: 30, items: [ { diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts index 31fdd44..3690a51 100644 --- a/src/app/title/item/title_item.ts +++ b/src/app/title/item/title_item.ts @@ -20,7 +20,7 @@ const Widget = BI.inherit(BI.BasicButton, { return { type: Label, - cls: 'cursor-pointer bi-font-bold', + cls: 'bi-font-bold', height: 40, hgap: 15, text, diff --git a/src/less/var.less b/src/less/var.less index 964e94b..a324209 100644 --- a/src/less/var.less +++ b/src/less/var.less @@ -1,3 +1,4 @@ @import "../../node_modules/fineui/src/less/var"; +@import '../../node_modules/fineui/src/less/visual.less'; @imageUrl: '/img/'; @image2xUrl: '/img/'; \ No newline at end of file From 3ccfb07206cf9a1376b1f755e35b8c79ae43aebe Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 30 May 2019 16:28:01 +0800 Subject: [PATCH 35/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=AD=A3=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 2 +- private/i18n.ts | 2 +- src/app/connection/left/item/left_item.ts | 4 +- .../connection/left/item/left_item_delete.ts | 43 +++++++++++++ .../connection/left/item/left_item_icon.ts | 62 ++----------------- src/app/connection/left/left.ts | 7 +-- .../connection/more/item/more_link_item.ts | 6 +- src/app/connection/more/more_link.service.ts | 14 ++--- src/app/connection/more/more_link.ts | 1 - src/app/connection/right/right.ts | 7 +-- .../right/right_detail/right_detail.ts | 2 +- .../connection/right/right_edit/right_edit.ts | 11 ++-- src/app/connection/select/select.ts | 8 +-- src/app/status/left/left.ts | 7 +-- src/app/status/right/right.ts | 14 ++--- src/shared/service/dialog.service.ts | 37 +++-------- 16 files changed, 94 insertions(+), 133 deletions(-) create mode 100644 src/app/connection/left/item/left_item_delete.ts diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 32d7ec2..13c2e30 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -30,7 +30,7 @@ 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_More_Title= 更多数据连接 Dec-Dcm_Connection_Other= 其他 Dec-Dcm_Connection_Plase_Add_One= 请选择左侧数据连接或点击新建数据连接 Dec-Dcm_Connection_Is_Existence= 数据连接名已存在 diff --git a/private/i18n.ts b/private/i18n.ts index a5bc85b..03caabc 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -31,7 +31,7 @@ export default { 'Dec-Dcm_Connection_Config_No_Save': '当前设置尚未保存,是否保存?', 'Dec-Dcm_Connection_New': '新建数据连接', 'Dec-Dcm_Connection_More': '更多数据连接...', - 'Dec-Dcm_Connection_More-Title': '更多数据连接', + 'Dec-Dcm_Connection_More_Title': '更多数据连接', 'Dec-Dcm_Connection_Other': '其他', 'Dec-Dcm_Connection_Plase_Add_One': '请选择左侧数据连接或点击新建数据连接', 'Dec-Dcm_Connection_Is_Existence': '数据连接名已存在', diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index ba31418..ef29d2e 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -1,6 +1,7 @@ import './left_item.less'; import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui'; import ItemIcon from './left_item_icon'; +import ItemDelete from './left_item_delete'; import Model from '../../link_set.model'; import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants'; const className = 'dec.dcm.component.linkSet.left.item'; @@ -33,7 +34,6 @@ const Widget: WidgetType = { }, { type: TextButton, - cls: 'link-title', textHeight: 24, textAlign: 'left', text: title, @@ -62,7 +62,7 @@ const Widget: WidgetType = { id, }, { - type: ItemIcon, + type: ItemDelete, cls: 'link-item-icon dcm-delete-font', title: BI.i18nText('Dec-Dcm_Delete'), value: ACTION_DELETE, diff --git a/src/app/connection/left/item/left_item_delete.ts b/src/app/connection/left/item/left_item_delete.ts new file mode 100644 index 0000000..c21f9f8 --- /dev/null +++ b/src/app/connection/left/item/left_item_delete.ts @@ -0,0 +1,43 @@ +import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView} from '@ui'; +import Model from '../../link_set.model'; + +const className = 'dec.dcm.component.linkSet.left.item.icon.delete'; +const Widget: WidgetType = { + _store() { + return BI.Models.getModel(Model); + }, + render() { + const {title, id} = this.options; + const that = this; + + return { + type: BubbleCombo, + stopPropagation: true, + direction: 'bottom', + ref: _ref => { + this.combo = _ref; + }, + el: { + type: Icon, + height: 24, + width: 26, + title, + }, + popup: { + type: TextBubblePopupBarView, + text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'), + listeners: [{ + eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, + action (type: boolean) { + that.combo.hideView(); + if (type) { + that.store.onIconClick(title, id); + } + }, + }], + }, + }; + }, +}; +BI.shortcut(className, BI.inherit(BI.Widget, Widget)); +export default className; diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index d8fd1d5..a597f02 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -1,6 +1,5 @@ -import {WidgetType, Icon, BubbleCombo, TextBubblePopupBarView, IconButton} from '@ui'; +import {WidgetType, IconButton} from '@ui'; import Model from '../../link_set.model'; -import {ACTION_DELETE} from '@private/constants'; const className = 'dec.dcm.component.linkSet.left.item.icon'; const Widget: WidgetType = { @@ -8,58 +7,7 @@ const Widget: WidgetType = { return BI.Models.getModel(Model); }, render() { - const {title, id, value} = this.options; - const that = this; - let iconContent: any = null; - let combo: any = null; - if (value === ACTION_DELETE) { - return { - type: BubbleCombo, - stopPropagation: true, - direction: 'bottom', - ref () { - combo = this; - }, - el: { - type: Icon, - baseCls: 'action-icon', - height: 24, - width: 26, - title, - ref (ref: any) { - iconContent = ref; - }, - }, - popup: { - type: TextBubblePopupBarView, - text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'), - listeners: [{ - eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, - action (type: boolean) { - combo.hideView(); - if (type) { - that.store.onIconClick(title, id); - } - }, - }], - }, - listeners: [{ - eventName: BI.BubbleCombo.EVENT_EXPAND, - action () { - iconContent.element.css({ - visibility: 'visible', - }); - }, - }, { - eventName: BI.BubbleCombo.EVENT_AFTER_HIDEVIEW, - action () { - iconContent.element.css({ - visibility: 'hidden', - }); - }, - }], - }; - } + const {title} = this.options; return { type: IconButton, @@ -68,10 +16,8 @@ const Widget: WidgetType = { stopPropagation: true, title, handler: () => { - const {value, id, title} = this.options; - if (value !== ACTION_DELETE) { - this.store.onIconClick(title, id); - } + const {id, title} = this.options; + this.store.onIconClick(title, id); }, }; }, diff --git a/src/app/connection/left/left.ts b/src/app/connection/left/left.ts index d9c2b85..dd4b5a1 100644 --- a/src/app/connection/left/left.ts +++ b/src/app/connection/left/left.ts @@ -4,21 +4,20 @@ import {LinkType} from '@ui/type'; import LeftItem from './item/left_item'; const className = 'dec.dcm.component.linkset.left'; -let leftContent: any = null; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, watch: { linkList(linkList: LinkType[]) { - leftContent.populate(BI.createItems(this._renderItems(linkList))); + this.leftContent.populate(BI.createItems(this._renderItems(linkList))); }, }, render() { return { type: ListView, - ref(_ref: any) { - leftContent = _ref; + ref: _ref => { + this.leftContent = _ref; }, items: this._renderItems(this.model.linkList), }; diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index 61e2e17..01a41c3 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -5,7 +5,7 @@ import ModelName from './more_link_litem.model'; const className = 'dec.dcm.component.linkSet.morelink.item'; const Widget: WidgetType = { props: { - baseCls: 'dec-webui-dcm-connection-more-link-item', + baseCls: 'dec-webui-dcm-connection-more-link-item bi-border', }, _store() { return BI.Models.getModel(ModelName); @@ -21,9 +21,6 @@ const Widget: WidgetType = { return { type: Vertical, - cls: 'bi-border', - width: 120, - height: 117, items: [ { type: Img, @@ -52,6 +49,7 @@ const Widget: WidgetType = { type: Label, cls: 'bi-header-background', height: 27, + width: 120, text, }, ], diff --git a/src/app/connection/more/more_link.service.ts b/src/app/connection/more/more_link.service.ts index acfac03..c10489c 100644 --- a/src/app/connection/more/more_link.service.ts +++ b/src/app/connection/more/more_link.service.ts @@ -1,12 +1,12 @@ import MoreLink from './more_link'; -let SubbitButton: any = null; +let subbitButton = null; let selectKey = ''; export const moreLink = (onConfirm?: Function): void => { const id = BI.UUID(); BI.Popovers.create(id, { type: 'bi.bar_popover', size: 'normal', - header: BI.i18nText('Dec-Dcm_Connection_More-Title'), + header: BI.i18nText('Dec-Dcm_Connection_More_Title'), width: 560, height: 500, body: { @@ -16,7 +16,7 @@ export const moreLink = (onConfirm?: Function): void => { eventName: 'EVENT_SELECT', action (text: string) { selectKey = text; - SubbitButton.setEnable(true); + subbitButton.setEnable(true); }, }, ], @@ -29,7 +29,7 @@ export const moreLink = (onConfirm?: Function): void => { text: BI.i18nText('BI-Basic_Cancel'), value: 1, level: 'ignore', - handler (v: any) { + handler () { BI.Popovers.close(id); }, }, { @@ -37,10 +37,10 @@ export const moreLink = (onConfirm?: Function): void => { text: BI.i18nText('BI-Basic_Sure'), disabled: true, value: 0, - ref(ref: any) { - SubbitButton = ref; + ref: _ref => { + subbitButton = _ref; }, - handler (v: any) { + handler () { BI.Popovers.close(id); onConfirm ? onConfirm(selectKey) : null; }, diff --git a/src/app/connection/more/more_link.ts b/src/app/connection/more/more_link.ts index bde8e09..b2ce288 100644 --- a/src/app/connection/more/more_link.ts +++ b/src/app/connection/more/more_link.ts @@ -26,7 +26,6 @@ const Widget: WidgetType = { type: Left, scrolly: true, width: 528, - height: 380, tgap: 2, rgap: 2, bgap: 2, diff --git a/src/app/connection/right/right.ts b/src/app/connection/right/right.ts index 16ef861..905be56 100644 --- a/src/app/connection/right/right.ts +++ b/src/app/connection/right/right.ts @@ -3,7 +3,6 @@ import {LinkType} from '@ui/type'; import Nothing from './nothing'; import RightDetail from './right_detail/right_detail'; import Model from '../link_set.model'; -let rightContent: any = null; const className = 'dec.dcm.component.right'; const Widget: WidgetType = { _store() { @@ -11,7 +10,7 @@ const Widget: WidgetType = { }, watch: { linkSelected(linkSelected: LinkType) { - rightContent.populate(BI.createItems([ + this.rightContent.populate(BI.createItems([ { type: (linkSelected && linkSelected.connectionName) ? RightDetail : Nothing, }, @@ -21,8 +20,8 @@ const Widget: WidgetType = { render() { return { type: ListView, - ref(_ref: any) { - rightContent = _ref; + ref: _ref => { + this.rightContent = _ref; }, items: [{ type: Nothing, diff --git a/src/app/connection/right/right_detail/right_detail.ts b/src/app/connection/right/right_detail/right_detail.ts index 3a8b596..d41547c 100644 --- a/src/app/connection/right/right_detail/right_detail.ts +++ b/src/app/connection/right/right_detail/right_detail.ts @@ -1,4 +1,4 @@ -import {WidgetType, ListView, Left} from '@ui/index'; +import {WidgetType, ListView} from '@ui/index'; import Model from './right_detail.model'; import {LinkType} from '@ui/type'; import Title from '../right_title/right_title'; diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index 8393f0b..b2c80fd 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -1,11 +1,11 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo, TextEditor} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link_set.model'; import FormItem from '@shared/components/form_item'; import Title from '@shared/components/title'; import {getDrivers, connectNameChecker} from './right_edit.service'; -let ConnectionName: any = null; +let connectionName: any = null; const className = 'dec.dcm.component.right.edit'; const Widget: WidgetType = { _store() { @@ -14,7 +14,7 @@ const Widget: WidgetType = { watch: { connectionNameErr(msg: string) { if (msg) { - BI.Bubbles.show('singleBubble', msg, ConnectionName, { + BI.Bubbles.show('singleBubble', msg, connectionName, { level: 'error', }); } else { @@ -35,12 +35,11 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, value: linkSelected.connectionName, ref(ref: any) { - ConnectionName = ref; + connectionName = ref; }, listeners: [{ eventName: BI.Editor.EVENT_CHANGE, diff --git a/src/app/connection/select/select.ts b/src/app/connection/select/select.ts index 56a82ed..22854c7 100644 --- a/src/app/connection/select/select.ts +++ b/src/app/connection/select/select.ts @@ -9,8 +9,6 @@ const Widget: WidgetType = { return BI.Models.getModel(selectModel); }, render() { - let combo: any = null; - return { type: Combo, trigger: 'click', @@ -67,11 +65,11 @@ const Widget: WidgetType = { } else { this.store.setNewLink(v); } - combo.hideView(); + this.combo.hideView(); }, }], - ref () { - combo = this; + ref: _ref => { + this.combo = _ref; }, }; }, diff --git a/src/app/status/left/left.ts b/src/app/status/left/left.ts index fa07593..d16451d 100644 --- a/src/app/status/left/left.ts +++ b/src/app/status/left/left.ts @@ -4,7 +4,6 @@ import {LinkType} from '@ui/type'; import LeftItem from './left_item'; const className = 'dec.dcm.component.linkStatus.left'; -let leftContent: any = null; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); @@ -16,14 +15,14 @@ const Widget: WidgetType = { }, statusSelected(title: string) { const linkList = this.model.linkList; - leftContent.populate(BI.createItems(this._renderItems(linkList, title))); + this.leftContent.populate(BI.createItems(this._renderItems(linkList, title))); }, }, render() { return { type: ListView, - ref(_ref: any) { - leftContent = _ref; + ref: _ref => { + this.leftContent = _ref; }, items: this._renderItems(this.model.linkList, this.model.statusSelected), }; diff --git a/src/app/status/right/right.ts b/src/app/status/right/right.ts index 5e9fa42..ceb454e 100644 --- a/src/app/status/right/right.ts +++ b/src/app/status/right/right.ts @@ -7,8 +7,6 @@ import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; const className = 'dec.dcm.component.linkStatus.right'; -let Title: any = null; -let Group: any = null; const Widget: WidgetType = { _store() { @@ -21,12 +19,12 @@ const Widget: WidgetType = { const isPlugin = link.text && BI.some(plugins, (index: number, item: string) => item === link.text); const Pool = isPlugin ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${link.text.toLowerCase()}.pool`) : RightCard; info(name, (res: InfoType) => { - Group.populate(BI.createItems([{ + this.statusGroup.populate(BI.createItems([{ type: Pool, ...res, }])); }); - Title.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`); + this.statusTitle.setText(`${BI.i18nText('Dec-Dcm_Data_Connections')}(${title})`); }, }, render() { @@ -47,16 +45,16 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Data_Connections'), }, ], - ref(ref: any) { - Title = ref; + ref: _ref => { + this.statusTitle = _ref; }, }, { type: ListView, cls: 'right-status-body', vgap: 10, hgap: 10, - ref(ref: any) { - Group = ref; + ref: _ref => { + this.statusGroup = _ref; }, }, ], diff --git a/src/shared/service/dialog.service.ts b/src/shared/service/dialog.service.ts index d9eb404..c7ddb77 100644 --- a/src/shared/service/dialog.service.ts +++ b/src/shared/service/dialog.service.ts @@ -131,8 +131,8 @@ class Dialog { } public linkFail(text: string, more: string, cb?: Function): string { - let Popover: any = null; - let More: any = null; + let dialogPopover = null; + let dialogMore = null; const id = BI.UUID(); const that = this; const body = { @@ -168,11 +168,11 @@ class Dialog { text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), level: 'ignore', handler() { - const isHide = !More.isVisible(); - Popover.element.css({ + const isHide = !dialogMore.isVisible(); + dialogPopover.element.css({ height: isHide ? '290' : '220', }); - More.setVisible(isHide); + dialogMore.setVisible(isHide); this.setText(isHide ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information')); }, }, @@ -206,8 +206,8 @@ class Dialog { height: 73, width: 400, value: false, - ref(ref: any) { - More = ref; + ref: _ref => { + dialogMore = _ref; }, }, ], @@ -224,8 +224,8 @@ class Dialog { width: 450, height: 220, items: [body], - ref(ref: any) { - Popover = ref; + ref: _ref => { + dialogPopover = _ref; }, }, }], @@ -242,24 +242,7 @@ class Dialog { public remove(id: string): void{ BI.Maskers.remove(id); } - public show1(body: any, autoClose = 0): string { - const id = BI.UUID(); - BI.Popovers.create(id, { - type: 'bi.popover', - cls: 'popover-notitle bi-custom-show', - size: 'small', - width: 450, - height: 220, - body, - }).open(id); - if (autoClose > 0) { - setTimeout(() => { - this.close(id); - }, autoClose); - } - - return id; - } + public show(body: any, autoClose = 0): string { const name = BI.UUID(); From 1a9ba0257fc533dd146b64332e74f9b79ba1cca2 Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 30 May 2019 16:43:50 +0800 Subject: [PATCH 36/44] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8TextEditor?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3Editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.ts | 3 +-- .../connection/right/right_edit/right_edit.ts | 16 ++++--------- .../right/right_edit/right_edit_jndi.ts | 17 +++++-------- .../right/right_edit/right_edit_mysql.ts | 18 +++++--------- src/app/title/title.ts | 3 +-- src/demo/plugin.redis.edit.ts | 24 +++++++++---------- 6 files changed, 30 insertions(+), 51 deletions(-) diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index ef29d2e..e4b7335 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -10,7 +10,7 @@ const Widget: WidgetType = { title: '', id: '', creator: '', - baseCls: 'dec-webui-dcm-connection-left-item', + baseCls: 'dec-webui-dcm-connection-left-item bi-list-item-active', }, _store() { return BI.Models.getModel(Model); @@ -20,7 +20,6 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, - cls: 'bi-list-item-active', height: 24, items: { left: [ diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index b2c80fd..4ae86f6 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -88,8 +88,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, @@ -133,8 +132,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, @@ -154,8 +152,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, inputType: 'password', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), @@ -182,7 +179,6 @@ const Widget: WidgetType = { height: 100, form: { type: TextAreaEditor, - cls: 'bi-border', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, @@ -222,8 +218,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 60, @@ -261,8 +256,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, disabled: true, }, diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts index aad12e3..4a789d9 100644 --- a/src/app/connection/right/right_edit/right_edit_jndi.ts +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -1,4 +1,4 @@ -import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; +import {Vertical, Editor, TextValueCombo, TextButton, Label, TextEditor} from '@ui'; import FormItem from '@shared/components/form_item'; import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; import {AttributeType} from '../right.typing'; @@ -29,8 +29,7 @@ const Widget = BI.inherit(BI.Widget, { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, allowBlank: true, value: connectionName, @@ -68,8 +67,7 @@ const Widget = BI.inherit(BI.Widget, { text: 'PROVIDER_URL', width: 180, form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, allowBlank: true, value: url, @@ -80,8 +78,7 @@ const Widget = BI.inherit(BI.Widget, { text: 'SECURITY_PRINCIPAL', width: 180, form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, allowBlank: true, value: principal, @@ -92,8 +89,7 @@ const Widget = BI.inherit(BI.Widget, { text: 'SECURITY_CREDENTIALS', width: 180, form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, allowBlank: true, value: credentials, @@ -127,8 +123,7 @@ const Widget = BI.inherit(BI.Widget, { text: item.text, width: 180, form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, allowBlank: true, value: this.options[item.name], diff --git a/src/app/connection/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts index ab3fe3e..03da872 100644 --- a/src/app/connection/right/right_edit/right_edit_mysql.ts +++ b/src/app/connection/right/right_edit/right_edit_mysql.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link_set.model'; @@ -23,8 +23,7 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, width: 300, value: linkSelected.connectionName, listeners: [{ @@ -61,8 +60,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, value: linkSelected.url, @@ -106,8 +104,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, @@ -127,8 +124,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, inputType: 'password', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), @@ -155,7 +151,6 @@ const Widget: WidgetType = { height: 100, form: { type: TextAreaEditor, - cls: 'bi-border', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 300, @@ -195,8 +190,7 @@ const Widget: WidgetType = { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), form: { - type: Editor, - cls: 'bi-border', + type: TextEditor, allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), width: 60, diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 7647265..924065d 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -6,14 +6,13 @@ import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.title'; const Widget: WidgetType = { props: { - baseCls: 'dec-webui-dcm-title', + baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', }, render() { const hideCloseButton = isDesigner(); return { type: LeftRightVerticalAdapt, - cls: 'bi-card bi-border-bottom', items: { left: [ { diff --git a/src/demo/plugin.redis.edit.ts b/src/demo/plugin.redis.edit.ts index c010093..8824963 100644 --- a/src/demo/plugin.redis.edit.ts +++ b/src/demo/plugin.redis.edit.ts @@ -1,4 +1,5 @@ import './style.scss'; +import {TextEditor, Vertical, Left, Label} from '@ui/index'; const RedisConstantName = 'dec.constant.database.conf.connect.form.redis.value'; const form = { url: '192.168.1.22', @@ -10,24 +11,23 @@ const classNameEdit = 'dec.dcm.plugin.redis.edit'; const Widget = BI.inherit(BI.Widget, { render() { return { - type: 'bi.vertical', + type: Vertical, cls: 'bi-plugin-redis', bgap: 10, items: [ { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Addr'), value: form.url, allowBlank: true, @@ -36,19 +36,18 @@ const Widget = BI.inherit(BI.Widget, { }], }, { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), allowBlank: true, width: 300, @@ -61,19 +60,18 @@ const Widget = BI.inherit(BI.Widget, { }], }, { - type: 'bi.left', + type: Left, height: 30, items: [ { - type: 'bi.label', + type: Label, text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), height: 24, width: 115, textAlign: 'left', }, { - type: 'bi.editor', - cls: 'bi-border', + type: TextEditor, inputType: 'password', value: form.password, allowBlank: true, From 286ac1982d8f2427e11289e9982fd044a0039eda Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 30 May 2019 17:24:55 +0800 Subject: [PATCH 37/44] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E7=9A=84=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connection/more/item/more_link_item.ts | 34 +++++++++++-------- src/app/connection/right/nothing.ts | 3 -- .../connection/right/right_edit/right_edit.ts | 2 +- src/shared/components/both_side.ts | 5 +-- src/shared/components/form_item.ts | 9 ++--- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index 01a41c3..e2da222 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -1,11 +1,13 @@ import './more_link_item.less'; -import {WidgetType, Vertical, Img, Label, Layout, Absolute} from '@ui/index'; +import {WidgetType, Vertical, Img, Label, Layout, Absolute, Vtape} from '@ui/index'; import ModelName from './more_link_litem.model'; const className = 'dec.dcm.component.linkSet.morelink.item'; const Widget: WidgetType = { props: { baseCls: 'dec-webui-dcm-connection-more-link-item bi-border', + height: 120, + width: 120, }, _store() { return BI.Models.getModel(ModelName); @@ -20,16 +22,17 @@ const Widget: WidgetType = { const {text, name} = this.options; return { - type: Vertical, + type: Vtape, items: [ { - type: Img, - width: 120, - height: 90, - src: this._buildResourceUrl(name), - }, { type: Absolute, items: [ + { + el: { + type: Img, + src: this._buildResourceUrl(name), + }, + }, { el: { type: Layout, @@ -41,16 +44,17 @@ const Widget: WidgetType = { this.selected = _ref; }, }, - left: 90, - top: -90, + right: 0, }, ], - }, { - type: Label, - cls: 'bi-header-background', - height: 27, - width: 120, - text, + }, + { + el: { + type: Label, + cls: 'bi-header-background', + text, + }, + height: 30, }, ], }; diff --git a/src/app/connection/right/nothing.ts b/src/app/connection/right/nothing.ts index 425ba85..cfe2172 100644 --- a/src/app/connection/right/nothing.ts +++ b/src/app/connection/right/nothing.ts @@ -7,8 +7,6 @@ const Widget: WidgetType = { top: 200, items: [{ type: Vertical, - width: 260, - height: 180, items: [ { type: Layout, @@ -18,7 +16,6 @@ const Widget: WidgetType = { }, { type: Label, - height: 20, text: BI.i18nText('Dec-Dcm_Connection_Plase_Add_One'), }, ], diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index 4ae86f6..38a9cce 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo, TextEditor} from '@ui/index'; +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link_set.model'; diff --git a/src/shared/components/both_side.ts b/src/shared/components/both_side.ts index 452b33b..ff05f20 100644 --- a/src/shared/components/both_side.ts +++ b/src/shared/components/both_side.ts @@ -1,13 +1,14 @@ import {WidgetType, Htape, Label} from '@ui/index'; const BothSide = 'dec.dcm.shared.component.both.side'; const Widget: WidgetType = { + props: { + height: 24, + }, render() { const {leftText, rightText} = this.options; return { type: Htape, - cls: 'both-side', - height: 24, items: [{ el: { type: Label, diff --git a/src/shared/components/form_item.ts b/src/shared/components/form_item.ts index 8cd1341..20c9f51 100644 --- a/src/shared/components/form_item.ts +++ b/src/shared/components/form_item.ts @@ -1,13 +1,14 @@ import {WidgetType, Htape, Label} from '@ui/index'; const className = 'dec.dcm.shared.component.form.item'; const Widget: WidgetType = { + props: { + height: 24, + }, render() { - const {text, form, hint, height, width = 115} = this.options; - + const {text, form, hint, width = 115} = this.options; + return { type: Htape, - cls: 'both-side', - height: height ? height : 24, items: [{ el: { type: Label, From f981258d312b31100a42471ca91cd5ff58823f3b Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 31 May 2019 10:53:50 +0800 Subject: [PATCH 38/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=AD=A3=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/constants.ts | 2 +- src/app/app.ts | 6 +- src/app/connection/link_set.ts | 4 +- .../connection/right/right_edit/right_edit.ts | 505 +++++++++++------- .../right/right_edit/right_edit_jndi.ts | 313 ++++++----- .../right/right_edit/right_edit_mysql.ts | 452 ++++++++++------ .../right/right_show/right_show_jndi.ts | 259 +++++---- .../right/right_title/right_title.ts | 6 +- src/app/status/left/left_item.ts | 1 + src/app/status/link_status.ts | 4 +- src/app/status/right/right.ts | 6 +- src/app/title/item/title_item.ts | 2 +- src/shared/components/form_item.ts | 31 -- src/shared/components/title.ts | 4 +- 14 files changed, 944 insertions(+), 651 deletions(-) delete mode 100644 src/shared/components/form_item.ts diff --git a/private/constants.ts b/private/constants.ts index 80ba494..f882542 100644 --- a/private/constants.ts +++ b/private/constants.ts @@ -1,6 +1,6 @@ export const OTHER_CONNECT = 'other'; export const JNDI_CONNECT = 'JNDI'; -export const MYSQL_CONNECT = 'mysql'; +export const MYSQL_CONNECT = 'MySQL'; export const DEFAULT_INFO = 'DESIGNER'; export const ACTION_DELETE = 'ACTION_DELETE'; export const ACTION_COPY = 'ACTION_COPY'; diff --git a/src/app/app.ts b/src/app/app.ts index f44392b..678d9be 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,4 +1,4 @@ -import {Vtape, Vertical, Absolute} from '../ui/index'; +import {Vtape, Absolute} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; import linkSet from './connection/link_set'; @@ -7,6 +7,9 @@ import '../less/index.less'; const className = 'dec.dcm.main'; const Widget = BI.inherit(BI.Widget, { + props: { + baseCls: 'dec-webui-dcm-layout bi-background', + }, _store() { return BI.Models.getModel(appModel); }, @@ -16,7 +19,6 @@ const Widget = BI.inherit(BI.Widget, { render() { return { type: Vtape, - cls: 'dec-webui-dcm-layout bi-background', items: [ { el: { diff --git a/src/app/connection/link_set.ts b/src/app/connection/link_set.ts index ab3b8c5..07b25c7 100644 --- a/src/app/connection/link_set.ts +++ b/src/app/connection/link_set.ts @@ -6,6 +6,9 @@ import Right from './right/right'; import {TAB_LINK_SET} from '@private/constants'; const className = 'dec.dcm.linkset'; const Widget: WidgetType = { + props: { + baseCls: 'bi-card', + }, _store() { return BI.Models.getModel(linkSetModel); }, @@ -17,7 +20,6 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'bi-card', items: [{ el: { type: Vtape, diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index 38a9cce..edaf66a 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -1,8 +1,7 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor} from '@ui/index'; +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link_set.model'; -import FormItem from '@shared/components/form_item'; import Title from '@shared/components/title'; import {getDrivers, connectNameChecker} from './right_edit.service'; let connectionName: any = null; @@ -31,236 +30,340 @@ const Widget: WidgetType = { vgap: 10, items: [ { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), - hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form: { - type: TextEditor, - width: 300, - value: linkSelected.connectionName, - ref(ref: any) { - connectionName = ref; + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - connectionName: this.getValue(), - }); - }, - }, { - eventName: BI.Editor.EVENT_FOCUS, - action() { - that.store.setConnectionNameErr(''); + { + type: TextEditor, + width: 300, + value: linkSelected.connectionName, + ref(ref: any) { + connectionName = ref; }, - }], - }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + connectionName: this.getValue(), + }); + }, + }, { + eventName: BI.Editor.EVENT_FOCUS, + action() { + that.store.setConnectionNameErr(''); + }, + }], + }, + { + type: Label, + cls: 'bi-water-mark', + lgap: 5, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_First_Step'), - height: 420, - form: { - type: Vertical, - vgap: 10, - items: [ - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form: { - type: TextValueCombo, - width: 300, - text: linkSelected.driver, - items: getDrivers(linkSelected), - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - driver: this.getValue()[0], - }); + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_First_Step'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), }, - }], - }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form: { - type: TextEditor, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.url, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - url: this.getValue(), - }); + { + type: TextValueCombo, + width: 300, + text: linkSelected.driver, + items: getDrivers(linkSelected), + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + driver: this.getValue()[0], + }); + }, + }], }, - }], + ], }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form: { - type: TextValueCombo, - width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, + { + type: VerticalAdapt, items: [ { - text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: '', + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), + }, + { + type: TextEditor, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.url, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + url: this.getValue(), + }); + }, + }], }, - ...CONNECT_CHARSET, ], - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - originalCharsetName: this.getValue()[0], - }); + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), }, - }], + { + type: TextValueCombo, + width: 300, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...CONNECT_CHARSET, + ], + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + originalCharsetName: this.getValue()[0], + }); + }, + }], + }, + ], }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form: { - type: TextEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.user, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - user: this.getValue(), - }); + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.user, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + user: this.getValue(), + }); + }, + }], }, - }], + ], }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form: { - type: TextEditor, - inputType: 'password', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.password, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - password: this.getValue(), - }); + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + }, + { + type: TextEditor, + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.password, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + password: this.getValue(), + }); + }, + }], }, - }], + ], }, - }, - { - type: Title, - text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - height: 100, - form: { - type: TextAreaEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - height: 100, - value: linkSelected.validationQuery, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - validationQuery: this.getValue(), - }); + { + type: Title, + text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), + }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), + }, + { + type: TextAreaEditor, + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + height: 100, + value: linkSelected.validationQuery, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + validationQuery: this.getValue(), + }); + }, + }], }, - }], + ], }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form: { - type: MultiSelectItem, - text: BI.i18nText('Dec-Dcm_Yes'), - selected: linkSelected.testOnBorrow, - width: 60, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - testOnBorrow: this.isSelected(), - }); + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), }, - }], + { + type: MultiSelectItem, + text: BI.i18nText('Dec-Dcm_Yes'), + selected: linkSelected.testOnBorrow, + width: 60, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + testOnBorrow: this.isSelected(), + }); + }, + }], + }, + ], }, - }, - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form: { - type: TextEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 60, - value: linkSelected.maxActive, - errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), - validationChecker: connectNameChecker, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - maxActive: this.getValue(), - }); + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 60, + value: linkSelected.maxActive, + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), + validationChecker: connectNameChecker, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + maxActive: this.getValue(), + }); + }, + }], }, - }], + ], }, - }, - ], - }, + ], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Second_Step'), - form: { - type: Button, - width: 80, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - level: 'ignore', - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Second_Step'), + }, + { + type: Button, + width: 80, + text: BI.i18nText('Dec-Dcm_Test_Connection'), + level: 'ignore', + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Third_Step'), - form: { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), - form: { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Third_Step'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), + }, + { type: TextEditor, width: 300, disabled: true, }, - }, + ], }, ], }; diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts index 4a789d9..8c56730 100644 --- a/src/app/connection/right/right_edit/right_edit_jndi.ts +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -1,5 +1,4 @@ -import {Vertical, Editor, TextValueCombo, TextButton, Label, TextEditor} from '@ui'; -import FormItem from '@shared/components/form_item'; +import {Vertical, TextValueCombo, TextButton, Label, TextEditor, VerticalAdapt} from '@ui'; import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants'; import {AttributeType} from '../right.typing'; import ModelName from './right_edit.model'; @@ -11,9 +10,7 @@ const Widget = BI.inherit(BI.Widget, { }, watch: { isCollapse(isCollapse) { - const height = isCollapse ? 550 : 200; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.jndiFormRef.setHeight(height); this.collapseRef.setText(text); this.otherAttributesRef.setVisible(isCollapse); }, @@ -26,152 +23,204 @@ const Widget = BI.inherit(BI.Widget, { vgap: 10, items: [ { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), - form: { - type: TextEditor, - width: 300, - allowBlank: true, - value: connectionName, - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: connectionName, + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 200, - ref: _ref => { - this.jndiFormRef = _ref; - }, - form: { - type: Vertical, - vgap: 10, - items: [ - { - type: FormItem, - text: 'INTIAL_CONTEXT_FACTORY', - width: 180, - form: { - type: TextValueCombo, - width: 300, - value: factory, - items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { - return { - text: item, - value: item, - }; - }), - }, - }, - { - type: FormItem, - text: 'PROVIDER_URL', - width: 180, - form: { - type: TextEditor, - width: 300, - allowBlank: true, - value: url, - }, - }, - { - type: FormItem, - text: 'SECURITY_PRINCIPAL', - width: 180, - form: { - type: TextEditor, - width: 300, - allowBlank: true, - value: principal, - }, - }, - { - type: FormItem, - text: 'SECURITY_CREDENTIALS', - width: 180, - form: { - type: TextEditor, - width: 300, - allowBlank: true, - value: credentials, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'INTIAL_CONTEXT_FACTORY', + }, + { + type: TextValueCombo, + width: 300, + value: factory, + items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { + return { + text: item, + value: item, + }; + }), + }, + ], }, - }, - { - type: FormItem, - width: 180, - form: { - type: TextButton, - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), - width: 300, - textAlign: 'right', - ref: _ref => { - this.collapseRef = _ref; - }, - handler: () => { - this.store.setIsCollapse(!this.model.isCollapse); - }, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'PROVIDER_URL', + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: url, + }, + ], }, - }, - { - type: Vertical, - invisible: true, - ref: _ref => { - this.otherAttributesRef = _ref; + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_PRINCIPAL', + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: principal, + }, + ], }, - items: BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { - return { - type: FormItem, - text: item.text, - width: 180, - form: { + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_CREDENTIALS', + }, + { type: TextEditor, width: 300, allowBlank: true, - value: this.options[item.name], + value: credentials, }, - }; - }), - }, - ], - }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 480, + textAlign: 'right', + ref: _ref => { + this.collapseRef = _ref; + }, + handler: () => { + this.store.setIsCollapse(!this.model.isCollapse); + }, + }, + ], + }, + { + type: Vertical, + invisible: true, + ref: _ref => { + this.otherAttributesRef = _ref; + }, + items: this._getOtherItems(), + }, + ], + }, + ], }, { - type: FormItem, - text: '', - height: 25, - form: { - type: Label, - cls: 'bi-error', - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), - }, + type: Label, + cls: 'bi-error', + lgap: 10, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), - height: 40, - form: { - type: Vertical, - items: [ - { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - width: 180, - form: { - type: TextValueCombo, - width: 300, - items: [{ - text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: originalCharsetName, - }, - ...CONNECT_CHARSET, - ], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: TextValueCombo, + width: 300, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: originalCharsetName, }, - ], - }, + ...CONNECT_CHARSET, + ], + }, + ], }, ], }; }, + _getOtherItems() { + return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { + return { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: item.text, + }, + { + type: TextEditor, + width: 300, + allowBlank: true, + value: this.options[item.name], + }, + ], + }; + }); + }, }); BI.shortcut(classNameEdit, Widget); export default classNameEdit; diff --git a/src/app/connection/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts index 03da872..0d36f01 100644 --- a/src/app/connection/right/right_edit/right_edit_mysql.ts +++ b/src/app/connection/right/right_edit/right_edit_mysql.ts @@ -1,15 +1,26 @@ -import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor} from '@ui/index'; +import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Button, TextValueCombo, TextEditor, VerticalAdapt, Label} from '@ui/index'; import {LinkType} from '@ui/type'; import {CONNECT_CHARSET} from '@private/constants'; import Model from '../../link_set.model'; -import FormItem from '@shared/components/form_item'; import Title from '@shared/components/title'; import {getDrivers, connectNameChecker} from './right_edit.service'; +let connectionName: any = null; const className = 'dec.dcm.component.right.edit.mysql'; const Widget: WidgetType = { _store() { return BI.Models.getModel(Model); }, + watch: { + connectionNameErr(msg: string) { + if (msg) { + BI.Bubbles.show('singleBubble', msg, connectionName, { + level: 'error', + }); + } else { + BI.Bubbles.hide('singleBubble'); + } + }, + }, render() { const linkSelected: LinkType = this.model.linkSelected; const that = this; @@ -19,203 +30,292 @@ const Widget: WidgetType = { vgap: 10, items: [ { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), - hint: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), - form: { - type: TextEditor, - width: 300, - value: linkSelected.connectionName, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - connectionName: this.getValue(), - }); + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName'), + }, + { + type: TextEditor, + width: 300, + value: linkSelected.connectionName, + ref(ref: any) { + connectionName = ref; }, - }], - }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + connectionName: this.getValue(), + }); + }, + }, { + eventName: BI.Editor.EVENT_FOCUS, + action() { + that.store.setConnectionNameErr(''); + }, + }], + }, + { + type: Label, + cls: 'bi-water-mark', + lgap: 5, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_ConnectionName-Change-Confirm'), + }, + ], }, + { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - form: { - type: TextValueCombo, - width: 300, - text: linkSelected.driver, - items: getDrivers(linkSelected), - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - driver: this.getValue()[0], - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.driver, + items: getDrivers(linkSelected), + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + driver: this.getValue()[0], + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), - form: { - type: TextEditor, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.url, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - url: this.getValue(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_URL'), + }, + { + type: TextEditor, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.url, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + url: this.getValue(), + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form: { - type: TextValueCombo, - width: 300, - text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, - items: [ - { - text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - value: '', - }, - ...CONNECT_CHARSET, - ], - listeners: [{ - eventName: BI.TextValueCombo.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - originalCharsetName: this.getValue()[0], - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: TextValueCombo, + width: 300, + text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + value: '', + }, + ...CONNECT_CHARSET, + ], + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + originalCharsetName: this.getValue()[0], + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - form: { - type: TextEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.user, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - user: this.getValue(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.user, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + user: this.getValue(), + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - form: { - type: TextEditor, - inputType: 'password', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - value: linkSelected.password, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - password: this.getValue(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + }, + { + type: TextEditor, + inputType: 'password', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + value: linkSelected.password, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + password: this.getValue(), + }); + }, + }], + }, + ], }, { type: Title, text: BI.i18nText('Dec-Dcm_Connection_Form_Pool_Properties'), }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - height: 100, - form: { - type: TextAreaEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 300, - height: 100, - value: linkSelected.validationQuery, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - validationQuery: this.getValue(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), + }, + { + type: TextAreaEditor, + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 300, + height: 100, + value: linkSelected.validationQuery, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + validationQuery: this.getValue(), + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), - form: { - type: MultiSelectItem, - text: BI.i18nText('Dec-Dcm_Yes'), - selected: linkSelected.testOnBorrow, - width: 60, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - testOnBorrow: this.isSelected(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), + }, + { + type: MultiSelectItem, + text: BI.i18nText('Dec-Dcm_Yes'), + selected: linkSelected.testOnBorrow, + width: 60, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + testOnBorrow: this.isSelected(), + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), - form: { - type: TextEditor, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - width: 60, - value: linkSelected.maxActive, - errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), - validationChecker: connectNameChecker, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action() { - that.store.setLinkUpdate({ - ...that.model.linkUpdate, - maxActive: this.getValue(), - }); - }, - }], - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_Connection_Max_Number'), + }, + { + type: TextEditor, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + width: 60, + value: linkSelected.maxActive, + errorText: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input-Number'), + validationChecker: connectNameChecker, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action() { + that.store.setLinkUpdate({ + ...that.model.linkUpdate, + maxActive: this.getValue(), + }); + }, + }], + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - form: { - type: Button, - text: BI.i18nText('Dec-Dcm_Test_Connection'), - level: 'ignore', - }, + type: VerticalAdapt, + items: [ + { + type: Button, + width: 80, + text: BI.i18nText('Dec-Dcm_Test_Connection'), + level: 'ignore', + }, + ], }, ], }; diff --git a/src/app/connection/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts index 65967b0..d4db6e1 100644 --- a/src/app/connection/right/right_show/right_show_jndi.ts +++ b/src/app/connection/right/right_show/right_show_jndi.ts @@ -1,5 +1,4 @@ -import {Vertical, TextButton, Label} from '@ui'; -import FormItem from '@shared/components/form_item'; +import {Vertical, TextButton, Label, VerticalAdapt} from '@ui'; import {OTHER_ATTRIBUTES} from '@private/constants'; import {AttributeType} from '../right.typing'; import ModelName from './right_show.model'; @@ -11,9 +10,7 @@ const Widget = BI.inherit(BI.Widget, { }, watch: { isCollapse(isCollapse) { - const height = isCollapse ? 550 : 200; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.jndiFormRef.setHeight(height); this.collapseRef.setText(text); this.otherAttributesRef.setVisible(isCollapse); }, @@ -26,119 +23,181 @@ const Widget = BI.inherit(BI.Widget, { vgap: 10, items: [ { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), - form: { - type: Label, - text: connectionName, - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), + }, + { + type: Label, + text: connectionName, + }, + ], }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 200, - ref: _ref => { - this.jndiFormRef = _ref; - }, - form: { - type: Vertical, - vgap: 10, - items: [ - { - type: FormItem, - text: 'INTIAL_CONTEXT_FACTORY', - width: 180, - form: { - type: Label, - text: factory, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), + }, + { + type: Vertical, + vgap: 10, + items: [ + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'INTIAL_CONTEXT_FACTORY', + }, + { + type: Label, + text: factory, + }, + ], }, - }, - { - type: FormItem, - text: 'PROVIDER_URL', - width: 180, - form: { - type: Label, - text: url, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'PROVIDER_URL', + }, + { + type: Label, + text: url, + }, + ], }, - }, - { - type: FormItem, - text: 'SECURITY_PRINCIPAL', - width: 180, - form: { - type: Label, - text: principal, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_PRINCIPAL', + }, + { + type: Label, + value: principal, + }, + ], }, - }, - { - type: FormItem, - text: 'SECURITY_CREDENTIALS', - width: 180, - form: { - type: Label, - text: credentials, + { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: 'SECURITY_CREDENTIALS', + }, + { + type: Label, + value: credentials, + }, + ], + }, + { + type: VerticalAdapt, + items: [ + { + type: TextButton, + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), + width: 480, + textAlign: 'right', + ref: _ref => { + this.collapseRef = _ref; + }, + handler: () => { + this.store.setIsCollapse(!this.model.isCollapse); + }, + }, + ], }, - }, - { - type: FormItem, - width: 180, - form: { - type: TextButton, - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'), - width: 300, - textAlign: 'right', - value: true, + { + type: Vertical, + invisible: true, ref: _ref => { - this.collapseRef = _ref; + this.otherAttributesRef = _ref; }, - handler: () => { - this.store.setIsCollapse(!this.model.isCollapse); - }, - }, - }, - { - type: Vertical, - invisible: true, - ref: _ref => { - this.otherAttributesRef = _ref; + items: this._getOtherItems(), }, - items: BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { - return { - type: FormItem, - text: item.text, - width: 180, - form: { - type: Label, - text: this.options[item.name], - }, - }; - }), - }, - ], - }, + ], + }, + ], }, { - type: FormItem, - text: '', - height: 25, - form: { - type: Label, - cls: 'bi-error', - text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), - }, + type: Label, + cls: 'bi-error', + lgap: 10, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Notice'), }, { - type: FormItem, - text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - form: { - type: Label, - text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), - }, + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 115, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Advanced'), + }, + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + }, + { + type: Label, + text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), + }, + ], }, ], }; }, + _getOtherItems() { + return BI.map(OTHER_ATTRIBUTES, (index: number, item: AttributeType) => { + return { + type: VerticalAdapt, + items: [ + { + type: Label, + cls: 'bi-font-bold', + width: 180, + textAlign: 'left', + text: item.text, + }, + { + type: Label, + value: this.options[item.name], + }, + ], + }; + }); + }, }); BI.shortcut(className, Widget); export default className; diff --git a/src/app/connection/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts index ea60e76..ed988d0 100644 --- a/src/app/connection/right/right_title/right_title.ts +++ b/src/app/connection/right/right_title/right_title.ts @@ -1,9 +1,12 @@ -import {WidgetType, Left, Label, Button, LeftRightVerticalAdapt} from '@ui/index'; +import {WidgetType, Label, Button, LeftRightVerticalAdapt} from '@ui/index'; import RightTitleModel from '../../link_set.model'; import {LinkType} from '@ui/type'; import {OTHER_CONNECT} from '@private/constants'; const className = 'dec.dcm.component.right.title'; const Widget: WidgetType = { + props: { + baseCls: 'bi-border-bottom', + }, _store() { return BI.Models.getModel(RightTitleModel); }, @@ -17,7 +20,6 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, height: 40, - cls: 'bi-border-bottom', items: { left: [ { diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index fe90df6..6ee3a49 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -6,6 +6,7 @@ const Widget: WidgetType = { title: '', id: '', creator: '', + baseCls: 'bi-list-item-active', }, _store() { return BI.Models.getModel(Model); diff --git a/src/app/status/link_status.ts b/src/app/status/link_status.ts index 66c56a5..80f2687 100644 --- a/src/app/status/link_status.ts +++ b/src/app/status/link_status.ts @@ -6,6 +6,9 @@ import {TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.linkstatus'; const Widget: WidgetType = { + props: { + baseCls: 'bi-card', + }, _store() { return BI.Models.getModel(linkStatusModel); }, @@ -17,7 +20,6 @@ const Widget: WidgetType = { render() { return { type: Htape, - cls: 'bi-card', items: [{ el: { type: Vtape, diff --git a/src/app/status/right/right.ts b/src/app/status/right/right.ts index ceb454e..4c3d3ab 100644 --- a/src/app/status/right/right.ts +++ b/src/app/status/right/right.ts @@ -6,9 +6,12 @@ import {InfoType} from './right.typings'; import {LinkType} from '@ui/type'; import pluginListConstant from '../../app.constant'; -const className = 'dec.dcm.component.linkStatus.right'; +const className = 'dcm-link-form'; const Widget: WidgetType = { + props: { + baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', + }, _store() { return BI.Models.getModel(Model); }, @@ -30,7 +33,6 @@ const Widget: WidgetType = { render() { return { type: Vertical, - cls: 'dcm-link-form', items: [ { type: VerticalAdapt, diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts index 3690a51..6b92eb6 100644 --- a/src/app/title/item/title_item.ts +++ b/src/app/title/item/title_item.ts @@ -4,6 +4,7 @@ import {getSelectStyle} from './title_item.service'; const className = 'dec.dcm.title.item'; const Widget = BI.inherit(BI.BasicButton, { props: { + baseCls: 'bi-font-bold', text: '', }, _store() { @@ -20,7 +21,6 @@ const Widget = BI.inherit(BI.BasicButton, { return { type: Label, - cls: 'bi-font-bold', height: 40, hgap: 15, text, diff --git a/src/shared/components/form_item.ts b/src/shared/components/form_item.ts deleted file mode 100644 index 20c9f51..0000000 --- a/src/shared/components/form_item.ts +++ /dev/null @@ -1,31 +0,0 @@ -import {WidgetType, Htape, Label} from '@ui/index'; -const className = 'dec.dcm.shared.component.form.item'; -const Widget: WidgetType = { - props: { - height: 24, - }, - render() { - const {text, form, hint, width = 115} = this.options; - - return { - type: Htape, - items: [{ - el: { - type: Label, - cls: 'bi-font-bold', - textAlign: 'left', - text, - }, - width, - }, form, hint ? { - type: Label, - cls: 'bi-water-mark', - lgap: 5, - textAlign: 'left', - text: hint, - } : null], - }; - }, -}; -BI.shortcut(className, BI.inherit(BI.Widget, Widget)); -export default className; diff --git a/src/shared/components/title.ts b/src/shared/components/title.ts index 0cda0af..f1843e2 100644 --- a/src/shared/components/title.ts +++ b/src/shared/components/title.ts @@ -1,12 +1,14 @@ import {WidgetType, Label} from '@ui/index'; const className = 'dec.dcm.shared.component.title'; const Widget: WidgetType = { + props: { + baseCls: 'bi-tips bi-border-bottom', + }, render() { const {text} = this.options; return { type: Label, - cls: 'bi-water-mark bi-border-bottom', height: 24, bgap: 10, textAlign: 'left', From c0466eb0b2b161f5024e88a525e667f833f03eff Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 31 May 2019 15:33:43 +0800 Subject: [PATCH 39/44] =?UTF-8?q?refactor:=20=E9=80=BB=E8=BE=91=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=94=BE=E5=88=B0model=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/link_set.mixin.ts | 50 +++++++++++++++++++ src/app/connection/link_set.model.ts | 46 +---------------- .../right/right_detail/right_detail.model.ts | 4 -- .../right/right_title/right_title.model.ts | 20 ++++++++ .../right/right_title/right_title.ts | 9 +--- 5 files changed, 74 insertions(+), 55 deletions(-) create mode 100644 src/app/connection/link_set.mixin.ts create mode 100644 src/app/connection/right/right_title/right_title.model.ts diff --git a/src/app/connection/link_set.mixin.ts b/src/app/connection/link_set.mixin.ts new file mode 100644 index 0000000..45f487d --- /dev/null +++ b/src/app/connection/link_set.mixin.ts @@ -0,0 +1,50 @@ +import {LinkType} from '@ui/type'; +import {saveConnection} from './link_set.service'; + +const mixinName = 'dec.dcm.minxin.linkset'; +const Mixin = { + setConnectionNameErr(err: string) { + this.model.connectionNameErr = err; + }, + setEdit(type: boolean) { + this.model.linkSelected = { + ...this.model.linkSelected, + isSelected: type, + }; + this.model.linkUpdate = this.model.linkSelected; + }, + setCancel() { + const linkSelected: LinkType = this.model.linkSelected; + const linkList: LinkType[] = this.model.linkList; + if (linkSelected.connectionId) { + this.setEdit(false); + } else { + this.model.linkList = [ + ...linkList.filter(item => !!item.connectionId), + ]; + if (this.model.linkList.length > 0) { + this.model.linkList[0].isSelected = true; + this.model.linkSelected = { + ...this.model.linkList[0], + isSelected: false, + }; + } else { + this.model.linkSelected = {}; + } + this.model.linkUpdate = this.model.linkSelected; + } + }, + saveLink() { + const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {}; + const update = { + ...this.model.linkUpdate, + ...pluginData, + }; + saveConnection(update).then(() => { + this.setEdit(false); + }); + }, +}; + +Fix.mixin(mixinName, Mixin); +export default mixinName; diff --git a/src/app/connection/link_set.model.ts b/src/app/connection/link_set.model.ts index 3144f41..f61bd13 100644 --- a/src/app/connection/link_set.model.ts +++ b/src/app/connection/link_set.model.ts @@ -3,10 +3,11 @@ import {deleteConnection, testConnection} from '@shared/crud/crud.request'; import {getCnnectionName} from './select/select.service'; import {DATA_BASE_TYPE} from '@private/constants'; import dialog from '@shared/service/dialog.service'; -import {saveConnection} from './link_set.service'; +import Mixin from './link_set.mixin'; const className = 'dec.dcm.model.linkset'; const Model = { context: ['tab', 'linkList', 'linkSelected', 'linkUpdate', 'connectionNameErr'], + mixins: [Mixin], actions: { /** * 左侧点击链接选中 @@ -38,7 +39,6 @@ const Model = { break; } }, - copyLink(id: string) { const connectionName = BI.find(this.model.linkList, (index: number, item: LinkType) => item.connectionId === id).connectionName; const name = getCnnectionName(this.model.linkList, connectionName); @@ -68,34 +68,6 @@ const Model = { setLinkUpdate(value: any) { this.model.linkUpdate = value; }, - setEdit(type: boolean) { - this.model.linkSelected = { - ...this.model.linkSelected, - isSelected: type, - }; - this.model.linkUpdate = this.model.linkSelected; - }, - setCancel() { - const linkSelected: LinkType = this.model.linkSelected; - const linkList: LinkType[] = this.model.linkList; - if (linkSelected.connectionId) { - this.setEdit(false); - } else { - this.model.linkList = [ - ...linkList.filter(item => !!item.connectionId), - ]; - if (this.model.linkList.length > 0) { - this.model.linkList[0].isSelected = true; - this.model.linkSelected = { - ...this.model.linkList[0], - isSelected: false, - }; - } else { - this.model.linkSelected = {}; - } - this.model.linkUpdate = this.model.linkSelected; - } - }, setNewLink(value: string) { if (!DATA_BASE_TYPE.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find')); @@ -106,20 +78,6 @@ const Model = { this._setNewLink(value); }); }, - - setConnectionNameErr(err: string) { - this.model.connectionNameErr = err; - }, - saveLink() { - const pluginData = this.model.linkUpdate.text ? BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`) : {}; - const update = { - ...this.model.linkUpdate, - ...pluginData, - }; - saveConnection(update).then(() => { - this.setEdit(false); - }); - }, }, _setLinkSelected(name: string) { this.model.linkList.forEach((item: LinkType) => { diff --git a/src/app/connection/right/right_detail/right_detail.model.ts b/src/app/connection/right/right_detail/right_detail.model.ts index fed6e29..5a61555 100644 --- a/src/app/connection/right/right_detail/right_detail.model.ts +++ b/src/app/connection/right/right_detail/right_detail.model.ts @@ -1,10 +1,6 @@ const className = 'dec.dcm.model.link.set.right.detail'; export const Model = BI.inherit(Fix.Model, { - context: ['linkSelected'], - actions: { - - }, }); BI.model(className, Model); export default className; diff --git a/src/app/connection/right/right_title/right_title.model.ts b/src/app/connection/right/right_title/right_title.model.ts new file mode 100644 index 0000000..6c54731 --- /dev/null +++ b/src/app/connection/right/right_title/right_title.model.ts @@ -0,0 +1,20 @@ +import LinksetMixin from '../../link_set.mixin'; +import {LinkType} from '@ui/type'; +const modelName = 'dec.dcm.model.component.right.title'; +export const Model = BI.inherit(Fix.Model, { + context: ['linkSelected', 'linkList', 'linkUpdate'], + mixins: [LinksetMixin], + actions: { + onSave() { + const linkList: LinkType[] = this.model.linkList; + const result = BI.find(linkList, (idx: number, value: LinkType) => this.model.linkUpdate.connectionName === value.connectionName && value.connectionId !== this.model.linkUpdate.connectionId); + if (result) { + this.setConnectionNameErr(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); + } else { + this.saveLink(); + } + }, + }, +}); +BI.model(modelName, Model); +export default modelName; diff --git a/src/app/connection/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts index ed988d0..3a08d9f 100644 --- a/src/app/connection/right/right_title/right_title.ts +++ b/src/app/connection/right/right_title/right_title.ts @@ -1,5 +1,5 @@ import {WidgetType, Label, Button, LeftRightVerticalAdapt} from '@ui/index'; -import RightTitleModel from '../../link_set.model'; +import RightTitleModel from './right_title.model'; import {LinkType} from '@ui/type'; import {OTHER_CONNECT} from '@private/constants'; const className = 'dec.dcm.component.right.title'; @@ -56,12 +56,7 @@ const Widget: WidgetType = { invisible: !isEdit, 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('Dec-Dcm_Connection_Is_Existence')); - } else { - that.store.saveLink(); - } + that.store.onSave(); }, }, ], From 076edbadcfed5885216f2265bb1e0919da53f112 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 3 Jun 2019 10:11:06 +0800 Subject: [PATCH 40/44] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/more/item/more_link_item.less | 2 +- src/app/connection/right/right_title/right_title.ts | 1 - src/app/status/link_status.ts | 3 ++- src/app/title/item/title_item.ts | 5 ++++- src/app/title/title.less | 3 ++- src/app/title/title.ts | 9 ++++----- src/shared/crud/crud.request.ts | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/app/connection/more/item/more_link_item.less b/src/app/connection/more/item/more_link_item.less index 8bcc779..fd3ff0f 100644 --- a/src/app/connection/more/item/more_link_item.less +++ b/src/app/connection/more/item/more_link_item.less @@ -1,6 +1,6 @@ @import '../../../../less/index.less'; .dec-webui-dcm-connection-more-link-item{ &:hover{ - border: solid 1px @border-color-highlight; + border-color :@border-color-highlight; } } \ No newline at end of file diff --git a/src/app/connection/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts index 3a08d9f..a75c6f9 100644 --- a/src/app/connection/right/right_title/right_title.ts +++ b/src/app/connection/right/right_title/right_title.ts @@ -12,7 +12,6 @@ const Widget: WidgetType = { }, render() { const linkSelected: LinkType = this.model.linkSelected; - const linkList: LinkType[] = this.model.linkList; const that = this; const {isEdit} = this.options; const title = linkSelected.text === OTHER_CONNECT ? BI.i18nText('Dec-Dcm_Connection_Other') : linkSelected.text; diff --git a/src/app/status/link_status.ts b/src/app/status/link_status.ts index 80f2687..12b6503 100644 --- a/src/app/status/link_status.ts +++ b/src/app/status/link_status.ts @@ -23,7 +23,7 @@ const Widget: WidgetType = { items: [{ el: { type: Vtape, - cls: 'dcm-link-left bi-border-right', + cls: 'dcm-link-left', items: [ { el: { @@ -49,6 +49,7 @@ const Widget: WidgetType = { width: 280, }, { type: Right, + cls: 'bi-border-left', }], }; }, diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts index 6b92eb6..b271a34 100644 --- a/src/app/title/item/title_item.ts +++ b/src/app/title/item/title_item.ts @@ -13,7 +13,7 @@ const Widget = BI.inherit(BI.BasicButton, { watch: { tab(tab: string) { const {value} = this.options; - this.element.css(getSelectStyle(value, tab)); + this.title.setStyle(getSelectStyle(value, tab)); }, }, render() { @@ -23,6 +23,9 @@ const Widget = BI.inherit(BI.BasicButton, { type: Label, height: 40, hgap: 15, + ref: _ref => { + this.title = _ref; + }, text, }; }, diff --git a/src/app/title/title.less b/src/app/title/title.less index 7137334..83f12f1 100644 --- a/src/app/title/title.less +++ b/src/app/title/title.less @@ -2,6 +2,7 @@ .dec-webui-dcm-title{ .title-item-selected{ color: @background-color-highlight; - border-bottom: solid 2px @border-color-highlight; + border-bottom-color:@border-color-highlight; + border-bottom-width: 2px; } } \ No newline at end of file diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 924065d..0cb46c4 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -9,7 +9,7 @@ const Widget: WidgetType = { baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', }, render() { - const hideCloseButton = isDesigner(); + const showCloseButton = isDesigner(); return { type: LeftRightVerticalAdapt, @@ -17,7 +17,7 @@ const Widget: WidgetType = { left: [ { type: TitleItem, - cls: 'title-item-selected', + cls: 'title-item-selected bi-border-bottom', text: BI.i18nText('Dec-Dcm_Connection_Management'), value: TAB_LINK_SET, }, @@ -28,17 +28,16 @@ const Widget: WidgetType = { }, ], right: [ - { + showCloseButton ? { type: IconButton, cls: 'close-ha-font', - invisible: !hideCloseButton, width: 30, height: 30, rgap: 10, handler() { closeWindow(); }, - }, + } : null, ], }, }; diff --git a/src/shared/crud/crud.request.ts b/src/shared/crud/crud.request.ts index de71075..0eab64d 100644 --- a/src/shared/crud/crud.request.ts +++ b/src/shared/crud/crud.request.ts @@ -11,7 +11,7 @@ export function isDesigner(): boolean { return PluginHelper.isDesigner(); } - return true; + return false; } /** From 00556ad4b540f205ebb9beff60a3c7253fefa9ce Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 3 Jun 2019 14:38:46 +0800 Subject: [PATCH 41/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=AD=A3=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/left/item/left_item.ts | 7 ++--- .../connection/left/item/left_item_delete.ts | 4 +-- .../connection/left/item/left_item_icon.ts | 4 +-- .../connection/more/item/more_link_item.ts | 2 +- src/app/connection/more/more_link.ts | 5 ++- .../right/right_title/right_title.ts | 1 - src/app/connection/select/select.ts | 1 - src/app/status/left/left_item.ts | 1 - src/app/status/right/right.ts | 31 ++++++++++--------- src/app/status/right/right_card.ts | 10 ------ 10 files changed, 25 insertions(+), 41 deletions(-) diff --git a/src/app/connection/left/item/left_item.ts b/src/app/connection/left/item/left_item.ts index e4b7335..4e88046 100644 --- a/src/app/connection/left/item/left_item.ts +++ b/src/app/connection/left/item/left_item.ts @@ -20,21 +20,18 @@ const Widget: WidgetType = { return { type: LeftRightVerticalAdapt, - height: 24, items: { left: [ { type: Icon, cls: 'dcm-link-font', - height: 24, - width: 26, + height: 25, + width: 25, text: BI.i18nText('Dec-Dcm_Connections'), title, }, { type: TextButton, - textHeight: 24, - textAlign: 'left', text: title, title, }, diff --git a/src/app/connection/left/item/left_item_delete.ts b/src/app/connection/left/item/left_item_delete.ts index c21f9f8..ad56b54 100644 --- a/src/app/connection/left/item/left_item_delete.ts +++ b/src/app/connection/left/item/left_item_delete.ts @@ -19,8 +19,8 @@ const Widget: WidgetType = { }, el: { type: Icon, - height: 24, - width: 26, + height: 25, + width: 25, title, }, popup: { diff --git a/src/app/connection/left/item/left_item_icon.ts b/src/app/connection/left/item/left_item_icon.ts index a597f02..d16ed76 100644 --- a/src/app/connection/left/item/left_item_icon.ts +++ b/src/app/connection/left/item/left_item_icon.ts @@ -11,8 +11,8 @@ const Widget: WidgetType = { return { type: IconButton, - height: 24, - width: 26, + height: 25, + width: 25, stopPropagation: true, title, handler: () => { diff --git a/src/app/connection/more/item/more_link_item.ts b/src/app/connection/more/item/more_link_item.ts index e2da222..23c5628 100644 --- a/src/app/connection/more/item/more_link_item.ts +++ b/src/app/connection/more/item/more_link_item.ts @@ -1,5 +1,5 @@ import './more_link_item.less'; -import {WidgetType, Vertical, Img, Label, Layout, Absolute, Vtape} from '@ui/index'; +import {WidgetType, Img, Label, Layout, Absolute, Vtape} from '@ui/index'; import ModelName from './more_link_litem.model'; const className = 'dec.dcm.component.linkSet.morelink.item'; diff --git a/src/app/connection/more/more_link.ts b/src/app/connection/more/more_link.ts index b2ce288..4d21a1a 100644 --- a/src/app/connection/more/more_link.ts +++ b/src/app/connection/more/more_link.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; +import {WidgetType, SearchEditor, Left, Vtape, VerticalAdapt} from '@ui/index'; import {DATA_BASE_TYPE_OTHER} from '@private/constants'; import MoreLinkItem from './item/more_link_item'; import ModelName from './more_link.model'; @@ -13,7 +13,7 @@ const Widget: WidgetType = { items: [ { el: { - type: Vertical, + type: VerticalAdapt, items: [{ type: SearchEditor, width: 300, @@ -25,7 +25,6 @@ const Widget: WidgetType = { { type: Left, scrolly: true, - width: 528, tgap: 2, rgap: 2, bgap: 2, diff --git a/src/app/connection/right/right_title/right_title.ts b/src/app/connection/right/right_title/right_title.ts index a75c6f9..f3995f3 100644 --- a/src/app/connection/right/right_title/right_title.ts +++ b/src/app/connection/right/right_title/right_title.ts @@ -25,7 +25,6 @@ const Widget: WidgetType = { type: Label, cls: 'bi-font-bold', hgap: 10, - textHeight: 40, text: `${BI.i18nText('Dec-Dcm_Data_Connections')}(${title ? title : BI.i18nText('Dec-Dcm_Default')})`, }, ], diff --git a/src/app/connection/select/select.ts b/src/app/connection/select/select.ts index 22854c7..10dd883 100644 --- a/src/app/connection/select/select.ts +++ b/src/app/connection/select/select.ts @@ -16,7 +16,6 @@ const Widget: WidgetType = { el: { type: 'bi.button', text: BI.i18nText('Dec-Dcm_Connection_New'), - height: 24, }, popup: { el: { diff --git a/src/app/status/left/left_item.ts b/src/app/status/left/left_item.ts index 6ee3a49..0a4ee89 100644 --- a/src/app/status/left/left_item.ts +++ b/src/app/status/left/left_item.ts @@ -22,7 +22,6 @@ const Widget: WidgetType = { { type: TextButton, cls: 'link-title', - textHeight: 30, lgap: 10, textAlign: 'left', text: title, diff --git a/src/app/status/right/right.ts b/src/app/status/right/right.ts index 4c3d3ab..71c1cd9 100644 --- a/src/app/status/right/right.ts +++ b/src/app/status/right/right.ts @@ -1,4 +1,4 @@ -import {WidgetType, Vertical, Left, Label, ListView, VerticalAdapt} from '@ui/index'; +import {WidgetType, Label, ListView, VerticalAdapt, Vtape} from '@ui/index'; import Model from './right.model'; import {info} from '@shared/crud/crud.request'; import RightCard from './right_card'; @@ -32,24 +32,25 @@ const Widget: WidgetType = { }, render() { return { - type: Vertical, + type: Vtape, items: [ { - type: VerticalAdapt, - cls: 'bi-border-bottom', - height: 40, - items: [ - { - type: Label, - cls: 'bi-font-bold', - textHeight: 40, - lgap: 10, - text: BI.i18nText('Dec-Dcm_Data_Connections'), + el: { + type: VerticalAdapt, + cls: 'bi-border-bottom', + items: [ + { + type: Label, + cls: 'bi-font-bold', + lgap: 10, + text: BI.i18nText('Dec-Dcm_Data_Connections'), + }, + ], + ref: _ref => { + this.statusTitle = _ref; }, - ], - ref: _ref => { - this.statusTitle = _ref; }, + height: 40, }, { type: ListView, cls: 'right-status-body', diff --git a/src/app/status/right/right_card.ts b/src/app/status/right/right_card.ts index 1cdb719..3894c95 100644 --- a/src/app/status/right/right_card.ts +++ b/src/app/status/right/right_card.ts @@ -16,7 +16,6 @@ const Widget: WidgetType = { { type: Vertical, cls: 'bi-background', - height: 150, items: [ { type: CenterAdapt, @@ -29,17 +28,14 @@ const Widget: WidgetType = { { type: Label, cls: 'bi-high-light card-font-success', - textHeight: 40, text: numActive, }, { type: Label, - textHeight: 40, text: '/', }, { type: Label, - textHeight: 40, text: maxActive, }, ], @@ -48,7 +44,6 @@ const Widget: WidgetType = { }, { type: Label, - height: 20, text: BI.i18nText('Dec-Dcm_Active_Connections_Number'), }, ], @@ -56,7 +51,6 @@ const Widget: WidgetType = { { type: Vertical, cls: 'bi-background', - height: 150, items: [ { type: CenterAdapt, @@ -69,17 +63,14 @@ const Widget: WidgetType = { { type: Label, cls: 'bi-high-light card-font-heighlight', - textHeight: 40, text: numIdle, }, { type: Label, - textHeight: 40, text: '/', }, { type: Label, - textHeight: 40, text: maxIdle, }, ], @@ -88,7 +79,6 @@ const Widget: WidgetType = { }, { type: Label, - height: 20, text: BI.i18nText('Dec-Dcm_Leisure_Connections_Number'), }, ], From d818088216d35ab76dc6245b7649494417625367 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 3 Jun 2019 15:09:29 +0800 Subject: [PATCH 42/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=AD=A3=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/connection/right/nothing.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/connection/right/nothing.ts b/src/app/connection/right/nothing.ts index cfe2172..4840ead 100644 --- a/src/app/connection/right/nothing.ts +++ b/src/app/connection/right/nothing.ts @@ -1,17 +1,20 @@ -import {WidgetType, CenterAdapt, Vertical, Layout, Label} from '@ui/index'; +import {WidgetType, Layout, Label, HorizotalAdapt, Vtape} from '@ui/index'; const className = 'dec.dcm.component.right.nothing'; const Widget: WidgetType = { render() { return { - type: CenterAdapt, + type: HorizotalAdapt, top: 200, items: [{ - type: Vertical, + type: Vtape, + width: 260, + height: 150, items: [ { - type: Layout, - cls: 'data-connection-background', - width: 260, + el: { + type: Layout, + cls: 'data-connection-background', + }, height: 130, }, { From 5f9fc7858fc1035a5374b41b79880002945c14c6 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Jun 2019 11:38:18 +0800 Subject: [PATCH 43/44] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=AD=A3=E4=B8=8D?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.ts | 1 - src/app/status/link_status.ts | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/app.ts b/src/app/app.ts index 678d9be..d198418 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -39,7 +39,6 @@ const Widget = BI.inherit(BI.Widget, { }, { el: { type: linkStatus, - invisible: true, }, left: 10, top: 10, diff --git a/src/app/status/link_status.ts b/src/app/status/link_status.ts index 12b6503..bf50a07 100644 --- a/src/app/status/link_status.ts +++ b/src/app/status/link_status.ts @@ -1,4 +1,4 @@ -import {WidgetType, Htape, Vtape, Left, Label, VerticalAdapt} from '@ui'; +import {WidgetType, Htape, Vtape, Label, VerticalAdapt} from '@ui'; import linkStatusModel from './link_status.model'; import LeftList from './left/left'; import Right from './right/right'; @@ -14,12 +14,16 @@ const Widget: WidgetType = { }, watch: { tab(tab: string) { - this.setVisible(tab === TAB_LINK_POOL); + this.linkStatus.setVisible(tab === TAB_LINK_POOL); }, }, render() { return { type: Htape, + invisible: true, + ref: _ref => { + this.linkStatus = _ref; + }, items: [{ el: { type: Vtape, From 5824afdda940d046682b51af9f77b16aed3b73ad Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Jun 2019 15:20:54 +0800 Subject: [PATCH 44/44] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8bi.linear?= =?UTF-8?q?=5Fsegment=E6=9B=BF=E6=8D=A2=E6=8E=89=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=9A=84tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.ts | 2 +- src/app/title/item/title_item.service.ts | 13 ------- src/app/title/item/title_item.ts | 39 ------------------- .../title_item.model.ts => title.model.ts} | 0 src/app/title/title.ts | 35 +++++++++++------ src/ui/fineui.ts | 1 + 6 files changed, 26 insertions(+), 64 deletions(-) delete mode 100644 src/app/title/item/title_item.service.ts delete mode 100644 src/app/title/item/title_item.ts rename src/app/title/{item/title_item.model.ts => title.model.ts} (100%) diff --git a/src/app/app.ts b/src/app/app.ts index d198418..de16680 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,4 +1,4 @@ -import {Vtape, Absolute} from '../ui/index'; +import {Vtape, Absolute, LinearSegment} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; import linkSet from './connection/link_set'; diff --git a/src/app/title/item/title_item.service.ts b/src/app/title/item/title_item.service.ts deleted file mode 100644 index 2bb4109..0000000 --- a/src/app/title/item/title_item.service.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function getSelectStyle(status: string, nowStatus: string): any { - if (status === nowStatus) { - return { - color: '#3685f2', - 'border-bottom': 'solid 2px #3685f2', - }; - } - - return { - color: '#3d4d66', - 'border-bottom': 'none', - }; -} diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts deleted file mode 100644 index b271a34..0000000 --- a/src/app/title/item/title_item.ts +++ /dev/null @@ -1,39 +0,0 @@ -import {Label} from '@ui'; -import tableItemModel from './title_item.model'; -import {getSelectStyle} from './title_item.service'; -const className = 'dec.dcm.title.item'; -const Widget = BI.inherit(BI.BasicButton, { - props: { - baseCls: 'bi-font-bold', - text: '', - }, - _store() { - return BI.Models.getModel(tableItemModel); - }, - watch: { - tab(tab: string) { - const {value} = this.options; - this.title.setStyle(getSelectStyle(value, tab)); - }, - }, - render() { - const {text} = this.options; - - return { - type: Label, - height: 40, - hgap: 15, - ref: _ref => { - this.title = _ref; - }, - text, - }; - }, - doClick() { - const {value} = this.options; - this.store.setTab(value); - }, -}); -BI.shortcut(className, Widget); - -export default className; diff --git a/src/app/title/item/title_item.model.ts b/src/app/title/title.model.ts similarity index 100% rename from src/app/title/item/title_item.model.ts rename to src/app/title/title.model.ts diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 0cb46c4..1a31ea0 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -1,6 +1,6 @@ import './title.less'; -import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; -import TitleItem from './item/title_item'; +import {WidgetType, IconButton, LeftRightVerticalAdapt, LinearSegment} from '@ui/index'; +import Model from './title.model'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.title'; @@ -8,23 +8,36 @@ const Widget: WidgetType = { props: { baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', }, + _store() { + return BI.Models.getModel(Model); + }, render() { const showCloseButton = isDesigner(); + const that = this; return { type: LeftRightVerticalAdapt, items: { left: [ { - type: TitleItem, - cls: 'title-item-selected bi-border-bottom', - text: BI.i18nText('Dec-Dcm_Connection_Management'), - value: TAB_LINK_SET, - }, - { - type: TitleItem, - text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), - value: TAB_LINK_POOL, + type: LinearSegment, + cls: 'bi-card', + height: 40, + width: 200, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Management'), + value: TAB_LINK_SET, + selected: true, + }, { + text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + value: TAB_LINK_POOL, + }], + listeners: [{ + eventName: 'EVENT_CHANGE', + action () { + that.store.setTab(this.getValue()[0]); + }, + }], }, ], right: [ diff --git a/src/ui/fineui.ts b/src/ui/fineui.ts index 8653849..f40ddad 100644 --- a/src/ui/fineui.ts +++ b/src/ui/fineui.ts @@ -34,6 +34,7 @@ export const TextBubblePopupBarView = 'bi.text_bubble_bar_popup_view'; export const BubbleCombo = 'bi.bubble_combo'; export const SearchEditor = 'bi.search_editor'; export const Img = 'bi.img'; +export const LinearSegment = 'bi.linear_segment'; // 布局 export const VerticalAdapt = 'bi.vertical_adapt';