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

[Url Generators] Expose URL Generator functionality on server side #59453

Closed
stacey-gammon opened this issue Mar 5, 2020 · 5 comments
Closed
Labels
Feature:SharingURLs Short URLs and Share URL features impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:large Large Level of Effort

Comments

@stacey-gammon
Copy link
Contributor

stacey-gammon commented Mar 5, 2020

Url generator service needs to be available to alerting and chat ops.

Merging together quite a few ideas and I think we can solve this really simply while keeping all url generator implementations on the client side.

Common helper function

   createUrlGeneratorAppUrl(
     id: GeneratorId,
    state: GeneratorStateMapping[GeneratorId]['State']
   ) => `${hostAndBasePath}\goto?id=${id}&state=${rison.encode(JSON.stringify(state))}`

That can be used server side! e.g. Chat Ops pseudocode:

  const { timeRange, dashboardId } = parseDashboardChatCommand(command);
  const linkToDashboard = createUrlGeneratorAppUrl(DASHBOARD_APP_URL_GENERATOR, { time: timeRange, dashboardId });
 return...

Alerting pseudocode:

  const { id, state } = alertSavedObject.url;
  const link = createUrlGeneratorAppUrl(id, state);
  return...

Url generator service registers a new app, goto with functionality like:

const generator = urlGeneratorsService.get(param.id);
if (generator.isDeprecated) {
  const { id, state } = generator.migrate(param.state);
  notifications.toastWarning('This url is deprecated, update your bookmarks to ${createGoTogeneratorUrl(id, state)}`);
}
window.location.href = urlGeneratorsService.get(param.id).createUrl(param.state)

An improvement could be server side validation, exposed rest api, but this will likely be sufficient for all the new features that need it, so the priority is not quite their imo, to pursue.

cc @bmcconaghy

@stacey-gammon stacey-gammon added Feature:SharingURLs Short URLs and Share URL features Team:AppArch labels Mar 5, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@stacey-gammon stacey-gammon changed the title [Url Generators] Push implementations to server side [Url Generators] Expose URL Generator functionality on server side Mar 5, 2020
@darnautov
Copy link
Contributor

@stacey-gammon having this definitely would be beneficial for alerting. We need to generate URLs for alert actions and at the moment it's not possible, because our URL generator utilizes setStateToKbnUrl from kibana_utils/public, which relies on the window object under the hood.

@stacey-gammon
Copy link
Contributor Author

@streamich - this may be something to add into the new URL service work.

@streamich streamich mentioned this issue Feb 24, 2021
13 tasks
@streamich streamich added the loe:large Large Level of Effort label Mar 1, 2021
@exalate-issue-sync exalate-issue-sync bot added the impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. label Jun 21, 2021
@ppisljar
Copy link
Member

ppisljar commented Aug 8, 2022

Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment.

@ppisljar ppisljar closed this as completed Aug 8, 2022
@darnautov
Copy link
Contributor

@elastic/kibana-app-services is there a plan to support URL locators server-side eventually? cc @streamich @Dosant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:SharingURLs Short URLs and Share URL features impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:large Large Level of Effort
Projects
None yet
Development

No branches or pull requests

5 participants