|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { shortcut, store } from '@core/core'; |
|
|
|
|
import { ButtonGroup, Vertical, CenterAdapt, Label, Layout, Vtape } from 'ui'; |
|
|
|
|
import { CenterAdapt, Label, Layout, Vtape, Loader } from 'ui'; |
|
|
|
|
import { ListItemXtype } from './list_item/list_item'; |
|
|
|
|
import { ConnectionListModel, ConnectionListModelXtype } from './list.model'; |
|
|
|
|
import { Connection } from '../../../crud/crud.typings'; |
|
|
|
@ -20,13 +20,13 @@ export class ConnectionList extends BI.LoadingPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
watch = { |
|
|
|
|
connections() { |
|
|
|
|
connections: () => { |
|
|
|
|
this.groupWidget.populate(this.renderList()); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
if (this.model.connections.length === 0) { |
|
|
|
|
if (BI.size(this.model.connections) === 0) { |
|
|
|
|
return { |
|
|
|
|
type: CenterAdapt, |
|
|
|
|
items: [ |
|
|
|
@ -54,19 +54,17 @@ export class ConnectionList extends BI.LoadingPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
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), |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private renderList() { |
|
|
|
|
return this.model.connections.map((item: Connection) => { |
|
|
|
|
private renderList(start = 0, end = 0) { |
|
|
|
|
return this.model.connections.slice(start, end).map((item: Connection) => { |
|
|
|
|
return { |
|
|
|
|
type: ListItemXtype, |
|
|
|
|
name: item.connectionName, |
|
|
|
|