@@ -100,11 +107,11 @@ class RequestsViewComponent extends Component {
render() {
if (!this.state.requests || !this.state.requests.length) {
- return this.renderEmptyRequests();
+ return RequestsViewComponent.renderEmptyRequests();
}
const failedCount = this.state.requests.filter(
- req => req.status === RequestStatus.ERROR
+ (req: Request) => req.status === RequestStatus.ERROR
).length;
return (
@@ -112,64 +119,44 @@ class RequestsViewComponent extends Component {
0 ? (
- ) : ''
- )
+ ) : (
+ ''
+ ),
}}
/>
-
+
-
- { this.state.request && this.state.request.description &&
+
+
+ {this.state.request && this.state.request.description && (
{this.state.request.description}
- }
+ )}
+
- { this.state.request &&
-
- }
+
+ {this.state.request && }
>
);
}
}
-
-RequestsViewComponent.propTypes = {
- adapters: PropTypes.object.isRequired,
-};
-
-const RequestsView = {
- title: i18n.translate('inspectorViews.requests.requestsTitle', {
- defaultMessage: 'Requests'
- }),
- order: 20,
- help: i18n.translate('inspectorViews.requests.requestsDescriptionTooltip', {
- defaultMessage: 'View the requests that collected the data'
- }),
- shouldShow(adapters) {
- return Boolean(adapters.requests);
- },
- component: RequestsViewComponent
-};
-
-export { RequestsView };
diff --git a/src/legacy/core_plugins/inspector_views/public/requests/details/req_details_request.js b/src/plugins/inspector/public/views/requests/components/types.ts
similarity index 64%
rename from src/legacy/core_plugins/inspector_views/public/requests/details/req_details_request.js
rename to src/plugins/inspector/public/views/requests/components/types.ts
index 08e3052b2e22c..ebc3b41e41019 100644
--- a/src/legacy/core_plugins/inspector_views/public/requests/details/req_details_request.js
+++ b/src/plugins/inspector/public/views/requests/components/types.ts
@@ -16,25 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { Request } from '../../../adapters/request/types';
-import React from 'react';
-import {
- EuiCodeBlock,
-} from '@elastic/eui';
-
-function RequestDetailsRequest(props) {
- return (
-
- { JSON.stringify(props.request.json, null, 2) }
-
- );
+export interface RequestDetailsProps {
+ request: Request;
}
-
-RequestDetailsRequest.shouldShow = (request) => !!request.json;
-
-export { RequestDetailsRequest };
diff --git a/src/plugins/inspector/public/views/requests/index.ts b/src/plugins/inspector/public/views/requests/index.ts
new file mode 100644
index 0000000000000..14ee38b415d1f
--- /dev/null
+++ b/src/plugins/inspector/public/views/requests/index.ts
@@ -0,0 +1,36 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you 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 { i18n } from '@kbn/i18n';
+
+import { RequestsViewComponent } from './components/requests_view';
+import { Adapters, InspectorViewDescription } from '../../types';
+
+export const RequestsView: InspectorViewDescription = {
+ title: i18n.translate('inspector.requests.requestsTitle', {
+ defaultMessage: 'Requests',
+ }),
+ order: 20,
+ help: i18n.translate('inspector.requests.requestsDescriptionTooltip', {
+ defaultMessage: 'View the requests that collected the data',
+ }),
+ shouldShow(adapters: Adapters) {
+ return Boolean(adapters.requests);
+ },
+ component: RequestsViewComponent,
+};
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index ec9f1387ebef6..d9fa07c4d4d04 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -887,24 +887,24 @@
"inspectorViews.data.noDataAvailableTitle": "利用可能なデータがありません",
"inspectorViews.data.rawCSVButtonLabel": "CSV",
"inspectorViews.data.rawCSVButtonTooltip": "日付をタイムスタンプとしてなど、提供されたデータをそのままダウンロードします",
- "inspectorViews.requests.descriptionRowIconAriaLabel": "説明",
- "inspectorViews.requests.failedLabel": " (失敗)",
- "inspectorViews.requests.noRequestsLoggedDescription.elementHasNotLoggedAnyRequestsText": "エレメントが (まだ) リクエストを記録していません。",
- "inspectorViews.requests.noRequestsLoggedDescription.whatDoesItUsuallyMeanText": "これは通常、データを取得する必要がないか、エレメントがまだデータの取得を開始していないことを意味します。",
- "inspectorViews.requests.noRequestsLoggedTitle": "リクエストが記録されていません",
- "inspectorViews.requests.requestFailedTooltipTitle": "リクエストに失敗しました",
- "inspectorViews.requests.requestInProgressAriaLabel": "リクエスト進行中",
- "inspectorViews.requests.requestLabel": "リクエスト",
- "inspectorViews.requests.requestsDescriptionTooltip": "データを収集したリクエストを表示します",
- "inspectorViews.requests.requestsTitle": "リクエスト",
- "inspectorViews.requests.requestSucceededTooltipTitle": "リクエスト成功",
- "inspectorViews.requests.requestTabLabel": "リクエスト",
- "inspectorViews.requests.requestTimeLabel": "{requestTime}ms",
- "inspectorViews.requests.requestTooltipDescription": "リクエストの合計所要時間です。",
- "inspectorViews.requests.requestWasMadeDescription": "{requestsCount, plural, one {# リクエストが} other {# リクエストが} } 行われました{failedRequests}",
- "inspectorViews.requests.requestWasMadeDescription.requestHadFailureText": "、{failedCount} 件に失敗がありました",
- "inspectorViews.requests.responseTabLabel": "応答",
- "inspectorViews.requests.statisticsTabLabel": "統計",
+ "inspector.requests.descriptionRowIconAriaLabel": "説明",
+ "inspector.requests.failedLabel": " (失敗)",
+ "inspector.requests.noRequestsLoggedDescription.elementHasNotLoggedAnyRequestsText": "エレメントが (まだ) リクエストを記録していません。",
+ "inspector.requests.noRequestsLoggedDescription.whatDoesItUsuallyMeanText": "これは通常、データを取得する必要がないか、エレメントがまだデータの取得を開始していないことを意味します。",
+ "inspector.requests.noRequestsLoggedTitle": "リクエストが記録されていません",
+ "inspector.requests.requestFailedTooltipTitle": "リクエストに失敗しました",
+ "inspector.requests.requestInProgressAriaLabel": "リクエスト進行中",
+ "inspector.requests.requestLabel": "リクエスト",
+ "inspector.requests.requestsDescriptionTooltip": "データを収集したリクエストを表示します",
+ "inspector.requests.requestsTitle": "リクエスト",
+ "inspector.requests.requestSucceededTooltipTitle": "リクエスト成功",
+ "inspector.requests.requestTabLabel": "リクエスト",
+ "inspector.requests.requestTimeLabel": "{requestTime}ms",
+ "inspector.requests.requestTooltipDescription": "リクエストの合計所要時間です。",
+ "inspector.requests.requestWasMadeDescription": "{requestsCount, plural, one {# リクエストが} other {# リクエストが} } 行われました{failedRequests}",
+ "inspector.requests.requestWasMadeDescription.requestHadFailureText": "、{failedCount} 件に失敗がありました",
+ "inspector.requests.responseTabLabel": "応答",
+ "inspector.requests.statisticsTabLabel": "統計",
"interpreter.function.visDimension.accessor.help": "使用するデータセット内の列 (列インデックスまたは列名)",
"interpreter.function.visDimension.error.accessor": "入力された列名は無効です。",
"interpreter.function.visDimension.help": "visConfig ディメンションオブジェクトを生成します",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 5b1261daf726b..4cb675289354a 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -887,24 +887,24 @@
"inspectorViews.data.noDataAvailableTitle": "没有可用数据",
"inspectorViews.data.rawCSVButtonLabel": "原始 CSV",
"inspectorViews.data.rawCSVButtonTooltip": "按原样下载数据,例如将日期作为时间戳下载",
- "inspectorViews.requests.descriptionRowIconAriaLabel": "描述",
- "inspectorViews.requests.failedLabel": " (失败)",
- "inspectorViews.requests.noRequestsLoggedDescription.elementHasNotLoggedAnyRequestsText": "该元素尚未记录任何请求。",
- "inspectorViews.requests.noRequestsLoggedDescription.whatDoesItUsuallyMeanText": "这通常表示无需提取任何数据,或该元素尚未开始提取数据。",
- "inspectorViews.requests.noRequestsLoggedTitle": "未记录任何请求",
- "inspectorViews.requests.requestFailedTooltipTitle": "请求失败",
- "inspectorViews.requests.requestInProgressAriaLabel": "请求进行中",
- "inspectorViews.requests.requestLabel": "请求:",
- "inspectorViews.requests.requestsDescriptionTooltip": "查看已收集数据的请求",
- "inspectorViews.requests.requestsTitle": "请求",
- "inspectorViews.requests.requestSucceededTooltipTitle": "请求成功",
- "inspectorViews.requests.requestTabLabel": "请求",
- "inspectorViews.requests.requestTimeLabel": "{requestTime}ms",
- "inspectorViews.requests.requestTooltipDescription": "请求所花费的总时间。",
- "inspectorViews.requests.requestWasMadeDescription": "{requestsCount, plural, one {# 个请求已} other {# 个请求已} }发出{failedRequests}",
- "inspectorViews.requests.requestWasMadeDescription.requestHadFailureText": ",{failedCount} 个失败",
- "inspectorViews.requests.responseTabLabel": "响应",
- "inspectorViews.requests.statisticsTabLabel": "统计信息",
+ "inspector.requests.descriptionRowIconAriaLabel": "描述",
+ "inspector.requests.failedLabel": " (失败)",
+ "inspector.requests.noRequestsLoggedDescription.elementHasNotLoggedAnyRequestsText": "该元素尚未记录任何请求。",
+ "inspector.requests.noRequestsLoggedDescription.whatDoesItUsuallyMeanText": "这通常表示无需提取任何数据,或该元素尚未开始提取数据。",
+ "inspector.requests.noRequestsLoggedTitle": "未记录任何请求",
+ "inspector.requests.requestFailedTooltipTitle": "请求失败",
+ "inspector.requests.requestInProgressAriaLabel": "请求进行中",
+ "inspector.requests.requestLabel": "请求:",
+ "inspector.requests.requestsDescriptionTooltip": "查看已收集数据的请求",
+ "inspector.requests.requestsTitle": "请求",
+ "inspector.requests.requestSucceededTooltipTitle": "请求成功",
+ "inspector.requests.requestTabLabel": "请求",
+ "inspector.requests.requestTimeLabel": "{requestTime}ms",
+ "inspector.requests.requestTooltipDescription": "请求所花费的总时间。",
+ "inspector.requests.requestWasMadeDescription": "{requestsCount, plural, one {# 个请求已} other {# 个请求已} }发出{failedRequests}",
+ "inspector.requests.requestWasMadeDescription.requestHadFailureText": ",{failedCount} 个失败",
+ "inspector.requests.responseTabLabel": "响应",
+ "inspector.requests.statisticsTabLabel": "统计信息",
"interpreter.function.visDimension.accessor.help": "数据集中要使用的列(列索引或列名称)",
"interpreter.function.visDimension.error.accessor": "提供的列名称无效",
"interpreter.function.visDimension.help": "生成 visConfig 维度对象",