Skip to content

Commit 4b30401

Browse files
digitalfishpondmaciaszczykm
authored andcommitted
Add namespace column to resource cards when more than one namespace is selected (#1063)
1 parent 5837d68 commit 4b30401

File tree

65 files changed

+973
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+973
-43
lines changed

i18n/messages-en.xtb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,4 +524,23 @@
524524
<translation id="3684607543489263600" key="MSG_ENV_FROM_CONFIG_MAP" source="/usr/local/google/home/bryk/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label for environment variable that comes from a Config Map">value from ConfigMap <ph name="NAME" />/<ph name="KEY" /></translation>
525525
<translation id="6987669710926523285" key="MSG_NODE_LIST_READY_LABEL" source="/usr/local/google/home/bryk/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Ready' which appears as a column label in the table of nodes (node list view).">Ready</translation>
526526
<translation id="6106340570580081121" key="MSG_DAEMON_SET_DETAIL_SERVICES_TITLE" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title 'Services' for the services information section on the daemon set detail page.">Services</translation>
527+
<translation id="6537383105836584689" key="MSG_DEPLOYMENT_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of deployments (deployment list view).">Namespace</translation>
528+
<translation id="2872431258829082433" key="MSG_JOB_LIST_NAME_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Name' which appears as a column label in the table of jobs (Job list view).">Name</translation>
529+
<translation id="8978854967234873489" key="MSG_JOB_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (Job list view).">Namespace</translation>
530+
<translation id="6310730601576371329" key="MSG_JOB_LIST_LABELS_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Labels' which appears as a column label in the table of replication controllers (Job list view).">Labels</translation>
531+
<translation id="6160307955179693927" key="MSG_JOB_LIST_PODS_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' which appears as a column label in the table of replication controllers (Job list view).">Pods</translation>
532+
<translation id="7287602791689381779" key="MSG_JOB_LIST_AGE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Age' which appears as a column label in the table of replication controllers (Job list view).">Age</translation>
533+
<translation id="2678441499396017713" key="MSG_JOB_LIST_IMAGES_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Images' which appears as a column label in the table of replication controllers (Job list view).">Images</translation>
534+
<translation id="6174070521345623465" key="MSG_REPLICA_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
535+
<translation id="7353393581531104052" key="MSG_POD_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of pods (pod list view).">Namespace</translation>
536+
<translation id="6859808734310490214" key="MSG_SERVICE_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of services (service list view).">Namespace</translation>
537+
<translation id="4677646778972512564" key="MSG_RC_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
538+
<translation id="7091154364335994224" key="MSG_DAEMON_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of daemon sets (daemon set list view).">Namespace</translation>
539+
<translation id="3842998446932089885" key="MSG_PET_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Pet set list header: namespace.">Namespace</translation>
540+
<translation id="1932088152662132374" key="MSG_SECRET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of secrets (secret list view).">Namespace</translation>
541+
<translation id="910153156225182799" key="MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Config map list header: namespace.">Namespace</translation>
542+
<translation id="910153156225182799" key="MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Config map list header: namespace.">Namespace</translation>
543+
<translation id="7091154364335994224" key="MSG_DAEMON_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of daemon sets (daemon set list view).">Namespace</translation>
544+
<translation id="4677646778972512564" key="MSG_RC_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
545+
<translation id="6106340570580081121" key="MSG_DAEMON_SET_DETAIL_SERVICES_TITLE" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title 'Services' for the services information section on the daemon set detail page.">Services</translation>
527546
</translationbundle>

i18n/messages-ja.xtb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,5 +712,24 @@
712712
<translation id="7249897739191369792" key="MSG_CONTAINER_DETAILS_NO_ENV_VARS" source="/usr/local/google/home/bryk/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label when there is no container environment variables.">-</translation>
713713
<translation id="3684607543489263600" key="MSG_ENV_FROM_CONFIG_MAP" source="/usr/local/google/home/bryk/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label for environment variable that comes from a Config Map">value from ConfigMap <ph name="NAME" />/<ph name="KEY" /></translation>
714714
<translation id="6987669710926523285" key="MSG_NODE_LIST_READY_LABEL" source="/usr/local/google/home/bryk/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Ready' which appears as a column label in the table of nodes (node list view).">Ready</translation>
715+
<translation id="910153156225182799" key="MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Config map list header: namespace.">Namespace</translation>
716+
<translation id="7091154364335994224" key="MSG_DAEMON_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of daemon sets (daemon set list view).">Namespace</translation>
717+
<translation id="4677646778972512564" key="MSG_RC_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
718+
<translation id="6537383105836584689" key="MSG_DEPLOYMENT_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of deployments (deployment list view).">Namespace</translation>
719+
<translation id="2872431258829082433" key="MSG_JOB_LIST_NAME_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Name' which appears as a column label in the table of jobs (Job list view).">Name</translation>
720+
<translation id="8978854967234873489" key="MSG_JOB_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (Job list view).">Namespace</translation>
721+
<translation id="6310730601576371329" key="MSG_JOB_LIST_LABELS_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Labels' which appears as a column label in the table of replication controllers (Job list view).">Labels</translation>
722+
<translation id="6160307955179693927" key="MSG_JOB_LIST_PODS_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Pods' which appears as a column label in the table of replication controllers (Job list view).">Pods</translation>
723+
<translation id="7287602791689381779" key="MSG_JOB_LIST_AGE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Age' which appears as a column label in the table of replication controllers (Job list view).">Age</translation>
724+
<translation id="2678441499396017713" key="MSG_JOB_LIST_IMAGES_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Images' which appears as a column label in the table of replication controllers (Job list view).">Images</translation>
725+
<translation id="6174070521345623465" key="MSG_REPLICA_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
726+
<translation id="7353393581531104052" key="MSG_POD_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of pods (pod list view).">Namespace</translation>
727+
<translation id="6859808734310490214" key="MSG_SERVICE_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of services (service list view).">Namespace</translation>
728+
<translation id="4677646778972512564" key="MSG_RC_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of replication controllers (RC list view).">Namespace</translation>
729+
<translation id="7091154364335994224" key="MSG_DAEMON_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of daemon sets (daemon set list view).">Namespace</translation>
730+
<translation id="3842998446932089885" key="MSG_PET_SET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Pet set list header: namespace.">Namespace</translation>
731+
<translation id="1932088152662132374" key="MSG_SECRET_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Label 'Namespace' which appears as a column label in the table of secrets (secret list view).">Namespace</translation>
732+
<translation id="910153156225182799" key="MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Config map list header: namespace.">Namespace</translation>
733+
<translation id="6106340570580081121" key="MSG_DAEMON_SET_DETAIL_SERVICES_TITLE" source="/home/denis/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title 'Services' for the services information section on the daemon set detail page.">Services</translation>
715734
<translation id="6106340570580081121" key="MSG_DAEMON_SET_DETAIL_SERVICES_TITLE" source="/home/floreks/Projects/dashboard/.tmp/serve/app-dev.js" desc="Title 'Services' for the services information section on the daemon set detail page.">Services</translation>
716735
</translationbundle>

src/app/frontend/common/namespace/namespace_module.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// Copyright 2015 Google Inc. All Rights Reserved.
32
//
43
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +12,7 @@
1312
// See the License for the specific language governing permissions and
1413
// limitations under the License.
1514

15+
import {NamespaceService} from './namespace_service';
1616
import {namespaceSelectComponent} from './namespaceselect_component';
1717

1818
/**
@@ -25,4 +25,5 @@ export default angular
2525
'ngMaterial',
2626
'ngResource',
2727
])
28-
.component('kdNamespaceSelect', namespaceSelectComponent);
28+
.component('kdNamespaceSelect', namespaceSelectComponent)
29+
.service('kdNamespaceService', NamespaceService);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
* Service class for registering namespace.
17+
* @final
18+
*/
19+
export class NamespaceService {
20+
/**
21+
* @ngInject
22+
*/
23+
constructor() {
24+
/** @private {boolean} */
25+
this.multipleNamespacesSelected_ = true;
26+
}
27+
28+
/**
29+
* Getter for multipleNamespacesSelected_ flag.
30+
* @return {boolean}
31+
*/
32+
areMultipleNamespacesSelected() { return this.multipleNamespacesSelected_; }
33+
34+
/**
35+
* Switches the multipleNamespacesSelected flag.
36+
* @param {boolean} multipleSelected
37+
*/
38+
setMultipleNamespacesSelected(multipleSelected) {
39+
this.multipleNamespacesSelected_ = multipleSelected;
40+
}
41+
}

src/app/frontend/common/namespace/namespaceselect_component.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export class NamespaceSelectController {
2525
* @param {!angular.$resource} $resource
2626
* @param {!ui.router.$state} $state
2727
* @param {!angular.Scope} $scope
28+
* @param {!./namespace_service.NamespaceService} kdNamespaceService
2829
* @ngInject
2930
*/
30-
constructor($resource, $state, $scope) {
31+
constructor($resource, $state, $scope, kdNamespaceService) {
3132
/**
3233
* Initialized with all namespaces on first open.
3334
* @export {!Array<string>}
@@ -49,6 +50,11 @@ export class NamespaceSelectController {
4950
*/
5051
this.selectedNamespace;
5152

53+
/**
54+
* @private {!./namespace_service.NamespaceService}
55+
*/
56+
this.namespaceService_ = kdNamespaceService;
57+
5258
/** @private {!angular.$resource} */
5359
this.resource_ = $resource;
5460

@@ -85,16 +91,20 @@ export class NamespaceSelectController {
8591
if (this.namespacesInitialized_) {
8692
if (this.namespaces.indexOf(newNamespace) >= 0) {
8793
this.selectedNamespace = newNamespace;
94+
this.namespaceService_.setMultipleNamespacesSelected(false);
8895
} else {
8996
this.selectedNamespace = NAMESPACE_NOT_SELECTED;
97+
this.namespaceService_.setMultipleNamespacesSelected(true);
9098
}
9199
this.changeNamespace();
92100
} else {
93101
this.namespaces = [newNamespace];
94102
this.selectedNamespace = newNamespace;
103+
this.namespaceService_.setMultipleNamespacesSelected(false);
95104
}
96105
} else {
97106
this.selectedNamespace = NAMESPACE_NOT_SELECTED;
107+
this.namespaceService_.setMultipleNamespacesSelected(true);
98108
}
99109
}
100110
}

src/app/frontend/configmaplist/configmapcard.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
</a>
2525
</div>
2626
</kd-resource-card-column>
27+
<kd-resource-card-column ng-if="$ctrl.areMultipleNamespacesSelected()">
28+
<div>
29+
<kd-middle-ellipsis display-string="{{::$ctrl.configMap.objectMeta.namespace}}">
30+
</kd-middle-ellipsis>
31+
</div>
32+
</kd-resource-card-column>
2733
<kd-resource-card-column>
2834
<kd-labels labels="::$ctrl.configMap.objectMeta.labels"></kd-labels>
2935
</kd-resource-card-column>

src/app/frontend/configmaplist/configmapcard_component.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ export default class ConfigMapCardController {
2424
/**
2525
* @param {!ui.router.$state} $state
2626
* @param {!angular.$interpolate} $interpolate
27+
* @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService
2728
* @ngInject
2829
*/
29-
constructor($state, $interpolate) {
30+
constructor($state, $interpolate, kdNamespaceService) {
3031
/**
3132
* Initialized from the scope.
3233
* @export {!backendApi.ConfigMap}
@@ -39,10 +40,21 @@ export default class ConfigMapCardController {
3940
/** @private */
4041
this.interpolate_ = $interpolate;
4142

43+
/** @private {!./../common/namespace/namespace_service.NamespaceService} */
44+
this.kdNamespaceService_ = kdNamespaceService;
45+
4246
/** @export */
4347
this.i18n = i18n;
4448
}
4549

50+
/**
51+
* @return {boolean}
52+
* @export
53+
*/
54+
areMultipleNamespacesSelected() {
55+
return this.kdNamespaceService_.areMultipleNamespacesSelected();
56+
}
57+
4658
/**
4759
* @return {string}
4860
* @export

src/app/frontend/configmaplist/configmapcardlist.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<kd-resource-card-header-column grow="2">
2020
{{::$ctrl.i18n.MSG_CONFIG_MAP_LIST_HEADER_NAME}}
2121
</kd-resource-card-header-column>
22+
<kd-resource-card-header-column grow="2" ng-if="$ctrl.areMultipleNamespacesSelected()">
23+
{{::$ctrl.i18n.MSG_CONFIGMAP_LIST_NAMESPACE_LABEL}}
24+
</kd-resource-card-header-column>
2225
<kd-resource-card-header-column grow="2">
2326
{{::$ctrl.i18n.MSG_CONFIG_MAP_LIST_HEADER_LABELS}}
2427
</kd-resource-card-header-column>

src/app/frontend/configmaplist/configmapcardlist_component.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,24 @@
1919
*/
2020
export class ConfigMapCardListController {
2121
/**
22+
* @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService
2223
* @ngInject
2324
*/
24-
constructor() {
25+
constructor(kdNamespaceService) {
26+
/** @private {!./../common/namespace/namespace_service.NamespaceService} */
27+
this.kdNamespaceService_ = kdNamespaceService;
28+
2529
/** @export */
2630
this.i18n = i18n;
2731
}
32+
33+
/**
34+
* @return {boolean}
35+
* @export
36+
*/
37+
areMultipleNamespacesSelected() {
38+
return this.kdNamespaceService_.areMultipleNamespacesSelected();
39+
}
2840
}
2941

3042
/**
@@ -41,10 +53,12 @@ export const configMapCardListComponent = {
4153
};
4254

4355
const i18n = {
44-
/** @export {string} @desc Pet set list header: name. */
56+
/** @export {string} @desc Config map list header: name. */
4557
MSG_CONFIG_MAP_LIST_HEADER_NAME: goog.getMsg('Name'),
46-
/** @export {string} @desc Pet set list header: labels. */
58+
/** @export {string} @desc Config map list header: namespace. */
59+
MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'),
60+
/** @export {string} @desc Config map list header: labels. */
4761
MSG_CONFIG_MAP_LIST_HEADER_LABELS: goog.getMsg('Labels'),
48-
/** @export {string} @desc Pet set list header: age. */
62+
/** @export {string} @desc Config map list header: age. */
4963
MSG_CONFIG_MAP_LIST_HEADER_AGE: goog.getMsg('Age'),
5064
};

src/app/frontend/configmaplist/configmaplist_module.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import filtersModule from 'common/filters/filters_module';
1717
import componentsModule from 'common/components/components_module';
1818
import chromeModule from 'chrome/chrome_module';
1919
import configMapDetailModule from 'configmapdetail/configmapdetail_module';
20+
import namespaceModule from 'common/namespace/namespace_module';
2021
import {configMapCardComponent} from './configmapcard_component';
2122
import {configMapCardListComponent} from './configmapcardlist_component';
2223

@@ -34,6 +35,7 @@ export default angular
3435
componentsModule.name,
3536
configMapDetailModule.name,
3637
chromeModule.name,
38+
namespaceModule.name,
3739
])
3840
.config(stateConfig)
3941
.component('kdConfigMapCardList', configMapCardListComponent)

0 commit comments

Comments
 (0)