Skip to content

Commit

Permalink
Fix bug 1486606: Show errors & warnings on dashboards (#1081)
Browse files Browse the repository at this point in the history
This is a last in a series of patches to bring full errors and warnings
support from standalone dashboards to Pontoon. It consists of four
parts:

1. Re-enabling temporary disabled features
* Support for Errors and warnings in string list and filters
* Exclude errors and warnings from approved and fuzzy filters

2. Changes in the Translate view
* Displays errors and warnings for strings with errors and warnings
* Add errors filters to Untranslated filters
* Add warnings and errors to Progress chart & Menu

3. Changes in Dashboards
* Add errors and warnings to progress chart (and legend) and
  differentiate All strings and Unreviewed from legend items
* Add errors and warnings to Progress colum in listings
* Use metric prefixes for high numbers in Progress colum

4. Unification and consistency
* Move Unreviewed after All to make them more accessible
* Consistently use Suggestions instead of Unreviewed
* Consistently use Unreviewed strings instead of Unreviewed suggestions
* Consistently use All strings instead of Total
* Use consistent ordering of All, Translated and Missing
* Remove icons from Top Contributors (they don't play any role)
  • Loading branch information
mathjazz committed Sep 19, 2018
1 parent a9f1982 commit 795fcc8
Show file tree
Hide file tree
Showing 28 changed files with 378 additions and 148 deletions.
55 changes: 41 additions & 14 deletions pontoon/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,7 @@ def get_top_instances(cls, qs):
'most_strings': sorted(qs, key=lambda x: x.total_strings)[-1],
'most_translations': sorted(qs, key=lambda x: x.approved_strings)[-1],
'most_suggestions': sorted(qs, key=lambda x: x.unreviewed_strings)[-1],
'most_missing': sorted(
qs,
key=lambda x: x.total_strings - x.approved_strings - x.fuzzy_strings
)[-1],
'most_missing': sorted(qs, key=lambda x: x.missing_strings)[-1],
}

def adjust_stats(
Expand Down Expand Up @@ -945,6 +942,8 @@ def stats(self):
'resource__path': [],
'resource__total_strings': self.total_strings,
'fuzzy_strings': self.fuzzy_strings,
'strings_with_errors': self.strings_with_errors,
'strings_with_warnings': self.strings_with_warnings,
'unreviewed_strings': self.unreviewed_strings,
'approved_strings': self.approved_strings,
}]
Expand All @@ -959,6 +958,8 @@ def get_details(parts):
'resource__deadline',
'resource__total_strings',
'fuzzy_strings',
'strings_with_errors',
'strings_with_warnings',
'unreviewed_strings',
'approved_strings',
)
Expand Down Expand Up @@ -994,9 +995,21 @@ def get_details(parts):
resource__path=F('resources__path'),
resource__deadline=F('resources__deadline'),
resource__total_strings=F('resources__total_strings'),
fuzzy_strings=F('resources__translatedresources__fuzzy_strings'),
unreviewed_strings=F('resources__translatedresources__unreviewed_strings'),
approved_strings=F('resources__translatedresources__approved_strings')
fuzzy_strings=F(
'resources__translatedresources__fuzzy_strings'
),
strings_with_errors=F(
'resources__translatedresources__strings_with_errors'
),
strings_with_warnings=F(
'resources__translatedresources__strings_with_warnings'
),
unreviewed_strings=F(
'resources__translatedresources__unreviewed_strings'
),
approved_strings=F(
'resources__translatedresources__approved_strings'
)
)
)

Expand All @@ -1012,7 +1025,15 @@ def get_details(parts):
resource__path=F('project__resources__path'),
resource__deadline=F('project__resources__deadline'),
resource__total_strings=F('project__resources__total_strings'),
fuzzy_strings=F('project__resources__translatedresources__fuzzy_strings'),
fuzzy_strings=F(
'project__resources__translatedresources__fuzzy_strings'
),
strings_with_errors=F(
'project__resources__translatedresources__strings_with_errors'
),
strings_with_warnings=F(
'project__resources__translatedresources__strings_with_warnings'
),
unreviewed_strings=F(
'project__resources__translatedresources__unreviewed_strings'
),
Expand All @@ -1039,6 +1060,8 @@ def get_details(parts):
'resource__deadline': [],
'resource__total_strings': all_resources.total_strings,
'fuzzy_strings': all_resources.fuzzy_strings,
'strings_with_errors': all_resources.strings_with_errors,
'strings_with_warnings': all_resources.strings_with_warnings,
'unreviewed_strings': all_resources.unreviewed_strings,
'approved_strings': all_resources.approved_strings,
})
Expand Down Expand Up @@ -1523,11 +1546,15 @@ def get_chart_dict(cls, obj):
return {
'total_strings': obj.total_strings,
'approved_strings': obj.approved_strings,
'unreviewed_strings': obj.unreviewed_strings,
'fuzzy_strings': obj.fuzzy_strings,
'strings_with_errors': obj.strings_with_errors,
'strings_with_warnings': obj.strings_with_warnings,
'unreviewed_strings': obj.unreviewed_strings,
'approved_share': round(obj.approved_strings / obj.total_strings * 100),
'unreviewed_share': round(obj.unreviewed_strings / obj.total_strings * 100),
'fuzzy_share': round(obj.fuzzy_strings / obj.total_strings * 100),
'errors_share': round(obj.strings_with_errors / obj.total_strings * 100),
'warnings_share': round(obj.strings_with_warnings / obj.total_strings * 100),
'unreviewed_share': round(obj.unreviewed_strings / obj.total_strings * 100),
'approved_percent': int(
math.floor(obj.approved_strings / obj.total_strings * 100)
),
Expand Down Expand Up @@ -1992,7 +2019,7 @@ def fuzzy(self, locale):
return Q(
pk__in=self.get_filtered_entities(
locale,
Q(fuzzy=True),
Q(fuzzy=True, warnings__isnull=True, errors__isnull=True),
lambda x: x.fuzzy
)
)
Expand Down Expand Up @@ -2059,7 +2086,7 @@ def translated(self, locale):
return Q(
pk__in=self.get_filtered_entities(
locale,
Q(approved=True),
Q(approved=True, warnings__isnull=True, errors__isnull=True),
lambda x: x.approved
)
)
Expand Down Expand Up @@ -2811,8 +2838,8 @@ def serialize(self):
'approved': self.approved,
'rejected': self.rejected,
'fuzzy': self.fuzzy,
'error_count': self.errors.count(),
'warning_count': self.warnings.count(),
'errors': [error.message for error in self.errors.all()],
'warnings': [warning.message for warning in self.warnings.all()],
}


Expand Down
56 changes: 44 additions & 12 deletions pontoon/base/static/css/heading_info.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ ul {
#heading .details,
#heading .legend {
font-weight: 300;
width: 360px;
}

#heading .details li,
Expand All @@ -36,6 +35,7 @@ ul {

#heading .details {
float: left;
width: 360px;
}

#heading .details .title {
Expand Down Expand Up @@ -72,6 +72,7 @@ ul {
}

#heading .details .resources .value.overflow {
max-width: 280px;
white-space: normal;
}

Expand Down Expand Up @@ -103,7 +104,8 @@ ul {
}

#heading .legend {
float: right;
float: left;
width: 190px;
}

#heading .legend li {
Expand All @@ -122,20 +124,11 @@ ul {
color: #7BC876;
}

#heading .legend li.banner {
padding: 0;
}

#heading .legend li .status.fa {
left: 0;
top: 4px;
}

#heading .legend li.unreviewed .status.fa {
font-size: 18px;
top: 2px;
}

#heading .legend li span.value {
color: #AAA;
float: right;
Expand All @@ -149,6 +142,45 @@ ul {
color: #7BC876;
}

#heading .banner .title {
#heading .non-plottable {
float: right;
}

#heading .non-plottable p {
color: #AAA;
font-weight: 300;
line-height: 24px;
text-align: right;
text-transform: uppercase;
}

#heading .non-plottable a p {
color: #FFFFFF;
}

#heading .non-plottable a:hover p {
color: #7BC876;
}

#heading .non-plottable p.value {
font-size: 20px;
}

#heading .non-plottable .all {
padding-bottom: 21px;
}

#heading .non-plottable .unreviewed .status.fa {
left: auto;
position: relative;
top: -1px;
}

#heading .non-plottable .unreviewed .status.fa:before {
color: #4D5967;
font-size: 18px;
}

#heading .non-plottable .unreviewed.pending .status.fa:before {
color: #4FC4F6;
}
16 changes: 16 additions & 0 deletions pontoon/base/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ button { width: auto; overflow: visible; }
color: #FED271;
}

.warnings .status.fa:before {
color: #FFA10F;
}

.errors .status.fa:before {
color: #F36;
}

.unreviewed .status.fa:before {
color: #4FC4F6;
content: "";
Expand Down Expand Up @@ -886,6 +894,14 @@ img.rounded {
border-color: #FED271;
}

.details div.warnings {
border-color: #FFA10F;
}

.details div.errors {
border-color: #F36;
}

.details div.missing {
border-color: #4D5967;
}
Expand Down
24 changes: 22 additions & 2 deletions pontoon/base/static/css/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ table.table {
background: #FED271;
}

.table .progress .chart-wrapper .warnings {
background: #FFA10F;
}

.table .progress .chart-wrapper .errors {
background: #F36;
}

.table .progress .chart-wrapper .missing {
background: #637283;
}
Expand All @@ -305,7 +313,11 @@ table.table {
display: inline-block;
padding: 0;
text-align: center;
width: 72px;
width: 51px;
}

.table .progress .legend li:last-child {
width: 54px;
}

.table .progress .legend li a {
Expand All @@ -329,6 +341,14 @@ table.table {
color: #FED271;
}

.table .progress .legend li.warnings .title {
color: #FFA10F;
}

.table .progress .legend li.errors .title {
color: #F36;
}

.table .progress .legend li.missing .title {
color: #7C8B9C;
}
Expand All @@ -342,7 +362,7 @@ table.table {
}

.table .progress .legend li .value {
font-size: 18px;
font-size: 15px;
line-height: 22px;
}

Expand Down
20 changes: 13 additions & 7 deletions pontoon/base/static/css/translate.css
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ body > header .locale.select {
color: #FED271;
}

.errors .status:before {
color: #F36;
}

.warnings .status:before {
color: #FFA10F;
}

.errors .status:before {
color: #F36;
}

.untranslated .status:before {
color: #AAAAAA;
content: "";
Expand Down Expand Up @@ -429,10 +429,11 @@ body > header .locale.select {
cursor: auto;
left: 50%;
line-height: 18px;
margin-left: -180px; /* Must be half the width */
margin-left: -200px; /* Must be half the width */
padding: 0;
text-align: center;
top: 48px;
width: 400px;
}

#progress .menu > div:first-child {
Expand Down Expand Up @@ -473,11 +474,16 @@ body > header .locale.select {
}

#progress .menu .details div {
width: 119px;
width: 79px;
}

#progress .menu .details div:last-child {
width: 120px;
width: 80px;
}

#progress .menu .details p {
font-size: 22px;
padding: 5px 0 10px;
}

body > header .notification.hide {
Expand Down
Loading

0 comments on commit 795fcc8

Please sign in to comment.