Skip to content

Create a pre wired version of SearchBar#46702

Merged
lizozom merged 26 commits intoelastic:masterfrom
lizozom:newplatform/data-plugin/stateful-search-bar-2
Oct 2, 2019
Merged

Create a pre wired version of SearchBar#46702
lizozom merged 26 commits intoelastic:masterfrom
lizozom:newplatform/data-plugin/stateful-search-bar-2

Conversation

@lizozom
Copy link
Contributor

@lizozom lizozom commented Sep 26, 2019

Summary

  • Pass NP data plugin into data shim, to gain access to autocomplete
  • Added ui to DataStart to host stateful components
  • Added createSearchBar function to create a stateful SearchBar
  • Introduced SearchBarInjectedDeps and SearchBarOwnProps for createSearchBar
  • Update data shim tests to have a single function wrapping elements in Context.
    • QueryBarInput
    • QueryBarTopRow
    • SearchBar
  • Remove npStart dependency from QueryBarInput by using autocomplete provided by KibanaContextProvider @alexwizp
  • Remove omit from render as it wasn't adding any attributes.
  • Use stateful SearchBar in TopNavMenu and remove injected state from kbn_top_nav.
  • Add KibanaContextProvider to vis_type_timeseries, vis/editors, graph, maps and lens

Checklist

Dev Docs

In order to use any of our stateful components, you are going to have to wrap your application on the topmost level with a KibanaContextProvider:

Assuming new platform syntax:

          <KibanaContextProvider
            services={{
              uiSettings: core.uiSettings,
              docLinks: core.docLinks,
              data: plugins.data,
            }}
          >
            {content}
          </KibanaContextProvider>

Then, inside a react component, you may use our stateful component, that requires less input and confuguration:

   const {
     ui: { SearchBar },
   } = plugins.data;

   render() {
      return <SearchBar
          appName="myApp"
          ...
        />
   }

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Liza K added 7 commits September 26, 2019 14:31
Pass storage and autocomplete to createSearchBar method
Add appName and autocomplete to IDataPluginServices
QueryBarInput to consume autocomplete and appName from context
QueryBarTopRow to consume appName from context
Remove appName from SearchBar
Added AutocompletePublicPluginSetup and AutocompletePublicPluginStart types
@lizozom lizozom self-assigned this Sep 26, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@lizozom lizozom changed the title Newplatform/data plugin/stateful search bar 2 Create a pre wired version of SearchBar Sep 26, 2019
@lizozom lizozom marked this pull request as ready for review September 26, 2019 17:11
@lizozom lizozom requested a review from a team September 26, 2019 17:11
@lizozom lizozom requested a review from a team as a code owner September 26, 2019 17:11
@lizozom lizozom added Feature:NP Migration release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v7.5.0 v8.0.0 labels Sep 26, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@TinaHeiligers
Copy link
Contributor

@Bargs you might also be interested in this PR

@TinaHeiligers TinaHeiligers self-requested a review September 27, 2019 16:27
@elasticmachine
Copy link
Contributor

💔 Build Failed

@lizozom
Copy link
Contributor Author

lizozom commented Sep 29, 2019

retest

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Looks ok to me once ci passes

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@flash1293 flash1293 self-requested a review October 2, 2019 12:10
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Graph changes look good to me

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@lizozom lizozom merged commit 0cd9d6c into elastic:master Oct 2, 2019
lizozom pushed a commit to lizozom/kibana that referenced this pull request Oct 2, 2019
* Bind search bar

* create prewired data components

* Pass NP data plugin to shim plugin, to access autocomplete
Pass storage and autocomplete to createSearchBar method
Add appName and autocomplete to IDataPluginServices
QueryBarInput to consume autocomplete and appName from context
QueryBarTopRow to consume appName from context
Remove appName from SearchBar
Added AutocompletePublicPluginSetup and AutocompletePublicPluginStart types

* Use KibanaContextProvider in vis editor and graph

* Use KibanaContextProvider in maps

* Use prewirted SearchBar in TopNavMenu

* Use KibanaContextProbider in Lens

* Fix appName usage in query bar input

* fixed query bar top row appName

* update tests

* fixed bind search bar bug

* mock SearchBar

* Removed unnecessary mocks

* Delete unused mock

* Fixed exporting of data plugin types

* Updated maps snapshot

* Fixed some TS issues

* Fixed jest tests

* Context adjustments in TSVB

* componentWillMount

* Code review fixes

* Pass dataTestSubj to query bar input

* Graph data
lizozom pushed a commit that referenced this pull request Oct 2, 2019
* Bind search bar

* create prewired data components

* Pass NP data plugin to shim plugin, to access autocomplete
Pass storage and autocomplete to createSearchBar method
Add appName and autocomplete to IDataPluginServices
QueryBarInput to consume autocomplete and appName from context
QueryBarTopRow to consume appName from context
Remove appName from SearchBar
Added AutocompletePublicPluginSetup and AutocompletePublicPluginStart types

* Use KibanaContextProvider in vis editor and graph

* Use KibanaContextProvider in maps

* Use prewirted SearchBar in TopNavMenu

* Use KibanaContextProbider in Lens

* Fix appName usage in query bar input

* fixed query bar top row appName

* update tests

* fixed bind search bar bug

* mock SearchBar

* Removed unnecessary mocks

* Delete unused mock

* Fixed exporting of data plugin types

* Updated maps snapshot

* Fixed some TS issues

* Fixed jest tests

* Context adjustments in TSVB

* componentWillMount

* Code review fixes

* Pass dataTestSubj to query bar input

* Graph data
@rayafratkina
Copy link
Contributor

@lizozom can you please add a DevDocs section?

@lizozom lizozom deleted the newplatform/data-plugin/stateful-search-bar-2 branch November 14, 2019 13:03
@elasticmachine
Copy link
Contributor

💔 Build Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:NP Migration release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v7.5.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants