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

move management registry to new platform #53020

Merged

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Dec 13, 2019

Summary

tldr; Move management registry to new platform to provide for transition to new api.

Steps

  1. Create management plugin
  2. Pass in capabilities dependency
  3. Change all references from import { management } from 'ui/management'; to npStart.plugins.management.legacy.
  4. Implement mocks - karma and jest
  5. Passed on providing types as the legacy api is being deprecated very soon
  6. I18n - minor changes to maintain existing translations (all two of them)
  7. Change management field component reference to direct reference, no ui/management

it('provides ManagementSection', () => {
expect(management).to.be.a(ManagementSection);
});
const createStartContract = () => ({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

strange diff, not a file move.

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@mattkime mattkime added Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v8.0.0 v7.6.0 labels Dec 15, 2019
@mattkime mattkime marked this pull request as ready for review December 15, 2019 05:58
@mattkime mattkime requested review from a team as code owners December 15, 2019 05:58
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 works well.
Added a couple comments about type usage

@@ -31,7 +31,7 @@ import {
} from '@elastic/eui';
import { PRIVACY_STATEMENT_URL } from '../../common/constants';
import { OptInExampleFlyout } from './opt_in_details_component';
import { Field } from 'ui/management';
import { Field } from '../../../kibana/public/management/sections/settings/components/field/field';
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider renaming this in a subsequent PR to something more management specific.

Copy link
Member

Choose a reason for hiding this comment

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

I don't even think this is management specific TBH. I think Field is the component used to render each of the advanced settings options.

Originally we had discussed having a dedicated settings plugin for dealing with the advanced settings UI, but maybe we decided to move it into management instead? I can't remember what the latest thought was on that.

If we do keep it in management though, I 100% agree we should rename. Maybe add a "settings" app / service inside the management plugin, and call it AdvancedSettingsField or something, IDK.


import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { ManagementStart } from './types';
// @ts-ignorets-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Double ts ignore

*/

export interface ManagementStart {
legacy: unknown;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not give this type any and avoid adding multiple ts-ignores?

import { createUiStatsReporter } from '../../../../../src/legacy/core_plugins/ui_metric/public';

export interface LegacyStart {
management: {
getSection: typeof management.getSection;
// @ts-ignore
getSection: typeof npStart.plugins.management.legacy.getSection;
Copy link
Contributor

@lizozom lizozom Dec 16, 2019

Choose a reason for hiding this comment

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

his applies to all places where typeof npStart... is used

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested ML and Transforms edits, and LGTM. Just wondering if the ts-ignores on npStart.plugins.management.legacy and management.sections.getSection can be avoided?

url: `#${JOBS_LIST_PATH}`,
});
// @ts-ignore
npStart.plugins.management.legacy
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ts-ignore because legacy has been given unknown type in ManagementStart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will take a look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were, thanks for the nudge

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Security changes LGTM

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@@ -77,6 +77,7 @@ const managementSections = [

describe('Management', () => {
it('filters and filters and maps section objects into SidebarNav items', () => {
// @ts-ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was giving me some trouble so I decided to ignore it. I'm happy to revisit with some help. Should be addressed in my next PR since there will be a layer of abstraction to merge two different section formats (new and old platforms)

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Reviewed code and tested everything locally. Everything seems to work as expected. I also tested adding a new management section from a NP plugin, and that works too (so I suppose technically this could unblock folks from moving to the new platform today if they really wanted to... although we know this API will be removed before 8.0 still)

I think we might be able to avoid making this change "breaking" altogether by re-exporting the NP contract from the legacy ui/management. If that works, it could simplify the footprint of this PR greatly and put less pressure on any 3rd party devs who may be registering management sections in their own plugins.

src/legacy/ui/public/management/index.js Show resolved Hide resolved
src/plugins/management/public/plugin.ts Show resolved Hide resolved
@mattkime
Copy link
Contributor Author

mattkime commented Dec 17, 2019

@lukeelmers

I think we might be able to avoid making this change "breaking" altogether by re-exporting the NP contract from the legacy ui/management. If that works, it could simplify the footprint of this PR greatly and put less pressure on any 3rd party devs who may be registering management sections in their own plugins.

import { npStart } from 'ui/new_platform`;
export const legacyManagement = npStart.plugins.management.legacy;

I attempted this and ran into difficulty. I think I ran into lifecycle / compilation problems. I'm seeing trouble navigating between kibana apps. I created a scratch PR to play with to verify - #53253


Edit: Reviewing this. I may have misattributed a problem I saw previously.

@mattkime mattkime force-pushed the move_management_registry_to_new_platfom branch from a60d252 to 9e837c3 Compare December 17, 2019 07:26
@mattkime mattkime force-pushed the move_management_registry_to_new_platfom branch from 9e837c3 to 75e4616 Compare December 17, 2019 16:53
@mattkime mattkime added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. labels Dec 17, 2019
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.

Diff is much more simple now!
I didn't retest after the recent changes, but overall LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Haven't re-tested since the latest updates were pushed, but code all LGTM!

@@ -31,7 +31,7 @@ import {
} from '@elastic/eui';
import { PRIVACY_STATEMENT_URL } from '../../common/constants';
import { OptInExampleFlyout } from './opt_in_details_component';
import { Field } from 'ui/management';
import { Field } from '../../../kibana/public/management/sections/settings/components/field/field';
Copy link
Member

Choose a reason for hiding this comment

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

I don't even think this is management specific TBH. I think Field is the component used to render each of the advanced settings options.

Originally we had discussed having a dedicated settings plugin for dealing with the advanced settings UI, but maybe we decided to move it into management instead? I can't remember what the latest thought was on that.

If we do keep it in management though, I 100% agree we should rename. Maybe add a "settings" app / service inside the management plugin, and call it AdvancedSettingsField or something, IDK.

@mattkime mattkime merged commit 2d36b21 into elastic:master Dec 17, 2019
mattkime added a commit to mattkime/kibana that referenced this pull request Jan 6, 2020
* move management registry to new platform
mattkime added a commit that referenced this pull request Jan 6, 2020
* move management registry to new platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:skip Skip the PR/issue when compiling release notes v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants