Skip to content

Commit 8f15e5c

Browse files
committed
Merge pull request #852 from floreks/pagination
Add pagination for pod and replica set list
2 parents 374385a + b677f51 commit 8f15e5c

26 files changed

+691
-11
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"angular-sanitize": "~1.5.0",
1313
"material-design-icons": "~2.2.2",
1414
"roboto-fontface": "~0.4.5",
15-
"ng-jsoneditor": "angular-tools/ng-jsoneditor#~1.0.0"
15+
"ng-jsoneditor": "angular-tools/ng-jsoneditor#~1.0.0",
16+
"angularUtils-pagination": "angular-utils-pagination#~0.11.1"
1617
},
1718
"overrides": {
1819
"material-design-icons": {

i18n/messages-en.xtb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,4 @@
352352
<translation id="1409526330139546496" key="MSG_DEPLOYMENT_DETAIL_REPLICAS_UNAVAILABLE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says that that many replicas are unavailable in the deployment (deployment details page)."><ph name="REPLICAS" /> unavailable</translation>
353353
<translation id="2887557544683001606" key="MSG_DEPLOYMENT_DETAIL_MAX_UNAVAILABLE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says how many replicas are allowed to be unavailable during an update in the deployment (deployment details page).">Max unavailable: <ph name="REPLICAS" /></translation>
354354
<translation id="7919923317290692250" key="MSG_DEPLOYMENT_DETAIL_MAX_SURGE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says that that many replicas can be created above the desired number of replicas in a deployment (deployment details page).">Max surge: <ph name="REPLICAS" /></translation>
355-
</translationbundle>
355+
</translationbundle>

i18n/messages-ja.xtb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,4 @@
352352
<translation id="1409526330139546496" key="MSG_DEPLOYMENT_DETAIL_REPLICAS_UNAVAILABLE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says that that many replicas are unavailable in the deployment (deployment details page)."><ph name="REPLICAS" /> unavailable</translation>
353353
<translation id="2887557544683001606" key="MSG_DEPLOYMENT_DETAIL_MAX_UNAVAILABLE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says how many replicas are allowed to be unavailable during an update in the deployment (deployment details page).">Max unavailable: <ph name="REPLICAS" /></translation>
354354
<translation id="7919923317290692250" key="MSG_DEPLOYMENT_DETAIL_MAX_SURGE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The message says that that many replicas can be created above the desired number of replicas in a deployment (deployment details page).">Max surge: <ph name="REPLICAS" /></translation>
355-
</translationbundle>
355+
</translationbundle>

src/app/frontend/common/components/contentcard/contentcard_component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
export class ContentCardController {
1919
/**
20-
* @param {Object} $transclude TODO(floreks) fix this when externs are fixed
20+
* @param {!angular.$transclude} $transclude
2121
* @ngInject
2222
*/
2323
constructor($transclude) {
@@ -29,7 +29,7 @@ export class ContentCardController {
2929
* Returns true if transclusion slot 'title' has been filled.
3030
* @export
3131
*/
32-
isTitleSlotFilled() { return this.transclude_['isSlotFilled']('title'); }
32+
isTitleSlotFilled() { return this.transclude_.isSlotFilled('title'); }
3333
}
3434

3535
/**

src/app/frontend/common/components/resourcecard/resourcecard_module.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import resourceModule from 'common/resource/resource_module';
1616
import {resourceCardComponent} from './resourcecard_component';
1717
import {resourceCardListComponent} from './resourcecardlist_component';
18+
import {resourceCardListFooterComponent} from './resourcecardlistfooter_component';
19+
import {resourceCardListPaginationComponent} from './resourcecardlistpagination_component';
1820
import {resourceCardMenuComponent} from './resourcecardmenu_component';
1921
import {resourceCardDeleteMenuItemComponent} from './resourcecarddeletemenuitem_component';
2022
import {resourceCardEditMenuItemComponent} from './resourcecardeditmenuitem_component';
@@ -34,10 +36,13 @@ export default angular
3436
[
3537
'ngMaterial',
3638
'ui.router',
39+
'angularUtils.directives.dirPagination',
3740
resourceModule.name,
3841
])
3942
.component('kdResourceCard', resourceCardComponent)
4043
.component('kdResourceCardList', resourceCardListComponent)
44+
.component('kdResourceCardListFooter', resourceCardListFooterComponent)
45+
.component('kdResourceCardListPagination', resourceCardListPaginationComponent)
4146
.component('kdResourceCardMenu', resourceCardMenuComponent)
4247
.component('kdResourceCardDeleteMenuItem', resourceCardDeleteMenuItemComponent)
4348
.component('kdResourceCardEditMenuItem', resourceCardEditMenuItemComponent)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
Copyright 2015 Google Inc. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<div ng-class="{'kd-resource-card-list-footer': $ctrl.shouldShowFooter()}" layout="row">
18+
<span ng-transclude="content" flex></span>
19+
<span ng-transclude="pagination" flex></span>
20+
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
@import '../../../variables';
16+
17+
.kd-resource-card-list-footer {
18+
border-top: 1px solid $border;
19+
font-size: $body-font-size-base;
20+
padding-top: $baseline-grid;
21+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* @final
17+
*/
18+
export class ResourceCardListFooterController {
19+
/**
20+
* @param {!../../pagination/pagination_service.PaginationService} kdPaginationService
21+
* @param {!angular.$transclude} $transclude TODO(floreks) fix this when externs are fixed
22+
* @ngInject
23+
*/
24+
constructor(kdPaginationService, $transclude) {
25+
/** @private {!./resourcecardlistpagination_component.ResourceCardListPaginationController} -
26+
* Initialized in ResourceCardListPaginationController in $onInit method */
27+
this.listPagination_;
28+
/** @private {!../../pagination/pagination_service.PaginationService} */
29+
this.paginationService_ = kdPaginationService;
30+
/** @private {Object} */
31+
this.transclude_ = $transclude;
32+
}
33+
34+
/**
35+
* @param {!./resourcecardlistpagination_component.ResourceCardListPaginationController}
36+
* listPagination
37+
*/
38+
setListPagination(listPagination) {
39+
if (this.listPagination_) {
40+
throw new Error('List pagination controller already set.');
41+
}
42+
43+
this.listPagination_ = listPagination;
44+
}
45+
46+
/**
47+
* Returns true if pagination slot has been filled and number of items on the list is bigger
48+
* then max available limit, false otherwise.
49+
*
50+
* @return {boolean}
51+
* @private
52+
*/
53+
shouldShowPagination_() {
54+
return this.listPagination_ &&
55+
this.listPagination_.totalItems > this.paginationService_.getRowsLimit();
56+
}
57+
58+
/**
59+
* Returns true if footer content slot has been filled or pagination should be displayed on
60+
* the footer, false otherwise.
61+
*
62+
* @return {boolean}
63+
* @export
64+
*/
65+
shouldShowFooter() {
66+
return this.transclude_.isSlotFilled('content') || this.shouldShowPagination_();
67+
}
68+
}
69+
70+
/**
71+
* Resource card list footer component. Provides footer to display some additional data, i.e.
72+
* pagination component.
73+
*
74+
* @type {!angular.Component}
75+
*/
76+
export const resourceCardListFooterComponent = {
77+
templateUrl: 'common/components/resourcecard/resourcecardlistfooter.html',
78+
controller: ResourceCardListFooterController,
79+
transclude: /** @type {undefined} TODO: Remove this when externs are fixed */ ({
80+
'content': '?kdResourceCardListFooterContent',
81+
'pagination': '?kdResourceCardListPagination',
82+
}),
83+
require: {
84+
'resourceCardListCtrl': '^kdResourceCardList',
85+
},
86+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
Copyright 2015 Google Inc. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<dir-pagination-controls class="kd-list-pagination" boundary-links="true"
18+
pagination-id="$ctrl.paginationId" template-url="common/pagination/pagination.html">
19+
</dir-pagination-controls>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
@import '../../../variables';
16+
17+
.kd-list-pagination {
18+
align-items: center;
19+
color: $foreground-2;
20+
display: flex;
21+
justify-content: flex-end;
22+
23+
> * {
24+
align-items: center;
25+
display: flex;
26+
}
27+
}

0 commit comments

Comments
 (0)