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

[Index management] Move to new platform "plugins" folder #58109

Merged

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Feb 20, 2020

This PR moves the index_management app to the "plugins" new platform folder.

The changes are mainly files that have been moved and re-connect the 3 dependent apps:

  • Rollup
  • Cross cluster replication
  • ILM

Making sure both server (see the 3 extensions ilm, isRollupIndex, isFollowerIndex added to the index data):
Screen Shot 2020-02-20 at 16 28 56

And client extensions still work

Screen Shot 2020-02-20 at 16 49 48

@cuff-links It be awesome if you could run the test plan on the app! 👍

@sebelga sebelga requested a review from a team as a code owner February 20, 2020 11:33
@sebelga sebelga added Feature:Index Management Index and index templates UI Feature:NP Migration Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v8.0.0 labels Feb 20, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@sebelga sebelga added the release_note:skip Skip the PR/issue when compiling release notes label Feb 20, 2020
import { plugin as initServerPlugin, Dependencies } from './server';

export type ServerFacade = Legacy.Server;

export function indexManagement(kibana: any) {
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 file needs to stay until all dependent apps have migrated to the "plugins" folder.

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

nice job @sebelga! another app to check off the migration list ✔️ 🎉

I left a couple questions in the code. I found a few issues with CCR and rollups when I disabled the index_management plugin that I think need to be addressed before merging. Also, it looks like there are some minor changes you made to the mappings editor (I did not comment on all of them) that seem unrelated to the migration. If that's the case, maybe it should be addressed in a separate PR?

Otherwise, code LGTM. I tested CCR, ILM and rollups integrations and everything worked as expected. I also went through all the actions for index and index templates.

Since I'll be out the next few days, maybe @jloleysens can take another look at this when you're ready?

@@ -77,10 +77,10 @@ export class RollupsServerPlugin implements Plugin<void, void, any, any> {
}

if (
serverShim.plugins.index_management &&
serverShim.plugins.index_management.addIndexManagementDataEnricher
serverShim.plugins.indexManagement &&
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can indexManagement be moved out of the serverShim now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! 👍

@@ -24,7 +24,7 @@ export const DocumentFields = React.memo(() => {
if (editorType === 'json') {
Copy link
Contributor

Choose a reason for hiding this comment

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

are changes to this file related to the migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, all the changes about adding/updating the array of dependencies of useCallback and useEffect were needed to fix a new rule in eslint (which is great as it helps us fix unnecessary re-renders).

@@ -56,15 +56,21 @@ export const AnalyzerParameterSelects = ({
});
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

@@ -110,7 +110,7 @@ export const ConfigurationForm = React.memo(({ defaultValue }: Props) => {
});
Copy link
Contributor

Choose a reason for hiding this comment

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

are changes to this file related to the migration?

@@ -61,6 +67,9 @@ export class IndexMgmtServerPlugin implements Plugin<IndexMgmtSetup, void, any,
indexDataEnricher: {
add: this.indexDataEnricher.add.bind(this.indexDataEnricher),
},
__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 needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A left over! I will remove it 👍

server.expose('addIndexManagementDataEnricher', serverPublicApi.indexDataEnricher.add);
isEnabled(config: any) {
return (
config.get('xpack.index_management.enabled') && config.get('xpack.index_management.enabled')
Copy link
Contributor

Choose a reason for hiding this comment

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

should this just be return config.get('xpack.index_management.enabled')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol 😄

config(Joi: any) {
return Joi.object({
// display menu item
ui: Joi.object({
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 needed? I don't think xpack.index_management.ui.enabled is an existing setting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I'm not quite sure I follow why the legacy config is needed, since it didn't exist previously. Can you explain?

Copy link
Contributor Author

@sebelga sebelga Feb 21, 2020

Choose a reason for hiding this comment

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

I thought those were necessary but apparently not. I think that previously we forgot to add them though (at least the enabled config) 😊

I removed everything but configPrefix and id which seems to be the minimum for the dependent apps to not complain.

@@ -20,7 +20,7 @@ import { addAllExtensions } from './np_ready/extend_index_management';
if (chrome.getInjected('ilmUiEnabled')) {
// We have to initialize this outside of the NP lifecycle, otherwise these extensions won't
// be available in Index Management unless the user visits ILM first.
addAllExtensions();
addAllExtensions((npSetup.plugins as any).indexManagement.extensionsService);
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 this will cause issues if the index_management plugin is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added a check. I think this bug is present on master then.. but not for long 😊

@@ -19,4 +19,4 @@ export const followerBadgeExtension = {
filterExpression: 'isFollowerIndex:true',
};

extensionsService.addBadge(followerBadgeExtension);
npSetup.plugins.indexManagement.extensionsService.addBadge(followerBadgeExtension);
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 this is going to cause issues if index management is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added a check.

@sebelga
Copy link
Contributor Author

sebelga commented Feb 21, 2020

Thanks for the review @alisonelizabeth !

I found a few issues with CCR and rollups when I disabled the index_management plugin that I think need to be addressed before merging.

Great catch, I fixed them. I think those are already present on master as I did not touch the logic and simply updated the pointer to the extensions.

it looks like there are some minor changes you made to the mappings editor (I did not comment on all of them) that seem unrelated to the migration. If that's the case, maybe it should be addressed in a separate PR?

All the changes were required to pass eslint which now has a rule that enforces that the correct elements are declared in the dependencies array.

Screen Shot 2020-02-21 at 12 47 50

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Code changes look good, could not spot a regression during local testing.

@sebelga
Copy link
Contributor Author

sebelga commented Feb 24, 2020

@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.

Not a requirement, but you might want to consider changing the way your Sass imports into these files now that the optimizer is improved. https://github.com/elastic/kibana/tree/master/packages/kbn-optimizer

  • Each sass file can now be imported directly into the JS component, rather than bundled into a giant index at the app root.
  • If you do this, it would make sense to remove the _ prefix on the sass files you choose to import directly. The underscore denotes a partial that is imported into another file that gets compiled.

The benefits to do this (not just in this plugin, but all through Kibana) is that you only load the CSS you need.

@sebelga
Copy link
Contributor Author

sebelga commented Feb 24, 2020

Thanks for the review @snide ! I will keep it as a note but I prefer to keep this PR focused on moving to the "plugins" folder and have a separate PR for this enhancement. It looks like a powerful feature indeed!

@sebelga
Copy link
Contributor Author

sebelga commented Feb 24, 2020

@elasticmachine merge upstream

@sebelga
Copy link
Contributor Author

sebelga commented Feb 25, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@sebelga sebelga merged commit 277b380 into elastic:master Feb 25, 2020
@sebelga sebelga deleted the np-migration/index-management-plugins-folder branch February 25, 2020 07:42
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 25, 2020
…re/files-and-filetree

* 'master' of github.com:elastic/kibana: (174 commits)
  [SIEM] Fix unnecessary re-renders on the Overview page (elastic#56587)
  Don't mutate error message (elastic#58452)
  Fix service map popover transaction duration (elastic#58422)
  [ML] Adding filebeat config to file dataviz (elastic#58152)
  [Uptime] Improve refresh handling when generating test data (elastic#58285)
  [Logs / Metrics UI] Remove path prefix from ViewSourceConfigur… (elastic#58238)
  [ML] Functional tests - adjust classification model memory (elastic#58445)
  [ML] Use event.timezone instead of beat.timezone in file upload (elastic#58447)
  [Logs UI] Unskip and stabilitize log column configuration tests (elastic#58392)
  [Telemetry] Separate the license retrieval from the stats in the usage collectors (elastic#57332)
  hide welcome screen for cloud (elastic#58371)
  Move src/legacy/ui/public/notify/app_redirect to kibana_legacy (elastic#58127)
  [ML] Functional tests - stabilize typing during df analytics creation (elastic#58227)
  fix short url in spaces (elastic#58313)
  [SIEM] Upgrades cypress to version 4.0.2 (elastic#58400)
  [Index management] Move to new platform "plugins" folder (elastic#58109)
  [kbn/optimizer] disable parallelization in terser plugin (elastic#58396)
  [Uptime] Delete useless try...catch blocks (elastic#58263)
  [Uptime] Use scripted metric for snapshot calculation (elastic#58247) (elastic#58389)
  [APM] Stabilize agent configuration API (elastic#57767)
  ...

# Conflicts:
#	src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx
sebelga added a commit to sebelga/kibana that referenced this pull request Feb 26, 2020
# Conflicts:
#	x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_state.tsx
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added backport missing Added to PRs automatically when the are determined to be missing a backport. and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Index Management Index and index templates UI Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants