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 d9ef3d7..28a5dfe 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,4 @@ -export const ConstantName = 'bi.constant.linkSet.right.edit.charset'; +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_title/right.title.component.ts b/src/app/link_set/right/right_title/right.title.component.ts index 1764f69..24800a7 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 @@ -40,7 +40,7 @@ const Widget: WidgetType = { 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('数据连接名已存在'); } else { saveConnection(that.model.linkUpdate).then(() => { that.store.setEdit(false); @@ -58,7 +58,6 @@ const Widget: WidgetType = { that.store.setCancel(); }, }, - ], }; }, diff --git a/src/app/link_set/select/select.component.ts b/src/app/link_set/select/select.component.ts index 8e77e4c..adf1a9f 100644 --- a/src/app/link_set/select/select.component.ts +++ b/src/app/link_set/select/select.component.ts @@ -1,9 +1,7 @@ import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui'; import selectModel from '../link-set.model'; import {moreLink} from '../more/more.link.service'; -const linkList = [ - 'APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', -]; +import connectList from './select.constant'; const className = 'fr.linkset.select'; const Widget: WidgetType = { _store() { @@ -26,7 +24,7 @@ const Widget: WidgetType = { el: { type: ButtonGroup, cls:'database-link-items', - items: [...BI.map(linkList, (index: number, item: string) => { + items: [...BI.map(BI.Constants.getConstant(connectList), (index: number, item: string) => { return { type: TextItem, height: 24, diff --git a/src/app/link_set/select/select.constant.ts b/src/app/link_set/select/select.constant.ts new file mode 100644 index 0000000..13ffac8 --- /dev/null +++ b/src/app/link_set/select/select.constant.ts @@ -0,0 +1,5 @@ +export const ConstantName = 'bi.constant.database.conf.connect.list'; +export const Constant = BI.constant(ConstantName, [ + 'APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', +]); +export default ConstantName; diff --git a/src/app/link_status/right/right.card.component.ts b/src/app/link_status/right/right.card.component.ts index dc236e6..ca3e2fb 100644 --- a/src/app/link_status/right/right.card.component.ts +++ b/src/app/link_status/right/right.card.component.ts @@ -2,6 +2,8 @@ import {WidgetType, Left, Label, Vertical} from '@ui/index'; const className = 'fr.component.linkStatus.right.card'; const Widget: WidgetType = { render() { + const {maxActive, maxIdle, numActive, numIdle} = this.options; + return { type: Left, items: [ @@ -21,7 +23,7 @@ const Widget: WidgetType = { type: Label, cls: 'right-status-text', extraCls: 'card-font1', - text: '0', + text: numActive, }, { type: Label, @@ -31,7 +33,7 @@ const Widget: WidgetType = { { type: Label, cls: 'right-status-text', - text: '50', + text: maxActive, }, ], }, @@ -59,7 +61,7 @@ const Widget: WidgetType = { type: Label, cls: 'right-status-text', extraCls: 'card-font2', - text: '0', + text: numIdle, }, { type: Label, @@ -69,7 +71,7 @@ const Widget: WidgetType = { { type: Label, cls: 'right-status-text', - text: '50', + text: maxIdle, }, ], }, diff --git a/src/app/link_status/right/right.component.ts b/src/app/link_status/right/right.component.ts index 01cb170..594809d 100644 --- a/src/app/link_status/right/right.component.ts +++ b/src/app/link_status/right/right.component.ts @@ -1,8 +1,11 @@ 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 {InfoType} from './right.typings'; const className = 'fr.component.linkStatus.right'; let Title: any = null; +let Group: any = null; const Widget: WidgetType = { _store() { @@ -11,6 +14,12 @@ const Widget: WidgetType = { watch:{ statusSelected(title: string) { Title.setText(`数据连接(${title})`); + info(name, (res: InfoType) => { + Group.populate(BI.createItems([{ + type: RightCard, + ...res, + }])); + }); }, }, render() { @@ -34,15 +43,16 @@ const Widget: WidgetType = { }, { type: Vertical, cls: 'right-status-body', - items: [ - { - type: RightCard, - }, - ], + ref(ref: any) { + Group = ref; + }, }, ], }; }, + mounted() { + + }, }; BI.shortcut(className, BI.inherit(BI.Widget, Widget)); export default className; diff --git a/src/app/link_status/right/right.typings.d.ts b/src/app/link_status/right/right.typings.d.ts new file mode 100644 index 0000000..0649242 --- /dev/null +++ b/src/app/link_status/right/right.typings.d.ts @@ -0,0 +1,6 @@ +export interface InfoType{ + maxActive: number; + maxIdle: number; + numActive: number; + numIdle: number; +} diff --git a/src/index.html b/src/index.html index a92b075..8db465b 100644 --- a/src/index.html +++ b/src/index.html @@ -9,5 +9,6 @@ + \ No newline at end of file diff --git a/src/shared/crud/crud.request.ts b/src/shared/crud/crud.request.ts index 76331ed..8196d6a 100644 --- a/src/shared/crud/crud.request.ts +++ b/src/shared/crud/crud.request.ts @@ -81,7 +81,7 @@ export function deleteConnection(id: string, cb: Function): void{ } } /** - * 检查数据连接状态 + * 检查数据连接 * @param id 数据连接id * @param cb 回调函数 */ @@ -95,3 +95,14 @@ export function getConnectionStatus(id: string, cb: Function): void{ cb('success'); } } + +export function info(name: string, cb: Function): void{ + console.log('%cname: ', 'color: MidnightBlue; background: Aquamarine;', name); + if (Dec) { + Dec.reqDeleta(`/v10/config/connection/pool/info?connectionName=${name}`, (res: any) => { + cb(res.data); + }); + } else { + cb({maxActive:50, maxIdle:10, numActive:0, numIdle:0}); + } +}