|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { shortcut, store } from '@core/core'; |
|
|
|
|
import { ButtonGroup, Vertical, CenterAdapt, Label, Layout, Vtape, LoadingBar } 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'; |
|
|
|
@ -61,42 +61,17 @@ export class ConnectionList extends BI.LoadingPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
type: Vertical, |
|
|
|
|
items: [{ |
|
|
|
|
type: ButtonGroup, |
|
|
|
|
layouts: [{ |
|
|
|
|
type: Vertical, |
|
|
|
|
}], |
|
|
|
|
items: this.renderList(), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.groupWidget = _ref; |
|
|
|
|
}, |
|
|
|
|
}, { |
|
|
|
|
type: LoadingBar, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.loadingBar = _ref; |
|
|
|
|
}, |
|
|
|
|
handler: () => { |
|
|
|
|
this.loadingBar.setLoading(); |
|
|
|
|
this.store.setItemNum(this.model.showItemNum + 50); |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
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), |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
created() { |
|
|
|
|
if (this.model.showItemNum) { |
|
|
|
|
BI.size(this.model.connections) > this.model.showItemNum ? |
|
|
|
|
this.loadingBar.setLoaded() : |
|
|
|
|
null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private renderList(start = 0) { |
|
|
|
|
const itemNum = Math.min(this.model.connections.length, this.model.showItemNum); |
|
|
|
|
|
|
|
|
|
return this.model.connections.slice(start, itemNum).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, |
|
|
|
|