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

Till/2400 message banner #2421

Merged
merged 15 commits into from
Sep 19, 2022
Merged

Till/2400 message banner #2421

merged 15 commits into from
Sep 19, 2022

Conversation

tillprochaska
Copy link
Contributor

@tillprochaska tillprochaska commented Jul 28, 2022

  • Messages can have a title, a date, and a level (info, warning, error, success).
  • Messages can be loaded dynamically from a remote JSON endpoint (configured via ALEPH_APP_MESSAGES_URL) or set to a static value via the ALEPH_APP_BANNER variable.
  • If a JSON endpoint is configured, the app will poll for changes every 15 minutes. This way, even users that keep the Aleph session open for a long time will be shown new messages with a max. 15 minutes delay.
  • Messages can be hidden after a fixed amount of time. This can be useful to display a messages for some time once an incident has be resolved.
  • Messages can have updates. If a message has updates, the most recent update (and the time it was posted) is displayed.

A few things to consider:

  • The messages JSON endpoint can be configured via an environment variable. The value of that variable is exposed to the frontend via the app metadata. This isn’t optimal for two reasons:

    1. It creates a request waterfall, i.e. the metadata has to be loaded before being able to load messages. This only happens once on app startup and honestly this also isn’t the worst performance bottleneck, so this should be fine.

    2. If the metadata endpoint is unavailable (e.g. because the API service crashed), the frontend won’t be able to load messages, i.e. we can’t display a message banner in case of a full outage.

      The only way to change that would be to include the messages endpoint in the frontend image. That means that everyone who’d like to use this feature would have to build a customized UI Docker image. Additionally, configuring this feature would be different from configuring everything else.

      I don’t think it’s worth the effort. As an alternative generating a simple, static HTML status page with the same information would be much more sensible. Users would be able to find status information there even in case of a full outage.

  • I’m unsure about naming. "Messages" is pretty generic. On the other hand, this might be used for things other than incidents/system status (e.g. announcing new features or datasets). We already use the terms alerts, notifications for different concepts.

@tillprochaska tillprochaska force-pushed the till/2400-message-banner branch 2 times, most recently from 184b85f to 02c07e1 Compare July 29, 2022 13:22
Comment on lines 53 to +54
"ui_uri": settings.APP_UI_URL,
"messages_url": settings.APP_MESSAGES_URL,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do we prefer? URI or URL?

Copy link
Contributor

Choose a reason for hiding this comment

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

URL is fine, it seems consistent with the settings portion of the line above, which isn't actually consistent with itself, hmmm.

Copy link
Contributor

@Rosencrantz Rosencrantz left a comment

Choose a reason for hiding this comment

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

The implementation works and seems to be well developed, it's obvious that you have thoughts about the implementation, there is testing in place which is awesome.

Where I've been struggling with this implementation is in the setting of the different levels. There doesn't seem to be any documentation on the labels I should be setting.

I determined that type:info, type:minor, and type:major all set different levels. But I could not find that documented anywhere. There is also type:announcement and type:scheduled-maintenance which is in our internal documentation on the wiki.

I also found that when I set the label type:major that the UI used the warning color, which was confusing.

I recommend that we take a look at the documentation, and ensure that it is clear how a user/admin can set the various types.

@@ -34,24 +40,55 @@ import ExportsScreen from 'src/screens/ExportsScreen/ExportsScreen';

import './Router.scss';

const MESSAGES_INTERVAL = 15 * 60 * 1000; // every 15 minutes
Copy link
Contributor

Choose a reason for hiding this comment

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

Why a check every 15 minutes? What are the implications of a shorter/longer interval?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refreshing the messages more frequently seemed a little wasteful. The worst case scenario here is that users will see an update 15 minutes after it has been published, which seemed acceptable to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something I noticed when I was playing with the message banner earlier in the week was that updates to the UI were inconsistent. I reduced the refresh to 60 seconds and even accounting for the build process is was really hit and miss as to when the update would show. I also couldn't figure out how long the "fixed" green banner would persist?

@tillprochaska
Copy link
Contributor Author

I also found that when I set the label type:major that the UI used the warning color, which was confusing.

That’s a bug! Just pushed a commit to fix it.

@Rosencrantz
Copy link
Contributor

Two more things. 1. Convert the review from a draft to a real PR. It's confusing otherwise. 2. Are you really looking to merge this directly into main? Should the endpoint actually be the develop branch?

@tillprochaska tillprochaska changed the base branch from main to develop September 1, 2022 14:08
Using a light font weight reduces legibility and contrast, which makes it difficult to read some UI texts.
Disatching the action to fetch messages in the router is a little unintuitive to me, but we already do the same for the metadata in that place, so I thought it would be good to be consistent.
There already is a way to set a app-wide message banner via the `ALEPH_APP_BANNER` environment variable. Users will still be able to use that approach and it takes precedences over other messages.
This is another way to display a warning message (only on the home page though). It was introduced in #1907 for a similar purpose (to inform users that anonymous access is temporarily disabled).

As we now have two ways to set an app-wide message banner (via the `APP_BANNER` env variable and by configuring a messages endpoint), I think we can now remove this feature.
@tillprochaska
Copy link
Contributor Author

tillprochaska commented Sep 1, 2022

I determined that type:info, type:minor, and type:major all set different levels. But I could not find that documented anywhere. There is also type:announcement and type:scheduled-maintenance which is in our internal documentation on the wiki.

I have documented the available message types here: https://github.com/alephdata/status-page-action#status-types

(The message banner implemented in Aleph is actually agnostic to the message type displayed. It will simply display a message in a color that is specified in the JSON. The types that are supported, which color should be used to display a message, for how long messages are displayed after they’ve been closed etc. is handled by the GitHub Action. I want to keep those details -- which in part are probably specific to our internal workflows -- out of the Aleph codebase.)

Are you really looking to merge this directly into main? Should the endpoint actually be the develop branch?

Ah, yes, I forget that every time. So annoying that GitHub has no option to configure the default target branch for PRs.

@tillprochaska tillprochaska marked this pull request as ready for review September 1, 2022 15:38
@Rosencrantz Rosencrantz merged commit e236edf into develop Sep 19, 2022
@sunu sunu deleted the till/2400-message-banner branch September 27, 2022 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants