提交 f5580522 编写于 作者: M Marcin Maciaszczyk 提交者: GitHub

Add log buttons in workload resources' lists (#2156)

* Add log buttons in workload resources' lists

* Use variable instead of string literals

* Rename component file
上级 797d49bb
......@@ -94,6 +94,7 @@
<translation id="3496419655731709621" key="MSG_COMMON_COMPONENTS_CONDITIONS_CONDITIONSLIST_9" desc="Label when there is no data.">-</translation>
<translation id="3570731037158883626" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_0" desc="Tooltip on the &quot;show less&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">show fewer labels</translation>
<translation id="8950559770902715649" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_1" desc="Tooltip on the &quot;show all&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">show all labels</translation>
<translation id="7262450799096886396" key="MSG_COMMON_COMPONENTS_RESOURCECARD_LOGSBUTTON_0" desc="Label for logs tooltip.">Logs</translation>
<translation id="8077948432236649947" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDDELETEMENUITEM_0" desc="Action &quot;Delete&quot; (verb), which appears as a menu item on the cards for kubernetes resources.">Delete</translation>
<translation id="1786717544428328487" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDEDITMENUITEM_0" desc="Label for YAML edit menu item.">View/edit YAML</translation>
<translation id="6165720699884834015" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDMENU_0" desc="Tooltip &quot;Actions&quot;, which appears when you hover over the menu icon on any resource card.">Actions</translation>
......@@ -637,7 +638,6 @@
<translation id="2699867637725149359" key="MSG_POD_LIST_CARDLIST_9" desc="Title of a column showing name of the node that pod is running at">Node</translation>
<translation id="5608535302521220986" key="MSG_POD_LIST_CARD_0" desc="Tooltip for failed pod card icon">This pod has errors.</translation>
<translation id="7889427465656547627" key="MSG_POD_LIST_CARD_1" desc="Tooltip for pending pod card icon">This pod is in a pending state.</translation>
<translation id="6227114160090429637" key="MSG_POD_LIST_CARD_2" desc="Label for logs tooltip">Logs</translation>
<translation id="1278633357095866885" key="MSG_POD_LIST_CARD_3" desc="Name of the pod resource">Pod</translation>
<translation id="1053078836410141563" key="MSG_POD_LIST_CARD_4" desc="Name of the pod resource">Pod</translation>
<translation id="4686932628263410864" key="MSG_POD_LIST_LIST_0" desc="Title for graph card displaying CPU metric of pods.">CPU usage</translation>
......
......@@ -98,6 +98,7 @@
<translation id="3496419655731709621" key="MSG_COMMON_COMPONENTS_CONDITIONS_CONDITIONSLIST_9" desc="Label when there is no data.">-</translation>
<translation id="3570731037158883626" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_0" desc="Tooltip on the &quot;show less&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">ラベルを隠す</translation>
<translation id="8950559770902715649" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_1" desc="Tooltip on the &quot;show all&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">ラベルをすべて表示</translation>
<translation id="7262450799096886396" key="MSG_COMMON_COMPONENTS_RESOURCECARD_LOGSBUTTON_0" desc="Label for logs tooltip.">Logs</translation>
<translation id="8077948432236649947" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDDELETEMENUITEM_0" desc="Action &quot;Delete&quot; (verb), which appears as a menu item on the cards for kubernetes resources.">削除</translation>
<translation id="1786717544428328487" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDEDITMENUITEM_0" desc="Label for YAML edit menu item.">YAML を見る/編集する</translation>
<translation id="6165720699884834015" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDMENU_0" desc="Tooltip &quot;Actions&quot;, which appears when you hover over the menu icon on any resource card.">アクション</translation>
......@@ -661,7 +662,6 @@
<translation id="2699867637725149359" key="MSG_POD_LIST_CARDLIST_9" desc="Title of a column showing name of the node that pod is running at">Node</translation>
<translation id="5608535302521220986" key="MSG_POD_LIST_CARD_0" desc="Tooltip for failed pod card icon">ポッドにエラーが発生しています。</translation>
<translation id="7889427465656547627" key="MSG_POD_LIST_CARD_1" desc="Tooltip for pending pod card icon">ポッドは待機状態です。</translation>
<translation id="6227114160090429637" key="MSG_POD_LIST_CARD_2" desc="Label for logs tooltip">Logs</translation>
<translation id="1278633357095866885" key="MSG_POD_LIST_CARD_3" desc="Name of the pod resource">ポッド</translation>
<translation id="1053078836410141563" key="MSG_POD_LIST_CARD_4" desc="Name of the pod resource">ポッド</translation>
<translation id="4686932628263410864" key="MSG_POD_LIST_LIST_0" desc="Title for graph card displaying CPU metric of pods.">CPU使用量</translation>
......
......@@ -94,6 +94,7 @@
<translation id="3496419655731709621" key="MSG_COMMON_COMPONENTS_CONDITIONS_CONDITIONSLIST_9" desc="Label when there is no data.">-</translation>
<translation id="3570731037158883626" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_0" desc="Tooltip on the &quot;show less&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">显示简要标签</translation>
<translation id="8950559770902715649" key="MSG_COMMON_COMPONENTS_LABELS_LABELS_1" desc="Tooltip on the &quot;show all&quot; button for the labels of any kubernetes resource. Usually appears on the resource details pages.">显示所有标签</translation>
<translation id="7262450799096886396" key="MSG_COMMON_COMPONENTS_RESOURCECARD_LOGSBUTTON_0" desc="Label for logs tooltip.">Logs</translation>
<translation id="8077948432236649947" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDDELETEMENUITEM_0" desc="Action &quot;Delete&quot; (verb), which appears as a menu item on the cards for kubernetes resources.">删除</translation>
<translation id="1786717544428328487" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDEDITMENUITEM_0" desc="Label for YAML edit menu item.">查看/编辑 YAML</translation>
<translation id="6165720699884834015" key="MSG_COMMON_COMPONENTS_RESOURCECARD_RESOURCECARDMENU_0" desc="Tooltip &quot;Actions&quot;, which appears when you hover over the menu icon on any resource card.">动作</translation>
......@@ -637,7 +638,6 @@
<translation id="2699867637725149359" key="MSG_POD_LIST_CARDLIST_9" desc="Title of a column showing name of the node that pod is running at">Node</translation>
<translation id="5608535302521220986" key="MSG_POD_LIST_CARD_0" desc="Tooltip for failed pod card icon">此容器组已出错</translation>
<translation id="7889427465656547627" key="MSG_POD_LIST_CARD_1" desc="Tooltip for pending pod card icon">此容器组等待中</translation>
<translation id="6227114160090429637" key="MSG_POD_LIST_CARD_2" desc="Label for logs tooltip">Logs</translation>
<translation id="1278633357095866885" key="MSG_POD_LIST_CARD_3" desc="Name of the pod resource">容器组</translation>
<translation id="1053078836410141563" key="MSG_POD_LIST_CARD_4" desc="Name of the pod resource">容器组</translation>
<translation id="4686932628263410864" key="MSG_POD_LIST_LIST_0" desc="Title for graph card displaying CPU metric of pods.">CPU 使用率</translation>
......
<!--
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-button ng-if="::$ctrl.getLogsHref()"
ng-href="{{::$ctrl.getLogsHref()}}"
target="_blank"
class="md-icon-button">
<md-icon md-font-library="material-icons">subject</md-icon>
<md-tooltip>[[Logs|Label for logs tooltip.]]</md-tooltip>
</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 {stateName as logsStateName, StateParams as LogsStateParams} from 'logs/state';
/**
* Controller for the logs button component.
* @final
*/
export class LogsButtonController {
/**
* @param {!ui.router.$state} $state
* @ngInject
*/
constructor($state) {
/** @export {string} Initialized from a binding. */
this.resourceKindName;
/** @export {!backendApi.ObjectMeta} Initialized from a binding. */
this.objectMeta;
/** @private {!ui.router.$state}} */
this.state_ = $state;
}
/**
* @return {string}
* @export
*/
getLogsHref() {
return this.state_.href(
logsStateName,
new LogsStateParams(
this.objectMeta.namespace, this.objectMeta.name, this.resourceKindName));
}
}
/** @type {!angular.Component} */
export const logsButtonComponent = {
templateUrl: 'common/components/resourcecard/logsbutton.html',
bindings: {
'resourceKindName': '<',
'objectMeta': '<',
},
bindToController: true,
controller: LogsButtonController,
};
......@@ -14,6 +14,7 @@
import resourceModule from 'common/resource/module';
import {logsButtonComponent} from './logsbutton_component';
import {resourceCardComponent} from './resourcecard_component';
import {resourceCardColumnComponent} from './resourcecardcolumn_component';
import {resourceCardColumnsComponent} from './resourcecardcolumns_component';
......@@ -42,6 +43,7 @@ export default angular
'angularUtils.directives.dirPagination',
resourceModule.name,
])
.component('kdLogsButton', logsButtonComponent)
.component('kdResourceCard', resourceCardComponent)
.component('kdResourceCardList', resourceCardListComponent)
.component('kdResourceCardListFooter', resourceCardListFooterComponent)
......
......@@ -68,6 +68,9 @@ limitations under the License.
</div>
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-logs-button object-meta="::$ctrl.daemonSet.objectMeta"
resource-kind-name="::$ctrl.daemonSet.typeMeta.kind">
</kd-logs-button>
<kd-resource-card-menu>
<kd-resource-card-delete-menu-item resource-kind-name="[[Daemon Set|Title 'Daemon Set' which is used as a title for the delete/update
dialogs (that can be opened on the daemon set list view).]]">
......
......@@ -88,13 +88,9 @@ limitations under the License.
<div ng-if="::!$ctrl.hasMemoryUsage()">-</div>
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<md-button ng-if="::$ctrl.getPodLogsHref()"
ng-href="{{::$ctrl.getPodLogsHref()}}"
target="_blank"
class="md-icon-button">
<md-icon md-font-library="material-icons">subject</md-icon>
<md-tooltip>[[Logs|Label for logs tooltip]]</md-tooltip>
</md-button>
<kd-logs-button object-meta="::$ctrl.pod.objectMeta"
resource-kind-name="::$ctrl.pod.typeMeta.kind">
</kd-logs-button>
<kd-resource-card-menu>
<kd-resource-card-delete-menu-item resource-kind-name="[[Pod|Name of the pod resource]]">
</kd-resource-card-delete-menu-item>
......
......@@ -76,6 +76,9 @@ limitations under the License.
</div>
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-logs-button object-meta="::$ctrl.replicaSet.objectMeta"
resource-kind-name="::$ctrl.replicaSet.typeMeta.kind">
</kd-logs-button>
<kd-resource-card-menu>
<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"
......
......@@ -73,6 +73,9 @@ limitations under the License.
</div>
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-logs-button object-meta="::$ctrl.replicationController.objectMeta"
resource-kind-name="::$ctrl.replicationController.typeMeta.kind">
</kd-logs-button>
<kd-replication-controller-card-menu replication-controller="::$ctrl.replicationController">
</kd-replication-controller-card-menu>
</kd-resource-card-column>
......
......@@ -74,6 +74,9 @@ limitations under the License.
</div>
</kd-resource-card-column>
<kd-resource-card-column class="kd-row-layout-column kd-icon-column">
<kd-logs-button object-meta="::$ctrl.statefulSet.objectMeta"
resource-kind-name="statefulset">
</kd-logs-button>
<kd-resource-card-menu>
<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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册