Skip to content

Commit 2a8c609

Browse files
[Uptime]Refactor header and action menu (#83779)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 9d8dd6d commit 2a8c609

File tree

23 files changed

+722
-411
lines changed

23 files changed

+722
-411
lines changed

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20323,8 +20323,6 @@
2032320323
"xpack.uptime.breadcrumbs.overviewBreadcrumbText": "アップタイム",
2032420324
"xpack.uptime.certificates.heading": "TLS証明書({total})",
2032520325
"xpack.uptime.certificates.refresh": "更新",
20326-
"xpack.uptime.certificates.returnToOverviewLinkLabel": "概要に戻る",
20327-
"xpack.uptime.certificates.settingsLinkLabel": "設定",
2032820326
"xpack.uptime.certs.expired": "期限切れ",
2032920327
"xpack.uptime.certs.expires": "有効期限",
2033020328
"xpack.uptime.certs.expireSoon": "まもなく期限切れ",
@@ -20462,7 +20460,6 @@
2046220460
"xpack.uptime.monitorList.table.description": "列にステータス、名前、URL、IP、ダウンタイム履歴、統合が入力されたモニターステータス表です。この表は現在 {length} 項目を表示しています。",
2046320461
"xpack.uptime.monitorList.table.url.name": "Url",
2046420462
"xpack.uptime.monitorList.tlsColumnLabel": "TLS証明書",
20465-
"xpack.uptime.monitorList.viewCertificateTitle": "証明書ステータス",
2046620463
"xpack.uptime.monitorStatusBar.durationTextAriaLabel": "ミリ秒単位の監視時間",
2046720464
"xpack.uptime.monitorStatusBar.healthStatusMessageAriaLabel": "監視ステータス",
2046820465
"xpack.uptime.monitorStatusBar.loadingMessage": "読み込み中…",
@@ -20528,7 +20525,6 @@
2052820525
"xpack.uptime.settings.error.couldNotSave": "設定を保存できませんでした!",
2052920526
"xpack.uptime.settings.invalid.error": "値は0よりも大きい値でなければなりません。",
2053020527
"xpack.uptime.settings.invalid.nanError": "値は整数でなければなりません。",
20531-
"xpack.uptime.settings.returnToOverviewLinkLabel": "概要に戻る",
2053220528
"xpack.uptime.settings.saveSuccess": "設定が保存されました。",
2053320529
"xpack.uptime.settingsBreadcrumbText": "設定",
2053420530
"xpack.uptime.snapshot.donutChart.ariaLabel": "現在のステータスを表す円グラフ、{total}個中{down}個のモニターがダウンしています。",

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20342,8 +20342,6 @@
2034220342
"xpack.uptime.breadcrumbs.overviewBreadcrumbText": "运行时间",
2034320343
"xpack.uptime.certificates.heading": "TLS 证书 ({total})",
2034420344
"xpack.uptime.certificates.refresh": "刷新",
20345-
"xpack.uptime.certificates.returnToOverviewLinkLabel": "返回到概览",
20346-
"xpack.uptime.certificates.settingsLinkLabel": "设置",
2034720345
"xpack.uptime.certs.expired": "已过期",
2034820346
"xpack.uptime.certs.expires": "过期",
2034920347
"xpack.uptime.certs.expireSoon": "即将过期",
@@ -20481,7 +20479,6 @@
2048120479
"xpack.uptime.monitorList.table.description": "具有“状态”、“名称”、“URL”、“IP”、“中断历史记录”和“集成”列的“监测状态”表。该表当前显示 {length} 个项目。",
2048220480
"xpack.uptime.monitorList.table.url.name": "URL",
2048320481
"xpack.uptime.monitorList.tlsColumnLabel": "TLS 证书",
20484-
"xpack.uptime.monitorList.viewCertificateTitle": "证书状态",
2048520482
"xpack.uptime.monitorStatusBar.durationTextAriaLabel": "监测持续时间(毫秒)",
2048620483
"xpack.uptime.monitorStatusBar.healthStatusMessageAriaLabel": "检测状态",
2048720484
"xpack.uptime.monitorStatusBar.loadingMessage": "正在加载……",
@@ -20547,7 +20544,6 @@
2054720544
"xpack.uptime.settings.error.couldNotSave": "无法保存设置!",
2054820545
"xpack.uptime.settings.invalid.error": "值必须大于 0。",
2054920546
"xpack.uptime.settings.invalid.nanError": "值必须为整数。",
20550-
"xpack.uptime.settings.returnToOverviewLinkLabel": "返回到概览",
2055120547
"xpack.uptime.settings.saveSuccess": "设置已保存!",
2055220548
"xpack.uptime.settingsBreadcrumbText": "设置",
2055320549
"xpack.uptime.snapshot.donutChart.ariaLabel": "显示当前状态的饼图。{total} 个监测中有 {down} 个已关闭。",

x-pack/plugins/uptime/public/apps/render_app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function renderApp(
2121
core: CoreStart,
2222
plugins: ClientPluginsSetup,
2323
startPlugins: ClientPluginsStart,
24-
{ element, history }: AppMountParameters
24+
appMountParameters: AppMountParameters
2525
) {
2626
const {
2727
application: { capabilities },
@@ -47,7 +47,6 @@ export function renderApp(
4747
basePath: basePath.get(),
4848
darkMode: core.uiSettings.get(DEFAULT_DARK_MODE),
4949
commonlyUsedRanges: core.uiSettings.get(DEFAULT_TIMEPICKER_QUICK_RANGES),
50-
history,
5150
isApmAvailable: apm,
5251
isInfraAvailable: infrastructure,
5352
isLogsAvailable: logs,
@@ -68,12 +67,13 @@ export function renderApp(
6867
],
6968
}),
7069
setBadge,
70+
appMountParameters,
7171
setBreadcrumbs: core.chrome.setBreadcrumbs,
7272
};
7373

74-
ReactDOM.render(<UptimeApp {...props} />, element);
74+
ReactDOM.render(<UptimeApp {...props} />, appMountParameters.element);
7575

7676
return () => {
77-
ReactDOM.unmountComponentAtNode(element);
77+
ReactDOM.unmountComponentAtNode(appMountParameters.element);
7878
};
7979
}

x-pack/plugins/uptime/public/apps/uptime_app.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
99
import React, { useEffect } from 'react';
1010
import { Provider as ReduxProvider } from 'react-redux';
1111
import { Router } from 'react-router-dom';
12-
import { I18nStart, ChromeBreadcrumb, CoreStart } from 'kibana/public';
12+
import { I18nStart, ChromeBreadcrumb, CoreStart, AppMountParameters } from 'kibana/public';
1313
import {
1414
KibanaContextProvider,
1515
RedirectAppLinks,
@@ -28,7 +28,7 @@ import { PageRouter } from '../routes';
2828
import { UptimeAlertsFlyoutWrapper } from '../components/overview/alerts';
2929
import { store } from '../state';
3030
import { kibanaService } from '../state/kibana_service';
31-
import { ScopedHistory } from '../../../../../src/core/public';
31+
import { ActionMenu } from '../components/common/header/action_menu';
3232
import { EuiThemeProvider } from '../../../observability/public';
3333

3434
export interface UptimeAppColors {
@@ -47,7 +47,6 @@ export interface UptimeAppProps {
4747
canSave: boolean;
4848
core: CoreStart;
4949
darkMode: boolean;
50-
history: ScopedHistory;
5150
i18n: I18nStart;
5251
isApmAvailable: boolean;
5352
isInfraAvailable: boolean;
@@ -58,6 +57,7 @@ export interface UptimeAppProps {
5857
renderGlobalHelpControls(): void;
5958
commonlyUsedRanges: CommonlyUsedRange[];
6059
setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void;
60+
appMountParameters: AppMountParameters;
6161
}
6262

6363
const Application = (props: UptimeAppProps) => {
@@ -71,6 +71,7 @@ const Application = (props: UptimeAppProps) => {
7171
renderGlobalHelpControls,
7272
setBadge,
7373
startPlugins,
74+
appMountParameters,
7475
} = props;
7576

7677
useEffect(() => {
@@ -101,7 +102,7 @@ const Application = (props: UptimeAppProps) => {
101102
<KibanaContextProvider
102103
services={{ ...core, ...plugins, triggersActionsUi: startPlugins.triggersActionsUi }}
103104
>
104-
<Router history={props.history}>
105+
<Router history={appMountParameters.history}>
105106
<EuiThemeProvider darkMode={darkMode}>
106107
<UptimeRefreshContextProvider>
107108
<UptimeSettingsContextProvider {...props}>
@@ -112,6 +113,7 @@ const Application = (props: UptimeAppProps) => {
112113
<main>
113114
<UptimeAlertsFlyoutWrapper />
114115
<PageRouter />
116+
<ActionMenu appMountParameters={appMountParameters} />
115117
</main>
116118
</RedirectAppLinks>
117119
</EuiPage>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import React, { useContext } from 'react';
8+
import {
9+
EuiButton,
10+
EuiButtonEmpty,
11+
EuiFlexGroup,
12+
EuiFlexItem,
13+
EuiHideFor,
14+
EuiShowFor,
15+
} from '@elastic/eui';
16+
import * as labels from '../../pages/translations';
17+
import { UptimeRefreshContext } from '../../contexts';
18+
19+
export const CertRefreshBtn = () => {
20+
const { refreshApp } = useContext(UptimeRefreshContext);
21+
22+
return (
23+
<EuiFlexItem style={{ alignItems: 'flex-end' }} grow={false}>
24+
<EuiFlexGroup responsive={false} gutterSize="s">
25+
<EuiFlexItem grow={false}>
26+
<EuiHideFor sizes={['xs']}>
27+
<EuiButton
28+
fill
29+
iconType="refresh"
30+
onClick={() => {
31+
refreshApp();
32+
}}
33+
data-test-subj="superDatePickerApplyTimeButton"
34+
>
35+
{labels.REFRESH_CERT}
36+
</EuiButton>
37+
</EuiHideFor>
38+
<EuiShowFor sizes={['xs']}>
39+
<EuiButtonEmpty
40+
iconType="refresh"
41+
onClick={() => {
42+
refreshApp();
43+
}}
44+
data-test-subj="superDatePickerApplyTimeButton"
45+
/>
46+
</EuiShowFor>
47+
</EuiFlexItem>
48+
</EuiFlexGroup>
49+
</EuiFlexItem>
50+
);
51+
};

0 commit comments

Comments
 (0)