提交 63d7927a 编写于 作者: S Sebastian Florek 提交者: GitHub

Refactor scaling and logs buttons (#2151)

* Refactor scale button to common component

* Add tests

* Rebase changes

* Fix tests

* Open logs in a new page
上级 bf4ddbd5
此差异已折叠。
......@@ -104,6 +104,9 @@
<translation id="7353491667260402390" key="MSG_COMMON_COMPONENTS_RESOURCEDETAIL_INFOCARD_2" desc="Label \'Labels\' for a resource.">ラベル</translation>
<translation id="5872558793526944357" key="MSG_COMMON_COMPONENTS_RESOURCEDETAIL_INFOCARD_3" desc="Label \'Annotations\' for a resource.">注釈</translation>
<translation id="311978980344633152" key="MSG_COMMON_COMPONENTS_RESOURCEDETAIL_INFOCARD_4" desc="Label \'Creation time\' for a resource.">作成日時</translation>
<translation id="5724590208757461876" key="MSG_COMMON_COMPONENTS_SCALE_SCALE_0" desc="Action \'Scale\' on the drop down menu on resource list page.">Scale</translation>
<translation id="2699323907720130275" key="MSG_COMMON_COMPONENTS_SCALE_SCALE_1" desc="Tooltip for the \'scale\' button on the action bar on a resource details view.">Edit number of pods</translation>
<translation id="8982112402145698888" key="MSG_COMMON_COMPONENTS_SCALE_SCALE_2" desc="Tooltip for the \'Scale\' button on the action bar on a resource details view.">Scale</translation>
<translation id="8514425134682432381" key="MSG_COMMON_COMPONENTS_WARNINGS_WARNINGS_0" desc="Tooltip for warning dismissal button.">Dismiss</translation>
<translation id="7328790086203280450" key="MSG_COMMON_COMPONENTS_WARNINGS_WARNINGS_1" desc="Tooltip for all warning dismissal button.">Dismiss all</translation>
<translation id="6941584785589389821" key="MSG_COMMON_COMPONENTS_ZEROSTATE_ZEROSTATE_0" desc="(no description provided)">表示するものがありません</translation>
......@@ -194,8 +197,7 @@
<ph name="CREATION_DATE"> に作成</ph>
</translation>
<translation id="8731452969115857295" key="MSG_DEPLOYMENT_DETAIL_ACTIONBAR_0" desc="Label \'Deployment\' which will appear in the deployment delete dialog opened from the deployment details page.">デプロイメント</translation>
<translation id="7127369397131060308" key="MSG_DEPLOYMENT_DETAIL_ACTIONBAR_1" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">ポッド数の編集</translation>
<translation id="951957391705478704" key="MSG_DEPLOYMENT_DETAIL_ACTIONBAR_2" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">スケール</translation>
<translation id="4537205375409268523" key="MSG_DEPLOYMENT_DETAIL_ACTIONBAR_1" desc="Label \'Deployment\' which will appear in the deployment dialog opened from the deployment details page.">Deployment</translation>
<translation id="916794903553842041" key="MSG_DEPLOYMENT_DETAIL_DETAIL_0" desc="Title for graph card displaying CPU metric of one deployment.">CPU使用量</translation>
<translation id="8453931805104629005" key="MSG_DEPLOYMENT_DETAIL_DETAIL_1" desc="Title for graph card displaying memory metric of one deployment.">メモリー使用量</translation>
<translation id="620255252783687720" key="MSG_DEPLOYMENT_DETAIL_DETAIL_10" desc="Text for horizontal pod autoscalers card zerostate in replica set details page.">このデプロイメントをターゲットとしている水平ポッドオートスケーラーはありません。</translation>
......@@ -233,7 +235,7 @@
<translation id="5603340787019545076" key="MSG_DEPLOYMENT_LIST_CARD_1" desc="Tooltip saying that some pods in a deployment are pending.">1つ以上のポッドが待機状態です</translation>
<translation id="5335487391687545375" key="MSG_DEPLOYMENT_LIST_CARD_2" desc="Label \'Deployment\' which will appear in the deployment delete dialog opened from a deployment card on the list page.">デプロイメント</translation>
<translation id="5009335850870865346" key="MSG_DEPLOYMENT_LIST_CARD_3" desc="Label \'Deployment\' which will appear in the deployment delete dialog opened from a deployment card on the list page.">デプロイメント</translation>
<translation id="2609047445317806483" key="MSG_DEPLOYMENT_LIST_CARD_4" desc="Action \'Edit Pod Count\' on the drop down menu for a single replication controller (replication controller list page).">スケール</translation>
<translation id="1062694263538589459" key="MSG_DEPLOYMENT_LIST_CARD_4" desc="Label \'Deployment\' which will appear in the deployment edit dialog opened from a deployment card on the list page.">Deployment</translation>
<translation id="8652993905127268587" key="MSG_DEPLOYMENT_LIST_CREATED_AT_TOOLTIP" desc="Tooltip 'Created at [some date]' showing the exact creation time of a deployment.">
<ph name="CREATION_DATE"> に作成</ph>
</translation>
......@@ -427,8 +429,7 @@
<ph name="START_DATE"> UTC に作成</ph>
</translation>
<translation id="3490469769225638472" key="MSG_JOB_DETAIL_ACTIONBAR_0" desc="Label \'Job\' which appears at the top of the dialog, opened from a job details page.">ジョブ</translation>
<translation id="6829338653792413829" key="MSG_JOB_DETAIL_ACTIONBAR_1" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">ポッド数の編集</translation>
<translation id="2508302008087028844" key="MSG_JOB_DETAIL_ACTIONBAR_2" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">スケール</translation>
<translation id="6834336408129965832" key="MSG_JOB_DETAIL_ACTIONBAR_1" desc="Label \'Job\' which appears at the top of the dialog, opened from a job details page.">Job</translation>
<translation id="9158321222252952956" key="MSG_JOB_DETAIL_DETAIL_0" desc="Title for graph card displaying CPU metric of one job.">CPU使用量</translation>
<translation id="5829638785096512195" key="MSG_JOB_DETAIL_DETAIL_1" desc="Title for graph card displaying memory metric of one job.">メモリー使用量</translation>
<translation id="91452791679953853" key="MSG_JOB_DETAIL_DETAIL_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、このジョブに管理されたポッドのキャッシュも含みます。</translation>
......@@ -456,7 +457,9 @@
<translation id="8162859503142023792" key="MSG_JOB_LIST_CARDLIST_7" desc="Label \'Images\' which appears as a column label in the table of replication controllers (Job list view).">イメージ</translation>
<translation id="3716747253637312807" key="MSG_JOB_LIST_CARDLIST_8" desc="Text for job card list zerostate.">表示するものがありません</translation>
<translation id="122753681203495181" key="MSG_JOB_LIST_CARD_0" desc="Column \'Job\' that shows if the resource kind should be shown in a Job List">ジョブ</translation>
<translation id="5429508523577500611" key="MSG_JOB_LIST_CARD_1" desc="Action \'Edit Pod Count\' on the drop down menu for a single replication controller (replication controller list page).">スケール</translation>
<translation id="6478317117857627375" key="MSG_JOB_LIST_CARD_1" desc="Label \'Job\' which will appear in the job scale dialog opened from a job card on the list page.">Job</translation>
<translation id="2309406660346586810" key="MSG_JOB_LIST_CARD_2" desc="Label \'Job\' which will appear in the job delete dialog opened from a job card on the list page.">Job</translation>
<translation id="8437900733414779283" key="MSG_JOB_LIST_CARD_3" desc="Label \'Job\' which will appear in the job edit dialog opened from a job card on the list page.">Job</translation>
<translation id="3055363125961915665" key="MSG_JOB_LIST_LIST_0" desc="Title for graph card displaying CPU metric of jobs.">CPU使用量</translation>
<translation id="5794425570699478727" key="MSG_JOB_LIST_LIST_1" desc="Title for graph card displaying memory metric of jobs.">メモリー使用量</translation>
<translation id="6300164314930034252" key="MSG_JOB_LIST_LIST_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、これらのジョブに管理されたポッドのキャッシュも含みます。</translation>
......@@ -675,8 +678,7 @@
<ph name="CREATION_DATE"> に作成</ph>
</translation>
<translation id="1260262098898397299" key="MSG_REPLICASET_DETAIL_ACTIONBAR_0" desc="Label \'Replica Set\' which appears at the top of the delete dialog, opened from a replica set details page.">レプリカセット</translation>
<translation id="2139391156871443392" key="MSG_REPLICASET_DETAIL_ACTIONBAR_1" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">ポッド数の編集</translation>
<translation id="6231957744809190528" key="MSG_REPLICASET_DETAIL_ACTIONBAR_2" desc="Tooltip for the \'scale\' button on the action bar of a deployment details view.">スケール</translation>
<translation id="1514528876969530401" key="MSG_REPLICASET_DETAIL_ACTIONBAR_1" desc="Label \'Replica Set\' which appears at the top of the dialog, opened from a replica set details page.">Replica Set</translation>
<translation id="4400871969398726978" key="MSG_REPLICASET_DETAIL_DETAIL_0" desc="Title for graph card displaying CPU metric of one replica set.">CPU使用量</translation>
<translation id="4704389000141025902" key="MSG_REPLICASET_DETAIL_DETAIL_1" desc="Title for graph card displaying memory metric of one replica set.">メモリー使用量</translation>
<translation id="8906155885743398611" key="MSG_REPLICASET_DETAIL_DETAIL_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、このレプリカセットに管理されたポッドのキャッシュも含みます。</translation>
......@@ -709,13 +711,12 @@
<translation id="8737661932051185312" key="MSG_REPLICASET_LIST_CARD_2" desc="Column \'Replica Set\' that shows if the resource kind should be shown in a Replica Set List">レプリカセット</translation>
<translation id="7581599441949506500" key="MSG_REPLICASET_LIST_CARD_3" desc="Label \'Replica Set\' which appears at the top of the delete dialog, opened from a replica set list page.">レプリカセット</translation>
<translation id="4577636652353595689" key="MSG_REPLICASET_LIST_CARD_4" desc="Label \'Replica Set\' which appears at the top of the delete dialog, opened from a replica set list page.">レプリカセット</translation>
<translation id="7138865349765060324" key="MSG_REPLICASET_LIST_CARD_5" desc="Action \'Edit Pod Count\' on the drop down menu for a single replication controller (replication controller list page).">スケール</translation>
<translation id="7557813909805722094" key="MSG_REPLICASET_LIST_CARD_5" desc="Label \'Replica Set\' which appears at the top of the edit dialog, opened from a replica set list page.">Replica Set</translation>
<translation id="1953836789676016853" key="MSG_REPLICASET_LIST_LIST_0" desc="Title for graph card displaying CPU metric of replica sets.">CPU使用量</translation>
<translation id="110700328163812848" key="MSG_REPLICASET_LIST_LIST_1" desc="Title for graph card displaying memory metric of replica sets.">メモリー使用量</translation>
<translation id="8124993050775257685" key="MSG_REPLICASET_LIST_LIST_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、これらのレプリカセットに管理されたポッドのキャッシュも含みます。</translation>
<translation id="1878569263371070678" key="MSG_REPLICATIONCONTROLLER_DETAIL_ACTIONBAR_0" desc="Tooltip for the \'scale\' button on the action bar of a replication controller details view.">ポッド数の編集</translation>
<translation id="3406595776017844770" key="MSG_REPLICATIONCONTROLLER_DETAIL_ACTIONBAR_1" desc="Tooltip for the \'scale\' button on the action bar of a replication controller details view.">スケール</translation>
<translation id="5668789506232173619" key="MSG_REPLICATIONCONTROLLER_DETAIL_ACTIONBAR_2" desc="Label \'Replication Controller\' which appears at the top of the edit dialog, opened from a replication controller details page.">レプリケーションコントローラー</translation>
<translation id="4086662747053444628" key="MSG_REPLICATIONCONTROLLER_DETAIL_ACTIONBAR_0" desc="Label \'Replication Controller\' which appears at the top of the scale dialog, opened from a replication controller details page.">Replication Controller</translation>
<translation id="6658500099642793481" key="MSG_REPLICATIONCONTROLLER_DETAIL_ACTIONBAR_1" desc="Label \'Replication Controller\' which appears at the top of the dialog, opened from a replication controller details page.">Replication Controller</translation>
<translation id="540465365371246326" key="MSG_REPLICATIONCONTROLLER_DETAIL_DETAIL_0" desc="Title for graph card displaying CPU metric of one replication controller.">CPU使用量</translation>
<translation id="5679990989824450360" key="MSG_REPLICATIONCONTROLLER_DETAIL_DETAIL_1" desc="Title for graph card displaying memory metric of one replication controller.">メモリー使用量</translation>
<translation id="811005294829243195" key="MSG_REPLICATIONCONTROLLER_DETAIL_DETAIL_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、このレプリケーションコントローラーに管理されたポッドのキャッシュも含みます。</translation>
......@@ -743,8 +744,7 @@
<translation id="3957484052069652608" key="MSG_REPLICATIONCONTROLLER_LIST_CARDLIST_6" desc="Label \'Age\' which appears as a column label in the table of replication controllers (RC list view).">起動時間</translation>
<translation id="6698419478883321763" key="MSG_REPLICATIONCONTROLLER_LIST_CARDLIST_7" desc="Label \'Images\' which appears as a column label in the table of replication controllers (RC list view).">イメージ</translation>
<translation id="3909279990084178026" key="MSG_REPLICATIONCONTROLLER_LIST_CARDLIST_8" desc="Text for replication controller card list zerostate.">表示するものがありません</translation>
<translation id="8284947559459883225" key="MSG_REPLICATIONCONTROLLER_LIST_CARDMENU_0" desc="Action \'View details\' on the drop down menu for a single replication controller (replication controller list page).">詳細を見る</translation>
<translation id="3333225559692017548" key="MSG_REPLICATIONCONTROLLER_LIST_CARDMENU_1" desc="Action \'Edit Pod Count\' on the drop down menu for a single replication controller (replication controller list page).">スケール</translation>
<translation id="8726722862459943357" key="MSG_REPLICATIONCONTROLLER_LIST_CARDMENU_0" desc="Label \'Replication Controller\' which will appear in the replication Controller scale dialog opened from a replication controller card on the list page.">Replication Controller</translation>
<translation id="1225563863938274391" key="MSG_REPLICATIONCONTROLLER_LIST_CARDMENU_2" desc="Label \'Replication Controller\' which will appear in the replication Controller delete dialogm opened from a replication controller card on the list page.">レプリケーションコントローラー</translation>
<translation id="538474906418277358" key="MSG_REPLICATIONCONTROLLER_LIST_CARDMENU_3" desc="Label \'Replication Controller\' which will appear in the replication Controller delete dialogm opened from a replication controller card on the list page.">レプリケーションコントローラー</translation>
<translation id="3633473974060235402" key="MSG_REPLICATIONCONTROLLER_LIST_CARD_0" desc="Tooltip saying that some pods in a replication controller have errors.">1つ以上のポッドがエラーです</translation>
......@@ -821,14 +821,11 @@
<translation id="3162800940071393879" key="MSG_SHELL_SHELL_0" desc="Title prefix for the shell card.">Shell in</translation>
<translation id="6124573494636381071" key="MSG_SHELL_SHELL_1" desc="Title part for the shell card.">in</translation>
<translation id="2232943352979399383" key="MSG_STATEFULSET_DETAIL_ACTIONBAR_0" desc="Label \'Stateful Set\' which appears at the top of the delete dialog, opened from a stateful set details page.">ステートフルセット</translation>
<translation id="8505855597345419629" key="MSG_STATEFULSET_DETAIL_ACTIONBAR_1" desc="Tooltip for the \'scale\' button on the action bar of a statefulset details view.">ポッド数の編集</translation>
<translation id="3619645847649857259" key="MSG_STATEFULSET_DETAIL_ACTIONBAR_2" desc="Tooltip for the \'scale\' button on the action bar of a statefulset details view.">スケール</translation>
<translation id="7781029351667027732" key="MSG_STATEFULSET_DETAIL_ACTIONBAR_1" desc="Label \'Stateful Set\' which appears at the top of the dialog, opened from a stateful set details page.">Stateful Set</translation>
<translation id="7161753444048215428" key="MSG_STATEFULSET_DETAIL_DETAIL_0" desc="Title for graph card displaying CPU metric of one stateful set.">CPU使用量</translation>
<translation id="8249817415205260138" key="MSG_STATEFULSET_DETAIL_DETAIL_1" desc="Title for graph card displaying memory metric of one stateful set.">メモリー使用量</translation>
<translation id="5166179618558114310" key="MSG_STATEFULSET_DETAIL_DETAIL_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、このステートフルセットに管理されたポッドのキャッシュも含みます。</translation>
<translation id="8811199499879136388" key="MSG_STATEFULSET_DETAIL_DETAIL_3" desc="Text for services card zerostate in replica set details page.">このレプリカセットと同じラベルセレクターのサービスはありません。</translation>
<translation id="8863896898922148088" key="MSG_STATEFULSET_DETAIL_DETAIL_4" desc="Text for pods card zerostate in stateful set details page.">このステートフルセットに管理されているポッドはありません。</translation>
<translation id="2168027988411259566" key="MSG_STATEFULSET_DETAIL_DETAIL_5" desc="Text for horizontal pod autoscalers card zerostate in replica set details page.">このレプリカセットをターゲットとしている水平ポッドオートスケーラーはありません。</translation>
<translation id="3348024993164925047" key="MSG_STATEFULSET_DETAIL_INFO_0" desc="Header in a detail view">詳細</translation>
<translation id="3442372861347610857" key="MSG_STATEFULSET_DETAIL_INFO_1" desc="Stateful set info details section images entry.">イメージ</translation>
<translation id="638418405338120294" key="MSG_STATEFULSET_DETAIL_INFO_10" desc="The message says that that many pods are running (stateful set details page).">{{ $ctrl.statefulSet.podInfo.running}} 起動中</translation>
......@@ -854,7 +851,7 @@
<translation id="8536391692904195793" key="MSG_STATEFULSET_LIST_CARD_2" desc="Column \'Stateful Set\' of a Stateful Set List">ステートフルセット</translation>
<translation id="8303350341808463069" key="MSG_STATEFULSET_LIST_CARD_3" desc="Label \'Stateful Set\' which will appear in the stateful set delete dialog opened from a stateful set card on the list page.">ステートフルセット</translation>
<translation id="7265964616399472549" key="MSG_STATEFULSET_LIST_CARD_4" desc="Label \'Stateful Set\' which will appear in the stateful set delete dialog opened from a stateful set card on the list page.">ステートフルセット</translation>
<translation id="173686867479605752" key="MSG_STATEFULSET_LIST_CARD_5" desc="Action \'Edit Pod Count\' on the drop down menu for a single statefulset (statefulset list page).">スケール</translation>
<translation id="492671461743788616" key="MSG_STATEFULSET_LIST_CARD_5" desc="Label \'Stateful Set\' which will appear in the stateful set edit dialog opened from a stateful set card on the list page.">Stateful Set</translation>
<translation id="8198362727821894618" key="MSG_STATEFULSET_LIST_LIST_0" desc="Title for graph card displaying CPU metric of stateful sets.">CPU使用量</translation>
<translation id="7302052672443322476" key="MSG_STATEFULSET_LIST_LIST_1" desc="Title for graph card displaying memory metric of stateful sets.">メモリー使用量</translation>
<translation id="725937525862708224" key="MSG_STATEFULSET_LIST_LIST_2" desc="Help message detailing what is included in the memory usage">メモリー使用量は、これらのステートフルセットに管理されたポッドのキャッシュも含みます。</translation>
......
此差异已折叠。
......@@ -45,8 +45,8 @@ type StatefulSetDetail struct {
// GetStatefulSetDetail gets Stateful Set details.
func GetStatefulSetDetail(client *k8sClient.Clientset, metricClient metricapi.MetricClient, namespace,
name string) (*StatefulSetDetail, error) {
log.Printf("Getting details of %s statefulset in %s namespace", name, namespace)
log.Printf("Getting details of %s service in %s namespace", name, namespace)
ss, err := client.AppsV1beta1().StatefulSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
......
......@@ -12,21 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// 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 appConfigServiceProvider from './service';
/**
......
......@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<md-button ng-href="{{::$ctrl.getLogsHref()}}">
<md-button ng-click="::$ctrl.viewLogs()">
<md-icon class="kd-actionbar-icon-button">subject</md-icon>
<md-tooltip md-direction="bottom">
[[View logs|Tooltip for the 'logs' button on the action bar.]]
......
......@@ -17,9 +17,10 @@ import {stateName as logsStateName, StateParams as LogsStateParams} from 'logs/s
export class ActionbarLogsItemController {
/**
* @param {!ui.router.$state} $state
* @param {!angular.$window} $window
* @ngInject
*/
constructor($state) {
constructor($state, $window) {
/** @export {string} Initialized from a binding. */
this.resourceKindName;
......@@ -28,18 +29,22 @@ export class ActionbarLogsItemController {
/** @private {!ui.router.$state}} */
this.state_ = $state;
/** @private {!angular.$window} */
this.window_ = $window;
}
/**
* Returns link to teh log view
* @return {string}
* Open the logs view in a new window.
* @export
*/
getLogsHref() {
return this.state_.href(
viewLogs() {
let logsLink = this.state_.href(
logsStateName,
new LogsStateParams(
this.objectMeta.namespace, this.objectMeta.name, this.resourceKindName));
this.window_.open(logsLink, '_blank');
}
}
......@@ -52,7 +57,7 @@ export class ActionbarLogsItemController {
export const actionbarLogsComponent = {
templateUrl: 'common/components/actionbar/actionbarlogs.html',
bindings: {
'resourceKindName': '@',
'resourceKindName': '<',
'objectMeta': '<',
},
bindToController: true,
......
......@@ -23,7 +23,6 @@ import {actionbarListButtonsComponent} from './actionbarlistbuttons_component';
import {actionbarLogsComponent} from './actionbarlogs_component';
import {actionbarComponent} from './component';
/**
* Module containing common actionbar.
*/
......
......@@ -29,6 +29,7 @@ import {labelComponent} from './labels/component';
import {middleEllipsisComponent} from './middleellipsis/component';
import resourceCardModule from './resourcecard/resourcecard_module';
import {infoCardComponent} from './resourcedetail/component';
import {scaleButtonComponent} from './scale/component';
import {serializedReferenceComponent} from './serializedreference/component';
import {sparklineComponent} from './sparkline/component';
import {toggleHiddenTextComponent} from './togglehiddentext/component';
......@@ -66,4 +67,5 @@ export default angular
.component('kdContentCard', contentCardComponent)
.component('kdWarnings', warningsComponent)
.component('kdConditionList', conditionListComponent)
.component('kdScaleButton', scaleButtonComponent)
.directive('kdWarnThreshold', warnThresholdDirective);
......@@ -55,7 +55,9 @@ export class ResourceCardDeleteMenuItemController {
this.state_.reload();
})
.catch((err) => {
this.log_.error('Error showing delete dialog:', err);
if (err) {
this.log_.error('Error showing delete dialog:', err);
}
});
}
}
......
......@@ -55,7 +55,9 @@ export class ResourceCardEditMenuItemController {
this.state_.reload();
})
.catch((err) => {
this.log_.error('Error showing edit dialog:', err);
if (err) {
this.log_.error('Error showing edit dialog:', err);
}
});
}
}
......
......@@ -15,7 +15,7 @@ limitations under the License.
-->
<md-menu>
<md-button ng-click="$mdOpenMenu($event)"
<md-button ng-click="$mdMenu.open($event)"
class="md-icon-button">
<md-icon md-font-library="material-icons">more_vert</md-icon>
<md-tooltip>[[Actions|Tooltip "Actions", which appears when you hover over the menu icon on any resource card.]]</md-tooltip>
......
// Copyright 2017 The Kubernetes Dashboard Authors.
//
// 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.
/**
* @final
*/
class ScaleButtonController {
/**
* @param {!../../scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(kdScaleService) {
/** @private {../../scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
/** @export {boolean} - Initialized from binding */
this.menuItem;
/** @export {!backendApi.ObjectMeta} - Initialized from binding */
this.objectMeta;
/** @export {string} - Initialized from binding */
this.resourceKindName;
/** @export {number} - Initialized from binding */
this.currentPods;
/** @export {number} - Initialized from binding */
this.desiredPods;
}
/**
* Handles update of replicas count for supported resources.
* @export
*/
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.objectMeta.namespace, this.objectMeta.name, this.currentPods, this.desiredPods,
this.resourceKindName);
}
/**
* @return {boolean}
* @export
*/
isMenuItem() {
return this.menuItem;
}
}
/**
* Contains scale button for supported resource detail pages.
*
* @type {!angular.Component}
*/
export const scaleButtonComponent = {
controller: ScaleButtonController,
templateUrl: 'common/components/scale/scale.html',
bindings: {
'resourceKindName': '@',
'objectMeta': '<',
'currentPods': '<',
'desiredPods': '<',
'menuItem': '<',
},
};
<!--
Copyright 2017 The Kubernetes Dashboard Authors.
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.
-->
<md-menu-item ng-if="$ctrl.isMenuItem()">
<md-button ng-click="$ctrl.handleScaleResourceDialog()"
role="menuitem">
[[Scale|Action 'Scale' on the drop down menu on resource list page.]]
</md-button>
</md-menu-item>
<md-button ng-if="!$ctrl.isMenuItem()"
ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar on a resource details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'Scale' button on the action bar on a resource details view.]]
</md-button>
// Copyright 2017 The Kubernetes Dashboard Authors.
//
// 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 {ScaleService} from './service';
/**
* Angular module containing application configuration.
*/
export default angular
.module(
'kubernetesDashboard.scaling',
[
'ngMaterial',
])
.service('kdScaleService', ScaleService);
......@@ -32,6 +32,7 @@ limitations under the License.
parallelism count input on the "update parallelism count" dialog (for a Job resource).]]</label>
</div>
<input name="DesiredPods"
aria-label="Desired Pods"
type="number"
kd-validate="integer"
min="0"
......
......@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-actionbar-logs resource-kind-name="daemonset"
<kd-actionbar-logs resource-kind-name="$ctrl.details.typeMeta.kind"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-logs>
......
......@@ -14,14 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<md-button ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment delete dialog opened from the deployment details page.]]"
<kd-scale-button resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment scale dialog opened from the deployment details page.]]"
object-meta="$ctrl.details.objectMeta"
current-pods="$ctrl.details.statusInfo.replicas"
desired-pods="$ctrl.details.statusInfo.available">
</kd-scale-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment dialog opened from the deployment details page.]]"
type-meta="$ctrl.details.typeMeta"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-detail-buttons>
......@@ -18,25 +18,10 @@
export class ActionBarController {
/**
* @param {!backendApi.DeploymentDetail} deploymentDetail
* @param {!common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(deploymentDetail, kdScaleService) {
constructor(deploymentDetail) {
/** @export {!backendApi.DeploymentDetail} */
this.details = deploymentDetail;
/** @private {!common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
}
/**
* Handles update of replicas count in deployment dialog.
* @export
*/
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.details.objectMeta.namespace, this.details.objectMeta.name,
this.details.statusInfo.replicas, this.details.statusInfo.available,
this.details.typeMeta.kind);
}
}
......@@ -74,14 +74,15 @@ limitations under the License.
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-resource-card-menu>
<md-menu-item>
<md-button ng-click="$ctrl.showScaleDialog()">
[[Scale|Action 'Edit Pod Count' on the drop down menu for a single replication controller (replication controller list page).]]
</md-button>
</md-menu-item>
<kd-scale-button resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment scale dialog opened from a deployment card on the list page.]]"
object-meta="$ctrl.deployment.objectMeta"
current-pods="$ctrl.deployment.pods.current"
desired-pods="$ctrl.deployment.pods.desired"
menu-item="true">
</kd-scale-button>
<kd-resource-card-delete-menu-item resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment delete dialog opened from a deployment card on the list page.]]">
</kd-resource-card-delete-menu-item>
<kd-resource-card-edit-menu-item resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment delete dialog opened from a deployment card on the list page.]]">
<kd-resource-card-edit-menu-item resource-kind-name="[[Deployment|Label 'Deployment' which will appear in the deployment edit dialog opened from a deployment card on the list page.]]">
</kd-resource-card-edit-menu-item>
</kd-resource-card-menu>
</kd-resource-card-column>
......
......@@ -25,10 +25,9 @@ export default class DeploymentCardController {
* @param {!ui.router.$state} $state
* @param {!angular.$interpolate} $interpolate
* @param {!./../../common/namespace/service.NamespaceService} kdNamespaceService
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor($state, $interpolate, kdNamespaceService, kdScaleService) {
constructor($state, $interpolate, kdNamespaceService) {
/**
* Initialized from the scope.
* @export {!backendApi.Deployment}
......@@ -43,9 +42,6 @@ export default class DeploymentCardController {
/** @private {!./../../common/namespace/service.NamespaceService} */
this.kdNamespaceService_ = kdNamespaceService;
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
}
/**
......@@ -106,15 +102,6 @@ export default class DeploymentCardController {
goog.getMsg('Created at {$creationDate}', {'creationDate': filter({'date': creationDate})});
return MSG_DEPLOYMENT_LIST_CREATED_AT_TOOLTIP;
}
/**
* @export
*/
showScaleDialog() {
this.kdScaleService_.showScaleDialog(
this.deployment.objectMeta.namespace, this.deployment.objectMeta.name,
this.deployment.pods.current, this.deployment.pods.desired, this.deployment.typeMeta.kind);
}
}
/**
......
......@@ -20,6 +20,7 @@ import aboutModule from './about/module';
import chromeModule from './chrome/module';
import clusterModule from './cluster/module';
import csrfTokenModule from './common/csrftoken/module';
import scalingModule from './common/scaling/module';
import configModule from './config/module';
import configMapModule from './configmap/module';
import daemonSetModule from './daemonset/module';
......@@ -97,6 +98,7 @@ export default angular
storageClassModule.name,
thirdPartyResourceModule.name,
roleModule.name,
scalingModule.name,
])
.config(indexConfig)
.config(routeConfig)
......
......@@ -14,13 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<md-button ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-button>
<kd-scale-button resource-kind-name="[[Job|Label 'Job' which appears at the top of the dialog, opened from a job details page.]]"
object-meta="$ctrl.details.objectMeta"
current-pods="$ctrl.details.parallelism"
desired-pods="$ctrl.details.parallelism">
</kd-scale-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Job|Label 'Job' which appears at the top of the dialog, opened from a job details page.]]"
type-meta="$ctrl.details.typeMeta"
......
......@@ -18,21 +18,10 @@
export class ActionBarController {
/**
* @param {!backendApi.JobDetail} jobDetail
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(jobDetail, kdScaleService) {
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
constructor(jobDetail) {
/** @export {!backendApi.JobDetail} */
this.details = jobDetail;
}
/** @export */
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.details.objectMeta.namespace, this.details.objectMeta.name, this.details.parallelism,
this.details.parallelism, this.details.typeMeta.kind);
}
}
......@@ -76,13 +76,16 @@ limitations under the License.
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-resource-card-menu>
<md-menu-item>
<md-button ng-click="$ctrl.showScaleDialog()">
[[Scale|Action 'Edit Pod Count' on the drop down menu for a single replication controller (replication controller list page).]]
</md-button>
</md-menu-item>
<kd-resource-card-delete-menu-item resource-kind-name="Job">
<kd-scale-button resource-kind-name="[[Job|Label 'Job' which will appear in the job scale dialog opened from a job card on the list page.]]"
object-meta="$ctrl.job.objectMeta"
current-pods="$ctrl.job.parallelism"
desired-pods="$ctrl.job.parallelism"
menu-item="true">
</kd-scale-button>
<kd-resource-card-delete-menu-item resource-kind-name="[[Job|Label 'Job' which will appear in the job delete dialog opened from a job card on the list page.]]">
</kd-resource-card-delete-menu-item>
<kd-resource-card-edit-menu-item resource-kind-name="[[Job|Label 'Job' which will appear in the job edit dialog opened from a job card on the list page.]]">
</kd-resource-card-edit-menu-item>
</kd-resource-card-menu>
</kd-resource-card-column>
</kd-resource-card-columns>
......
......@@ -24,10 +24,9 @@ export default class JobCardController {
/**
* @param {!ui.router.$state} $state
* @param {!./../../common/namespace/service.NamespaceService} kdNamespaceService
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor($state, kdNamespaceService, kdScaleService) {
constructor($state, kdNamespaceService) {
/**
* Initialized from the scope.
* @export {!backendApi.Job}
......@@ -39,9 +38,6 @@ export default class JobCardController {
/** @private {!./../../common/namespace/service.NamespaceService} */
this.kdNamespaceService_ = kdNamespaceService;
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
}
/**
......@@ -87,15 +83,6 @@ export default class JobCardController {
isSuccess() {
return !this.isPending() && !this.hasWarnings();
}
/**
* @export
*/
showScaleDialog() {
this.kdScaleService_.showScaleDialog(
this.job.objectMeta.namespace, this.job.objectMeta.name, this.job.parallelism,
this.job.parallelism, this.job.typeMeta.kind);
}
}
/**
......
......@@ -18,7 +18,7 @@ limitations under the License.
<kd-title class="kd-logs-title">
[[Logs from|Title prefix for logs card.]]
<md-select class="kd-logs-toolbar-select"
aria-label="Logs from"
aria-label="container"
ng-model="ctrl.container"
md-on-close="ctrl.onContainerChange(ctrl.container)"
required>
......@@ -29,6 +29,7 @@ limitations under the License.
</md-select>
[[in|Title part for logs card.]]
<md-select class="kd-logs-toolbar-select"
aria-label="resource"
ng-model="ctrl.pod"
md-on-close="ctrl.onContainerChange(ctrl.pod)"
required>
......
......@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-actionbar-logs resource-kind-name="pod"
<kd-actionbar-logs resource-kind-name="$ctrl.details.typeMeta.kind"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-logs>
......
......@@ -14,19 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-actionbar-logs resource-kind-name="replicaset"
<kd-actionbar-logs resource-kind-name="$ctrl.details.typeMeta.kind"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-logs>
<md-button ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'scale' button on the action bar of a deployment details view.]]
</md-button>
<kd-scale-button resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the scale dialog, opened from a replica set details page.]]"
object-meta="$ctrl.details.objectMeta"
current-pods="$ctrl.details.podInfo.current"
desired-pods="$ctrl.details.podInfo.desired">
</kd-scale-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the delete dialog, opened from a replica set details page.]]"
<kd-actionbar-detail-buttons resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the dialog, opened from a replica set details page.]]"
type-meta="$ctrl.details.typeMeta"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-detail-buttons>
......@@ -18,24 +18,10 @@
export class ActionBarController {
/**
* @param {!backendApi.ReplicaSetDetail} replicaSetDetail
* @param {!common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(replicaSetDetail, kdScaleService) {
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
constructor(replicaSetDetail) {
/** @export {!backendApi.ReplicaSetDetail} */
this.details = replicaSetDetail;
}
/**
* Handles update of replicas count in replication controller dialog.
* @export
*/
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.details.objectMeta.namespace, this.details.objectMeta.name,
this.details.podInfo.current, this.details.podInfo.desired, this.details.typeMeta.kind);
}
}
......@@ -77,14 +77,15 @@ limitations under the License.
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-resource-card-menu>
<md-menu-item>
<md-button ng-click="$ctrl.showScaleDialog()">
[[Scale|Action 'Edit Pod Count' on the drop down menu for a single replication controller (replication controller list page).]]
</md-button>
</md-menu-item>
<kd-scale-button resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the scale dialog, opened from a replica set list page.]]"
object-meta="$ctrl.replicaSet.objectMeta"
current-pods="$ctrl.replicaSet.pods.current"
desired-pods="$ctrl.replicaSet.pods.desired"
menu-item="true">
</kd-scale-button>
<kd-resource-card-delete-menu-item resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the delete dialog, opened from a replica set list page.]]">
</kd-resource-card-delete-menu-item>
<kd-resource-card-edit-menu-item resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the delete dialog, opened from a replica set list page.]]">
<kd-resource-card-edit-menu-item resource-kind-name="[[Replica Set|Label 'Replica Set' which appears at the top of the edit dialog, opened from a replica set list page.]]">
</kd-resource-card-edit-menu-item>
</kd-resource-card-menu>
</kd-resource-card-column>
......
......@@ -33,10 +33,9 @@ export default class ReplicaSetCardController {
* @param {!ui.router.$state} $state
* @param {!angular.$interpolate} $interpolate
* @param {!./../../common/namespace/service.NamespaceService} kdNamespaceService
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor($state, $interpolate, kdNamespaceService, kdScaleService) {
constructor($state, $interpolate, kdNamespaceService) {
/**
* Initialized from the scope.
* @export {!backendApi.ReplicaSet}
......@@ -51,19 +50,6 @@ export default class ReplicaSetCardController {
/** @private {!./../../common/namespace/service.NamespaceService} */
this.kdNamespaceService_ = kdNamespaceService;
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
}
/**
* @export
*/
showScaleDialog() {
this.kdScaleService_.showScaleDialog(
this.replicaSet.objectMeta.namespace, this.replicaSet.objectMeta.name,
this.replicaSet.pods.current, this.replicaSet.pods.desired, this.replicaSet.typeMeta.kind);
}
/**
......
......@@ -16,7 +16,6 @@ import chromeModule from 'chrome/module';
import componentsModule from 'common/components/module';
import filtersModule from 'common/filters/module';
import namespaceModule from 'common/namespace/module';
import {ScaleService} from 'common/scaling/service';
import eventsModule from 'events/module';
import {replicaSetInfoComponent} from './detail/info_component';
......@@ -46,7 +45,6 @@ export default angular
.component('kdReplicaSetCard', replicaSetCardComponent)
.component('kdReplicaSetCardList', replicaSetCardListComponent)
.component('kdReplicaSetInfo', replicaSetInfoComponent)
.service('kdScaleService', ScaleService)
.factory('kdReplicaSetDetailResource', replicaSetDetailResource)
.factory('kdReplicaSetEventsResource', replicaSetEventsResource)
.factory('kdReplicaSetListResource', replicaSetListResource)
......
......@@ -14,19 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-actionbar-logs resource-kind-name="replicationcontroller"
<kd-actionbar-logs resource-kind-name="$ctrl.details.typeMeta.kind"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-logs>
<md-button ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar of a replication controller details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'scale' button on the action bar of a replication controller details view.]]
</md-button>
<kd-scale-button resource-kind-name="[[Replication Controller|Label 'Replication Controller' which appears at the top of the scale dialog, opened from a replication controller details page.]]"
object-meta="$ctrl.details.objectMeta"
current-pods="$ctrl.details.podInfo.current"
desired-pods="$ctrl.details.podInfo.desired">
</kd-scale-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Replication Controller|Label 'Replication Controller' which appears at the top of the edit dialog, opened from a replication controller details page.]]"
<kd-actionbar-detail-buttons resource-kind-name="[[Replication Controller|Label 'Replication Controller' which appears at the top of the dialog, opened from a replication controller details page.]]"
type-meta="$ctrl.details.typeMeta"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-detail-buttons>
......@@ -18,23 +18,10 @@
export class ActionBarController {
/**
* @param {!backendApi.ReplicationControllerDetail} replicationControllerDetail
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(replicationControllerDetail, kdScaleService) {
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
constructor(replicationControllerDetail) {
/** @export {!backendApi.ReplicationControllerDetail} */
this.details = replicationControllerDetail;
}
/**
* Handles update of replicas count in replication controller dialog.
* @export
*/
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.details.objectMeta.namespace, this.details.objectMeta.name,
this.details.podInfo.current, this.details.podInfo.desired, this.details.typeMeta.kind);
}
}
......@@ -15,18 +15,14 @@ limitations under the License.
-->
<kd-resource-card-menu>
<md-menu-item>
<md-button ng-click="$ctrl.viewDetails()">
[[View details|Action 'View details' on the drop down menu for a single replication controller (replication controller list page).]]
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="$ctrl.showScaleDialog()">
[[Scale|Action 'Edit Pod Count' on the drop down menu for a single replication controller (replication controller list page).]]
</md-button>
</md-menu-item>
<kd-resource-card-edit-menu-item resource-kind-name="[[Replication Controller|Label 'Replication Controller' which will appear in the replication Controller delete dialogm opened from a replication controller card on the list page.]]">
</kd-resource-card-edit-menu-item>
<kd-scale-button resource-kind-name="[[Replication Controller|Label 'Replication Controller' which will appear in the replication Controller scale dialog opened from a replication controller card on the list page.]]"
object-meta="$ctrl.replicationController.objectMeta"
current-pods="$ctrl.replicationController.pods.current"
desired-pods="$ctrl.replicationController.pods.desired"
menu-item="true">
</kd-scale-button>
<kd-resource-card-delete-menu-item resource-kind-name="[[Replication Controller|Label 'Replication Controller' which will appear in the replication Controller delete dialogm opened from a replication controller card on the list page.]]">
</kd-resource-card-delete-menu-item>
</md-menu>
<kd-resource-card-edit-menu-item resource-kind-name="[[Replication Controller|Label 'Replication Controller' which will appear in the replication Controller delete dialogm opened from a replication controller card on the list page.]]">
</kd-resource-card-edit-menu-item>
</kd-resource-card-menu>
......@@ -12,65 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import {StateParams} from 'common/resource/resourcedetail';
import {stateName} from 'replicationcontroller/detail/state';
/**
* Controller for the replication controller card menu
*
* @final
*/
export default class ReplicationControllerCardMenuController {
/**
* @param {!ui.router.$state} $state
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor($state, kdScaleService) {
/**
* Initialized from the scope.
* @export {!backendApi.ReplicationController}
*/
this.replicationController;
/** @private {!ui.router.$state} */
this.state_ = $state;
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
}
/**
* @param {!function(!MouseEvent)} $mdOpenMenu
* @param {!MouseEvent} $event
* @export
*/
openMenu($mdOpenMenu, $event) {
$mdOpenMenu($event);
}
/**
* @export
*/
viewDetails() {
this.state_.go(
stateName,
new StateParams(
this.replicationController.objectMeta.namespace,
this.replicationController.objectMeta.name));
}
/**
* @export
*/
showScaleDialog() {
this.kdScaleService_.showScaleDialog(
this.replicationController.objectMeta.namespace, this.replicationController.objectMeta.name,
this.replicationController.pods.current, this.replicationController.pods.desired,
this.replicationController.typeMeta.kind);
}
}
/**
* @return {!angular.Component}
*/
......@@ -78,6 +19,5 @@ export const replicationControllerCardMenuComponent = {
bindings: {
'replicationController': '=',
},
controller: ReplicationControllerCardMenuController,
templateUrl: 'replicationcontroller/list/cardmenu.html',
};
......@@ -14,19 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-actionbar-logs resource-kind-name="statefulset"
<kd-actionbar-logs resource-kind-name="$ctrl.details.typeMeta.kind"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-logs>
<md-button ng-click="$ctrl.handleScaleResourceDialog()">
<md-icon class="kd-actionbar-icon-button">linear_scale</md-icon>
<md-tooltip md-direction="bottom">
[[Edit number of pods|Tooltip for the 'scale' button on the action bar of a statefulset details view.]]
</md-tooltip>
[[Scale|Tooltip for the 'scale' button on the action bar of a statefulset details view.]]
</md-button>
<kd-scale-button resource-kind-name="[[Stateful Set|Label 'Stateful Set' which appears at the top of the scale dialog, opened from a stateful set details page.]]"
object-meta="$ctrl.details.objectMeta"
current-pods="$ctrl.details.podInfo.current"
desired-pods="$ctrl.details.podInfo.desired">
</kd-scale-button>
<kd-actionbar-detail-buttons resource-kind-name="[[Stateful Set|Label 'Stateful Set' which appears at the top of the delete dialog, opened from a stateful set details page.]]"
<kd-actionbar-detail-buttons resource-kind-name="[[Stateful Set|Label 'Stateful Set' which appears at the top of the dialog, opened from a stateful set details page.]]"
type-meta="$ctrl.details.typeMeta"
object-meta="$ctrl.details.objectMeta">
</kd-actionbar-detail-buttons>
......@@ -18,24 +18,10 @@
export class ActionBarController {
/**
* @param {!backendApi.StatefulSetDetail} statefulSetDetail
* @param {!./../../common/scaling/service.ScaleService} kdScaleService
* @ngInject
*/
constructor(statefulSetDetail, kdScaleService) {
/** @private {!./../../common/scaling/service.ScaleService} */
this.kdScaleService_ = kdScaleService;
constructor(statefulSetDetail) {
/** @export {!backendApi.StatefulSetDetail} */
this.details = statefulSetDetail;
}
/**
* Handles update of replicas count in statefulset controller dialog.
* @export
*/
handleScaleResourceDialog() {
this.kdScaleService_.showScaleDialog(
this.details.objectMeta.namespace, this.details.objectMeta.name,
this.details.podInfo.current, this.details.podInfo.desired, this.details.typeMeta.kind);
}
}
......@@ -40,26 +40,6 @@ limitations under the License.
</kd-pod-card-list>
</kd-content>
</kd-content-card>
<kd-content-card>
<kd-content>
<kd-service-card-list service-list="::ctrl.statefulSetDetail.serviceList"
service-list-resource="::ctrl.statefulSetServiceResource">
<kd-empty-list-text>
[[There are currently no Services with the same label selector as this Replica Set.|Text for services card zerostate in replica set details page.]]
</kd-empty-list-text>
</kd-service-card-list>
</kd-content>
</kd-content-card>
<kd-content-card>
<kd-content>
<kd-horizontal-pod-autoscaler-card-list horizontal-pod-autoscaler-list="::ctrl.statefulSetDetail.horizontalPodAutoscalerList">
<kd-empty-list-text>
[[There are currently no Horizontal Pod Autoscalers targeting this Replica Set.|Text for horizontal pod autoscalers card zerostate in replica set details page.]]
</kd-empty-list-text>
</kd-horizontal-pod-autoscaler-card-list>
</kd-content>
</kd-content-card>
<kd-event-card-list event-list="::ctrl.statefulSetDetail.eventList"
event-list-resource="::ctrl.eventListResource"></kd-event-card-list>
......@@ -75,14 +75,15 @@ limitations under the License.
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-resource-card-menu>
<md-menu-item>
<md-button ng-click="$ctrl.showScaleDialog()">
[[Scale|Action 'Edit Pod Count' on the drop down menu for a single statefulset (statefulset list page).]]
</md-button>
</md-menu-item>
<kd-scale-button resource-kind-name="[[Stateful Set|Label 'Stateful Set' which will appear in the stateful set scale dialog opened from a stateful set card on the list page.]]"
object-meta="$ctrl.statefulSet.objectMeta"
current-pods="$ctrl.statefulSet.pods.current"
desired-pods="$ctrl.statefulSet.pods.desired"
menu-item="true">
</kd-scale-button>
<kd-resource-card-delete-menu-item resource-kind-name="[[Stateful Set|Label 'Stateful Set' which will appear in the stateful set delete dialog opened from a stateful set card on the list page.]]">
</kd-resource-card-delete-menu-item>
<kd-resource-card-edit-menu-item resource-kind-name="[[Stateful Set|Label 'Stateful Set' which will appear in the stateful set delete dialog opened from a stateful set card on the list page.]]">
<kd-resource-card-edit-menu-item resource-kind-name="[[Stateful Set|Label 'Stateful Set' which will appear in the stateful set edit dialog opened from a stateful set card on the list page.]]">
</kd-resource-card-edit-menu-item>
</kd-resource-card-menu>
</kd-resource-card-column>
......
......@@ -12,74 +12,54 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import {StateParams} from 'common/resource/resourcedetail';
import {stateName} from 'replicationcontroller/detail/state';
import replicationControllerModule from 'replicationcontroller/module';
import componentsModule from 'common/components/module';
import scalingModule from 'common/scaling/module';
describe('Replication controller card menu controller', () => {
/** @type {!ReplicationControllerCardMenuController} */
describe('Scale button component', () => {
/** @type {!ScaleButtonController} */
let ctrl;
/** @type {!ui.router.$state} */
let state;
/** @type {!common/scaling/scaleresource_service.ScaleService}*/
/** @type {!ScaleService} */
let kdScaleService;
beforeEach(() => {
angular.mock.module(replicationControllerModule.name);
angular.mock.module(componentsModule.name);
angular.mock.module(scalingModule.name);
angular.mock.inject(($componentController, $state, _kdScaleService_, $rootScope) => {
state = $state;
angular.mock.inject(($componentController, _kdScaleService_) => {
kdScaleService = _kdScaleService_;
ctrl = $componentController('kdReplicationControllerCardMenu', {$scope: $rootScope}, {
replicationController: {objectMeta: {name: 'foo-name', namespace: 'foo-namespace'}},
ctrl = $componentController('kdScaleButton', {
kdScaleService: _kdScaleService_,
});
});
});
it('should view details', () => {
// given
spyOn(state, 'go');
// when
ctrl.viewDetails();
// then
expect(state.go).toHaveBeenCalledWith(stateName, new StateParams('foo-namespace', 'foo-name'));
});
it('should open the menu', () => {
it('should show edit replicas dialog', () => {
// given
let openMenuFn = jasmine.createSpy();
let event = {};
ctrl.objectMeta = {
namespace: 'foo-namespace',
name: 'foo-name',
};
ctrl.desiredPods = 3;
ctrl.currentPods = 3;
ctrl.resourceKindName = 'Replica Set';
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.openMenu(openMenuFn, event);
ctrl.handleScaleResourceDialog();
// then
expect(openMenuFn).toHaveBeenCalledWith(event);
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
});
it('should show update replicas dialog', () => {
it('should return true if menu button should be displayed within menu item', () => {
// given
ctrl.replicationController = {
objectMeta: {
namespace: '',
name: '',
},
typeMeta: {
kind: '',
},
pods: {
current: 1,
desired: 1,
},
};
spyOn(kdScaleService, 'showScaleDialog');
ctrl.menuItem = true;
// when
ctrl.showScaleDialog();
let result = ctrl.isMenuItem();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
expect(result).toBeTruthy();
});
});
......@@ -18,19 +18,15 @@ import module from 'deployment/module';
describe('Action Bar controller', () => {
/** @type {!ActionBarController} */
let ctrl;
/** @type {!ScaleService} */
let kdScaleService;
/** @type {!backendApi.DeploymentDetail} */
let details = {};
beforeEach(() => {
angular.mock.module(module.name);
angular.mock.inject(($controller, _kdScaleService_) => {
kdScaleService = _kdScaleService_;
angular.mock.inject(($controller) => {
ctrl = $controller(ActionBarController, {
deploymentDetail: details,
kdScaleService: _kdScaleService_,
});
});
});
......@@ -38,28 +34,4 @@ describe('Action Bar controller', () => {
it('should initialize details', () => {
expect(ctrl.details).toBe(details);
});
it('should show edit replicas dialog', () => {
// given
ctrl.details = {
objectMeta: {
namespace: 'foo-namespace',
name: 'foo-name',
},
typeMeta: {
kind: '',
},
statusInfo: {
replicas: 3,
available: 3,
},
};
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.handleScaleResourceDialog();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
});
});
......@@ -18,19 +18,15 @@ import module from 'job/module';
describe('Action Bar controller', () => {
/** @type {!ActionBarController} */
let ctrl;
/** @type {!ScaleService} */
let kdScaleService;
/** @type {!backendApi.JobDetail} */
let details = {};
beforeEach(() => {
angular.mock.module(module.name);
angular.mock.inject(($controller, _kdScaleService_) => {
kdScaleService = _kdScaleService_;
angular.mock.inject(($controller) => {
ctrl = $controller(ActionBarController, {
jobDetail: details,
kdScaleService: _kdScaleService_,
});
});
});
......@@ -38,25 +34,4 @@ describe('Action Bar controller', () => {
it('should initialize details', () => {
expect(ctrl.details).toBe(details);
});
it('should show edit replicas dialog', () => {
// given
ctrl.details = {
objectMeta: {
namespace: 'foo-namespace',
name: 'foo-name',
},
typeMeta: {
kind: '',
},
parallelism: 3,
};
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.handleScaleResourceDialog();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
});
});
......@@ -18,19 +18,15 @@ import module from 'replicaset/module';
describe('Action Bar controller', () => {
/** @type {!ActionBarController} */
let ctrl;
let kdScaleService;
/** @type {!backendApi.ReplicaSetDetail} */
let details = {};
beforeEach(() => {
angular.mock.module(module.name);
angular.mock.inject(($controller, _kdScaleService_) => {
/** @type {!ScaleService} */
kdScaleService = _kdScaleService_;
angular.mock.inject(($controller) => {
ctrl = $controller(ActionBarController, {
replicaSetDetail: details,
kdScaleService: _kdScaleService_,
});
});
});
......@@ -38,28 +34,4 @@ describe('Action Bar controller', () => {
it('should initialize details', () => {
expect(ctrl.details).toBe(details);
});
it('should show edit replicas dialog', () => {
// given
ctrl.details = {
objectMeta: {
namespace: 'foo-namespace',
name: 'foo-name',
},
typeMeta: {
kind: '',
},
podInfo: {
current: 3,
desired: 3,
},
};
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.handleScaleResourceDialog();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
});
});
......@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import scalingModule from 'common/scaling/module';
import replicaSetModule from 'replicaset/module';
describe('Replica Set card', () => {
......@@ -23,6 +24,7 @@ describe('Replica Set card', () => {
let scaleData;
beforeEach(() => {
angular.mock.module(scalingModule.name);
angular.mock.module(replicaSetModule.name);
angular.mock.inject(($componentController, $rootScope, kdScaleService) => {
......
......@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import scalingModule from 'common/scaling/module';
import replicaSetModule from 'replicaset/module';
describe('Replica Set Card List controller', () => {
......@@ -29,6 +30,7 @@ describe('Replica Set Card List controller', () => {
let scaleData;
beforeEach(() => {
angular.mock.module(scalingModule.name);
angular.mock.module(replicaSetModule.name);
angular.mock.inject(($componentController, kdNamespaceService, kdScaleService) => {
......
......@@ -18,46 +18,23 @@ import replicationControllerModule from 'replicationcontroller/module';
describe('Replication Controller Detail Action Bar controller', () => {
/**
* Replication Controller Detail Action Bar controller.
* @type {!ReplicationControllerDetailActionBarController}
* @type {!ActionBarController}
*/
let ctrl;
/** @type {!ReplicationControllerService} */
let kdScaleService;
/** @type {!backendApi.ReplicationControllerDetail} */
let details = {};
beforeEach(() => {
angular.mock.module(replicationControllerModule.name);
angular.mock.inject(($controller, $resource, _kdScaleService_) => {
kdScaleService = _kdScaleService_;
angular.mock.inject(($controller) => {
ctrl = $controller(ActionBarController, {
replicationControllerDetail: {},
kdScaleService: _kdScaleService_,
replicationControllerDetail: details,
});
});
});
it('should show edit replicas dialog', () => {
// given
ctrl.details = {
objectMeta: {
namespace: 'foo-namespace',
name: 'foo-name',
},
typeMeta: {
kind: '',
},
podInfo: {
current: 3,
desired: 3,
},
};
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.handleScaleResourceDialog();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
it('should initialize details', () => {
expect(ctrl.details).toBe(details);
});
});
......@@ -18,19 +18,15 @@ import module from 'statefulset/module';
describe('Action Bar controller', () => {
/** @type {!ActionBarController} */
let ctrl;
/** @type {!ScaleService} */
let kdScaleService;
/** @type {!backendApi.StatefulSetDetail} */
let details = {};
beforeEach(() => {
angular.mock.module(module.name);
angular.mock.inject(($controller, _kdScaleService_) => {
kdScaleService = _kdScaleService_;
angular.mock.inject(($controller) => {
ctrl = $controller(ActionBarController, {
statefulSetDetail: details,
kdScaleService: _kdScaleService_,
});
});
});
......@@ -38,28 +34,4 @@ describe('Action Bar controller', () => {
it('should initialize details', () => {
expect(ctrl.details).toBe(details);
});
it('should show edit replicas dialog', () => {
// given
ctrl.details = {
objectMeta: {
namespace: 'foo-namespace',
name: 'foo-name',
},
typeMeta: {
kind: '',
},
podInfo: {
current: 3,
desired: 3,
},
};
spyOn(kdScaleService, 'showScaleDialog');
// when
ctrl.handleScaleResourceDialog();
// then
expect(kdScaleService.showScaleDialog).toHaveBeenCalled();
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册