Skip to content

Commit ac6679b

Browse files
committed
Switch beenhere icon to check_circle (#844)
Handle `succeeded` status
1 parent a409069 commit ac6679b

File tree

9 files changed

+84
-10
lines changed

9 files changed

+84
-10
lines changed

src/app/frontend/daemonsetlist/daemonsetcardlist.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<md-tooltip md-direction="right">{{::$ctrl.i18n.MSG_PODS_ARE_PENDING_TOOLTIP}}</md-tooltip>
3939
</md-icon>
4040
<md-icon class="material-icons kd-success" ng-if="::$ctrl.isSuccess(daemonSet)">
41-
beenhere
41+
check_circle
4242
</md-icon>
4343
</kd-resource-card-status>
4444
<kd-resource-card-columns>

src/app/frontend/deploymentlist/deploymentcard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<md-tooltip md-direction="right">One or more pods are in pending state</md-tooltip>
2626
</md-icon>
2727
<md-icon class="material-icons kd-success" ng-if="::$ctrl.isSuccess()">
28-
beenhere
28+
check_circle
2929
</md-icon>
3030
</kd-resource-card-status>
3131
<kd-resource-card-columns>

src/app/frontend/joblist/jobcard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<md-icon class="material-icons" style="color: green";
3131
ng-if="::$ctrl.isSuccess()">
32-
beenhere
32+
check_circle
3333
</md-icon>
3434
</kd-resource-card-status>
3535
<kd-resource-card-columns>

src/app/frontend/petsetlist/petsetcard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</md-tooltip>
2828
</md-icon>
2929
<md-icon class="material-icons kd-success" ng-if="::$ctrl.isSuccess()">
30-
beenhere
30+
check_circle
3131
</md-icon>
3232
</kd-resource-card-status>
3333
<kd-resource-card-columns>

src/app/frontend/podlist/podcardlist.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
<kd-resource-card ng-repeat="pod in $ctrl.podList.pods"
3333
type-meta="pod.typeMeta" object-meta="pod.objectMeta">
3434
<kd-resource-card-status layout="row">
35-
<md-icon class="material-icons kd-error" ng-if="::pod.podPhase=='Failed'">
35+
<md-icon class="material-icons kd-error" ng-if="$ctrl.isStatusFailed(pod)">
3636
error
3737
<md-tooltip md-direction="right">{{::$ctrl.i18n.MSG_POD_IS_FAILED_TOOLTIP}}</md-tooltip>
3838
</md-icon>
39-
<md-icon class="material-icons" ng-if="::pod.podPhase=='Pending'">
39+
<md-icon class="material-icons" ng-if="$ctrl.isStatusPending(pod)">
4040
timelapse
4141
<md-tooltip md-direction="right">{{::$ctrl.i18n.MSG_POD_IS_PENDING_TOOLTIP}}</md-tooltip>
4242
</md-icon>
43-
<md-icon class="material-icons kd-success" ng-if="::pod.podPhase=='Running'">
44-
beenhere
43+
<md-icon class="material-icons kd-success" ng-if="$ctrl.isStatusSuccessful(pod)">
44+
check_circle
4545
</md-icon>
4646
</kd-resource-card-status>
4747
<kd-resource-card-columns>

src/app/frontend/podlist/podcardlist_component.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,30 @@ export class PodCardListController {
6161
return this.state_.href(stateName,
6262
new StateParams(pod.objectMeta.namespace, pod.objectMeta.name));
6363
}
64+
65+
/**
66+
* Checks if pod status is successful, i.e. running or succeeded.
67+
* @param pod
68+
* @return {boolean}
69+
* @export
70+
*/
71+
isStatusSuccessful(pod) { return pod.podPhase === 'Running' || pod.podPhase === 'Succeeded'; }
72+
73+
/**
74+
* Checks if pod status is pending.
75+
* @param pod
76+
* @return {boolean}
77+
* @export
78+
*/
79+
isStatusPending(pod) { return pod.podPhase === 'Pending'; }
80+
81+
/**
82+
* Checks if pod status is failed.
83+
* @param pod
84+
* @return {boolean}
85+
* @export
86+
*/
87+
isStatusFailed(pod) { return pod.podPhase === 'Failed'; }
6488
}
6589

6690
/**

src/app/frontend/replicasetlist/replicasetcard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<md-icon class="material-icons" style="color: green";
3131
ng-if="::$ctrl.isSuccess()">
32-
beenhere
32+
check_circle
3333
</md-icon>
3434
</kd-resource-card-status>
3535
<kd-resource-card-columns>

src/app/frontend/replicationcontrollerlist/replicationcontrollercard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<md-tooltip md-direction="right">One or more pods are in pending state</md-tooltip>
2727
</md-icon>
2828
<md-icon class="material-icons kd-success" ng-if="::$ctrl.isSuccess()">
29-
beenhere
29+
check_circle
3030
</md-icon>
3131
</kd-resource-card-status>
3232
<kd-resource-card-columns>

src/test/frontend/podlist/podcardlist_component_test.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,54 @@ describe('Pod card list controller', () => {
5252
},
5353
})).toBe('#/pod/foo-namespace/foo-pod');
5454
});
55+
56+
it('should check pod status correctly (succeeded is successful)', () => {
57+
expect(ctrl.isStatusSuccessful({
58+
name: 'test-pod',
59+
podPhase: 'Succeeded',
60+
})).toBeTruthy();
61+
});
62+
63+
it('should check pod status correctly (running is successful)', () => {
64+
expect(ctrl.isStatusSuccessful({
65+
name: 'test-pod',
66+
podPhase: 'Running',
67+
})).toBeTruthy();
68+
});
69+
70+
it('should check pod status correctly (failed isn\'t successful)', () => {
71+
expect(ctrl.isStatusSuccessful({
72+
name: 'test-pod',
73+
podPhase: 'Failed',
74+
})).toBeFalsy();
75+
});
76+
77+
it('should check pod status correctly (pending is pending)', () => {
78+
expect(ctrl.isStatusPending({
79+
name: 'test-pod',
80+
podPhase: 'Pending',
81+
})).toBeTruthy();
82+
});
83+
84+
it('should check pod status correctly (failed isn\'t pending)', () => {
85+
expect(ctrl.isStatusPending({
86+
name: 'test-pod',
87+
podPhase: 'Failed',
88+
})).toBeFalsy();
89+
});
90+
91+
it('should check pod status correctly (failed is failed)', () => {
92+
expect(ctrl.isStatusFailed({
93+
name: 'test-pod',
94+
podPhase: 'Failed',
95+
})).toBeTruthy();
96+
});
97+
98+
it('should check pod status correctly (running isn\'t failed)', () => {
99+
expect(ctrl.isStatusFailed({
100+
name: 'test-pod',
101+
podPhase: 'Running',
102+
})).toBeFalsy();
103+
});
104+
55105
});

0 commit comments

Comments
 (0)