From 4b3040103f227f73ec7929b3d8b380f5e3a55506 Mon Sep 17 00:00:00 2001 From: Denis Poisson Date: Mon, 1 Aug 2016 15:49:41 +0200 Subject: [PATCH] Add namespace column to resource cards when more than one namespace is selected (#1063) --- i18n/messages-en.xtb | 19 ++++++++ i18n/messages-ja.xtb | 19 ++++++++ .../common/namespace/namespace_module.js | 5 +- .../common/namespace/namespace_service.js | 41 ++++++++++++++++ .../namespace/namespaceselect_component.js | 12 ++++- .../frontend/configmaplist/configmapcard.html | 6 +++ .../configmaplist/configmapcard_component.js | 14 +++++- .../configmaplist/configmapcardlist.html | 3 ++ .../configmapcardlist_component.js | 22 +++++++-- .../configmaplist/configmaplist_module.js | 2 + .../frontend/daemonsetlist/daemonsetcard.html | 6 +++ .../daemonsetlist/daemonsetcard_component.js | 14 +++++- .../daemonsetlist/daemonsetcardlist.html | 3 ++ .../daemonsetcardlist_component.js | 21 ++++++++- .../daemonsetlist/daemonsetlist_module.js | 2 + .../deploymentlist/deploymentcard.html | 6 +++ .../deploymentcard_component.js | 14 +++++- .../deploymentlist/deploymentcardlist.html | 3 ++ .../deploymentcardlist_component.js | 24 +++++++++- .../deploymentlist/deploymentlist_module.js | 2 + src/app/frontend/joblist/jobcard.html | 6 +++ src/app/frontend/joblist/jobcard_component.js | 14 +++++- src/app/frontend/joblist/jobcardlist.html | 13 +++-- .../frontend/joblist/jobcardlist_component.js | 47 +++++++++++++++++++ src/app/frontend/joblist/joblist_module.js | 2 + src/app/frontend/petsetlist/petsetcard.html | 6 +++ .../petsetlist/petsetcard_component.js | 14 +++++- .../frontend/petsetlist/petsetcardlist.html | 3 ++ .../petsetlist/petsetcardlist_component.js | 16 ++++++- .../frontend/petsetlist/petsetlist_module.js | 2 + src/app/frontend/podlist/podcardlist.html | 9 ++++ .../frontend/podlist/podcardlist_component.js | 17 ++++++- src/app/frontend/podlist/podlist_module.js | 2 + .../replicasetlist/replicasetcard.html | 6 +++ .../replicasetcard_component.js | 14 +++++- .../replicasetlist/replicasetcardlist.html | 3 ++ .../replicasetcardlist_component.js | 18 ++++++- .../replicasetlist/replicasetlist_module.js | 2 + .../replicationcontrollercard.html | 6 +++ .../replicationcontrollercard_component.js | 14 +++++- .../replicationcontrollercardlist.html | 3 ++ ...replicationcontrollercardlist_component.js | 20 +++++++- .../replicationcontrollerlist_module.js | 2 + src/app/frontend/secretlist/secretcard.html | 6 +++ .../secretlist/secretcard_component.js | 14 +++++- .../frontend/secretlist/secretcardlist.html | 3 ++ .../secretlist/secretcardlist_component.js | 21 ++++++++- .../frontend/secretlist/secretlist_module.js | 2 + src/app/frontend/servicelist/servicecard.html | 6 +++ .../servicelist/servicecard_component.js | 14 +++++- .../frontend/servicelist/servicecardlist.html | 3 ++ .../servicelist/servicecardlist_component.js | 21 ++++++++- .../servicelist/servicelist_module.js | 2 + .../namespace/namespace_service_test.js | 40 ++++++++++++++++ .../namespaceselect_component_test.js | 27 ++++++++--- .../configmapcardlist_component_test.js | 18 ++++++- .../daemonsetcardlist_component_test.js | 43 +++++++++++++++++ .../deploymentcardlist_component_test.js | 43 +++++++++++++++++ .../joblist/jobcardlist_component_test.js | 43 +++++++++++++++++ .../petsetcardlist_component_test.js | 43 +++++++++++++++++ .../podlist/podcardlist_component_test.js | 18 ++++++- .../replicasetcardlist_component_test.js | 43 +++++++++++++++++ ...cationcontrollercardlist_component_test.js | 43 +++++++++++++++++ .../secretcardlist_component_test.js | 43 +++++++++++++++++ .../servicecardlist_component_test.js | 43 +++++++++++++++++ 65 files changed, 973 insertions(+), 43 deletions(-) create mode 100644 src/app/frontend/common/namespace/namespace_service.js create mode 100644 src/test/frontend/common/namespace/namespace_service_test.js create mode 100644 src/test/frontend/daemonsetlist/daemonsetcardlist_component_test.js create mode 100644 src/test/frontend/deploymentlist/deploymentcardlist_component_test.js create mode 100644 src/test/frontend/joblist/jobcardlist_component_test.js create mode 100644 src/test/frontend/petsetlist/petsetcardlist_component_test.js create mode 100644 src/test/frontend/replicasetlist/replicasetcardlist_component_test.js create mode 100644 src/test/frontend/replicationcontrollerlist/replicationcontrollercardlist_component_test.js create mode 100644 src/test/frontend/secretlist/secretcardlist_component_test.js create mode 100644 src/test/frontend/servicelist/servicecardlist_component_test.js diff --git a/i18n/messages-en.xtb b/i18n/messages-en.xtb index 5c986a8ef..6d69f7cd4 100644 --- a/i18n/messages-en.xtb +++ b/i18n/messages-en.xtb @@ -524,4 +524,23 @@ value from ConfigMap / Ready Services + Namespace + Name + Namespace + Labels + Pods + Age + Images + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Services \ No newline at end of file diff --git a/i18n/messages-ja.xtb b/i18n/messages-ja.xtb index e8cc02f92..7b9f7c981 100644 --- a/i18n/messages-ja.xtb +++ b/i18n/messages-ja.xtb @@ -712,5 +712,24 @@ - value from ConfigMap / Ready + Namespace + Namespace + Namespace + Namespace + Name + Namespace + Labels + Pods + Age + Images + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Namespace + Services Services \ No newline at end of file diff --git a/src/app/frontend/common/namespace/namespace_module.js b/src/app/frontend/common/namespace/namespace_module.js index c32e15c84..363eaff06 100644 --- a/src/app/frontend/common/namespace/namespace_module.js +++ b/src/app/frontend/common/namespace/namespace_module.js @@ -1,4 +1,3 @@ - // Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import {NamespaceService} from './namespace_service'; import {namespaceSelectComponent} from './namespaceselect_component'; /** @@ -25,4 +25,5 @@ export default angular 'ngMaterial', 'ngResource', ]) - .component('kdNamespaceSelect', namespaceSelectComponent); + .component('kdNamespaceSelect', namespaceSelectComponent) + .service('kdNamespaceService', NamespaceService); diff --git a/src/app/frontend/common/namespace/namespace_service.js b/src/app/frontend/common/namespace/namespace_service.js new file mode 100644 index 000000000..88dd2cd6c --- /dev/null +++ b/src/app/frontend/common/namespace/namespace_service.js @@ -0,0 +1,41 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * Service class for registering namespace. + * @final + */ +export class NamespaceService { + /** + * @ngInject + */ + constructor() { + /** @private {boolean} */ + this.multipleNamespacesSelected_ = true; + } + + /** + * Getter for multipleNamespacesSelected_ flag. + * @return {boolean} + */ + areMultipleNamespacesSelected() { return this.multipleNamespacesSelected_; } + + /** + * Switches the multipleNamespacesSelected flag. + * @param {boolean} multipleSelected + */ + setMultipleNamespacesSelected(multipleSelected) { + this.multipleNamespacesSelected_ = multipleSelected; + } +} diff --git a/src/app/frontend/common/namespace/namespaceselect_component.js b/src/app/frontend/common/namespace/namespaceselect_component.js index 34199c2f5..32055c388 100644 --- a/src/app/frontend/common/namespace/namespaceselect_component.js +++ b/src/app/frontend/common/namespace/namespaceselect_component.js @@ -25,9 +25,10 @@ export class NamespaceSelectController { * @param {!angular.$resource} $resource * @param {!ui.router.$state} $state * @param {!angular.Scope} $scope + * @param {!./namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($resource, $state, $scope) { + constructor($resource, $state, $scope, kdNamespaceService) { /** * Initialized with all namespaces on first open. * @export {!Array} @@ -49,6 +50,11 @@ export class NamespaceSelectController { */ this.selectedNamespace; + /** + * @private {!./namespace_service.NamespaceService} + */ + this.namespaceService_ = kdNamespaceService; + /** @private {!angular.$resource} */ this.resource_ = $resource; @@ -85,16 +91,20 @@ export class NamespaceSelectController { if (this.namespacesInitialized_) { if (this.namespaces.indexOf(newNamespace) >= 0) { this.selectedNamespace = newNamespace; + this.namespaceService_.setMultipleNamespacesSelected(false); } else { this.selectedNamespace = NAMESPACE_NOT_SELECTED; + this.namespaceService_.setMultipleNamespacesSelected(true); } this.changeNamespace(); } else { this.namespaces = [newNamespace]; this.selectedNamespace = newNamespace; + this.namespaceService_.setMultipleNamespacesSelected(false); } } else { this.selectedNamespace = NAMESPACE_NOT_SELECTED; + this.namespaceService_.setMultipleNamespacesSelected(true); } } } diff --git a/src/app/frontend/configmaplist/configmapcard.html b/src/app/frontend/configmaplist/configmapcard.html index cf6ccabdc..ecafc1d63 100644 --- a/src/app/frontend/configmaplist/configmapcard.html +++ b/src/app/frontend/configmaplist/configmapcard.html @@ -24,6 +24,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/configmaplist/configmapcard_component.js b/src/app/frontend/configmaplist/configmapcard_component.js index 0429a6688..a073f35a2 100644 --- a/src/app/frontend/configmaplist/configmapcard_component.js +++ b/src/app/frontend/configmaplist/configmapcard_component.js @@ -24,9 +24,10 @@ export default class ConfigMapCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.ConfigMap} @@ -39,10 +40,21 @@ export default class ConfigMapCardController { /** @private */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/configmaplist/configmapcardlist.html b/src/app/frontend/configmaplist/configmapcardlist.html index d5f239402..63aa7d8e0 100644 --- a/src/app/frontend/configmaplist/configmapcardlist.html +++ b/src/app/frontend/configmaplist/configmapcardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_CONFIG_MAP_LIST_HEADER_NAME}} + + {{::$ctrl.i18n.MSG_CONFIGMAP_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_CONFIG_MAP_LIST_HEADER_LABELS}} diff --git a/src/app/frontend/configmaplist/configmapcardlist_component.js b/src/app/frontend/configmaplist/configmapcardlist_component.js index 4cbb78ced..248f03b73 100644 --- a/src/app/frontend/configmaplist/configmapcardlist_component.js +++ b/src/app/frontend/configmaplist/configmapcardlist_component.js @@ -19,12 +19,24 @@ */ export class ConfigMapCardListController { /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor() { + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -41,10 +53,12 @@ export const configMapCardListComponent = { }; const i18n = { - /** @export {string} @desc Pet set list header: name. */ + /** @export {string} @desc Config map list header: name. */ MSG_CONFIG_MAP_LIST_HEADER_NAME: goog.getMsg('Name'), - /** @export {string} @desc Pet set list header: labels. */ + /** @export {string} @desc Config map list header: namespace. */ + MSG_CONFIG_MAP_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), + /** @export {string} @desc Config map list header: labels. */ MSG_CONFIG_MAP_LIST_HEADER_LABELS: goog.getMsg('Labels'), - /** @export {string} @desc Pet set list header: age. */ + /** @export {string} @desc Config map list header: age. */ MSG_CONFIG_MAP_LIST_HEADER_AGE: goog.getMsg('Age'), }; diff --git a/src/app/frontend/configmaplist/configmaplist_module.js b/src/app/frontend/configmaplist/configmaplist_module.js index 4a849f2fa..135d57f46 100644 --- a/src/app/frontend/configmaplist/configmaplist_module.js +++ b/src/app/frontend/configmaplist/configmaplist_module.js @@ -17,6 +17,7 @@ import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; import chromeModule from 'chrome/chrome_module'; import configMapDetailModule from 'configmapdetail/configmapdetail_module'; +import namespaceModule from 'common/namespace/namespace_module'; import {configMapCardComponent} from './configmapcard_component'; import {configMapCardListComponent} from './configmapcardlist_component'; @@ -34,6 +35,7 @@ export default angular componentsModule.name, configMapDetailModule.name, chromeModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdConfigMapCardList', configMapCardListComponent) diff --git a/src/app/frontend/daemonsetlist/daemonsetcard.html b/src/app/frontend/daemonsetlist/daemonsetcard.html index a11ead84d..fc30c8b33 100644 --- a/src/app/frontend/daemonsetlist/daemonsetcard.html +++ b/src/app/frontend/daemonsetlist/daemonsetcard.html @@ -35,6 +35,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/daemonsetlist/daemonsetcard_component.js b/src/app/frontend/daemonsetlist/daemonsetcard_component.js index 7b04d73fc..bc1ac3133 100644 --- a/src/app/frontend/daemonsetlist/daemonsetcard_component.js +++ b/src/app/frontend/daemonsetlist/daemonsetcard_component.js @@ -24,9 +24,10 @@ export class DaemonSetCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** @export {!backendApi.DaemonSet} - Initialized from binding. */ this.daemonSet; @@ -36,10 +37,21 @@ export class DaemonSetCardController { /** @private {!angular.$interpolate} */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/daemonsetlist/daemonsetcardlist.html b/src/app/frontend/daemonsetlist/daemonsetcardlist.html index 645f08301..51ee1a6ef 100644 --- a/src/app/frontend/daemonsetlist/daemonsetcardlist.html +++ b/src/app/frontend/daemonsetlist/daemonsetcardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_DAEMON_SET_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_DAEMON_SET_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_DAEMON_SET_LIST_LABELS_LABEL}} diff --git a/src/app/frontend/daemonsetlist/daemonsetcardlist_component.js b/src/app/frontend/daemonsetlist/daemonsetcardlist_component.js index 78e81b93b..dc83b49ac 100644 --- a/src/app/frontend/daemonsetlist/daemonsetcardlist_component.js +++ b/src/app/frontend/daemonsetlist/daemonsetcardlist_component.js @@ -16,11 +16,25 @@ * @final */ export class DaemonSetCardListController { - /** @ngInject */ - constructor() { + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -47,6 +61,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of daemon sets (daemon set list view). */ MSG_DAEMON_SET_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of daemon sets (daemon set list view). */ + MSG_DAEMON_SET_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Labels' which appears as a column label in the table of daemon sets (daemon set list view). */ MSG_DAEMON_SET_LIST_LABELS_LABEL: goog.getMsg('Labels'), diff --git a/src/app/frontend/daemonsetlist/daemonsetlist_module.js b/src/app/frontend/daemonsetlist/daemonsetlist_module.js index 7f6b61412..ac37a41ce 100644 --- a/src/app/frontend/daemonsetlist/daemonsetlist_module.js +++ b/src/app/frontend/daemonsetlist/daemonsetlist_module.js @@ -15,6 +15,7 @@ import componentsModule from 'common/components/components_module'; import chromeModule from 'chrome/chrome_module'; import filtersModule from 'common/filters/filters_module'; +import namespaceModule from 'common/namespace/namespace_module'; import stateConfig from './daemonsetlist_stateconfig'; import {daemonSetCardListComponent} from './daemonsetcardlist_component'; import {daemonSetCardComponent} from './daemonsetcard_component'; @@ -33,6 +34,7 @@ export default angular 'ngResource', 'ui.router', filtersModule.name, + namespaceModule.name, componentsModule.name, chromeModule.name, daemonSetDetailModule.name, diff --git a/src/app/frontend/deploymentlist/deploymentcard.html b/src/app/frontend/deploymentlist/deploymentcard.html index 65368fed6..55b10286d 100644 --- a/src/app/frontend/deploymentlist/deploymentcard.html +++ b/src/app/frontend/deploymentlist/deploymentcard.html @@ -41,6 +41,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/deploymentlist/deploymentcard_component.js b/src/app/frontend/deploymentlist/deploymentcard_component.js index 5bd121d20..e24c61ca0 100644 --- a/src/app/frontend/deploymentlist/deploymentcard_component.js +++ b/src/app/frontend/deploymentlist/deploymentcard_component.js @@ -24,9 +24,10 @@ export default class DeploymentCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.Deployment} @@ -39,10 +40,21 @@ export default class DeploymentCardController { /** @private {!angular.$interpolate} */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/deploymentlist/deploymentcardlist.html b/src/app/frontend/deploymentlist/deploymentcardlist.html index 8539c0526..ba7c1f483 100644 --- a/src/app/frontend/deploymentlist/deploymentcardlist.html +++ b/src/app/frontend/deploymentlist/deploymentcardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_DEPLOYMENT_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_DEPLOYMENT_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_DEPLOYMENT_LIST_LABELS_LABEL}} diff --git a/src/app/frontend/deploymentlist/deploymentcardlist_component.js b/src/app/frontend/deploymentlist/deploymentcardlist_component.js index 4a65e5c0c..39b5da82d 100644 --- a/src/app/frontend/deploymentlist/deploymentcardlist_component.js +++ b/src/app/frontend/deploymentlist/deploymentcardlist_component.js @@ -16,8 +16,25 @@ * @final */ class DeploymentCardListController { - /** @ngInject */ - constructor() { this.i18n = i18n; } + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + + /** @export */ + this.i18n = i18n; + } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -37,6 +54,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of deployments (deployment list view). */ MSG_DEPLOYMENT_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of deployments (deployment list view). */ + MSG_DEPLOYMENT_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Labels' which appears as a column label in the table of deployments (deployment list view). */ MSG_DEPLOYMENT_LIST_LABELS_LABEL: goog.getMsg('Labels'), diff --git a/src/app/frontend/deploymentlist/deploymentlist_module.js b/src/app/frontend/deploymentlist/deploymentlist_module.js index f7a5f78a6..a07359ebc 100644 --- a/src/app/frontend/deploymentlist/deploymentlist_module.js +++ b/src/app/frontend/deploymentlist/deploymentlist_module.js @@ -15,6 +15,7 @@ import stateConfig from './deploymentlist_stateconfig'; import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; +import namespaceModule from 'common/namespace/namespace_module'; import chromeModule from 'chrome/chrome_module'; import {deploymentCardComponent} from './deploymentcard_component'; import {deploymentCardListComponent} from './deploymentcardlist_component'; @@ -34,6 +35,7 @@ export default angular 'ui.router', filtersModule.name, componentsModule.name, + namespaceModule.name, chromeModule.name, deploymentDetailModule.name, ]) diff --git a/src/app/frontend/joblist/jobcard.html b/src/app/frontend/joblist/jobcard.html index 493ce1923..e5b5e3754 100644 --- a/src/app/frontend/joblist/jobcard.html +++ b/src/app/frontend/joblist/jobcard.html @@ -41,6 +41,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/joblist/jobcard_component.js b/src/app/frontend/joblist/jobcard_component.js index 08cc2ca2e..3c90808ce 100644 --- a/src/app/frontend/joblist/jobcard_component.js +++ b/src/app/frontend/joblist/jobcard_component.js @@ -23,9 +23,10 @@ import {stateName} from 'jobdetail/jobdetail_state'; export default class JobCardController { /** * @param {!ui.router.$state} $state + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state) { + constructor($state, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.Job} @@ -34,6 +35,17 @@ export default class JobCardController { /** @private {!ui.router.$state} */ this.state_ = $state; + + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); } /** diff --git a/src/app/frontend/joblist/jobcardlist.html b/src/app/frontend/joblist/jobcardlist.html index 60f1c0dde..a4ae06da5 100644 --- a/src/app/frontend/joblist/jobcardlist.html +++ b/src/app/frontend/joblist/jobcardlist.html @@ -17,19 +17,22 @@ limitations under the License. - Name + {{::$ctrl.i18n.MSG_JOB_LIST_NAME_LABEL}} + + + {{::$ctrl.i18n.MSG_JOB_LIST_NAMESPACE_LABEL}} - Labels + {{::$ctrl.i18n.MSG_JOB_LIST_LABELS_LABEL}} - Pods + {{::$ctrl.i18n.MSG_JOB_LIST_PODS_LABEL}} - Age + {{::$ctrl.i18n.MSG_JOB_LIST_AGE_LABEL}} - Images + {{::$ctrl.i18n.MSG_JOB_LIST_IMAGES_LABEL}} diff --git a/src/app/frontend/joblist/jobcardlist_component.js b/src/app/frontend/joblist/jobcardlist_component.js index ef35eaae8..d4468abf3 100644 --- a/src/app/frontend/joblist/jobcardlist_component.js +++ b/src/app/frontend/joblist/jobcardlist_component.js @@ -12,6 +12,31 @@ // See the License for the specific language governing permissions and // limitations under the License. +/** + * @final + */ +class JobListController { + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + + /** @export */ + this.i18n = i18n; + } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } +} + /** * @return {!angular.Component} */ @@ -23,4 +48,26 @@ export const jobCardListComponent = { 'jobListResource': '<', }, templateUrl: 'joblist/jobcardlist.html', + controller: JobListController, +}; + +const i18n = { + /** @export {string} @desc Label 'Name' which appears as a column label in the table of + jobs (Job list view). */ + MSG_JOB_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of replication controllers (Job list view). */ + MSG_JOB_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), + /** @export {string} @desc Label 'Labels' which appears as a column label in the table of + replication controllers (Job list view). */ + MSG_JOB_LIST_LABELS_LABEL: goog.getMsg('Labels'), + /** @export {string} @desc Label 'Pods' which appears as a column label in the table of + replication controllers (Job list view). */ + MSG_JOB_LIST_PODS_LABEL: goog.getMsg('Pods'), + /** @export {string} @desc Label 'Age' which appears as a column label in the + table of replication controllers (Job list view). */ + MSG_JOB_LIST_AGE_LABEL: goog.getMsg('Age'), + /** @export {string} @desc Label 'Images' which appears as a column label in the + table of replication controllers (Job list view). */ + MSG_JOB_LIST_IMAGES_LABEL: goog.getMsg('Images'), }; diff --git a/src/app/frontend/joblist/joblist_module.js b/src/app/frontend/joblist/joblist_module.js index ae6e9a47b..5680db3f5 100644 --- a/src/app/frontend/joblist/joblist_module.js +++ b/src/app/frontend/joblist/joblist_module.js @@ -15,6 +15,7 @@ import stateConfig from './joblist_stateconfig'; import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; +import namespaceModule from 'common/namespace/namespace_module'; import {jobCardComponent} from './jobcard_component'; import {jobCardListComponent} from './jobcardlist_component'; import jobDetailModule from 'jobdetail/jobdetail_module'; @@ -34,6 +35,7 @@ export default angular filtersModule.name, componentsModule.name, jobDetailModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdJobCardList', jobCardListComponent) diff --git a/src/app/frontend/petsetlist/petsetcard.html b/src/app/frontend/petsetlist/petsetcard.html index b4fb86619..3836537a6 100644 --- a/src/app/frontend/petsetlist/petsetcard.html +++ b/src/app/frontend/petsetlist/petsetcard.html @@ -39,6 +39,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/petsetlist/petsetcard_component.js b/src/app/frontend/petsetlist/petsetcard_component.js index 33d64eab3..4151c751a 100644 --- a/src/app/frontend/petsetlist/petsetcard_component.js +++ b/src/app/frontend/petsetlist/petsetcard_component.js @@ -24,9 +24,10 @@ export default class PetSetCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.PetSet} @@ -39,10 +40,21 @@ export default class PetSetCardController { /** @private */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/petsetlist/petsetcardlist.html b/src/app/frontend/petsetlist/petsetcardlist.html index c6258240d..50923be64 100644 --- a/src/app/frontend/petsetlist/petsetcardlist.html +++ b/src/app/frontend/petsetlist/petsetcardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_PET_SET_LIST_HEADER_NAME}} + + {{::$ctrl.i18n.MSG_PET_SET_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_PET_SET_LIST_HEADER_LABELS}} diff --git a/src/app/frontend/petsetlist/petsetcardlist_component.js b/src/app/frontend/petsetlist/petsetcardlist_component.js index b55ccd707..3df22a857 100644 --- a/src/app/frontend/petsetlist/petsetcardlist_component.js +++ b/src/app/frontend/petsetlist/petsetcardlist_component.js @@ -19,12 +19,24 @@ */ export class PetSetCardListController { /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor() { + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -43,6 +55,8 @@ export const petSetCardListComponent = { const i18n = { /** @export {string} @desc Pet set list header: name. */ MSG_PET_SET_LIST_HEADER_NAME: goog.getMsg('Name'), + /** @export {string} @desc Pet set list header: namespace. */ + MSG_PET_SET_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Pet set list header: labels. */ MSG_PET_SET_LIST_HEADER_LABELS: goog.getMsg('Labels'), /** @export {string} @desc Pet set list header: pods. */ diff --git a/src/app/frontend/petsetlist/petsetlist_module.js b/src/app/frontend/petsetlist/petsetlist_module.js index 703b5dbb1..accd61188 100644 --- a/src/app/frontend/petsetlist/petsetlist_module.js +++ b/src/app/frontend/petsetlist/petsetlist_module.js @@ -15,6 +15,7 @@ import stateConfig from './petsetlist_stateconfig'; import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; +import namespaceModule from 'common/namespace/namespace_module'; import chromeModule from 'chrome/chrome_module'; import petSetDetailModule from 'petsetdetail/petsetdetail_module'; import {petSetCardComponent} from './petsetcard_component'; @@ -34,6 +35,7 @@ export default angular 'ui.router', filtersModule.name, componentsModule.name, + namespaceModule.name, petSetDetailModule.name, chromeModule.name, ]) diff --git a/src/app/frontend/podlist/podcardlist.html b/src/app/frontend/podlist/podcardlist.html index de9f159da..4752000bd 100644 --- a/src/app/frontend/podlist/podcardlist.html +++ b/src/app/frontend/podlist/podcardlist.html @@ -20,6 +20,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_POD_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_POD_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_POD_LIST_STATUS_LABEL}} @@ -64,6 +67,12 @@ limitations under the License. + +
+ + +
+
{{::pod.podPhase}} {{::pod.restartCount}} diff --git a/src/app/frontend/podlist/podcardlist_component.js b/src/app/frontend/podlist/podcardlist_component.js index 94ea7511a..8abdd7189 100644 --- a/src/app/frontend/podlist/podcardlist_component.js +++ b/src/app/frontend/podlist/podcardlist_component.js @@ -24,8 +24,9 @@ export class PodCardListController { * @ngInject * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * List of pods. Initialized from the scope. * @export {!backendApi.PodList} @@ -41,10 +42,21 @@ export class PodCardListController { /** @private {!angular.$interpolate} */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {boolean} * @export @@ -166,6 +178,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of pods (pod list view). */ MSG_POD_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of pods (pod list view). */ + MSG_POD_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Status' which appears as a column label in the table of pods (pod list view). */ MSG_POD_LIST_STATUS_LABEL: goog.getMsg('Status'), diff --git a/src/app/frontend/podlist/podlist_module.js b/src/app/frontend/podlist/podlist_module.js index 46a02c910..2162adc4c 100644 --- a/src/app/frontend/podlist/podlist_module.js +++ b/src/app/frontend/podlist/podlist_module.js @@ -17,6 +17,7 @@ import stateConfig from './podlist_stateconfig'; import {podCardListComponent} from './podcardlist_component'; import paginationModule from 'common/pagination/pagination_module'; import filtersModule from 'common/filters/filters_module'; +import namespaceModule from 'common/namespace/namespace_module'; /** * Angular module for the Pods list view. @@ -33,6 +34,7 @@ export default angular chromeModule.name, paginationModule.name, filtersModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdPodCardList', podCardListComponent) diff --git a/src/app/frontend/replicasetlist/replicasetcard.html b/src/app/frontend/replicasetlist/replicasetcard.html index 0a48b0fda..5962cd237 100644 --- a/src/app/frontend/replicasetlist/replicasetcard.html +++ b/src/app/frontend/replicasetlist/replicasetcard.html @@ -41,6 +41,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/replicasetlist/replicasetcard_component.js b/src/app/frontend/replicasetlist/replicasetcard_component.js index 1ee01b4dd..ac1104854 100644 --- a/src/app/frontend/replicasetlist/replicasetcard_component.js +++ b/src/app/frontend/replicasetlist/replicasetcard_component.js @@ -24,9 +24,10 @@ export default class ReplicaSetCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.ReplicaSet} @@ -39,10 +40,21 @@ export default class ReplicaSetCardController { /** @private */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/replicasetlist/replicasetcardlist.html b/src/app/frontend/replicasetlist/replicasetcardlist.html index 14101aa26..a772a0119 100644 --- a/src/app/frontend/replicasetlist/replicasetcardlist.html +++ b/src/app/frontend/replicasetlist/replicasetcardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_REPLICA_SET_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_REPLICA_SET_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_REPLICA_SET_LIST_LABELS_LABEL}} diff --git a/src/app/frontend/replicasetlist/replicasetcardlist_component.js b/src/app/frontend/replicasetlist/replicasetcardlist_component.js index 5132e3fbe..9f58feefa 100644 --- a/src/app/frontend/replicasetlist/replicasetcardlist_component.js +++ b/src/app/frontend/replicasetlist/replicasetcardlist_component.js @@ -17,14 +17,27 @@ */ export class ReplicaSetCardListController { /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor() { + constructor(kdNamespaceService) { /** @export {!backendApi.ReplicaSetList} Initialized from binding. */ this.replicaSetList; + + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -44,6 +57,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of replica sets (replica set list view). */ MSG_REPLICA_SET_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of replication controllers (RC list view). */ + MSG_REPLICA_SET_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Labels' which appears as a column label in the table of replica sets (replica set list view). */ MSG_REPLICA_SET_LIST_LABELS_LABEL: goog.getMsg('Labels'), diff --git a/src/app/frontend/replicasetlist/replicasetlist_module.js b/src/app/frontend/replicasetlist/replicasetlist_module.js index dc3692ec3..bf058937a 100644 --- a/src/app/frontend/replicasetlist/replicasetlist_module.js +++ b/src/app/frontend/replicasetlist/replicasetlist_module.js @@ -15,6 +15,7 @@ import stateConfig from './replicasetlist_stateconfig'; import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; +import namespaceModule from 'common/namespace/namespace_module'; import {replicaSetCardComponent} from './replicasetcard_component'; import {replicaSetCardListComponent} from './replicasetcardlist_component'; import replicaSetDetailModule from 'replicasetdetail/replicasetdetail_module'; @@ -34,6 +35,7 @@ export default angular 'ui.router', filtersModule.name, componentsModule.name, + namespaceModule.name, replicaSetDetailModule.name, paginationModule.name, ]) diff --git a/src/app/frontend/replicationcontrollerlist/replicationcontrollercard.html b/src/app/frontend/replicationcontrollerlist/replicationcontrollercard.html index d4e8da6f8..6ea2811a5 100644 --- a/src/app/frontend/replicationcontrollerlist/replicationcontrollercard.html +++ b/src/app/frontend/replicationcontrollerlist/replicationcontrollercard.html @@ -38,6 +38,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/replicationcontrollerlist/replicationcontrollercard_component.js b/src/app/frontend/replicationcontrollerlist/replicationcontrollercard_component.js index 424a57145..846c60a91 100644 --- a/src/app/frontend/replicationcontrollerlist/replicationcontrollercard_component.js +++ b/src/app/frontend/replicationcontrollerlist/replicationcontrollercard_component.js @@ -24,9 +24,10 @@ export default class ReplicationControllerCardController { /** * @param {!ui.router.$state} $state * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state, $interpolate) { + constructor($state, $interpolate, kdNamespaceService) { /** * Initialized from the scope. * @export {!backendApi.ReplicationController} @@ -39,10 +40,21 @@ export default class ReplicationControllerCardController { /** @private {!angular.$interpolate} */ this.interpolate_ = $interpolate; + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist.html b/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist.html index cf683ad1c..643b7f38a 100644 --- a/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist.html +++ b/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_RC_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_RC_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_RC_LIST_LABELS_LABEL}} diff --git a/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist_component.js b/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist_component.js index d433998e6..d48c24934 100644 --- a/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist_component.js +++ b/src/app/frontend/replicationcontrollerlist/replicationcontrollercardlist_component.js @@ -16,10 +16,25 @@ * @final */ class RCCardListController { - constructor() { + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -39,6 +54,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of replication controllers (RC list view). */ MSG_RC_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of replication controllers (RC list view). */ + MSG_RC_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Labels' which appears as a column label in the table of replication controllers (RC list view). */ MSG_RC_LIST_LABELS_LABEL: goog.getMsg('Labels'), diff --git a/src/app/frontend/replicationcontrollerlist/replicationcontrollerlist_module.js b/src/app/frontend/replicationcontrollerlist/replicationcontrollerlist_module.js index 38732bdc3..635b28498 100644 --- a/src/app/frontend/replicationcontrollerlist/replicationcontrollerlist_module.js +++ b/src/app/frontend/replicationcontrollerlist/replicationcontrollerlist_module.js @@ -15,6 +15,7 @@ import stateConfig from './replicationcontrollerlist_stateconfig'; import filtersModule from 'common/filters/filters_module'; import componentsModule from 'common/components/components_module'; +import namespaceModule from 'common/namespace/namespace_module'; import {replicationControllerCardComponent} from './replicationcontrollercard_component'; import {replicationControllerCardMenuComponent} from './replicationcontrollercardmenu_component'; import {replicationControllerCardListComponent} from './replicationcontrollercardlist_component'; @@ -35,6 +36,7 @@ export default angular filtersModule.name, componentsModule.name, replicationControllerDetailModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdReplicationControllerCardList', replicationControllerCardListComponent) diff --git a/src/app/frontend/secretlist/secretcard.html b/src/app/frontend/secretlist/secretcard.html index e57e8d5d7..6f893b006 100644 --- a/src/app/frontend/secretlist/secretcard.html +++ b/src/app/frontend/secretlist/secretcard.html @@ -22,6 +22,12 @@ limitations under the License. + +
+ + +
+
{{::$ctrl.secret.objectMeta.creationTimestamp | relativeTime}} diff --git a/src/app/frontend/secretlist/secretcard_component.js b/src/app/frontend/secretlist/secretcard_component.js index b9c4f2791..bf06e60df 100644 --- a/src/app/frontend/secretlist/secretcard_component.js +++ b/src/app/frontend/secretlist/secretcard_component.js @@ -2,8 +2,9 @@ class SecretCardController { /** * @ngInject * @param {!angular.$interpolate} $interpolate + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService */ - constructor($interpolate) { + constructor($interpolate, kdNamespaceService) { /** * Secret initialised from scope * @export {!backendApi.Secret} @@ -12,6 +13,17 @@ class SecretCardController { /** @private {!angular.$interpolate} */ this.interpolate_ = $interpolate; + + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); } /** diff --git a/src/app/frontend/secretlist/secretcardlist.html b/src/app/frontend/secretlist/secretcardlist.html index 92d2ce221..4a32dfc56 100644 --- a/src/app/frontend/secretlist/secretcardlist.html +++ b/src/app/frontend/secretlist/secretcardlist.html @@ -18,6 +18,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_SECRET_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_SECRET_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_SECRET_LIST_AGE_LABEL}} diff --git a/src/app/frontend/secretlist/secretcardlist_component.js b/src/app/frontend/secretlist/secretcardlist_component.js index 3621856b7..254cd5811 100644 --- a/src/app/frontend/secretlist/secretcardlist_component.js +++ b/src/app/frontend/secretlist/secretcardlist_component.js @@ -16,11 +16,25 @@ * @final */ export class SecretCardListController { - /** @ngInject */ - constructor() { + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -42,6 +56,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of secrets (secret list view). */ MSG_SECRET_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of secrets (secret list view). */ + MSG_SECRET_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Age' which appears as a column label in the table of secrets (secret list view). */ MSG_SECRET_LIST_AGE_LABEL: goog.getMsg('Age'), diff --git a/src/app/frontend/secretlist/secretlist_module.js b/src/app/frontend/secretlist/secretlist_module.js index 51b622b63..4afd8913e 100644 --- a/src/app/frontend/secretlist/secretlist_module.js +++ b/src/app/frontend/secretlist/secretlist_module.js @@ -17,6 +17,7 @@ import stateConfig from './secretlist_stateconfig'; import paginationModule from 'common/pagination/pagination_module'; import componentsModule from 'common/components/components_module'; import filtersModule from 'common/filters/filters_module'; +import namespaceModule from 'common/namespace/namespace_module'; import {secretCardListComponent} from './secretcardlist_component'; import {secretCardComponent} from './secretcard_component'; @@ -36,6 +37,7 @@ export default angular componentsModule.name, paginationModule.name, filtersModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdSecretCardList', secretCardListComponent) diff --git a/src/app/frontend/servicelist/servicecard.html b/src/app/frontend/servicelist/servicecard.html index c6630cec6..9f0a2d23e 100644 --- a/src/app/frontend/servicelist/servicecard.html +++ b/src/app/frontend/servicelist/servicecard.html @@ -32,6 +32,12 @@ limitations under the License. + +
+ + +
+
diff --git a/src/app/frontend/servicelist/servicecard_component.js b/src/app/frontend/servicelist/servicecard_component.js index 6f14a0cd9..648bd6cd0 100644 --- a/src/app/frontend/servicelist/servicecard_component.js +++ b/src/app/frontend/servicelist/servicecard_component.js @@ -21,9 +21,13 @@ import {stateName} from 'servicedetail/servicedetail_state'; export class ServiceCardController { /** * @param {!ui.router.$state} $state + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService * @ngInject */ - constructor($state) { + constructor($state, kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export {!backendApi.Service} */ this.service; @@ -34,6 +38,14 @@ export class ServiceCardController { this.i18n = i18n; } + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } + /** * @return {string} * @export diff --git a/src/app/frontend/servicelist/servicecardlist.html b/src/app/frontend/servicelist/servicecardlist.html index e6d4dbc6b..082977076 100644 --- a/src/app/frontend/servicelist/servicecardlist.html +++ b/src/app/frontend/servicelist/servicecardlist.html @@ -19,6 +19,9 @@ limitations under the License. {{::$ctrl.i18n.MSG_SERVICE_LIST_NAME_LABEL}} + + {{::$ctrl.i18n.MSG_SERVICE_LIST_NAMESPACE_LABEL}} + {{::$ctrl.i18n.MSG_SERVICE_LIST_LABELS_LABEL}} diff --git a/src/app/frontend/servicelist/servicecardlist_component.js b/src/app/frontend/servicelist/servicecardlist_component.js index e13fdf63d..93562742c 100644 --- a/src/app/frontend/servicelist/servicecardlist_component.js +++ b/src/app/frontend/servicelist/servicecardlist_component.js @@ -16,11 +16,25 @@ * @final */ export class ServiceCardListController { - /** @ngInject */ - constructor() { + /** + * @param {!./../common/namespace/namespace_service.NamespaceService} kdNamespaceService + * @ngInject + */ + constructor(kdNamespaceService) { + /** @private {!./../common/namespace/namespace_service.NamespaceService} */ + this.kdNamespaceService_ = kdNamespaceService; + /** @export */ this.i18n = i18n; } + + /** + * @return {boolean} + * @export + */ + areMultipleNamespacesSelected() { + return this.kdNamespaceService_.areMultipleNamespacesSelected(); + } } /** @@ -45,6 +59,9 @@ const i18n = { /** @export {string} @desc Label 'Name' which appears as a column label in the table of services (service list view). */ MSG_SERVICE_LIST_NAME_LABEL: goog.getMsg('Name'), + /** @export {string} @desc Label 'Namespace' which appears as a column label in the + table of services (service list view). */ + MSG_SERVICE_LIST_NAMESPACE_LABEL: goog.getMsg('Namespace'), /** @export {string} @desc Label 'Labels' which appears as a column label in the table of services (service list view). */ MSG_SERVICE_LIST_LABELS_LABEL: goog.getMsg('Labels'), diff --git a/src/app/frontend/servicelist/servicelist_module.js b/src/app/frontend/servicelist/servicelist_module.js index 3a368f300..c2698e7bd 100644 --- a/src/app/frontend/servicelist/servicelist_module.js +++ b/src/app/frontend/servicelist/servicelist_module.js @@ -15,6 +15,7 @@ import componentsModule from 'common/components/components_module'; import chromeModule from 'chrome/chrome_module'; import filtersModule from 'common/filters/filters_module'; +import namespaceModule from 'common/namespace/namespace_module'; import stateConfig from './servicelist_stateconfig'; import {serviceCardListComponent} from './servicecardlist_component'; import {serviceCardComponent} from './servicecard_component'; @@ -34,6 +35,7 @@ export default angular filtersModule.name, componentsModule.name, chromeModule.name, + namespaceModule.name, ]) .config(stateConfig) .component('kdServiceCardList', serviceCardListComponent) diff --git a/src/test/frontend/common/namespace/namespace_service_test.js b/src/test/frontend/common/namespace/namespace_service_test.js new file mode 100644 index 000000000..10952fe30 --- /dev/null +++ b/src/test/frontend/common/namespace/namespace_service_test.js @@ -0,0 +1,40 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import namespaceModule from 'common/namespace/namespace_module'; + +describe('Namespace service', () => { + /** @type {!common/namespace/namespace_service.NamespaceService} */ + let namespaceService; + + beforeEach(() => angular.mock.module(namespaceModule.name)); + + beforeEach(angular.mock.inject((kdNamespaceService) => { + namespaceService = kdNamespaceService; + + })); + + it(`should initialise multipleNamespacesSelected as true`, + () => { expect(namespaceService.areMultipleNamespacesSelected()).toBe(true); }); + + it(`should set multipleNamespacesSelected to true`, () => { + namespaceService.setMultipleNamespacesSelected(true); + expect(namespaceService.areMultipleNamespacesSelected()).toBe(true); + }); + + it(`should set multipleNamespacesSelected to false`, () => { + namespaceService.setMultipleNamespacesSelected(false); + expect(namespaceService.areMultipleNamespacesSelected()).toBe(false); + }); +}); diff --git a/src/test/frontend/common/namespace/namespaceselect_component_test.js b/src/test/frontend/common/namespace/namespaceselect_component_test.js index 1b10c4822..64ec0ca97 100644 --- a/src/test/frontend/common/namespace/namespaceselect_component_test.js +++ b/src/test/frontend/common/namespace/namespaceselect_component_test.js @@ -21,6 +21,8 @@ describe('Namespace select component ', () => { let scope; /** @type {!common/namespace/namespaceselect_component.NamespaceSelectController} */ let ctrl; + /** @type {!common/namespace/namespace_service.NamespaceService} */ + let service; /** @type {!angular.$httpBackend} */ let httpBackend; /** @type {!ui.router.$state} */ @@ -39,12 +41,14 @@ describe('Namespace select component ', () => { angular.mock.module(fakeModule.name); angular.mock.module(chromeModule.name); - angular.mock.inject(($componentController, $rootScope, $httpBackend, $state) => { - scope = $rootScope; - ctrl = $componentController('kdNamespaceSelect', {$scope: $rootScope}); - httpBackend = $httpBackend; - state = $state; - }); + angular.mock.inject( + ($componentController, $rootScope, $httpBackend, $state, kdNamespaceService) => { + scope = $rootScope; + ctrl = $componentController('kdNamespaceSelect', {$scope: $rootScope}); + service = kdNamespaceService; + httpBackend = $httpBackend; + state = $state; + }); }); it('should initialize from non-exisitng namespace and watch for state changes', () => { @@ -106,4 +110,15 @@ describe('Namespace select component ', () => { ctrl.selectedNamespace = 'foo'; expect(ctrl.formatNamespace('foo')).toBe('foo'); }); + + it('should change this.isMultipleNamespaces depending on namespaces selected', () => { + ctrl.$onInit(); + + expect(service.areMultipleNamespacesSelected()).toBe(true); + + scope.$broadcast('$stateChangeSuccess', {}, {namespace: 'a'}); + scope.$digest(); + expect(ctrl.selectedNamespace).toBe('a'); + expect(service.areMultipleNamespacesSelected()).toBe(false); + }); }); diff --git a/src/test/frontend/configmaplist/configmapcardlist_component_test.js b/src/test/frontend/configmaplist/configmapcardlist_component_test.js index 270f1cf0f..87ed8de40 100644 --- a/src/test/frontend/configmaplist/configmapcardlist_component_test.js +++ b/src/test/frontend/configmaplist/configmapcardlist_component_test.js @@ -16,14 +16,28 @@ import configMapListModule from 'configmaplist/configmaplist_module'; describe('Config Map card list', () => { /** @type {!configmaplist/configmapcard_component.ConfigMapCardListController} */ let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; beforeEach(() => { angular.mock.module(configMapListModule.name); - angular.mock.inject(($componentController, $rootScope) => { - ctrl = $componentController('kdConfigMapCardList', {$scope: $rootScope}); + angular.mock.inject(($componentController, $rootScope, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!ConfigMapCardListController} */ + ctrl = $componentController( + 'kdConfigMapCardList', {$scope: $rootScope, kdNamespaceService_: data}, {}); }); }); + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); + it('should init i18n', () => { expect(ctrl.i18n).not.toBeUndefined(); }); }); diff --git a/src/test/frontend/daemonsetlist/daemonsetcardlist_component_test.js b/src/test/frontend/daemonsetlist/daemonsetcardlist_component_test.js new file mode 100644 index 000000000..fdbe84d47 --- /dev/null +++ b/src/test/frontend/daemonsetlist/daemonsetcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import daemonsetListModule from 'daemonsetlist/daemonsetlist_module'; + +describe('Daemon Set Card List controller', () => { + /** + * @type {!daemonsetlist/daemonsetcardlist_component.DaemonSetCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(daemonsetListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!DaemonSetCardListController} */ + ctrl = $componentController('kdDaemonSetCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/deploymentlist/deploymentcardlist_component_test.js b/src/test/frontend/deploymentlist/deploymentcardlist_component_test.js new file mode 100644 index 000000000..0f6eafe6f --- /dev/null +++ b/src/test/frontend/deploymentlist/deploymentcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import deploymentListModule from 'deploymentlist/deploymentlist_module'; + +describe('Deployment Card List controller', () => { + /** + * @type {!deploymentlist/deploymentcardlist_component.DeploymentCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(deploymentListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!DeploymentCardListController} */ + ctrl = $componentController('kdDeploymentCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/joblist/jobcardlist_component_test.js b/src/test/frontend/joblist/jobcardlist_component_test.js new file mode 100644 index 000000000..60f5731a2 --- /dev/null +++ b/src/test/frontend/joblist/jobcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import jobListModule from 'joblist/joblist_module'; + +describe('Job Card List controller', () => { + /** + * @type {!joblist/jobcardlist_component.JobCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(jobListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!JobCardListController} */ + ctrl = $componentController('kdJobCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/petsetlist/petsetcardlist_component_test.js b/src/test/frontend/petsetlist/petsetcardlist_component_test.js new file mode 100644 index 000000000..101cc152a --- /dev/null +++ b/src/test/frontend/petsetlist/petsetcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import petsetListModule from 'petsetlist/petsetlist_module'; + +describe('Pet Set Card List controller', () => { + /** + * @type {!petsetlist/petsetcardlist_component.PetSetCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(petsetListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!PetSetCardListController} */ + ctrl = $componentController('kdPetSetCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/podlist/podcardlist_component_test.js b/src/test/frontend/podlist/podcardlist_component_test.js index 336888988..afd3118e5 100644 --- a/src/test/frontend/podlist/podcardlist_component_test.js +++ b/src/test/frontend/podlist/podcardlist_component_test.js @@ -20,16 +20,30 @@ describe('Pod card list controller', () => { * @type {!podlist/podcardlist_component.PodCardListController} */ let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; beforeEach(() => { angular.mock.module(podsListModule.name); angular.mock.module(podDetailModule.name); - angular.mock.inject(($componentController, $rootScope) => { - ctrl = $componentController('kdPodCardList', {$scope: $rootScope}, {}); + angular.mock.inject(($componentController, $rootScope, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!podCardListController} */ + ctrl = $componentController( + 'kdPodCardList', {$scope: $rootScope, kdNamespaceService_: data}, {}); }); }); + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); + it('should execute logs href callback function', () => { expect(ctrl.getPodDetailHref({ objectMeta: { diff --git a/src/test/frontend/replicasetlist/replicasetcardlist_component_test.js b/src/test/frontend/replicasetlist/replicasetcardlist_component_test.js new file mode 100644 index 000000000..1dc56c6a8 --- /dev/null +++ b/src/test/frontend/replicasetlist/replicasetcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import replicasetListModule from 'replicasetlist/replicasetlist_module'; + +describe('Replica Set Card List controller', () => { + /** + * @type {!replicasetlist/replicasetcardlist_component.ReplicaSetCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(replicasetListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!ReplicaSetCardListController} */ + ctrl = $componentController('kdReplicaSetCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/replicationcontrollerlist/replicationcontrollercardlist_component_test.js b/src/test/frontend/replicationcontrollerlist/replicationcontrollercardlist_component_test.js new file mode 100644 index 000000000..877772de2 --- /dev/null +++ b/src/test/frontend/replicationcontrollerlist/replicationcontrollercardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import replicationControllerListModule from 'replicationcontrollerlist/replicationcontrollerlist_module'; + +describe('Replication Controller Card List controller', () => { + /** + * @type {!replicationcontrollerlist/replicationcontrollercardlist_component.RCCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(replicationControllerListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!RCCardListController} */ + ctrl = $componentController('kdReplicationControllerCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/secretlist/secretcardlist_component_test.js b/src/test/frontend/secretlist/secretcardlist_component_test.js new file mode 100644 index 000000000..8d402d3d4 --- /dev/null +++ b/src/test/frontend/secretlist/secretcardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import secretListModule from 'secretlist/secretlist_module'; + +describe('Secret Card List controller', () => { + /** + * @type {!secretlist/secretcardlist_component.SecretCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + */ + let data; + + beforeEach(() => { + angular.mock.module(secretListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!SecretListController} */ + ctrl = $componentController('kdSecretCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); diff --git a/src/test/frontend/servicelist/servicecardlist_component_test.js b/src/test/frontend/servicelist/servicecardlist_component_test.js new file mode 100644 index 000000000..48d9cfbed --- /dev/null +++ b/src/test/frontend/servicelist/servicecardlist_component_test.js @@ -0,0 +1,43 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import serviceListModule from 'servicelist/servicelist_module'; + +describe('Service Card List controller', () => { + /** + * @type {!servicelist/servicecardlist_component.ServiceCardListController} + */ + let ctrl; + /** + * @type {!./../common/namespace/namespace_service.NamespaceService} + * */ + let data; + + beforeEach(() => { + angular.mock.module(serviceListModule.name); + + angular.mock.inject(($componentController, kdNamespaceService) => { + /** @type {!./../common/namespace/namespace_service.NamespaceService} */ + data = kdNamespaceService; + /** @type {!ServiceCardListController} */ + ctrl = $componentController('kdServiceCardList', {kdNamespaceService_: data}); + }); + }); + + it('should instantiate the controller properly', () => { expect(ctrl).not.toBeUndefined(); }); + + it('should return the value from Namespace service', () => { + expect(ctrl.areMultipleNamespacesSelected()).toBe(data.areMultipleNamespacesSelected()); + }); +}); -- GitLab