Page MenuHomeSoftware Heritage

templates/layout: Add status widget in top bar
ClosedPublic

Authored by anlambert on Nov 30 2020, 6:01 PM.

Details

Summary

Add a small status widget in the top bar of the main HTML layout linking
to https://status.softwareheritage.org/ and asynchronously getting Software
Heritage status data from the status.io API.

Closes T2402

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build has FAILED

Patch application report for D4634 (id=16441)

Rebasing onto 8492a4c688...

Current branch diff-target is up to date.
Changes applied before test
commit af8a2609bd7319298a05b952c399da6e9321c812
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 30 17:57:35 2020 +0100

    templates/layout: Add status widget in top bar
    
    Add a small status widget in the top bar of the main HTML layout linking
    to https://status.softwareheritage.org/ and asynchronously getting Software
    Heritage status data from the status.io API.
    
    Closes T2402

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/503/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/503/console

Update: Fix cypress tests and avoid Web UI flashing when loading page.

Build has FAILED

Patch application report for D4634 (id=16442)

Rebasing onto 8492a4c688...

Current branch diff-target is up to date.
Changes applied before test
commit b05be184d85eda2b45433222ab5e0c2449f9dd1c
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 30 17:57:35 2020 +0100

    templates/layout: Add status widget in top bar
    
    Add a small status widget in the top bar of the main HTML layout linking
    to https://status.softwareheritage.org/ and asynchronously getting Software
    Heritage status data from the status.io API.
    
    Closes T2402

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/504/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/504/console

Build is green

Patch application report for D4634 (id=16442)

Rebasing onto 8492a4c688...

Current branch diff-target is up to date.
Changes applied before test
commit b05be184d85eda2b45433222ab5e0c2449f9dd1c
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 30 17:57:35 2020 +0100

    templates/layout: Add status widget in top bar
    
    Add a small status widget in the top bar of the main HTML layout linking
    to https://status.softwareheritage.org/ and asynchronously getting Software
    Heritage status data from the status.io API.
    
    Closes T2402

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/505/ for more details.

ardumont added a subscriber: ardumont.

Neat. lgtm

some questions and suggestions inline.

swh/web/assets/src/bundles/webapp/status-widget.js
51

no if else block instructions?

Also, can't we simplify this a bit with a dict/map (don't recall the js term) calling a function which sets the class and the text?

Something along the line of:

status = {
  100: 'green',  # operational
  200: 'blue',  # scheduled maintenance
  300: 'yellow',  # degraded performance
  400: 'yellow',   # partial service disruption
  500: 'red',  # service disruption
  600: 'red', # security event
}

fontColor = status.get(maxStatusCode)
if fontColor {   # given the current code, i gather it's possible to not enter any conditionals?
  $('.swh-current-status-indicator').addClass(fontColor);
  $('#swh-current-status-description').text(maxStatusDescription);
}
swh/web/config.py
102

What's that?

This revision is now accepted and ready to land.Dec 2 2020, 9:19 AM
swh/web/assets/src/bundles/webapp/status-widget.js
51

Right, will improve that.

swh/web/config.py
102

path to the swh status json data, see T2402 description

Build is green

Patch application report for D4634 (id=16478)

Rebasing onto 8492a4c688...

Current branch diff-target is up to date.
Changes applied before test
commit bfcffb5af9b7f3e7ea9430541c90a6b35291104f
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 30 17:57:35 2020 +0100

    templates/layout: Add status widget in top bar
    
    Add a small status widget in the top bar of the main HTML layout linking
    to https://status.softwareheritage.org/ and asynchronously getting Software
    Heritage status data from the status.io API.
    
    Closes T2402

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/507/ for more details.