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

[Dashboard] Deangularize Nav Bar #55443

Closed
wants to merge 5 commits into from

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Jan 21, 2020

Summary

Removing Angular wrapper around Angular NavBar in Dashboard app. Some refactoring of existing logic to support the new DOM structure.
I've tested this in the following scenarios:

  1. Updating/deleting/changing saved queries
  2. Searching
  3. Adding/removing/enabling/disabling filters
  4. Updating timerange

Some additional comments below to help review this

Checklist

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

For maintainers

@majagrubic majagrubic changed the title Deangularize filter bar [Dashboard] Deangularize Nav Bar Jan 21, 2020
};

private services = this.props.kibana.services;
private savedQueryService = this.services.data.query.savedQueries;
public filterBarRef: Element | null = null;
public filterBarWrapperRef: Element | null = null;

public static getDerivedStateFromProps(nextProps: SearchBarProps, prevState: State) {
Copy link
Contributor Author

@majagrubic majagrubic Jan 24, 2020

Choose a reason for hiding this comment

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

This was some very convoluted for updating state from props. I think a simpler version can be done in componentDidUpdate.

@@ -63,13 +64,14 @@ export function TopNavMenu(props: TopNavMenuProps) {
}

function renderLayout() {
const className = props.noPadding ? undefined : 'kbnTopNavMenu';
Copy link
Contributor Author

@majagrubic majagrubic Jan 24, 2020

Choose a reason for hiding this comment

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

kbnTopNavMenu has some top/bottom padding:

padding: $euiSizeS 0px $euiSizeXS;

which, with the new DOM structure, was causing Dashboard in the fullscreen mode to have some empty space between the top of the screen and the first row of visualizations. We need to disable paddings in fullscreen mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the same problem should exist for visualize?
Can we implement it in the SCSS file in such a way that solves the problem for both?

@majagrubic majagrubic force-pushed the deangularize-filter-bar branch 2 times, most recently from 8380ff8 to 5563f41 Compare January 27, 2020 11:14
@majagrubic majagrubic added v8.0.0 v7.7.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Jan 28, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@majagrubic majagrubic added release_note:skip Skip the PR/issue when compiling release notes Feature:Dashboard Dashboard related features labels Jan 28, 2020
@majagrubic majagrubic marked this pull request as ready for review January 28, 2020 11:07
@majagrubic majagrubic requested a review from a team January 28, 2020 11:07
@majagrubic majagrubic requested a review from a team as a code owner January 28, 2020 11:07
@majagrubic
Copy link
Contributor Author

Jenkins, test this

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.

Overall looks good.
There's a small regression with saved queries - on master, loading a saved query immediatelly applies it, while on your PR - you have to click "Update" to apply it.

It's not a blocker for this PR of course, but I would recommend using the default behaviors available in this PR, to delete saved query handling (as well as other default behaviors) from dashboard code.

@@ -490,11 +544,10 @@ export class DashboardAppController {
},
queryFilter.getGlobalFilters()
);
// Making this method sync broke the updates.
// Temporary fix, until we fix the complex state in this file.
setTimeout(() => {
queryFilter.setFilters(queryFilter.getGlobalFilters());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you do a replace all of queryFilter to filterManager?

@@ -63,13 +64,14 @@ export function TopNavMenu(props: TopNavMenuProps) {
}

function renderLayout() {
const className = props.noPadding ? undefined : 'kbnTopNavMenu';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the same problem should exist for visualize?
Can we implement it in the SCSS file in such a way that solves the problem for both?

@majagrubic
Copy link
Contributor Author

Not sure why I can't reply below the comment, but re:
#55443 (comment)

Visualize doesn't have fullscreen mode (where we're are hiding the top nav), so I don't think it should be an issue.

@majagrubic
Copy link
Contributor Author

Overall looks good.
There's a small regression with saved queries - on master, loading a saved query immediatelly applies it, while on your PR - you have to click "Update" to apply it.

Great catch. Looks like the watcher receives undefined as a new query value and does nothing.

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.

Left two small nits, but they are not blockers.

I noticed that in some cases the filter state update doesn't seem to get propagated correctly.

  1. Create dashboard
  2. Add visualization
  3. Save current query (include time range)
  4. Add a filter pill
  5. The filter pill appears and disappears

filter_flicker

@@ -254,6 +258,41 @@ export class DashboardAppController {
};
};

$scope.showFilterBar = () =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to put this on the scope? Seems like it not used anymore from within angular

@@ -441,22 +488,25 @@ export class DashboardAppController {
}
};

$scope.updateQueryAndFetch = function({ query, dateRange }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - seems like this is only used from within react

Fixing type for notifications service

Fixing notifications service types

Resolving all type errors

Removing unnecessary watch

Refactoring

Do not show menu bar in fullscreen mode

Fix flickering on FilterBar popover opening

Removing directive from application

Update navbar after saving new query

Adding missing navbar update

Clear query when clearing saved query

Cleaning up convoluted search bar logic

Fixing typecheck

Removing dirty state tampering

Renaming history > hashHistory

Clear query bar when saved query cleared

Fix filterStateManager

Update navbar after updating filters

Fixing issues after rebase

Update dateRange from props

Update props from query

Replace hashHistory with history

Replacing stateless TopNav component with the stateful one

Fix type error
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky

History

  • 💚 Build #23322 succeeded 103a2f645b6b3be2bb72f4a614648ef4a710fa51
  • 💚 Build #23308 succeeded a4b0a6a240181aa474b4a7bfad7d04f9c5bc3772
  • 💔 Build #23150 failed 28017a0160b001f4067b697e4d8b9e8d5f121a47
  • 💔 Build #23138 failed 28017a0160b001f4067b697e4d8b9e8d5f121a47
  • 💚 Build #23025 succeeded c85b0e32b22fa790d5115372a3bf33f4048bd824

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

@majagrubic
Copy link
Contributor Author

majagrubic commented Jan 30, 2020

Hey @lizozom and @flash1293 thanks for reviews. I am going to pause this for now until
#56160 is merged and hopefully I can offload more state to the search bar. There are some race conditions here when state is updated in two different places which make this hard to debug, and it's not high priority change.

@lizozom
Copy link
Contributor

lizozom commented Jan 30, 2020

@majagrubic, it might be only my laptop, but it seems to me the rendering is less performant.
Could it be due to changing from getDerivedStateFromProps to componentDidUpdate?

lizozom pushed a commit that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in #55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from #56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <[email protected]>
lizozom pushed a commit to lizozom/kibana that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in elastic#55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from elastic#56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <[email protected]>
lizozom pushed a commit that referenced this pull request Feb 6, 2020
* Clean up discover

* Clean up visualize

* Clean up dashboard

* use-default-behaviors

* ts

* Discover interval changing

* timerange for interval definition in editor

* ts

* Revert most of changes to dashboard app because of changes in #55443

* Fix spaces

* Revert editor to scope PR!

* typo

* keep savedQuery state in create search bar

* update saved query to save it with the state

* revert all dashboard changes

* saved queries

* @kertal code review

* fix applying filters from histogram

* @Dosant code review

* Merge changes from #56643 to handle saved query errors

Fix bug where saved query clean does not reset query

* change string path

* if

* Extract useFilterManager and useTimefilter

* Split useSavedQuery and restore capability of changing saved query in URL

* Added some tests

* context view

* Remove useMemo

* spaces

* Support filter intial values
Improve useSavedQuery hook in terface

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
@majagrubic majagrubic closed this Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dashboard Dashboard related features release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants