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

Alert screen for CODIS operational room #42

Merged
merged 2 commits into from
Mar 28, 2021
Merged

Alert screen for CODIS operational room #42

merged 2 commits into from
Mar 28, 2021

Conversation

chloeskt
Copy link
Contributor

@chloeskt chloeskt commented Mar 26, 2021

Motivation

Hi all ! This PR aims at transforming our platform into a multiple page app:

  • the classic homepage that we already have
  • the alert page: it is meant to be displayed on a big screen in CODIS's room. There is a sober screen when there are no alert and it switches to an alert mode when there are alerts.

As discussed, only the lastest event (as latest fire) is displayed on the screen. When multiple alerts are given by the RPI for the same event (same fire), we display a GIF of all images incoming (doubt relief for the firefighters).

Features

Multiple features have been added:

  • no alert screen
  • alert screen
  • button on the navbar (top right corner) to access the alert page ("ecran de monitoring")
  • css styles (to make an element blink)
  • changes in rough layout
Changes in rough layout:
  • Store div_live_alerts_data: in order to store the table of live alerts we get once the call to the API is done
  • Store last_displayed_event_id: to keep track of the last event (fire) which has been displayed on the alert screen (useful for the GIF part)
  • Store images_url_current_alert: this is a Dict[str, List[str]]. Keys: str of the event id. Values: List of all the urls which belong to this event id (again for GIF part)

This might change with the use of a webhook, but we will still need to store the data somewhere to make it accessible to multiple callbacks.

Limits

As we know, the webhook will change many things, therefore some developments made here might become outdated. Also we will need to think about deleting some info at some point, especially for the Store images_url_current_alert, otherwise the dict will keep on growing. Once a event has been "acquitté", we can remove it from the dict. This will be easy but we need to wait for the webhook to get a better picture of the workflow needed.

Screens

When there are no alerts:

Capture d’écran 2021-03-28 à 14 15 48 (3)

When there is an alert:

Capture d’écran 2021-03-28 à 14 15 42 (3)

@chloeskt chloeskt added this to the 0.1.3 milestone Mar 26, 2021
@chloeskt chloeskt self-assigned this Mar 26, 2021
@Akilditu
Copy link
Collaborator

Thanks for the PR, will review it asap 👍

Copy link
Collaborator

@Akilditu Akilditu left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR, overall great maybe adding 2 screenshots of how the 2 big screens renders would be nice :)

app/alert_screen.py Show resolved Hide resolved
app/main.py Show resolved Hide resolved
app/main.py Outdated Show resolved Hide resolved
app/main.py Outdated Show resolved Hide resolved
app/alert_screen.py Outdated Show resolved Hide resolved
@chloeskt chloeskt force-pushed the big_screen branch 3 times, most recently from 78dea22 to 4b4c25a Compare March 28, 2021 12:58
@chloeskt
Copy link
Contributor Author

chloeskt commented Mar 28, 2021

Thanks a lot for this PR, overall great maybe adding 2 screenshots of how the 2 big screens renders would be nice :)

Thank you for your review @Akilditu ! I added two screenshots in the description of the PR 👌

@Akilditu Akilditu self-requested a review March 28, 2021 13:06
Akilditu
Akilditu previously approved these changes Mar 28, 2021
Copy link
Collaborator

@Akilditu Akilditu left a comment

Choose a reason for hiding this comment

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

Thanks for changes and answers !

Copy link
Collaborator

@pechouc pechouc left a comment

Choose a reason for hiding this comment

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

Hello!

Thanks a lot for this PR, it clarifies a lot of things and the alert screen seems to work perfectly 😊

I have added a few very dumb comments regarding naming / styling, I hope they are not too "relous". However, there is maybe a more substantial discussion regarding the three different callbacks being triggered by the same input (Input("interval-component-homepage", "n_intervals")). Let me know what you think about this!

app/alert_screen.py Outdated Show resolved Hide resolved
app/alert_screen.py Outdated Show resolved Hide resolved
app/alert_screen.py Outdated Show resolved Hide resolved
app/alert_screen.py Outdated Show resolved Hide resolved
app/main.py Show resolved Hide resolved
app/main.py Outdated Show resolved Hide resolved
app/main.py Outdated Show resolved Hide resolved
app/main.py Show resolved Hide resolved
app/navbar.py Outdated Show resolved Hide resolved
@chloeskt
Copy link
Contributor Author

Thank you @pechouc for your review ! Mostly I agree with you (I even think that to improve the quality of the code, we should do some refactoring. But it is clearly not the priority). Regarding the merge of update_alert_data and update_dict_of_images I'm not sure. Also I think that many things will need to change once we get the webhook to work, we will probably need to discuss the workflow again !

@chloeskt chloeskt force-pushed the big_screen branch 4 times, most recently from 3839b4b to 5f9c20d Compare March 28, 2021 16:44
@chloeskt
Copy link
Contributor Author

@Akilditu @pechouc I had to remove the following lines in styles.css due to issues reported by Codacy through CSSLint (which seems to be an unmaintained library with multiple issues ... StyleLint seems to be way better).

@-ms-keyframes blink { 
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

Many users had the same issue which has been reported to the creators of CSSLint, see this issue on Github.

Let's hope that our users won't have IE < 10: the blink features won't work for them !

Copy link
Collaborator

@pechouc pechouc left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the changes, I agree with you: let's keep the callbacks as in the revised version! As you rightly mentioned, this logic will probably change significantly with the web-hook.

@chloeskt chloeskt merged commit 688f683 into master Mar 28, 2021
@chloeskt chloeskt deleted the big_screen branch March 28, 2021 18:36
@frgfm frgfm modified the milestones: 0.1.3, 0.1.2 Jul 4, 2022
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.

None yet

4 participants