Skip to content
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

[Search Sessions] Search session example app #89583

Merged
merged 15 commits into from
Feb 22, 2021

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Jan 28, 2021

Summary

Adds a search session developer example plugin.
Following the demo application you will:

Step 1. Configure the Query
Step 2. Start a search
Step 3. Save a session (you can do this while the search is still running or when it is finished)
Step 4. Restore a session
Step 5-6. Navigate to management and then navigate back from there to restore a session

demo-search-sessions.mov

I have a functional test separately #92133 it needs some infra/ops changes to make it work (we can't run example tests with x-pack yet)

@@ -4,7 +4,7 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils"],
"requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

share is needed for URL generator to get back to search session

import { SearchSessionsExampleApp } from './search_sessions/app';
import { RedirectAppLinks } from '../../../src/plugins/kibana_react/public';

const LINKS: ExampleLink[] = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to introduce some kind of sub-routes for more examples

@@ -51,9 +53,28 @@ export class SearchExamplesPlugin
developerExamples.register({
appId: 'searchExamples',
title: 'Search Examples',
description: `Search Examples`,
description: `Examples on searching elasticsearch using data plugin: low-level search client (data.search.search), high-level search client (SearchSource), search sessions (data.search.sessions)`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just improving with nicer description, image, and readme.

@@ -0,0 +1,433 @@
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MOVED THIS.
Didn't change the older example

@@ -80,8 +80,8 @@ export class QueryService {
savedQueries: createSavedQueryService(savedObjectsClient),
state$: this.state$,
timefilter: this.timefilter,
getEsQuery: (indexPattern: IndexPattern) => {
const timeFilter = this.timefilter.timefilter.createFilter(indexPattern);
getEsQuery: (indexPattern: IndexPattern, timeRange?: TimeRange) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added additional parameter (createFilter already had 2nd optional argument).
It was convenient to use this in an example

): Record<string, unknown> {
const query = parseUrlHash(url)?.query;
keys?: Array<keyof State>,
{ getFromHashQuery = true }: { getFromHashQuery: boolean } = { getFromHashQuery: true }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to extend the functionality of this helper because the example plugin doesn't use hash routing and stores state not inside the hash part of the URL but inside of the location.search instead

setStateToKbnURL already had this param in place

}: SearchSessionIndicatorDeps): React.FC => {
const searchSessionsManagementUrl = basePath.prepend('/app/management/kibana/search_sessions');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a bug that wasn't visible in discover/dashboard.

@Dosant Dosant added docs Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes Team:AppServices v7.13.0 v8.0.0 labels Feb 18, 2021
@Dosant Dosant marked this pull request as ready for review February 18, 2021 14:20
@Dosant Dosant requested a review from a team as a code owner February 18, 2021 14:20
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@Dosant Dosant changed the title [wip][Search Sessions] Basic search sessions example [Search Sessions] Search session example app Feb 18, 2021
@Dosant Dosant force-pushed the dev/search/search-session-example branch from fef8f2f to 828a90b Compare February 20, 2021 07:15
@Dosant
Copy link
Contributor Author

Dosant commented Feb 22, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 914.3KB 914.3KB +22.0B
dataEnhanced 40.4KB 40.6KB +190.0B
kibanaUtils 154.5KB 154.7KB +203.0B
total +415.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and I love the way the example works.
One UX nit: I'm not a huge fan of the list items appearing as you interact with them.
Maybe instead they should be disabled as long as previous steps were not completed?

@Dosant
Copy link
Contributor Author

Dosant commented Feb 22, 2021

@lizozom, I agree that having new steps appearing out of nowhere is not the best UX, but I also think that having all steps out there and just disabling buttons wouldn't be enough. I am thinking of some content-overlays on top of "disabled" states which would help to focus attention on the current step. But not sure it worth spending more time on this. I think currently it is pretty good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants