-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate status page app to core #72017
Changes from 15 commits
ba9e213
5964ffc
f63d8d2
dcc1f0a
6b42c45
854211e
c4dbd19
7f927f7
c857b74
8a2f98e
0a7b243
d65c125
7bdc3c2
e91d5b7
b7bc230
4beb5d3
66337af
46c5adf
716dee7
92924b7
7352ad9
3a3e2e9
5b8719e
1a0c2ae
920f52b
71f4273
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,19 @@ import { | |
AppNavLinkStatus, | ||
AppMountParameters, | ||
} from '../application'; | ||
import { HttpSetup, HttpStart } from '../http'; | ||
import { CoreContext } from '../core_system'; | ||
import { renderApp, setupUrlOverflowDetection } from './errors'; | ||
import { NotificationsStart } from '../notifications'; | ||
import { IUiSettingsClient } from '../ui_settings'; | ||
import type { HttpSetup, HttpStart } from '../http'; | ||
import type { CoreContext } from '../core_system'; | ||
import type { NotificationsSetup, NotificationsStart } from '../notifications'; | ||
import type { IUiSettingsClient } from '../ui_settings'; | ||
import type { InjectedMetadataSetup } from '../injected_metadata'; | ||
import { renderApp as renderErrorApp, setupUrlOverflowDetection } from './errors'; | ||
import { renderApp as renderStatusApp } from './status'; | ||
|
||
interface SetupDeps { | ||
application: InternalApplicationSetup; | ||
http: HttpSetup; | ||
injectedMetadata: InjectedMetadataSetup; | ||
notifications: NotificationsSetup; | ||
} | ||
|
||
interface StartDeps { | ||
|
@@ -47,7 +51,7 @@ export class CoreApp { | |
|
||
constructor(private readonly coreContext: CoreContext) {} | ||
|
||
public setup({ http, application }: SetupDeps) { | ||
public setup({ http, application, injectedMetadata, notifications }: SetupDeps) { | ||
application.register(this.coreContext.coreId, { | ||
id: 'error', | ||
title: 'App Error', | ||
|
@@ -56,7 +60,20 @@ export class CoreApp { | |
// Do not use an async import here in order to ensure that network failures | ||
// cannot prevent the error UI from displaying. This UI is tiny so an async | ||
// import here is probably not useful anyways. | ||
return renderApp(params, { basePath: http.basePath }); | ||
return renderErrorApp(params, { basePath: http.basePath }); | ||
}, | ||
}); | ||
|
||
if (injectedMetadata.getAnonymousStatusPage()) { | ||
http.anonymousPaths.register('/status'); | ||
} | ||
application.register(this.coreContext.coreId, { | ||
id: 'status', | ||
title: 'Server Status', | ||
appRoute: '/status', | ||
navLinkStatus: AppNavLinkStatus.hidden, | ||
mount(params: AppMountParameters) { | ||
return renderStatusApp(params, { http, notifications }); | ||
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We choose to not use async import for the error app, so I think it makes sense to do the same for the status page. |
||
}, | ||
}); | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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 React, { FunctionComponent } from 'react'; | ||
import { EuiBasicTable, EuiIcon } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import type { FormattedStatus } from '../lib'; | ||
|
||
interface StatusTableProps { | ||
statuses?: FormattedStatus[]; | ||
} | ||
|
||
const tableColumns = [ | ||
{ | ||
field: 'state', | ||
name: '', | ||
render: (state: FormattedStatus['state']) => ( | ||
<EuiIcon type="dot" aria-hidden color={state.uiColor} /> | ||
), | ||
width: '32px', | ||
}, | ||
{ | ||
field: 'id', | ||
name: i18n.translate('core.statusPage.statusTable.columns.idHeader', { | ||
defaultMessage: 'ID', | ||
}), | ||
}, | ||
{ | ||
field: 'state', | ||
name: i18n.translate('core.statusPage.statusTable.columns.statusHeader', { | ||
defaultMessage: 'Status', | ||
}), | ||
render: (state: FormattedStatus['state']) => <span>{state.message}</span>, | ||
}, | ||
]; | ||
|
||
export const StatusTable: FunctionComponent<StatusTableProps> = ({ statuses }) => { | ||
if (!statuses) { | ||
return null; | ||
} | ||
return ( | ||
<EuiBasicTable<FormattedStatus> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL you can specify generics of react components in tsx. |
||
columns={tableColumns} | ||
items={statuses} | ||
rowProps={({ state }) => ({ | ||
className: `status-table-row-${state.uiColor}`, | ||
})} | ||
data-test-subj="statusBreakdown" | ||
/> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { renderApp } from './render_app'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { formatNumber } from './format_number'; | ||
export { loadStatus, Metric, FormattedStatus, ProcessedServerResponse } from './load_status'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot navigate to the other Kibana pages from other
anonymous pages
without reloading. It creates a bug whenstatus.allowAnonymous: true
and you logged-in user lands on the/status
page and navigates to other pages. result:SecurityNavControl
is not rendered.As a workaround, we could make
status
page chromeless to enforce page reloading.Is it possible to land on the
/status
page from a link in Kibana UI?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum. This indeed is an issue. We really need to have a way to know about anonymous vs logged-in apps from core, to be able to automatically performs that kind of reload when using
navigateToApp
between anon/logged or logged/anon apps. Do you know if we have an issue for that?chromeless apps do not really force page reloading, but I guess hiding the chrome navigation will remove any way for the user to navigate away from the status page using the UI. do you think it would be sufficient?
Not that I'm aware of. The app is hidden and there is no link to it anywhere in chrome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was my reasoning as well. I think it's okay since the user navigates to the
/status
page manually.I'm not aware of any.