-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI for adding/updating annotation in build pages. Add annotation lines in metrics with corresponding label. Fixes #179.
- Loading branch information
1 parent
8ec3270
commit 8c1f21c
Showing
16 changed files
with
270 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.14 on 2018-10-09 09:31 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0091_notification_delivery_remove_unique_status'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Annotation', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('description', models.CharField(max_length=1024)), | ||
('build', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='core.Build')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var app = angular.module('Annotation', []); | ||
|
||
app.config(['$locationProvider', function($locationProvider) { | ||
$locationProvider.html5Mode({ | ||
enabled: true, | ||
requireBase: false | ||
}) | ||
}]) | ||
|
||
function AnnotationController($scope, $http, $httpParamSerializerJQLike) { | ||
$scope.updateAnnotation = function(build_id) { | ||
var method = 'post' | ||
var url = '/api/annotations/' | ||
var data = { | ||
description: $scope.description, | ||
build: build_id | ||
} | ||
if (typeof $scope.annotation_id !== "undefined") { | ||
method = "put" | ||
url += $scope.annotation_id + "/" | ||
data["id"] = $scope.annotation_id | ||
} | ||
$http({ | ||
method: method, | ||
url: url, | ||
data: $httpParamSerializerJQLike(data), | ||
headers: {'Content-Type': 'application/x-www-form-urlencoded', | ||
'X-CSRFTOKEN': csrf_token} | ||
}).then(function(response) { | ||
$("#annotation_text").html("<strong>Annotation: </strong>" + | ||
$scope.description) | ||
$("#annotation_text").removeClass("hidden") | ||
$("#annotation_button").html("Update") | ||
$("#annotation_modal").modal('hide') | ||
$scope.annotation_id = response.data.id | ||
}, function(response) { | ||
var msg = "There was an error while editing annotation.\n" + | ||
"Status = " + response.status + " " + response.statusText + | ||
"(" + response.xhrStatus + ")" | ||
alert(msg) | ||
$("#annotation_modal").modal('hide') | ||
}) | ||
} | ||
} | ||
|
||
app.controller( | ||
'AnnotationController', | ||
[ | ||
'$scope', | ||
'$http', | ||
'$httpParamSerializerJQLike', | ||
AnnotationController | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.