aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-02-13 14:02:58 +0000
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-02-13 15:39:45 +0000
commite14ec15544f36a412be1ee527b35a46875a6b394 (patch)
tree77364677a2c1ee5aca41f5ed0476078460f20950
parentbe209ddf7e03e21a399cb595ddf50a67083345a0 (diff)
Added support for 'upstream development' status
Upstream development is presented as a bar starting on the date when the card in Jira entered 'upstream development' state. The date is taken from the card history. End date is set to either fix version or the end of the timeline. Some minor changes: * legend updated in the roadmap and timeline templates * legend moved to separate template file * styles fixed to remove redundancy Change-Id: I8cf4be999ca393fc91b0b15132c327f6985c6196 Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rw-r--r--linaroroadmap/settings.py2
-rw-r--r--roadmap/helpers.py28
-rw-r--r--roadmap/models.py5
-rw-r--r--roadmap/static/css/roadmap.css31
-rw-r--r--roadmap/templates/roadmap/_roadmap_legend.html29
-rw-r--r--roadmap/templates/roadmap/roadmap.html23
-rw-r--r--roadmap/templates/roadmap/timeline.html23
-rw-r--r--roadmap/views.py2
8 files changed, 103 insertions, 40 deletions
diff --git a/linaroroadmap/settings.py b/linaroroadmap/settings.py
index 113fa26..4d13ccb 100644
--- a/linaroroadmap/settings.py
+++ b/linaroroadmap/settings.py
@@ -230,6 +230,8 @@ LOGGING = {
}
}
+UPSTREAM_DEVELOPMENT = "Upstream Development"
+
try:
from local_settings import *
except ImportError:
diff --git a/roadmap/helpers.py b/roadmap/helpers.py
index 5bdf13c..97f5d3a 100644
--- a/roadmap/helpers.py
+++ b/roadmap/helpers.py
@@ -128,7 +128,7 @@ def create_or_update(issue, options, jira=None):
log.debug("Status is: {0}".format(status))
cardStart = None
- end = None
+ cardEnd = None
if fixVersion:
if fixVersion.name == "ONGOING":
if (hasattr(issue.fields, 'customfield_10300')
@@ -139,14 +139,34 @@ def create_or_update(issue, options, jira=None):
for item in history.items:
if (item.field == "status"
and item.toString == "Closed"):
- end = datetime.strptime(
+ cardEnd = datetime.strptime(
history.created,
"%Y-%m-%dT%H:%M:%S.000+0000").isoformat()
if cardStart:
break
else:
cardStart = fixVersion.fix_date
- log.debug("Start: {0} - End: {1}".format(cardStart, end))
+ log.debug("Start: {0} - End: {1}".format(cardStart, cardEnd))
+
+ upstream_development_name = settings.UPSTREAM_DEVELOPMENT
+ if status.name == upstream_development_name:
+ if hasattr(issue, "changelog"):
+ for history in issue.changelog.histories:
+ for item in history.items:
+ if (item.field == "status"
+ and item.toString == upstream_development_name):
+ cardStart = datetime.strptime(
+ history.created,
+ "%Y-%m-%dT%H:%M:%S.000+0000").isoformat()
+ if (item.field == "status"
+ and item.toString == "Closed"):
+ cardEnd = datetime.strptime(
+ history.created,
+ "%Y-%m-%dT%H:%M:%S.000+0000").isoformat()
+ if not cardEnd and fixVersion:
+ if fixVersion.name != "ONGOING":
+ cardEnd = fixVersion.fix_date
+ log.debug("Start: {0} - End: {1}".format(cardStart, cardEnd))
implementedby_list = []
depends_list = []
@@ -243,7 +263,7 @@ def create_or_update(issue, options, jira=None):
'status': status,
'fix_version': fixVersion,
'start': cardStart,
- 'end': end,
+ 'end': cardEnd,
'project': project,
'security': security,
'card_type': card_type
diff --git a/roadmap/models.py b/roadmap/models.py
index 03411f4..9389828 100644
--- a/roadmap/models.py
+++ b/roadmap/models.py
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with roadmap. If not, see <http://www.gnu.org/licenses/>.
+from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models
from reversion.models import Revision
@@ -261,6 +262,8 @@ class Card(models.Model):
return False
if self.resolution and self.resolution.name == "Cancelled":
return False
+ if self.status.name == settings.UPSTREAM_DEVELOPMENT and self.end is None:
+ return False
return True
@property
@@ -293,6 +296,8 @@ class Card(models.Model):
def event_type(self):
if self.fix_version.name == self.ONGOING:
return self.ONGOING
+ if self.status.name == settings.UPSTREAM_DEVELOPMENT:
+ return self.ONGOING
return self.FIXDATE
@property
diff --git a/roadmap/static/css/roadmap.css b/roadmap/static/css/roadmap.css
index 79fd8d7..9eaaed5 100644
--- a/roadmap/static/css/roadmap.css
+++ b/roadmap/static/css/roadmap.css
@@ -1,3 +1,17 @@
+.legend-item {
+ position: relative;
+ display: inline-block;
+ margin-left: 20px;
+ margin-bottom: 5px;
+}
+
+.legend-content {
+ margin-right: 15px !important;
+ margin-left: 15px !important;
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+
.timeline-event-content {
margin-left: 30px !important;
}
@@ -123,6 +137,23 @@ div.timeline-event-range.development {
border-color: #38761D;
background-color: #D9EAD3;
}
+span.upstream-development {
+ border-color: #38761D;
+ background-color: #38761D;
+}
+div.timeline-event-range.upstream-development {
+ border-color: #38761D;
+ background-color: #38761D;
+}
+div.timeline-event-range.upstream-development div.timeline-event-content {
+ color: #FFF;
+}
+div.timeline-event-range.upstream-development div.timeline-event-content a {
+ color: #FFF;
+}
+div.timeline-event-range.upstream-development div.timeline-event-content a:hover {
+ color: #DDD;
+}
span.closing-review {
border-color: #38761D;
background-color: #D9EAD3;
diff --git a/roadmap/templates/roadmap/_roadmap_legend.html b/roadmap/templates/roadmap/_roadmap_legend.html
new file mode 100644
index 0000000..49682c1
--- /dev/null
+++ b/roadmap/templates/roadmap/_roadmap_legend.html
@@ -0,0 +1,29 @@
+ <div class="left">
+ <h2>Statuses</h2>
+ <div style="display: block; margin-bottom: 10px;">
+ <div class="legend-item"><div class="timeline-event-content">Drafting</div><div class="timeline-event timeline-event-dot drafting" style="position: absolute;"></div></div>
+ <div class="legend-item"><div class="timeline-event-content">Approved</div><div class="timeline-event timeline-event-dot approved" style="position: absolute;"></div></div>
+ <div class="legend-item"><div class="timeline-event-content">Scheduled</div><div class="timeline-event timeline-event-dot scheduled" style="position: absolute;"></div></div>
+ <div class="legend-item"><div class="timeline-event-content">Development</div><div class="timeline-event timeline-event-dot development" style="position: absolute;"></div></div>
+ <div class="legend-item"><div class="timeline-event-content">Closing review</div><div class="timeline-event timeline-event-dot closing-review" style="position: absolute;"></div></div>
+ <div class="legend-item"><div class="timeline-event-content">Closed</div><div class="timeline-event timeline-event-dot closed" style="position: absolute;"></div></div>
+ </div>
+ <div style="display: block;">
+ <div class="legend-item"><div class="timeline-event timeline-event-range drafting"><div class="legend-content">Drafting</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range approved"><div class="legend-content">Approved</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range scheduled"><div class="legend-content">Scheduled</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range development"><div class="legend-content">Development</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range upstream-development"><div class="legend-content">Upstream development</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range closing-review"><div class="legend-content">Closing review</div></div></div>
+ <div class="legend-item"><div class="timeline-event timeline-event-range closed"><div class="legend-content">Closed</div></div></div>
+ </div>
+ </div>
+
+ <div class="right">
+ <h2>Symbols</h2>
+ <div class="legend-item"><img title="ARMv7-A" src="{{ STATIC_URL }}img/32bit.png"/> ARMv7-A</div>
+ <div class="legend-item"><img title="ARMv8-A" src="{{ STATIC_URL }}img/64bit.png"/> ARMv8-A</div>
+ <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="close-sidebar">open/close sidebar</div>
+ <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="print-timeline">print timeline</div>
+ </div>
+
diff --git a/roadmap/templates/roadmap/roadmap.html b/roadmap/templates/roadmap/roadmap.html
index 0b1abba..9355503 100644
--- a/roadmap/templates/roadmap/roadmap.html
+++ b/roadmap/templates/roadmap/roadmap.html
@@ -9,22 +9,7 @@
{% endblock %}
{% block feature %}
- <div class="left">
- <h2>Statuses</h2>
- <div class="concept" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Drafting</div><div class="timeline-event timeline-event-dot drafting" style="position: absolute;"></div></div>
- <div class="approved" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Approved</div><div class="timeline-event timeline-event-dot approved" style="position: absolute;"></div></div>
- <div class="scheduled" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Scheduled</div><div class="timeline-event timeline-event-dot scheduled" style="position: absolute;"></div></div>
- <div class="development" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Development</div><div class="timeline-event timeline-event-dot engineering" style="position: absolute;"></div></div>
- <div class="released" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Closed</div><div class="timeline-event timeline-event-dot closed" style="position: absolute;"></div></div>
- </div>
-
- <div class="right">
- <h2>Symbols</h2>
- <div style="position: relative; float:left; margin-left: 20px;"><img title="ARMv7-A" src="{{ STATIC_URL }}img/32bit.png"/> ARMv7-A</div>
- <div style="position: relative; float:left; margin-left: 20px;"><img title="ARMv8-A" src="{{ STATIC_URL }}img/64bit.png"/> ARMv8-A</div>
- <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="close-sidebar">open/close sidebar</div>
- <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="print-timeline">print timeline</div>
- </div>
+{% include "roadmap/_roadmap_legend.html" %}
{% endblock %}
{% block js_include %}
@@ -74,7 +59,11 @@
data.push({
"start": new Date("{{ card.start_date|date:'c' }}"),
{% if card.event_type == 'ONGOING' %}
- "end": new Date(2015, 1, 1),
+ {% if card.end_date %}
+ "end": new Date("{{ card.end_date|date:'c' }}"),
+ {% else %}
+ "end": endDate,
+ {% endif %}
{% endif %}
"content": "<a class=\"confirm\" href=\"{{ card.url }}\">{{ card.summary }}</a>",
"editable": false,
diff --git a/roadmap/templates/roadmap/timeline.html b/roadmap/templates/roadmap/timeline.html
index 0e1d714..04e96d5 100644
--- a/roadmap/templates/roadmap/timeline.html
+++ b/roadmap/templates/roadmap/timeline.html
@@ -9,22 +9,7 @@
{% endblock %}
{% block feature %}
- <div class="left">
- <h2>Statuses</h2>
- <div class="concept" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Drafting</div><div class="timeline-event timeline-event-dot drafting" style="position: absolute;"></div></div>
- <div class="approved" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Approved</div><div class="timeline-event timeline-event-dot approved" style="position: absolute;"></div></div>
- <div class="scheduled" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Scheduled</div><div class="timeline-event timeline-event-dot scheduled" style="position: absolute;"></div></div>
- <div class="development" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Development</div><div class="timeline-event timeline-event-dot engineering" style="position: absolute;"></div></div>
- <div class="released" style="position: relative; float:left; margin-left: 20px;"><div class="timeline-event-content">Closed</div><div class="timeline-event timeline-event-dot closed" style="position: absolute;"></div></div>
- </div>
-
- <div class="right">
- <h2>Symbols</h2>
- <div style="position: relative; float:left; margin-left: 20px;"><img title="ARMv7-A" src="{{ STATIC_URL }}img/32bit.png"/> ARMv7-A</div>
- <div style="position: relative; float:left; margin-left: 20px;"><img title="ARMv8-A" src="{{ STATIC_URL }}img/64bit.png"/> ARMv8-A</div>
- <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="close-sidebar">open/close sidebar</div>
- <div style="float:right; text-decoration:underline; color:#33f; cursor:pointer; padding: 5px;" id="print-timeline">print timeline</div>
- </div>
+{% include "roadmap/_roadmap_legend.html" %}
{% endblock %}
{% block js_include %}
@@ -71,7 +56,11 @@
data.push({
"start": new Date("{{ card.start_date|date:'c' }}"),
{% if card.event_type == 'ONGOING' %}
- "end": new Date(2015, 1, 1),
+ {% if card.end_date %}
+ "end": new Date("{{ card.end_date|date:'c' }}"),
+ {% else %}
+ "end": endDate,
+ {% endif %}
{% endif %}
"content": "<a class=\"confirm\" href=\"{{ card.url }}\">{{ card.summary }}</a>",
"editable": false,
diff --git a/roadmap/views.py b/roadmap/views.py
index a32bb10..4ff87fd 100644
--- a/roadmap/views.py
+++ b/roadmap/views.py
@@ -354,9 +354,7 @@ def roadmap(request, roadmap_id):
[non_epics.aggregate(Max("start")).items()[0][1],
non_epics.exclude(fix_version__name="ONGOING").aggregate(
Max("fix_version__fix_date")).items()[0][1]])
- print roadmap_end
roadmap_end = roadmap_end + timedelta(days=180)
- print roadmap_end
template = loader.get_template('roadmap/roadmap.html')
context = RequestContext(request, {
'current': current_roadmap,