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

[NP] Dashboard #61895

Merged
merged 33 commits into from
Apr 6, 2020
Merged

[NP] Dashboard #61895

merged 33 commits into from
Apr 6, 2020

Conversation

sulemanof
Copy link
Contributor

@sulemanof sulemanof commented Mar 30, 2020

Summary

Move the Dashboard plugin to NP.

Note: src/legacy/core_plugins/kibana/public/dashboard/migrations was only left in legacy and will be moved right after this PR is merged.

Changes are mostly related to update imports, files structure and i18n ids.
Other changes:

  • remove all jest.mock('ui/...'), so completely removed all references to legacy;

  • in file kbn_url_tracker.ts the createHashHistory() were moved down into onMountApp func to avoid creating a hash history before an app is mounted (the hash history starts adding # ending to the actual url);

  • since the share plugin is optional, the Share button was disabled if share contract is not exposed

    share_disabled

Checklist

Delete any items that are not applicable to this PR.

For maintainers

…a_parsed_url

# Conflicts:
#	x-pack/legacy/plugins/lens/public/plugin.tsx
…a_parsed_url

# Conflicts:
#	x-pack/legacy/plugins/lens/public/plugin.tsx
…a_parsed_url

# Conflicts:
#	x-pack/legacy/plugins/lens/public/legacy_imports.ts
# Conflicts:
#	src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts
# Conflicts:
#	src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts
# Conflicts:
#	src/plugins/dashboard/public/dashboard_app.tsx
#	src/plugins/dashboard/public/dashboard_app_controller.tsx
#	src/plugins/dashboard/public/lib/embeddable_saved_object_converters.test.ts
@sulemanof sulemanof marked this pull request as ready for review April 1, 2020 12:27
@sulemanof sulemanof requested a review from a team April 1, 2020 12:27
@sulemanof sulemanof requested review from a team as code owners April 1, 2020 12:27
@sulemanof sulemanof added Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes labels Apr 1, 2020
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.

Added some comments, but this is looking great already! Big step forward 🎉

src/plugins/dashboard/public/application/application.ts Outdated Show resolved Hide resolved
src/plugins/dashboard/public/plugin.tsx Outdated Show resolved Hide resolved
* under the License.
*/

export const DashboardConstants = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, I wasn't aware we had duplicate code for this stuff, it's good we can finally get rid of it :)

# Conflicts:
#	src/plugins/dashboard/public/application/actions/expand_panel_action.test.tsx
#	src/plugins/dashboard/public/application/actions/replace_panel_action.test.tsx
#	src/plugins/dashboard/public/application/dashboard_app_controller.tsx
#	src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx
#	src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx
#	src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Apr 3, 2020
# Conflicts:
#	src/plugins/dashboard/public/application/dashboard_state_manager.ts
@Dosant Dosant assigned Dosant and unassigned Dosant Apr 3, 2020
@Dosant Dosant self-requested a review April 3, 2020 11:19

// get state defaults from saved dashboard, make sure it is migrated
this.stateDefaults = migrateAppState(
getAppStateDefaults(this.savedDashboard, this.hideWriteControls),
kibanaVersion
{ ...getAppStateDefaults(this.savedDashboard, this.hideWriteControls) },
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder what has changed that before this spread wasn't needed?
Or is this fixes some existing bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what caused this, but TypeScript started hate the previous one

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to revert and seems like all is good. maybe you had some type issues in a process of moving staff around. Could you double check please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, that was my fault.
VSCode accidentally thought that I want to use the TypeScript version which it likes more 🙂

typescript_version

And throws me such an issue:

typescript_issue

I reverted back those changes, but seems this will become actual again once ts 3.8.2 is merged

https://github.com/elastic/kibana/pull/57774/files#diff-2f67bccb7b0ca326ff2a7aec1b0ee965

@@ -94,7 +94,7 @@ export function initDashboardApp(app, deps) {
.when(DashboardConstants.LANDING_PAGE_PATH, {
...defaults,
template: dashboardListingTemplate,
controller($scope, kbnUrlStateStorage, history) {
controller: function($scope, kbnUrlStateStorage, history) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this function changes something? or no need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohhh, that's a very interesting point!
So, it was working fine in legacy platform, but stop working in the new platform.
The failure was something like: Angular can't bootstrap..., the reason was the controller is invoked as new controller() inside the angular and this particular function was not converted to a function declaration and acts like an arrow function.
So seems we have different babel configs for legacy and new platform (in legacy object methods are converted to function declarations, but in new platform they are not).
Maybe @joshdover could clarify this? 🙂

} from '../types';
import { migratePanelsTo730 } from '../../migrations/migrate_to_730_panels';
} from '../../types';
// should be moved in src/plugins/dashboard/common right after https://github.com/elastic/kibana/pull/61895 is merged
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please clarify? this is a link to the same pr 🤔
circular dependency :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah, awkward.
An infinite loop 😆
That actually means a separate PR will be created with moving those right after this one is merged 😃

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Tested in chrome. Was focused on navigation between apps. And _g preserving between navigations.
Didn't notice anything

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.

Tested in Chrome and everything works as expected, LGTM 👍
(Assuming the i18n thing is fixed, should be a really small change)

@sulemanof
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Sass file moves typical of NP migration. Did not check the JS level.

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Code lgtm, didn't retest after previous comment

@sulemanof sulemanof merged commit 104b490 into elastic:master Apr 6, 2020
@sulemanof sulemanof deleted the np/dashboard branch April 6, 2020 09:11
sulemanof added a commit to sulemanof/kibana that referenced this pull request Apr 6, 2020
* Remove absoluteToParsedUrl reference in dashboard

* Remove KibanaParsedUrl from visualize

* Fix tests

* Add tests

* Fix saved dashboard

* Fix empty line after resolving conflicts

* Move dashboard to np

* Move migrations back to legacy

* Make it works

* Other fixes

* Move into application folder

* FIx translations

* Make share & home plugins otional

* FIx kbn url tracking, jest tests

* Import from dashboard_constants in FT

* Fix translations order

* Use getStartServices for start plugin deps

* Path fixes

* i18n fix

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
sulemanof added a commit that referenced this pull request Apr 6, 2020
* Remove absoluteToParsedUrl reference in dashboard

* Remove KibanaParsedUrl from visualize

* Fix tests

* Add tests

* Fix saved dashboard

* Fix empty line after resolving conflicts

* Move dashboard to np

* Move migrations back to legacy

* Make it works

* Other fixes

* Move into application folder

* FIx translations

* Make share & home plugins otional

* FIx kbn url tracking, jest tests

* Import from dashboard_constants in FT

* Fix translations order

* Use getStartServices for start plugin deps

* Path fixes

* i18n fix

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants