Skip to content

Commit 56308f8

Browse files
committed
Merge pull request #724 from bryk/pod-list-frontend
Frontend for pods list and workloads section
2 parents 8e96e76 + 4ee32fe commit 56308f8

13 files changed

+367
-55
lines changed

src/app/frontend/podlist/podcardlist.html

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,47 @@
1414
limitations under the License.
1515
-->
1616

17-
<kd-content-card ng-if="::$ctrl.podList.pods">
18-
<kd-title>Pods</kd-title>
19-
<kd-content>
20-
<kd-resource-card-list selectable="false" with-statuses="false">
21-
<kd-resource-card-header-columns>
22-
<kd-resource-card-header-column size="medium" grow="4">Name</kd-resource-card-header-column>
23-
<kd-resource-card-header-column>Status</kd-resource-card-header-column>
24-
<kd-resource-card-header-column size="small" grow="nogrow">
25-
Restarts
26-
</kd-resource-card-header-column>
27-
<kd-resource-card-header-column>Age</kd-resource-card-header-column>
28-
<kd-resource-card-header-column>Cluster IP</kd-resource-card-header-column>
29-
<kd-resource-card-header-column>Logs</kd-resource-card-header-column>
30-
</kd-resource-card-header-columns>
17+
<kd-resource-card-list selectable="false" with-statuses="false" ng-if="::$ctrl.podList.pods">
18+
<kd-resource-card-header-columns>
19+
<kd-resource-card-header-column size="medium" grow="4">Name</kd-resource-card-header-column>
20+
<kd-resource-card-header-column>Status</kd-resource-card-header-column>
21+
<kd-resource-card-header-column size="small" grow="nogrow">
22+
Restarts
23+
</kd-resource-card-header-column>
24+
<kd-resource-card-header-column>Age</kd-resource-card-header-column>
25+
<kd-resource-card-header-column>Cluster IP</kd-resource-card-header-column>
26+
<kd-resource-card-header-column>Logs</kd-resource-card-header-column>
27+
</kd-resource-card-header-columns>
3128

32-
<kd-resource-card ng-repeat="pod in $ctrl.podList.pods">
33-
<kd-resource-card-columns>
34-
<kd-resource-card-column>
35-
<div>
36-
<kd-middle-ellipsis display-string="{{::pod.name}}">
37-
</kd-middle-ellipsis>
38-
</div>
39-
</kd-resource-card-column>
40-
<kd-resource-card-column>{{::pod.podPhase}}</kd-resource-card-column>
41-
<kd-resource-card-column>{{::pod.restartCount}}</kd-resource-card-column>
42-
<kd-resource-card-column>
43-
<div ng-if="::pod.startTime">
44-
{{::pod.startTime | relativeTime}}
45-
<md-tooltip>
46-
Started at {{::(pod.startTime | date:'d/M/yy HH:mm':'UTC')}} UTC
47-
</md-tooltip>
48-
</div>
49-
<div ng-if="::!pod.startTime">-</div>
50-
</kd-resource-card-column>
51-
<kd-resource-card-column>
52-
<div ng-if="::pod.podIP">{{::pod.podIP}}</div>
53-
<div ng-if="::!pod.podIP">-</div>
54-
</kd-resource-card-column>
55-
<kd-resource-card-column>
56-
<a ng-href="{{::$ctrl.getPodLogsHref(pod)}}" target="_blank">
57-
Logs
58-
<i class="material-icons kd-text-icon">open_in_new</i>
59-
</a>
60-
</kd-resource-card-column>
61-
</kd-resource-card-columns>
62-
</kd-resource-card>
63-
</kd-resource-card-list>
64-
</kd-content>
65-
</kd-content-card>
29+
<kd-resource-card ng-repeat="pod in $ctrl.podList.pods">
30+
<kd-resource-card-columns>
31+
<kd-resource-card-column>
32+
<div>
33+
<kd-middle-ellipsis display-string="{{::pod.name}}">
34+
</kd-middle-ellipsis>
35+
</div>
36+
</kd-resource-card-column>
37+
<kd-resource-card-column>{{::pod.podPhase}}</kd-resource-card-column>
38+
<kd-resource-card-column>{{::pod.restartCount}}</kd-resource-card-column>
39+
<kd-resource-card-column>
40+
<div ng-if="::pod.startTime">
41+
{{::pod.startTime | relativeTime}}
42+
<md-tooltip>
43+
Started at {{::(pod.startTime | date:'d/M/yy HH:mm':'UTC')}} UTC
44+
</md-tooltip>
45+
</div>
46+
<div ng-if="::!pod.startTime">-</div>
47+
</kd-resource-card-column>
48+
<kd-resource-card-column>
49+
<div ng-if="::pod.podIP">{{::pod.podIP}}</div>
50+
<div ng-if="::!pod.podIP">-</div>
51+
</kd-resource-card-column>
52+
<kd-resource-card-column>
53+
<a ng-href="{{::$ctrl.getPodLogsHref(pod)}}" target="_blank">
54+
Logs
55+
<i class="material-icons kd-text-icon">open_in_new</i>
56+
</a>
57+
</kd-resource-card-column>
58+
</kd-resource-card-columns>
59+
</kd-resource-card>
60+
</kd-resource-card-list>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<kd-content-card>
17+
<kd-content>
18+
<kd-pod-card-list pod-list="$ctrl.podList">
19+
</kd-pod-card-list>
20+
</kd-content>
21+
</kd-content-card>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
* Controller for the pod list view.
17+
*
18+
* @final
19+
*/
20+
export class PodListController {
21+
/**
22+
* @param {!backendApi.PodList} podList
23+
* @ngInject
24+
*/
25+
constructor(podList) {
26+
/** @export {!backendApi.PodList} */
27+
this.podList = podList;
28+
}
29+
}

src/app/frontend/podlist/podlist_module.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import stateConfig from './podlist_stateconfig';
1516
import {podCardListComponent} from './podcardlist_component';
1617

1718
/**
1819
* Module containing endpoint components.
1920
*/
2021
export default angular
2122
.module(
22-
'kubernetesDashboard.common.components.podsList',
23+
'kubernetesDashboard.podsList',
2324
[
2425
'ngMaterial',
26+
'ngResource',
27+
'ui.router',
2528
])
29+
.config(stateConfig)
2630
.component('kdPodCardList', podCardListComponent);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
/** Name of the state. Can be used in, e.g., $state.go method. */
16+
export const stateName = 'pods';
17+
18+
/** Absolute URL of the state. */
19+
export const stateUrl = '/pods';
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 {actionbarViewName} from 'chrome/chrome_state';
16+
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_component';
17+
import {PodListController} from './podlist_controller';
18+
import {stateName, stateUrl} from './podlist_state';
19+
import {PodListActionBarController} from './podlistactionbar_controller';
20+
21+
/**
22+
* Configures states for the service view.
23+
*
24+
* @param {!ui.router.$stateProvider} $stateProvider
25+
* @ngInject
26+
*/
27+
export default function stateConfig($stateProvider) {
28+
$stateProvider.state(stateName, {
29+
url: stateUrl,
30+
resolve: {
31+
'podList': resolvePodList,
32+
},
33+
data: {
34+
[breadcrumbsConfig]: {
35+
'label': 'Pods',
36+
},
37+
},
38+
views: {
39+
'': {
40+
controller: PodListController,
41+
controllerAs: '$ctrl',
42+
templateUrl: 'podlist/podlist.html',
43+
},
44+
[actionbarViewName]: {
45+
controller: PodListActionBarController,
46+
controllerAs: 'ctrl',
47+
templateUrl: 'podlist/podlistactionbar.html',
48+
},
49+
},
50+
});
51+
}
52+
53+
/**
54+
* @param {!angular.$resource} $resource
55+
* @return {!angular.$q.Promise}
56+
* @ngInject
57+
*/
58+
export function resolvePodList($resource) {
59+
/** @type {!angular.Resource<!backendApi.PodList>} */
60+
let resource = $resource('api/v1/pods');
61+
return resource.get().$promise;
62+
}
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+
<md-button class="md-icon-button" ng-click="ctrl.redirectToDeployPage()">
18+
<md-icon class="kd-actionbar-icon-button">add</md-icon>
19+
<md-tooltip md-direction="left">Deploy a containerized app</md-tooltip>
20+
</md-button>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 {stateName as deploy} from 'deploy/deploy_state';
16+
17+
/**
18+
* @final
19+
*/
20+
export class PodListActionBarController {
21+
/**
22+
* @param {!ui.router.$state} $state
23+
* @ngInject
24+
*/
25+
constructor($state) {
26+
/** @private {!ui.router.$state} */
27+
this.state_ = $state;
28+
}
29+
30+
/**
31+
* @export
32+
*/
33+
redirectToDeployPage() { this.state_.go(deploy); }
34+
}

src/app/frontend/replicationcontrollerdetail/replicationcontrollerdetail.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
2424
<kd-replication-controller-services services="::ctrl.replicationControllerDetail.services">
2525
</kd-replication-controller-services>
2626

27-
<kd-pod-card-list pod-list="::ctrl.replicationControllerDetail.pods"
28-
logs-href-fn="::ctrl.getPodLogsHref(pod)">
29-
</kd-pod-card-list>
27+
<kd-content-card>
28+
<kd-title>
29+
Pods
30+
</kd-title>
31+
<kd-content>
32+
<kd-pod-card-list pod-list="::ctrl.replicationControllerDetail.pods"
33+
logs-href-fn="::ctrl.getPodLogsHref(pod)">
34+
</kd-pod-card-list>
35+
</kd-content>
36+
</kd-content-card>
3037
</md-tab>
3138
<md-tab label="Events">
3239
<kd-replication-controller-events events="::ctrl.events">

src/app/frontend/workloads/workloads.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
-->
16+
17+
<kd-content-card>
18+
<kd-title>
19+
Replica Sets
20+
</kd-title>
21+
<kd-content>
22+
<kd-replica-set-card-list replica-sets="$ctrl.workloads.replicaSetList.replicaSets">
23+
</kd-replica-set-card-list>
24+
</kd-content>
25+
</kd-content-card>
26+
1627
<kd-content-card>
1728
<kd-title>
1829
Replication Controllers
@@ -26,10 +37,10 @@
2637

2738
<kd-content-card>
2839
<kd-title>
29-
Replica Sets
40+
Pods
3041
</kd-title>
3142
<kd-content>
32-
<kd-replica-set-card-list replica-sets="$ctrl.workloads.replicaSetList.replicaSets">
33-
</kd-replica-set-card-list>
43+
<kd-pod-card-list pod-list="$ctrl.workloads.podList">
44+
</kd-pod-card-list>
3445
</kd-content>
3546
</kd-content-card>

0 commit comments

Comments
 (0)