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

Combine visualizations and visualize plugins #121550

Merged
merged 27 commits into from
Jan 12, 2022

Conversation

DianaDerevyankina
Copy link
Contributor

@DianaDerevyankina DianaDerevyankina commented Dec 17, 2021

Closes #113737

Summary

Merged visualize into visualizations plugin.

  • Removed dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables flag to avoid circular dependencies between visualizations and dashboard;

  • Code from visualize public plugin was added to visualizations public plugin with minor services changes:

    • dashboard was removed because of circular dependency;
    • visualizations was removed as all required code was used directly from visualizations;
    • visEditorsRegistry was added to get rid of its getter and setter and pass it through as other services.
  • Following code from visualizations previously was used only in visualize services, so it was imported directly and removed from VisualizationsStart

    • createVis -> imported createVisAsync from vis_async
    • convertToSerializedVis -> imported from saved_visualize_utils
    • convertFromSerializedVis -> imported from saved_visualize_utils
    • getSavedVisualization -> imported from saved_visualize_utils
    • saveVisualization -> imported from saved_visualize_utils
    • findListItems -> imported from saved_visualize_utils
    • __LEGACY.createVisEmbeddableFromObject -> imported from create_vis_embeddable_from_object
  • Code from visualize server plugin was added to visualizations server plugin without any changes;

  • Changes related to kibana.json:

    • dependencies from visualize kibana.json were moved to visualizations kibana.json;
    • In vis_default_editor kibana.json visualize optional plugin was replaced with visualizations;
    • In timeseries kibana.json visualize was removed as it already has visualizations dependency;
  • Updated tests and translations keys.

Checklist

For maintainers

@@ -20,7 +20,7 @@ const mockServices = {
},
}),
capabilities: {
visualize: {
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK capabilities are not coupled to the plugin id - I would like to keep it as visualize if possible, I think this will cause a bunch of downstream problems.

@alexwizp
Copy link
Contributor

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor

@elasticmachine merge upstream

@DianaDerevyankina DianaDerevyankina self-assigned this Dec 30, 2021
@@ -124,7 +124,7 @@ export const applicationUsageSchema = {
kibana: commonSchema, // It's a forward app so we'll likely never report it
management: commonSchema,
short_url_redirect: commonSchema, // It's a forward app so we'll likely never report it
visualize: commonSchema,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let’s not change telemetry keys - the application we are tracking here is still “visualize”, everything else will cause problems

@DianaDerevyankina DianaDerevyankina added backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.1.0 labels Dec 30, 2021
@@ -51,7 +51,7 @@ export const readOnlyUserRole: RoleType = {
ml: ['read'],
maps: ['read'],
graph: ['read'],
visualize: ['read'],
visualizations: ['read'],
Copy link
Contributor

Choose a reason for hiding this comment

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

References the permission which is still “visualize”

@@ -140,7 +140,7 @@ export interface UsageData extends UsageStats {
dev_tools?: number;
advancedSettings?: number;
infrastructure?: number;
visualize?: number;
visualizations?: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

References the permission which is still “visualize “

@@ -285,7 +285,7 @@ export function getSpacesUsageCollector(
description: 'The number of spaces which have this feature disabled.',
},
},
visualize: {
visualizations: {
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

@@ -7655,7 +7655,7 @@
"description": "The number of spaces which have this feature disabled."
}
},
"visualize": {
"visualizations": {
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

public setup(core: CoreSetup) {
this.logger.debug('visualize: Setup');

core.capabilities.registerProvider(capabilitiesProvider);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure we don't need to register visualize capabilities in visualizations plugin?

@@ -66,3 +67,6 @@ export const [getOverlays, setOverlays] = createGetterSetter<OverlayStart>('Over
export const [getChrome, setChrome] = createGetterSetter<ChromeStart>('Chrome');

export const [getSpaces, setSpaces] = createGetterSetter<SpacesPluginStart>('Spaces', false);

export const [getVisEditorsRegistry, setVisEditorsRegistry] =
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure that we need to add one more getterSetter for that case. I've checked all places where we use it and looks like you can just add this service into

src/plugins/visualizations/public/plugin.ts  
const services: VisualizeServices = {

Could you please check that?

@alexwizp alexwizp marked this pull request as ready for review January 4, 2022 13:37
@alexwizp alexwizp requested review from a team as code owners January 4, 2022 13:37
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Super small Presentation team changes LGTM!

It'll be a lot simpler and less confusing to have these two plugins combined into one!

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Diana well done, it seems to work fine.
One proposal I have for easier navigation into the plugin is to rename the visualizations-->application folder to `visualizations-->visualize_app' or a name that describes what this folder contains (actually the listing code and the visualize editor wrapper)

@@ -12,7 +12,8 @@
"references": [
{ "path": "../../core/tsconfig.json" },
{ "path": "../data/tsconfig.json" },
{ "path": "../visualize/tsconfig.json" },
{ "path": "../visualizations/tsconfig.json" },
{ "path": "../discover/tsconfig.json" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have we added the discover dependency here?

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 in case of adding visualizations/tsconfig.json it should still work without /discover/tsconfig.json
but for that case I prefer to keep discover cause it's in requiredBundles.

image

@@ -18,7 +18,7 @@
{ "path": "../../data/tsconfig.json" },
{ "path": "../../expressions/tsconfig.json" },
{ "path": "../../visualizations/tsconfig.json" },
{ "path": "../../visualize/tsconfig.json" },
{ "path": "../../dashboard/tsconfig.json" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we adding the dashboard dependency here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In src/plugins/vis_types/timeseries/server/usage_collector/get_usage_collector.ts we have an import from dashboard. Dashboard plugin should be added to rootDir

image

export const STATE_STORAGE_KEY = '_a';
export const GLOBAL_STATE_STORAGE_KEY = '_g';

export const APP_NAME = 'visualize';
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 rename this constant to VISUALIZE_APP_NAME as the current app is called visualizations and it can be confusing.

@@ -93,3 +113,30 @@ export interface VisEditorOptionsProps<VisParamType = unknown> {
setValidity(isValid: boolean): void;
setTouched(isTouched: boolean): void;
}

export interface VisualizationServices extends CoreStart {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it used anywhere? We already have the VisualizeServices on the application/types so it seems unnecessary. I would remove this type and move the VisualizeServices to this file and export it from here as it is not used only from the application folder but it is used in many places of this plugin

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 actually unnecessary, thanks for noticing!

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.

Looking mostly good to me, just two small things

@@ -372,18 +378,21 @@ export const getTopNavConfig = (
? [
{
id: 'save',
iconType: showSaveAndReturn ? undefined : 'save',
iconType: originatingApp ? undefined : 'save',
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 - old showSaveAndReturn included the check of the savedvis id which is omitted here

description: i18n.translate('visualize.topNavMenu.saveVisualizationButtonAriaLabel', {
defaultMessage: 'Save Visualization',
}),
emphasize: !originatingApp,
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

@@ -2,7 +2,7 @@
"id": "visDefaultEditor",
"version": "kibana",
"ui": true,
"optionalPlugins": ["visualize"],
"optionalPlugins": ["visualizations"],
"requiredBundles": ["kibanaUtils", "kibanaReact", "data", "fieldFormats", "discover", "esUiShared"],
"owner": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add the description from the other kibana.json here as well?

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.

Ah, nvm, I get it now - just checking for originatingApp is right. No objections, lgtm, thanks!

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Thanx for applying my suggestions Diana! LGTM!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
visualizations 89 141 +52
visualize 62 - -62
total -10

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
visualizations 288 283 -5
visualize 23 - -23
total -28

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
visualizations 59.4KB 111.6KB +52.2KB
visualize 51.5KB - -51.5KB
total +692.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
visualizations 16 15 -1
visualize 1 - -1
total -2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
visDefaultEditor 19.4KB 19.4KB +5.0B
visTypeTimeseries 14.7KB 14.7KB -12.0B
visualizations 37.9KB 48.7KB +10.8KB
visualize 15.7KB - -15.7KB
total -4.9KB
Unknown metric groups

API count

id before after diff
visualizations 307 303 -4
visualize 24 - -24
total -28

async chunk count

id before after diff
visualizations 7 8 +1
visualize 1 - -1
total -0

ESLint disabled line counts

id before after diff
visualizations 13 16 +3
visualize 3 - -3
total -0

References to deprecated APIs

id before after diff
visualizations 86 127 +41
visualize 41 - -41
total -0

Total ESLint disabled count

id before after diff
visualizations 15 18 +3
visualize 3 - -3
total -0

History

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

cc @dziyanadzeraviankina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combine visualizations and visualize plugins
10 participants