Skip to content

Commit 39c7d30

Browse files
digitalfishpondbryk
authored andcommitted
Status icons for DaemonSets visible on list and resources pages (#803)
1 parent 4f8bf0e commit 39c7d30

File tree

7 files changed

+55
-4
lines changed

7 files changed

+55
-4
lines changed

i18n/messages-en.xtb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
<translation id="1603454081570532220" key="MSG_PORT_MAPPINGS_PROTOCOL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Protocol' above the protocol selection box in the port mappings section, on the deploy page.">Protocol</translation>
108108
<translation id="520366299646638360" key="MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user does not specify a protocol for an existing port mapping (in the port mappings section, on the deploy page).">Protocol is required</translation>
109109
<translation id="1660903123116357917" key="MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an invalid protocol for a port mapping (in the port mappings section, on the deploy page).">Invalid protocol</translation>
110+
<translation id="791270856930969272" key="MSG_PODS_ARE_FAILED_TOOLTIP" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="tooltip for failed pod card icon">One or more pods have errors</translation>
111+
<translation id="8275670389075054584" key="MSG_PODS_ARE_PENDING_TOOLTIP" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="tooltip for pending pod card icon">One or more pods are in pending state</translation>
110112
<translation id="3543875874833788829" key="MSG_WORKLOADS_DEAMON_SETS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Daemon sets&quot;, which appears above the daemon sets list on the workloads page.">Daemon sets</translation>
111113
<translation id="5605659611398511623" key="MSG_WORKLOADS_DEPLOYMENTS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Deployments&quot;, which appears above the deployments list on the workloads page.">Deployments</translation>
112114
<translation id="3282083729093413912" key="MSG_WORKLOADS_REPLICA_SETS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Replica sets&quot;, which appears above the replica sets list on the workloads page.">Replica sets</translation>

i18n/messages-ja.xtb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
<translation id="1603454081570532220" key="MSG_PORT_MAPPINGS_PROTOCOL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Protocol' above the protocol selection box in the port mappings section, on the deploy page.">Protocol</translation>
108108
<translation id="520366299646638360" key="MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user does not specify a protocol for an existing port mapping (in the port mappings section, on the deploy page).">Protocol is required</translation>
109109
<translation id="1660903123116357917" key="MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an invalid protocol for a port mapping (in the port mappings section, on the deploy page).">Invalid protocol</translation>
110+
<translation id="791270856930969272" key="MSG_PODS_ARE_FAILED_TOOLTIP" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="tooltip for failed pod card icon">One or more pods have errors</translation>
111+
<translation id="8275670389075054584" key="MSG_PODS_ARE_PENDING_TOOLTIP" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="tooltip for pending pod card icon">One or more pods are in pending state</translation>
110112
<translation id="3543875874833788829" key="MSG_WORKLOADS_DEAMON_SETS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Daemon sets&quot;, which appears above the daemon sets list on the workloads page.">Daemon sets</translation>
111113
<translation id="5605659611398511623" key="MSG_WORKLOADS_DEPLOYMENTS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Deployments&quot;, which appears above the deployments list on the workloads page.">Deployments</translation>
112114
<translation id="3282083729093413912" key="MSG_WORKLOADS_REPLICA_SETS_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label &quot;Replica sets&quot;, which appears above the replica sets list on the workloads page.">Replica sets</translation>

src/app/frontend/daemonsetlist/daemonsetcardlist.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
</kd-resource-card-header-columns>
2929
<kd-resource-card ng-repeat="daemonSet in ::$ctrl.daemonSets.daemonSets"
3030
object-meta="daemonSet.objectMeta" type-meta="daemonSet.typeMeta">
31+
<kd-resource-card-status layout="row">
32+
<md-icon class="material-icons kd-error" ng-if="::$ctrl.hasWarnings(daemonSet)">
33+
error
34+
<md-tooltip md-direction="right">{{::$ctrl.i18n.MSG_PODS_ARE_FAILED_TOOLTIP}}</md-tooltip>
35+
</md-icon>
36+
<md-icon class="material-icons" ng-if="::$ctrl.isPending(daemonSet)">
37+
timelapse
38+
<md-tooltip md-direction="right">{{::$ctrl.i18n.MSG_PODS_ARE_PENDING_TOOLTIP}}</md-tooltip>
39+
</md-icon>
40+
<md-icon class="material-icons kd-success" ng-if="::$ctrl.isSuccess(daemonSet)">
41+
beenhere
42+
</md-icon>
43+
</kd-resource-card-status>
3144
<kd-resource-card-columns>
3245
<kd-resource-card-column>
3346
<a ng-href="{{::$ctrl.getDaemonSetDetailHref(daemonSet)}}">

src/app/frontend/daemonsetlist/daemonsetlist.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
<kd-content-card>
1818
<kd-content>
19-
<kd-daemon-set-card-list daemon-sets="::ctrl.daemonSetList"></kd-daemon-set-card-list>
19+
<kd-daemon-set-card-list daemon-sets="::ctrl.daemonSetList" with-statuses="true"></kd-daemon-set-card-list>
2020
</kd-content>
2121
</kd-content-card>

src/app/frontend/daemonsetlist/daemonsetlist_component.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export class DaemonSetCardListController {
3232

3333
/** @private {!ui.router.$state} */
3434
this.state_ = $state;
35+
36+
/**
37+
* @export
38+
*/
39+
this.i18n = i18n;
3540
}
3641

3742
/**
@@ -43,6 +48,27 @@ export class DaemonSetCardListController {
4348
return this.state_.href(
4449
stateName, new StateParams(daemonSet.objectMeta.namespace, daemonSet.objectMeta.name));
4550
}
51+
52+
/**
53+
* Returns true if any of the object's pods have warning, false otherwise
54+
* @return {boolean}
55+
* @export
56+
*/
57+
hasWarnings(daemonSet) { return daemonSet.pods.failed > 0; }
58+
59+
/**
60+
* Returns true if the object's pods have no warnings and there is at least one pod
61+
* in pending state, false otherwise
62+
* @return {boolean}
63+
* @export
64+
*/
65+
isPending(daemonSet) { return !this.hasWarnings(daemonSet) && daemonSet.pods.pending > 0; }
66+
67+
/**
68+
* @return {boolean}
69+
* @export
70+
*/
71+
isSuccess(daemonSet) { return !this.isPending(daemonSet) && !this.hasWarnings(daemonSet); }
4672
}
4773

4874
/**
@@ -62,3 +88,11 @@ export const daemonSetCardListComponent = {
6288
'withStatuses': '<',
6389
},
6490
};
91+
92+
const i18n = {
93+
/** @export {string} @desc tooltip for failed pod card icon */
94+
MSG_PODS_ARE_FAILED_TOOLTIP: goog.getMsg('One or more pods have errors.'),
95+
96+
/** @export {string} @desc tooltip for pending pod card icon */
97+
MSG_PODS_ARE_PENDING_TOOLTIP: goog.getMsg('One or more pods are in pending state.'),
98+
};

src/app/frontend/replicationcontrollerlist/replicationcontrollercard_component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export default class ReplicationControllerCardController {
4848
}
4949

5050
/**
51-
* Returns true if any of replication controller pods has warning, false otherwise
51+
* Returns true if any of the replication controller's pods have warning, false otherwise
5252
* @return {boolean}
5353
* @export
5454
*/
5555
hasWarnings() { return this.replicationController.pods.warnings.length > 0; }
5656

5757
/**
58-
* Returns true if replication controller pods have no warnings and there is at least one pod
58+
* Returns true if the replication controller's pods have no warnings and there is at least one pod
5959
* in pending state, false otherwise
6060
* @return {boolean}
6161
* @export

src/app/frontend/workloads/workloads.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</a>
2222
</kd-title>
2323
<kd-content>
24-
<kd-daemon-set-card-list daemon-sets="$ctrl.workloads.daemonSetList">
24+
<kd-daemon-set-card-list daemon-sets="$ctrl.workloads.daemonSetList" with-statuses="true">
2525
</kd-daemon-set-card-list>
2626
</kd-content>
2727
</kd-content-card>

0 commit comments

Comments
 (0)