mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
updates for paginator and pagination in logs.
This commit is contained in:
parent
f44e6f5991
commit
d4035e0ec3
@ -47,8 +47,8 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<paginator class="pull-right" total-count="//vm.totalCount//" page-size="1" page="vm.page" display-count="3" retrieve="vm.search({op: vm.op, username: vm.username})"></paginator>
|
||||
</div>
|
||||
<paginator class="pull-right" total-count="//vm.totalCount//" page-size="//vm.pageSize//" page="vm.page" display-count="3"></paginator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@
|
||||
};
|
||||
|
||||
vm.page = 1;
|
||||
vm.pageSize = 1;
|
||||
vm.pageSize = 2;
|
||||
|
||||
$scope.$watch('vm.totalCount', function(current) {
|
||||
if(current) {
|
||||
|
@ -22,8 +22,7 @@
|
||||
'totalCount': '@',
|
||||
'pageSize': '@',
|
||||
'page': '=',
|
||||
'displayCount': '@',
|
||||
'retrieve': '&'
|
||||
'displayCount': '@'
|
||||
},
|
||||
'link': link,
|
||||
'controller': PaginatorController,
|
||||
@ -57,6 +56,7 @@
|
||||
++this.time;
|
||||
++ctrl.page;
|
||||
}
|
||||
scope.$apply();
|
||||
}
|
||||
|
||||
TimeCounter.prototype.canIncrement = function() {
|
||||
@ -71,6 +71,7 @@
|
||||
--this.time;
|
||||
--ctrl.page;
|
||||
}
|
||||
scope.$apply();
|
||||
}
|
||||
|
||||
TimeCounter.prototype.canDecrement = function() {
|
||||
@ -93,11 +94,8 @@
|
||||
tc.setMaximum(Math.floor(buttonCount / displayCount));
|
||||
}
|
||||
|
||||
element.find('ul li:first a').on('click', previous);
|
||||
ctrl.showPrevious = false;
|
||||
|
||||
element.find('ul li:first a').on('click', previous);
|
||||
element.find('ul li:last a').on('click', next);
|
||||
ctrl.showNext = (buttonCount > displayCount);
|
||||
|
||||
var drawButtons = function(time) {
|
||||
element.find('li[tag="pagination-button"]').remove();
|
||||
@ -114,12 +112,12 @@
|
||||
}
|
||||
|
||||
drawButtons(tc.getTime());
|
||||
togglePrevious(false);
|
||||
toggleNext((buttonCount > displayCount));
|
||||
|
||||
togglePrevious(tc.canDecrement());
|
||||
toggleNext(tc.canIncrement());
|
||||
|
||||
togglePageButton();
|
||||
|
||||
|
||||
function togglePrevious(status) {
|
||||
if(status){
|
||||
element.find('ul li:first').removeClass('disabled');
|
||||
@ -133,38 +131,29 @@
|
||||
element.find('ul li:last').removeClass('disabled');
|
||||
}else{
|
||||
element.find('ul li:last').addClass('disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buttonClickHandler(e) {
|
||||
ctrl.page = $(e.target).attr('page');
|
||||
togglePageButton();
|
||||
ctrl.retrieve();
|
||||
|
||||
if(tc.canIncrement()) {
|
||||
toggleNext(true);
|
||||
}else {
|
||||
toggleNext(false);
|
||||
}
|
||||
|
||||
if(tc.canDecrement()) {
|
||||
togglePrevious(true);
|
||||
}else{
|
||||
togglePrevious(false);
|
||||
}
|
||||
togglePageButton();
|
||||
togglePrevious(tc.canDecrement());
|
||||
toggleNext(tc.canIncrement());
|
||||
scope.$apply();
|
||||
}
|
||||
|
||||
function togglePageButton() {
|
||||
element.find('li[tag="pagination-button"]').removeClass('active');
|
||||
element.find('li[tag="pagination-button"] a[page="' + ctrl.page + '"]').parent().addClass('active');
|
||||
element.find('li[tag="pagination-button"]').removeClass('active');
|
||||
element.find('li[tag="pagination-button"] a[page="' + ctrl.page + '"]').parent().addClass('active');
|
||||
}
|
||||
|
||||
function previous() {
|
||||
if(tc.canDecrement()) {
|
||||
tc.decrement();
|
||||
drawButtons(tc.getTime());
|
||||
element.find('li[tag="pagination-button"] a[page="' + ctrl.page + '"]').trigger('click');
|
||||
element.find('li[tag="pagination-button"] a[page="' + ctrl.page + '"]').trigger('click');
|
||||
}
|
||||
scope.$apply();
|
||||
}
|
||||
|
||||
function next() {
|
||||
@ -172,8 +161,8 @@
|
||||
tc.increment();
|
||||
drawButtons(tc.getTime());
|
||||
element.find('li[tag="pagination-button"] a[page="' + ctrl.page + '"]').trigger('click');
|
||||
|
||||
}
|
||||
scope.$apply();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user