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

Migrate ui/registry/feature_catalogue to New Platform plugin #48818

Merged
merged 6 commits into from
Oct 28, 2019

Conversation

joshdover
Copy link
Contributor

@joshdover joshdover commented Oct 21, 2019

Summary

Fixes #46738

This PR adds a new feature_catalogue plugin which provides an interface for registering and reading a catalogue items.

For the time being, the Home app will register all items out of the legacy registry with the new plugin, and then read these items out of the new plugin.

Dev Docs

The ui/registries/feature_catalogue module has been deprecated for removal in 8.0

Plugins wishing to migrate may remove their usage of ui/registries/feature_catalogue and rely on either:

// For legacy plugins
import { npSetup } from 'ui/new_platform';
npSetup.plugins.feature_catalogue.register(/* same details here */);

// For new plugins: first add 'feature_catalogue` to the list of `optionalPlugins` 
// in your kibana.json file. Then access the plugin directly in `setup`:

class MyPlugin {
  setup(core, plugins) {
    if (plugins.feature_catalogue) {
      plugins.feature_catalogue.register(/* same details here. */);
    }
  }
}

Note that the old module supported providing a Angular DI function to receive Angular dependencies. This is no longer supported as we migrate away from Angular.

Checklist

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

For maintainers

@joshdover joshdover added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform 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 Oct 21, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

return {
get: (): readonly FeatureCatalogueEntry[] =>
[...this.features.values()]
.filter(entry => capabilities.catalogue[entry.id] !== false)
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this is desired behaviour https://github.com/elastic/kibana/pull/48818/files#diff-a757f884a32fbf9bab5a0c977e69bb9eR54
just curious why? to allow OSS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for plugins that haven't registered features, eg. 3rd party plugins, functional test plugins, etc.

});

describe('setup', () => {
test('wires up and returns registry', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: not sure those are really useful tests if TS enforces the contract

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can go either way here, but I prefer some coverage here over nothing.

# Feature catalogue plugin

Replaces the legacy `ui/registry/feature_catalogue` module for registering "features" that should be showed in the home
page's feature catalogue. This should not be confused with the "feature" plugin for registering features used to derive
Copy link
Contributor

Choose a reason for hiding this comment

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

then probably we should rename either?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this will be more clear once this registry moves into a "home" plugin with the actual UI. I opted not to name this plugin "home" right now since it may not be split out until 8.x and I thought that would be confusing in the meantime.

@joshdover joshdover force-pushed the np/feature-catalogue branch from b56a005 to f612fb9 Compare October 23, 2019 14:15
@joshdover joshdover requested a review from a team as a code owner October 23, 2019 14:37
@elasticmachine
Copy link
Contributor

💔 Build Failed

@joshdover
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@joshdover
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@joshdover joshdover force-pushed the np/feature-catalogue branch from 7b58502 to e6a27c2 Compare October 28, 2019 16:26
(Private(FeatureCatalogueRegistryProvider as any) as any).inTitleOrder.map(
npSetup.plugins.feature_catalogue.register
);
return npStart.plugins.feature_catalogue.get();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flash1293 Any issues with doing this here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not all, that's fine 👍

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@joshdover joshdover merged commit 23a9058 into elastic:master Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate ui/registry/feature_catalogue to New Platform
5 participants