Browse Source

Merge pull request #92 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:feature/10.0 to feature/10.0

* commit '139479514c1fbd9dbc5d27c1e93512002c2bc327':
  fix: DEC-10156 连接池列表加入分页
qufenxi
alan 5 years ago
parent
commit
2e54cfac90
  1. 18
      src/modules/pages/connection_pool/connection_pool.ts
  2. 2
      src/modules/pages/connection_pool/list_item/list_item.ts

18
src/modules/pages/connection_pool/connection_pool.ts

@ -1,5 +1,5 @@
import { shortcut, store } from '@core/core';
import { ButtonGroup, Htape, Vtape, Label, Vertical, Layout, CenterAdapt } from 'ui';
import { Htape, Vtape, Label, Layout, CenterAdapt, Loader } from 'ui';
import { ConnectionPoolModel, ConnectionPoolModelXtype } from './connection_pool.model';
import { ListItemXtype } from './list_item/list_item';
import { PoolXtype } from './pool/pool';
@ -7,7 +7,6 @@ export const ConnectionPoolXtype = 'dec.dcm.connection_pool';
@shortcut(ConnectionPoolXtype)
@store(ConnectionPoolModelXtype)
export class ConnectionPool extends BI.Widget {
groupWidget: any;
title: any;
model: ConnectionPoolModel['model'];
@ -44,14 +43,11 @@ export class ConnectionPool extends BI.Widget {
height: 40,
},
{
type: ButtonGroup,
layouts: [{
type: Vertical,
}],
items: this.renderList(),
ref: (_ref: any) => {
this.groupWidget = _ref;
type: Loader,
itemsCreator: (options: {times: number}, populate) => {
populate(this.renderList((options.times - 1) * 50, options.times * 50));
},
hasNext: options => options.times * 50 < BI.size(this.model.connections),
},
],
},
@ -113,10 +109,10 @@ export class ConnectionPool extends BI.Widget {
};
}
private renderList() {
private renderList(start = 0, end = 0) {
const defaultSelected = this.model.connectionJDBC.length > 0 ? this.model.connectionJDBC[0].connectionName : '';
return this.model.connectionJDBC.map(item => {
return this.model.connectionJDBC.slice(start, end).map(item => {
return {
type: ListItemXtype,
name: item.connectionName,

2
src/modules/pages/connection_pool/list_item/list_item.ts

@ -21,6 +21,8 @@ export class ListItem extends BI.BasicButton {
{
type: Label,
text: this.options.name,
width: 250,
textAlign: 'left',
},
],
};

Loading…
Cancel
Save