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

Show notifier on page load, if notifier params are in query string #7636

Merged
merged 5 commits into from
Jul 6, 2016

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Jul 6, 2016

An application may want to redirect to Kibana and show a toast notification post-redirect. This PR enables this functionality.

Specifically, if the Kibana app finds a query string parameter named notif_msg, it will create a Notifier with the value of that parameter as its message. Optionally, two additional query string parameters may be passed:

  • notif_lvl for notification level (error, warning, etc.). Default = info.
  • notif_loc for notification location. Default = no location is set.

@ycombinator
Copy link
Contributor Author

ycombinator commented Jul 6, 2016

Some questions I have about the code in this PR:

  1. Is src/core_plugins/kibana/public/kibana.js the right place to define the showNotifier function? Or should it be its own module elsewhere? If so, where?
  2. Should the showNotifier function be invoked via modules.get('kibana').run()? Or is there a better lifecycle hook to use?
  3. Is using the three notif_* query string parameters really the best way to pass the information into the app? Or should they be one parameter that's perhaps rison-encoded? Or something else?

@w33ble
Copy link
Contributor

w33ble commented Jul 6, 2016

Can this use markdown in notif_msg for rich notifications? I don't actually know if the notifier works that way, or if you have to specify that you're using markdown or otherwise want to render rich content.

@ycombinator
Copy link
Contributor Author

Can this use markdown in notif_msg for rich notifications?

From my testing, if notif_msg contains a markdown link and notif_lvl is banner, the link is rendered in the notification.

@epixa
Copy link
Contributor

epixa commented Jul 6, 2016

What do you think about removing the value from the query string (using $location.replace() as to not leave an item in history) so that people don't accidentally pass around links that add a notification? Would that work for the licensing stuff?

@ycombinator
Copy link
Contributor Author

ycombinator commented Jul 6, 2016

What do you think about removing the value from the query string ...?

I imagine you mean right after the notification has been triggered. Yeah, I think that is a good idea. It should work for licensing as well.

@ycombinator
Copy link
Contributor Author

jenkins, test it

@Bargs Bargs self-assigned this Jul 6, 2016
@@ -44,3 +45,5 @@ chrome
moment.tz.setDefault(tz);
}
});

modules.get('kibana').run(Notifier.run);
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this approach much better, but I think Notifier.run should probably be Notifier.pullMessagesFromUrl or something

@spalger
Copy link
Contributor

spalger commented Jul 6, 2016

LGTM

@spalger spalger removed their assignment Jul 6, 2016
@ycombinator ycombinator merged commit 4f2cd1f into elastic:master Jul 6, 2016
@ycombinator ycombinator deleted the notifier-on-page-load branch July 6, 2016 20:06
@epixa epixa added v5.0.0 and removed v5.0.0 labels Aug 1, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
Show notifier on page load, if notifier params are in query string

Former-commit-id: 4f2cd1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants