Skip to content

[NP] Graph migration#59409

Merged
maryia-lapata merged 29 commits intoelastic:masterfrom
maryia-lapata:np-graph
Mar 16, 2020
Merged

[NP] Graph migration#59409
maryia-lapata merged 29 commits intoelastic:masterfrom
maryia-lapata:np-graph

Conversation

@maryia-lapata
Copy link
Copy Markdown
Contributor

@maryia-lapata maryia-lapata commented Mar 5, 2020

Fixes #57180.

Migration of Graph client side app from x-pack/legacy/plugins/graph to x-pack/plugins/graph.

Since we cannot use legacy imports in NP, the legacy KibanaParsedUrl was just inlined into generateDefaultTemplate.

Things that can't be migrated right now and be left behind in the legacy plugin:

  • saved object mappings
  • saved object migrations
  • xpack feature registration

Checklist

@maryia-lapata maryia-lapata added WIP Work in progress v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 labels Mar 5, 2020
@maryia-lapata
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

merge conflict between base and head

};

//Determines if 2 nodes are connected via an edge
this.areLinked = function(a, b) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This function isn't used, but I'm not sure if we can remove it.

@maryia-lapata maryia-lapata changed the title [WIP] [NP] Graph migration [NP] Graph migration Mar 6, 2020
@maryia-lapata maryia-lapata added Feature:Graph Graph application feature Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// and removed WIP Work in progress labels Mar 6, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

import angular from 'angular';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';

import '../../../../webpackShims/ace';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It couldn't find the module ace, so I import webpackShims/ace.
@flash1293 can we use such import in NP?

@maryia-lapata
Copy link
Copy Markdown
Contributor Author

@flash1293 maybe you know how we should replace legacy styles import

@import 'src/legacy/ui/public/chrome/variables';

Copy link
Copy Markdown
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.

That looks pretty good already, left a few comments.

One thing I noticed is that it's not showing a proper title:
Screenshot 2020-03-10 at 16 30 04

Looks like the legacy platform worked some magic there we have to replace.

The README from the legacy platform can also be moved now.

About the scss import thing:

@flash1293 maybe you know how we should replace legacy styles import

I think it's safe to remove that line, I couldn't find a usage of the variables defined in there, looks like a leftover

About the workspace js file:

This function isn't used, but I'm not sure if we can remove it.

Let's leave the cleanup in here for later iterations, all of this will move into redux reducers anyway soon.

import { i18n } from '@kbn/i18n';
import rison from 'rison-node';
import { takeEvery, select } from 'redux-saga/effects';
import { KibanaParsedUrl } from './kibana_parsed_url';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As this is used in just a single place here and is just taking a single code path through the whole thing, I think it's fine to condense the actual logic and inline it into generateDefaultTemplate directly using only the core services and utilities.

Something like (just for illustration):

const appPath = modifyUrl(`/discover`, parsed => {
      parsed.query['_g'] = rison.encode(...);
    });
const discoverUrl = core.http.basePath.prepend(`app/kibana#${appPath}`)

It's already making tons of assumptions about discover URLs anyway. I'll create a separate issue to switch to #57496 at some point, but for now let's make it as little code as possible in here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for suggestion. I updated the code.
I also left the call of parse function from url module. Since rison.encode wraps index value into quotes when id starts with a number (in our case e.g. datasource.id is 90943e30-9a47-11e8-b64d-95841ca0b247), to replace ' to %27 in the url I partially left the implementation of prependPath.

@maryia-lapata
Copy link
Copy Markdown
Contributor Author

jenkins, test this please

@maryia-lapata
Copy link
Copy Markdown
Contributor Author

One thing I noticed is that it's not showing a proper title:
Screenshot 2020-03-10 at 16 30 04

Looks like the legacy platform worked some magic there we have to replace.

It occurs if I switch to Graph after Logs or Metrics, so it seems like the Logs app is breaking tab title.

The README from the legacy platform can also be moved now.

I moved it and updated a bit.

@maryia-lapata maryia-lapata marked this pull request as ready for review March 11, 2020 14:31
@maryia-lapata maryia-lapata requested a review from a team March 11, 2020 14:31
@maryia-lapata maryia-lapata requested a review from a team as a code owner March 11, 2020 14:31
@flash1293
Copy link
Copy Markdown
Contributor

@elasticmachine merge upstream

Copy link
Copy Markdown
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 and couldn't find any issues, LGTM 🚀

I just merged a PR fixing config issues, there might be slight conflicts with this PR, but should be easy to fix ultimately.

@flash1293 flash1293 mentioned this pull request Mar 13, 2020
69 tasks
Copy link
Copy Markdown
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

SASS moves look ok

@kertal
Copy link
Copy Markdown
Member

kertal commented Mar 16, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

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

@maryia-lapata maryia-lapata merged commit 7d12b76 into elastic:master Mar 16, 2020
@maryia-lapata maryia-lapata deleted the np-graph branch March 16, 2020 07:36
maryia-lapata added a commit that referenced this pull request Mar 16, 2020
* Move graph to NP

* Styles

* Clean up

* Fix eslint

* Fix ESlint

* Fix path

* Fix container height

* Clean up

* Update index.ts

* Update graph_client_workspace.js

* Refactoring

* Remove unused methods

* Update graph_client_workspace.test.js

* Rename npData to data

* Move Readme

* Inline parsing discover url

* Remove import of legacy styles

* Update README

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

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 16, 2020
…o alerting/view-in-app

* 'alerting/view-in-app' of github.com:gmmorris/kibana: (33 commits)
  [SIEM] Adds 'Closes and opens signals' Cypress test (elastic#59950)
  [NP] Graph migration (elastic#59409)
  [ML] Clone analytics job  (elastic#59791)
  Move VALUE_CLICK_TRIGGER and APPLY_FILTER_TRIGGER to ui_action… (elastic#60202)
  Handle improperly defined Watcher Logging Action text parameter. (elastic#60169)
  Move select range trigger to uiActions (elastic#60168)
  [SIEM][CASES] Configure cases: Final (elastic#59358)
  Closes elastic#59784. Sets xpack.apm.serviceMapEnabled default value true. (elastic#60153)
  [siem/cypress] update junit filename to be picked up by runbld (elastic#60156)
  OSS logic added to test environment  (elastic#60134)
  Move canvas setup into app mount (elastic#59926)
  enable triggers_actions_ui plugin by default (elastic#60137)
  Expose Elasticsearch from start and deprecate from setup (elastic#59886)
  [SIEM] [Case] Insert timeline bugfix and limit 25 cases (elastic#60136)
  [ML] Client side cut over (elastic#60100)
  Disable query bar on service map routes (elastic#60118)
  Move subscribe_with_scope to kibana_legacy (elastic#59781)
  [Ingest] Agent Config create with sys monitoring (elastic#60111)
  [Watcher UI] Not possible to edit a watch that was created with the API if the ID contains a dot (elastic#59383)
  Actually fetch functionbeat fields needed for telemetry (elastic#60054)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 16, 2020
* master: (40 commits)
  skips 'config_open.ts' files from linter check (elastic#60248)
  [Searchprofiler] Spacing between rendered shards (elastic#60238)
  Add UiSettings validation & Kibana default route redirection (elastic#59694)
  [SIEM][CASE] Change configuration button (elastic#60229)
  [Step 1][App Arch] Saved object migrations from kibana plugin to new platform  (elastic#59044)
  adds new test (elastic#60064)
  [Uptime] Index Status API to Rest (elastic#59657)
  [SIEM] Adds 'Closes and opens signals' Cypress test (elastic#59950)
  [NP] Graph migration (elastic#59409)
  [ML] Clone analytics job  (elastic#59791)
  Move VALUE_CLICK_TRIGGER and APPLY_FILTER_TRIGGER to ui_action… (elastic#60202)
  Handle improperly defined Watcher Logging Action text parameter. (elastic#60169)
  Move select range trigger to uiActions (elastic#60168)
  [SIEM][CASES] Configure cases: Final (elastic#59358)
  Closes elastic#59784. Sets xpack.apm.serviceMapEnabled default value true. (elastic#60153)
  [siem/cypress] update junit filename to be picked up by runbld (elastic#60156)
  OSS logic added to test environment  (elastic#60134)
  Move canvas setup into app mount (elastic#59926)
  enable triggers_actions_ui plugin by default (elastic#60137)
  Expose Elasticsearch from start and deprecate from setup (elastic#59886)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported Feature:Graph Graph application feature release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph client side app migration

6 participants