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

Remove kbnUrl usage #58999

Closed
9 tasks
flash1293 opened this issue Mar 2, 2020 · 0 comments · Fixed by #60016
Closed
9 tasks

Remove kbnUrl usage #58999

flash1293 opened this issue Mar 2, 2020 · 0 comments · Fixed by #60016
Assignees
Labels
Feature:NP Migration Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@flash1293
Copy link
Contributor

flash1293 commented Mar 2, 2020

The kbnUrl angular service is still used in several places within shimmed angular applications. As a part of removing the dependency on legacy services, these should be replaced by directly using the $location service of angular as an interim step switching to a completely angular-free application. If it's possible to use the history object directly, angular shouldn't be called at all.

Migration steps:

  • Replace eval with template strings

  • See whether history calls can replace kbnUrl

  • If not, follow the following guy as a starting point

  • Replace change with $location.path (this will discard the current query, check whether that's OK)

  • Replace redirect with $location.path and $location.redirect (this will discard the current query, check whether that's OK)

  • Replace removeParam by inlining the implementation from kbn url

  • Check whether everything still works

  • src/plugins/kibana_legacy/public/angular/ensure_default_index_pattern.tsx

  • src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js

122:      savedObjects: function(redirectWhenMissing, $route, kbnUrl, Promise, $rootScope, State) {
125:        return ensureDefaultIndexPattern(core, getServices().data, $rootScope, kbnUrl).then(() => {
152:              .getSavedSearchById(savedSearchId, kbnUrl)
194:  kbnUrl,
258:          kbnUrl.change('/discover');
326:            return kbnUrl.eval('#/discover/{{id}}', { id: searchId });
743:            kbnUrl.change('/discover/{{id}}', { id: savedSearch.id });
879:    kbnUrl.change('/discover/{{id}}', { id: $route.current.params.id });
883:    kbnUrl.change('/discover');
  • src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row.ts
47:  kbnUrl: any,
115:        const path = kbnUrl.eval('#/discover/context/{{ indexPattern }}/{{ anchorId }}', {
  • src/legacy/core_plugins/kibana/public/visualize/np_ready/application.ts
122:    .service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider))
  • src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js
87:          hasDefaultIndex: ($rootScope, kbnUrl) =>
88:            ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl),
99:          hasDefaultIndex: ($rootScope, kbnUrl) =>
100:            ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl),
108:          savedVis: function(redirectWhenMissing, $route, $rootScope, kbnUrl) {
126:            return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl)
147:          savedVis: function(redirectWhenMissing, $route, $rootScope, kbnUrl) {
149:            return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl)
  • src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.js
51:  const kbnUrl = $injector.get('kbnUrl');
78:        kbnUrl.changePath(VisualizeConstants.LANDING_PAGE_PATH);
  • src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.js
73:  kbnUrl,
370:    kbnUrl.removeParam(DashboardConstants.ADD_VISUALIZATION_TO_DASHBOARD_MODE_PARAM);
588:                appPath: kbnUrl.eval(`${VisualizeConstants.EDIT_PATH}/{{id}}`, { id: savedVis.id }),
607:              kbnUrl.change(dashboardParsedUrl.appPath);
614:              kbnUrl.change(`${VisualizeConstants.EDIT_PATH}/{{id}}`, { id: savedVis.id });
  • src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
97:          const kbnUrl = $injector.get('kbnUrl');
108:            kbnUrl.redirect(DashboardConstants.CREATE_NEW_DASHBOARD_URL);
114:            kbnUrl.redirect(`${createDashboardEditUrl(id)}?_a=(viewMode:edit)`);
139:          dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) {
140:            return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl).then(() => {
174:          dash: function(redirectWhenMissing, $rootScope, kbnUrl) {
175:            return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
192:          dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) {
195:            return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
211:                  kbnUrl.redirect(DashboardConstants.LANDING_PAGE_PATH);
  • src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
145:    .service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants