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

WIP: Add 'created' field to reportsummary and expose in UI (#939) #940

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mozfreddyb
Copy link

This only adds a created field during cache generation, which
wouldn't make it work for old, cached reports.
It also involved quite a bit of vue hackery, due to the data
not being available during django page render.
Maybe the model ought to change to take not only a collectionid
but also a collection.created?
This is also WIP because I'm literally dumping the Python created
attribute into the JSON and reading it out in JS. There is no explicit
serialization/parsing of the date and I'm not sure what format
is going to be used. Heh.

This only adds a _created_ field during cache generation, which
wouldn't make it work for old, cached reports.
It also involved quite a bit of vue hackery, due to the data
not being available during django page render.
Maybe the model ought to change to take not only a `collectionid`
but also a `collection.created`?
This is also WIP because I'm literally dumping the Python `created`
attribute into the JSON and reading it out in JS. There is no explicit
serialization/parsing of the date and I'm not sure what format
is going to be used. Heh.
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ddb13cc) 69.98% compared to head (91eff4c) 69.97%.

Files Patch % Lines
server/covmanager/tasks.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #940      +/-   ##
==========================================
- Coverage   69.98%   69.97%   -0.01%     
==========================================
  Files         149      149              
  Lines        9229     9230       +1     
  Branches       90       90              
==========================================
  Hits         6459     6459              
- Misses       2749     2750       +1     
  Partials       21       21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -125,6 +125,7 @@ def calculate_report_summary(pk):
elif not data:
# This is the root
data = coverage
data["created"] = collection.created
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment below, this shouldn't be necessary.

@@ -81,7 +82,8 @@
},
watch: {
'chart.data': function() {
this.draw()
this.draw();
document.title = '{{ collectionid }} - Summary - ' + chart.data.created;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the full collection object instead (passed to the template here, fetched like this), and replace any collectionid uses in the template to collection.id.

Then you can use {{collection.created}} directly in a JS string literal to append to title, though created() on line 98 is a better place for it. There's an existing helper formatClientTimestamp() defined in the base template you can use.

document.title += ` - ${formatClientTimestamp("{{ collection.created }}")}`

The {{}} tags are evaluated on the server by Django so that will already be resolved before JS sees it.

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

3 participants