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

Annotation line in graphs. #371

Merged
merged 1 commit into from
Oct 31, 2018
Merged

Conversation

stevanradakovic
Copy link
Member

Add UI for adding/updating annotation in build pages.
Add annotation lines in metrics with corresponding label.

Fixes #179.

@@ -36,4 +36,5 @@
url(r'^(%s)/(%s)/build/([^/]+)/testrun/([^/]+)/metadata$' % ((slug_pattern,) * 2), views.test_run_metadata, name='testrun_metadata'),
url(r'^(%s)/(%s)/build/([^/]+)/testrun/([^/]+)/attachments/([^/]+)$' % ((slug_pattern,) * 2), views.attachment, name='attachment'),
url(r'^testjob/(\d+)$', views.test_job, name='test_job'),
url(r'^(%s)/(%s)/update-annotation/$' % ((slug_pattern,) * 2), views.update_annotation, name='update_annotation'),
Copy link
Contributor

Choose a reason for hiding this comment

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

do we consider annotations 'sensitive'? If not, maybe create REST endpoint and update using PUT requests?

@mwasilew
Copy link
Contributor

oups, I think I merged in wrong order. Could you please rebase?

@mwasilew
Copy link
Contributor

It seems to work. I have one doubt though. When I set annotation for the build on the chart I'm getting as many labels as there are environments. Is that expected? I think there should be only one annotation label no matter how many environments.

squad/frontend/static/squad/annotation.js Show resolved Hide resolved
squad/frontend/templates/squad/build-nav.html Outdated Show resolved Hide resolved
squad/frontend/static/squad/charts.js Show resolved Hide resolved
@@ -25,7 +25,6 @@ function ChartsController($scope, $http, $location, $compile) {
minDate = data[name][0][0]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting the following error:
TypeError: "data[name][0] is undefined"

@terceiro
Copy link
Member

hi, I'm sorry but after #377 was merged there a few merge conflicts here. that is a pretty big PR so delaying much longer would make things even worse.

@terceiro
Copy link
Member

(basically the template changes bow have to be done against the *.jinja2 counterparts of the templates you changed originally)

@stevanradakovic
Copy link
Member Author

stevanradakovic commented Oct 23, 2018

@terceiro I've rebased the PR against the jinja2 update.
AFAIK, Milosz was to do a final review regarding my latest changes on Thursday, but since he's not here this week it'd be great if you can go through this PR so it doesn't sit around for too long. Thanks!

Copy link
Member

@terceiro terceiro left a comment

Choose a reason for hiding this comment

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

The UI looks good, thanks!

I felt adding annotations while looking at the chart is a bit cumbersome. I have to go back to the list of builds, look for the one I want by its number, then add the annotation there. ISTR that clicking on the circle (the points in the graph) used to lead you to the corresponding build page, maybe that got lost at some point?

Also, when you have two annotations that overlap, the ilne from one of them can go over the label for the other:

screenshot_2018-10-24 squad -

Is it possible to make all the vertical lines on one z-index, and the labels on another?

I have also some specific comments on the code.

@@ -21,4 +21,5 @@
url(r'^data/(%s)/(%s)' % ((slug_pattern,) * 2), data.get),
url(r'^resubmit/([0-9]+)', ci.resubmit_job),
url(r'^forceresubmit/([0-9]+)', ci.force_resubmit_job),
url(r'^update-annotation/(%s)/(%s)/(%s)$' % ((slug_pattern,) * 3), views.update_annotation, name='update_annotation'),
Copy link
Member

Choose a reason for hiding this comment

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

also IMO it would probably be better to use the REST API here.

Copy link
Member

Choose a reason for hiding this comment

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

specially seeing the implementation of this view below, since it has nothing special. it would be better to not have to maintain that code.

)
entry[environment] = [
[int(p['test_run__build__datetime'].timestamp()), p['result'], p['test_run__build__version']] for p in series
[int(p['test_run__build__datetime'].timestamp()), p['result'], p['test_run__build__version'], "" if p['test_run__build__annotation__description'] is None else p['test_run__build__annotation__description']] for p in series
Copy link
Member

Choose a reason for hiding this comment

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

you can use p['test_run__build__annotation__description'] or "" which is simpler and shorter

).annotate(
pass_percentage=100 * Sum('tests_pass') / Sum(tests_total)
).order_by('test_run__build__datetime')

results[environment] = [
[int(s['test_run__build__datetime'].timestamp()), s['pass_percentage'], s['test_run__build__version']]
[int(s['test_run__build__datetime'].timestamp()), s['pass_percentage'], s['test_run__build__version'], "" if s['test_run__build__annotation__description'] is None else s['test_run__build__annotation__description']]
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -9,6 +9,7 @@
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
Copy link
Member

Choose a reason for hiding this comment

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

this seems unused

@stevanradakovic
Copy link
Member Author

We have the chart click event, it should work for opening build pages, otherwise there's a bug in master. The overlapping is a bug in the annotation plugin chartjs/chartjs-plugin-annotation#94 so we can maybe fix it upstream at some point.
I'll take a look at the code comments, thanks!

@terceiro
Copy link
Member

just tested the click and it works on master

@terceiro
Copy link
Member

(and it also works on your branch; not sure why it didn't work for me yesterday)

@terceiro
Copy link
Member

terceiro commented Oct 25, 2018

I found what seems to be a error that is triggered whenever I hit "reload" having a few environments and one metrics selected:

 [Show/hide message details.] ReferenceError: None is not defined[Learn More] metrics:194:75
ReferenceError: "DATA is not defined"

this is Firefox 62, and it happens consistently on your branch, but not on master.

Add UI for adding/updating annotation in build pages.
Add annotation lines in metrics with corresponding label.

Fixes Linaro#179.
@stevanradakovic
Copy link
Member Author

Fixed all reported issues with the latest push.

@mwasilew
Copy link
Contributor

Looks good from my perspective.

@terceiro terceiro merged commit f0606e2 into Linaro:master Oct 31, 2018
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