Skip to content

Commit 3c87be8

Browse files
author
Sebastian Florek
authored
Reintroduce zerostate (#925)
1 parent b2359dc commit 3c87be8

36 files changed

+518
-100
lines changed

i18n/messages-en.xtb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,6 @@
471471
<translation id="7557308683356383132" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_MEMORY_LIMITS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Memory limits (bytes)' for the allocated resources table header on the node details page.">Memory limits (bytes)</translation>
472472
<translation id="2055003113871137121" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_PODS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' for the allocated resources table header on the node details page.">Memory limits (bytes)</translation>
473473
<translation id="5154496218567149713" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_PODS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' for the allocated resources table header on the node details page.">Pods</translation>
474+
<translation id="1538072409274591134" key="MSG_ZERO_STATE_TITLE" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title text which appears on zero state view.">There is nothing to display here</translation>
475+
<translation id="843228251260108399" key="MSG_ZERO_STATE_TEXT" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Text which appears on zero state view under the title. It provides to deploy view or offers user to take the Dashboard Tour.">Let's <ph name="CREATE_NEW_LINK" /> create a new app <ph name="CREATE_NEW_CLOSE_LINK" /> or learn more and <ph name="OPEN_LINK" /> take the Dashboard Tour <ph name="LINK_ICON" /> <ph name="CLOSE_LINK" /></translation>
474476
</translationbundle>

i18n/messages-ja.xtb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,6 @@
658658
<translation id="7557308683356383132" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_MEMORY_LIMITS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Memory limits (bytes)' for the allocated resources table header on the node details page.">Memory limits (bytes)</translation>
659659
<translation id="2055003113871137121" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_PODS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' for the allocated resources table header on the node details page.">Memory limits (bytes)</translation>
660660
<translation id="5154496218567149713" key="MSG_NODE_DETAIL_ALLOCATED_RESOURCES_PODS" source="/home/maciaszczykm/workspace/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' for the allocated resources table header on the node details page.">Pods</translation>
661+
<translation id="1538072409274591134" key="MSG_ZERO_STATE_TITLE" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title text which appears on zero state view.">There is nothing to display here</translation>
662+
<translation id="843228251260108399" key="MSG_ZERO_STATE_TEXT" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Text which appears on zero state view under the title. It provides to deploy view or offers user to take the Dashboard Tour.">Let's <ph name="CREATE_NEW_LINK" /> create a new app <ph name="CREATE_NEW_CLOSE_LINK" /> or learn more and <ph name="OPEN_LINK" /> take the Dashboard Tour <ph name="LINK_ICON" /> <ph name="CLOSE_LINK" /></translation>
661663
</translationbundle>

src/app/externs/backendapi.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,13 @@ backendApi.ReplicationControllerList;
110110

111111
/**
112112
* @typedef {{
113-
* replicationControllers: !backendApi.ReplicationControllerList,
114-
* replicaSets: !backendApi.ReplicaSetList,
115-
* pods: !backendApi.PodList
113+
* deploymentList: !backendApi.DeploymentList,
114+
* replicaSetList: !backendApi.ReplicaSetList,
115+
* jobList: !backendApi.JobList,
116+
* replicationControllerList: !backendApi.ReplicationControllerList,
117+
* podList: !backendApi.PodList,
118+
* daemonSetList: !backendApi.DaemonSetList,
119+
* petSetList: !backendApi.PetSetList
116120
* }}
117121
*/
118122
backendApi.Workloads;

src/app/frontend/common/components/components_module.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import endpointModule from './endpoint/endpoint_module';
2020
import infoCardModule from './infocard/infocard_module';
2121
import resourceCardModule from './resourcecard/resourcecard_module';
2222
import actionbarModule from './actionbar/actionbar_module';
23+
import zeroStateModule from './zerostate/zerostate_module';
2324
import sparklineDirective from './sparkline/sparkline_directive';
2425
import warnThresholdDirective from './warnthreshold/warnthreshold_directive';
2526

@@ -38,6 +39,7 @@ export default angular
3839
endpointModule.name,
3940
infoCardModule.name,
4041
resourceCardModule.name,
42+
zeroStateModule.name,
4143
])
4244
.directive('kdLabels', labelsDirective)
4345
.directive('kdMiddleEllipsis', middleEllipsisDirective)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<kd-content-card>
18+
<kd-content>
19+
<div class="kd-zerostate-message">
20+
<div class="kd-zerostate-title">{{::$ctrl.i18n.MSG_ZERO_STATE_TITLE}}</div>
21+
<div class="kd-zerostate-text">
22+
<span ng-bind-html="::$ctrl.i18n.MSG_ZERO_STATE_TEXT"></span>
23+
</div>
24+
</div>
25+
</kd-content>
26+
</kd-content-card>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
@import '../../../variables';
15+
16+
.kd-zerostate-message {
17+
padding: 2 * $baseline-grid;
18+
text-align: center;
19+
}
20+
21+
.kd-zerostate-icon {
22+
color: $primary;
23+
font-size: $body-font-size-base;
24+
margin-bottom: $baseline-grid;
25+
}
26+
27+
.kd-zerostate-title {
28+
color: $muted;
29+
font-size: $headline-font-size-base;
30+
margin-bottom: $baseline-grid / 2;
31+
}
32+
33+
.kd-zerostate-text {
34+
word-break: break-all;
35+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 ZeroStateController {
19+
/**
20+
* @ngInject
21+
*/
22+
constructor() {
23+
/** @export */
24+
this.i18n = i18n;
25+
}
26+
}
27+
28+
/**
29+
* Returns zero state component.
30+
*
31+
* @return {!angular.Directive}
32+
*/
33+
export const zeroStateComponent = {
34+
templateUrl: 'common/components/zerostate/zerostate.html',
35+
transclude: true,
36+
controller: ZeroStateController,
37+
};
38+
39+
const i18n = {
40+
/** @export {string} @desc Title text which appears on zero state view. */
41+
MSG_ZERO_STATE_TITLE: goog.getMsg('There is nothing to display here'),
42+
/** @export {string} @desc Text which appears on zero state view under the title. It provides
43+
* to deploy view or offers user to take the Dashboard Tour. */
44+
MSG_ZERO_STATE_TEXT: goog.getMsg(
45+
'Let\'s {$createNewLink} create a new app {$createNewCloseLink} or learn more' +
46+
' and {$openLink} take the Dashboard Tour {$linkIcon} {$closeLink}',
47+
{
48+
'createNewLink': `<a href="#/deploy/file">`,
49+
'createNewCloseLink': `</a>`,
50+
'openLink': `<a href="http://kubernetes.io/docs/user-guide/ui/" target="_blank">`,
51+
'linkIcon': `<i class="material-icons kd-zerostate-icon">open_in_new</i>`,
52+
'closeLink': `</a>`,
53+
}),
54+
};
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+
import {zeroStateComponent} from './zerostate_component';
16+
import resourceCardModule from 'common/components/resourcecard/resourcecard_module';
17+
18+
/**
19+
* Module containing common actionbar.
20+
*/
21+
export default angular
22+
.module(
23+
'kubernetesDashboard.common.components.zeroState',
24+
[
25+
'ngMaterial',
26+
'ui.router',
27+
resourceCardModule.name,
28+
])
29+
.component('kdZeroState', zeroStateComponent);

src/app/frontend/daemonsetlist/daemonsetlist.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
limitations under the License.
1515
-->
1616

17-
<kd-content-card>
17+
<kd-content-card ng-if="!ctrl.shouldShowZeroState()">
1818
<kd-content>
1919
<kd-daemon-set-card-list daemon-sets="::ctrl.daemonSetList" with-statuses="true"></kd-daemon-set-card-list>
2020
</kd-content>
2121
</kd-content-card>
22+
<kd-zero-state ng-if="ctrl.shouldShowZeroState()"></kd-zero-state>

src/app/frontend/daemonsetlist/daemonsetlist_component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class DaemonSetCardListController {
2727
constructor($state, $interpolate) {
2828
/**
2929
* Initialized from the scope.
30-
* @export {!backendApi.ReplicationController}
30+
* @export {!backendApi.DaemonSet}
3131
*/
3232
this.daemonSets;
3333

0 commit comments

Comments
 (0)