-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Data/Search Sessions] Management UI #81707
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
Merged
lizozom
merged 81 commits into
elastic:master
from
tsullivan:feature/data/management-ui
Jan 20, 2021
Merged
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
58117ea
logging and error handling in session client routes
tsullivan eee4641
[Data] Background Search Session Management UI
tsullivan 37a24eb
functional tests
tsullivan 5f7a3c8
fix ci
tsullivan b791318
Merge branch 'master' into feature/data/management-ui
tsullivan 5d1cdb0
new functional tests
tsullivan 534ae52
fix fn tests
tsullivan 5c6fd95
cleanups
tsullivan d374a6b
cleanup
tsullivan 866bb06
restore test
tsullivan d1e4678
Merge branch 'master' into feature/data/management-ui
kibanamachine 23fcdbc
Merge branch 'master' into feature/data/management-ui
tsullivan 6d41c06
Merge branch 'master' into feature/data/management-ui
tsullivan bf87f84
Merge branch 'master' into feature/data/management-ui
tsullivan 11a5f7a
configurable refresh and fetch timeout
tsullivan 1644f2d
more tests
tsullivan b68c581
Merge branch 'master' into feature/data/management-ui
tsullivan 858c232
feedback items
tsullivan d586d64
take expiresSoon field out of the interface
tsullivan 8c91842
move helper to common
tsullivan f632a4c
remove bg sessions w/find and delete
tsullivan 5dc31dd
add storybook
tsullivan 5d0fe85
fix tests
tsullivan a38f1d6
storybook actions
tsullivan 2b29591
Merge branch 'master' into feature/data/management-ui
tsullivan f3e1a9b
refactor expiration status calculation
tsullivan d967657
isViewable as calculated field
tsullivan 4cc1b12
Merge branch 'master' into feature/data/management-ui
kibanamachine 8ed2b4e
Merge branch 'master' into feature/data/management-ui
tsullivan e3f9113
refreshInterval 10s default
tsullivan 36aa6b9
Merge branch 'feature/data/management-ui' of github.com:tsullivan/kib…
tsullivan 0259e43
Merge branch 'master' into feature/data/management-ui
tsullivan d2ad3f3
list newest first
tsullivan 3041960
"Type" => "App"
tsullivan 6d3b66a
remove inline view action
tsullivan a4b415a
in-progress status tooltip shows expire date
tsullivan 88ee034
move date_string to public
tsullivan 660b467
fix tests
tsullivan 25e13fc
Adds management to tsconfig refs
TinaHeiligers 56044ba
removes preemptive script fix
TinaHeiligers 4adb390
view action was removed
tsullivan 0051eba
Merge branch 'master' into feature/data/management-ui
tsullivan 1089170
rename the feature to Search Sessions
tsullivan e4cd13e
Update x-pack/plugins/data_enhanced/public/search/sessions_mgmt/compo…
tsullivan f6bd874
Update x-pack/plugins/data_enhanced/public/search/sessions_mgmt/compo…
tsullivan c46548e
add TODO
tsullivan 7c2ac8b
use RedirectAppLinks
tsullivan 88a8974
Merge branch 'master' of github.com:elastic/kibana into management_to…
TinaHeiligers a654f91
Merge remote-tracking branch 'elastic/master' into feature/data/manag…
tsullivan 91bf1ae
Merge branch 'master' of github.com:elastic/kibana into pr/81707
69f66f2
Merge remote-tracking branch 'tinah/management_to_TS_project' into pr…
f59dc04
code review and react improvements
e23bb74
Merge branch 'master' of github.com:elastic/kibana into pr/81707
ce1062d
config
08ba096
Merge branch 'master' of github.com:elastic/kibana into pr/81707
c89eb43
fix test
2bc230d
Merge branch 'master' into feature/data/management-ui
kibanamachine fb58fcd
Merge branch 'master' of github.com:elastic/kibana into pr/81707
ca59197
Fix merge
b009bf4
Merge branch 'master' of github.com:elastic/kibana into pr/81707
5ac094e
Merge branch 'master' of github.com:elastic/kibana into pr/81707
ae5bcc0
Fix management test
3a38aad
@Dosant code review
c030ed1
code review
83d4a73
Deleteed story
863f2cc
Merge branch 'master' of github.com:elastic/kibana into pr/81707
5992e03
Merge branch 'master' into feature/data/management-ui
kibanamachine fc3121d
Merge branch 'master' of github.com:elastic/kibana into pr/81707
aad9f73
some more code review stuffs
34cd742
fix ts
9e7ac84
Merge branch 'master' of github.com:elastic/kibana into pr/81707
22eba85
Code review and cleanup
49a9433
Added functional tests for restoring, reloading and canceling a dashb…
706129c
Don't show expiration time for canceled, expired or errored sessions
b7d91ee
fix jest
6c409ce
Merge branch 'master' of github.com:elastic/kibana into pr/81707
ba11297
Moved UISession to public
a0c9a5e
Merge branch 'master' into feature/data/management-ui
kibanamachine 0f54a66
Merge branch 'master' of github.com:elastic/kibana into pr/81707
cdf1af6
@tsullivan code review
56c39f8
Fixed import
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React, { ReactNode } from 'react'; | ||
| import { IntlProvider } from 'react-intl'; | ||
| // eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
| import { UrlGeneratorsStart } from '../../../../../../../src/plugins/share/public/url_generators'; | ||
|
|
||
| export function LocaleWrapper({ children }: { children?: ReactNode }) { | ||
| return <IntlProvider locale="en">{children}</IntlProvider>; | ||
| } | ||
|
|
||
| export const mockUrls = ({ | ||
| getUrlGenerator: (id: string) => ({ createUrl: () => `hello-cool-${id}-url` }), | ||
| } as unknown) as UrlGeneratorsStart; |
78 changes: 78 additions & 0 deletions
78
x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { CoreSetup } from 'kibana/public'; | ||
| import type { ManagementAppMountParams } from 'src/plugins/management/public'; | ||
| import type { | ||
| AppDependencies, | ||
| IManagementSectionsPluginsSetup, | ||
| IManagementSectionsPluginsStart, | ||
| SessionsMgmtConfigSchema, | ||
| } from '../'; | ||
| import { APP } from '../'; | ||
| import { SearchSessionsMgmtAPI } from '../lib/api'; | ||
| import { AsyncSearchIntroDocumentation } from '../lib/documentation'; | ||
| import { renderApp } from './render'; | ||
|
|
||
| export class SearchSessionsMgmtApp { | ||
| constructor( | ||
| private coreSetup: CoreSetup<IManagementSectionsPluginsStart>, | ||
| private config: SessionsMgmtConfigSchema, | ||
| private params: ManagementAppMountParams, | ||
| private pluginsSetup: IManagementSectionsPluginsSetup | ||
| ) {} | ||
|
|
||
| public async mountManagementSection() { | ||
| const { coreSetup, params, pluginsSetup } = this; | ||
| const [coreStart, pluginsStart] = await coreSetup.getStartServices(); | ||
|
|
||
| const { | ||
| chrome: { docTitle }, | ||
| http, | ||
| docLinks, | ||
| i18n, | ||
| notifications, | ||
| uiSettings, | ||
| application, | ||
| } = coreStart; | ||
| const { data, share } = pluginsStart; | ||
|
|
||
| const pluginName = APP.getI18nName(); | ||
| docTitle.change(pluginName); | ||
| params.setBreadcrumbs([{ text: pluginName }]); | ||
|
|
||
| const { sessionsClient } = data.search; | ||
| const api = new SearchSessionsMgmtAPI(sessionsClient, this.config, { | ||
| notifications, | ||
| urls: share.urlGenerators, | ||
| application, | ||
| }); | ||
|
|
||
| const documentation = new AsyncSearchIntroDocumentation(docLinks); | ||
|
|
||
| const dependencies: AppDependencies = { | ||
| plugins: pluginsSetup, | ||
| config: this.config, | ||
| documentation, | ||
| core: coreStart, | ||
| api, | ||
| http, | ||
| i18n, | ||
| uiSettings, | ||
| share, | ||
| }; | ||
|
|
||
| const { element } = params; | ||
| const unmountAppCb = renderApp(element, dependencies); | ||
|
|
||
| return () => { | ||
| docTitle.reset(); | ||
| unmountAppCb(); | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| export { renderApp }; | ||
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { render, unmountComponentAtNode } from 'react-dom'; | ||
| import { AppDependencies } from '../'; | ||
| import { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public'; | ||
| import { SearchSessionsMgmtMain } from '../components/main'; | ||
|
|
||
| export const renderApp = ( | ||
| elem: HTMLElement | null, | ||
| { i18n, uiSettings, ...homeDeps }: AppDependencies | ||
| ) => { | ||
| if (!elem) { | ||
| return () => undefined; | ||
| } | ||
|
|
||
| const { Context: I18nContext } = i18n; | ||
| // uiSettings is required by the listing table to format dates in the timezone from Settings | ||
| const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ | ||
| uiSettings, | ||
| }); | ||
|
|
||
| render( | ||
| <I18nContext> | ||
| <KibanaReactContextProvider> | ||
| <SearchSessionsMgmtMain {...homeDeps} timezone={uiSettings.get('dateFormat:tz')} /> | ||
| </KibanaReactContextProvider> | ||
| </I18nContext>, | ||
| elem | ||
| ); | ||
|
|
||
| return () => { | ||
| unmountComponentAtNode(elem); | ||
| }; | ||
| }; |
89 changes: 89 additions & 0 deletions
89
...ck/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/cancel_button.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { FormattedMessage } from '@kbn/i18n/react'; | ||
| import React, { useState } from 'react'; | ||
| import { SearchSessionsMgmtAPI } from '../../lib/api'; | ||
| import { TableText } from '../'; | ||
| import { OnActionComplete } from './types'; | ||
|
|
||
| interface CancelButtonProps { | ||
| id: string; | ||
| name: string; | ||
| api: SearchSessionsMgmtAPI; | ||
| onActionComplete: OnActionComplete; | ||
| } | ||
|
|
||
| const CancelConfirm = ({ | ||
| onConfirmDismiss, | ||
| ...props | ||
| }: CancelButtonProps & { onConfirmDismiss: () => void }) => { | ||
| const { id, name, api, onActionComplete } = props; | ||
| const [isLoading, setIsLoading] = useState(false); | ||
|
|
||
| const title = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.title', { | ||
| defaultMessage: 'Cancel search session', | ||
| }); | ||
| const confirm = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.cancelButton', { | ||
| defaultMessage: 'Cancel', | ||
| }); | ||
| const cancel = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.dontCancelButton', { | ||
| defaultMessage: 'Dismiss', | ||
| }); | ||
| const message = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.message', { | ||
| defaultMessage: `Canceling the search session \'{name}\' will expire any cached results, so that quick restore will no longer be available. You will still be able to re-run it, using the reload action.`, | ||
| values: { | ||
| name, | ||
| }, | ||
| }); | ||
|
|
||
| return ( | ||
| <EuiOverlayMask> | ||
| <EuiConfirmModal | ||
| title={title} | ||
| onCancel={onConfirmDismiss} | ||
| onConfirm={async () => { | ||
| setIsLoading(true); | ||
| await api.sendCancel(id); | ||
| onActionComplete(); | ||
| }} | ||
| confirmButtonText={confirm} | ||
| confirmButtonDisabled={isLoading} | ||
| cancelButtonText={cancel} | ||
| defaultFocusedButton="confirm" | ||
| buttonColor="danger" | ||
| > | ||
| {message} | ||
| </EuiConfirmModal> | ||
| </EuiOverlayMask> | ||
| ); | ||
| }; | ||
|
|
||
| export const CancelButton = (props: CancelButtonProps) => { | ||
| const [showConfirm, setShowConfirm] = useState(false); | ||
|
|
||
| const onClick = () => { | ||
| setShowConfirm(true); | ||
| }; | ||
|
|
||
| const onConfirmDismiss = () => { | ||
| setShowConfirm(false); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <TableText onClick={onClick}> | ||
| <FormattedMessage | ||
| id="xpack.data.mgmt.searchSessions.actionCancel" | ||
| defaultMessage="Cancel" | ||
| /> | ||
| </TableText> | ||
| {showConfirm ? <CancelConfirm {...props} onConfirmDismiss={onConfirmDismiss} /> : null} | ||
| </> | ||
| ); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.