Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/2016-05-27'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pike committed May 27, 2016
2 parents d12d8a0 + 3f82e66 commit 0e069e4
Show file tree
Hide file tree
Showing 6 changed files with 449 additions and 144 deletions.
74 changes: 74 additions & 0 deletions apps/l10nstats/management/commands/deactivate.py
@@ -0,0 +1,74 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import json
from urllib2 import urlopen
from urlparse import urljoin
from ConfigParser import ConfigParser

from django.core.management.base import BaseCommand

from l10nstats.models import Active


class Command(BaseCommand):
option_list = BaseCommand.option_list

def handle(self, *args, **kwargs):
self.handleApps(*args, **kwargs)
self.handleDirs(*args, **kwargs)

def handleApps(self, *args, **kwargs):
l10nbuilds = urlopen(
'https://raw.githubusercontent.com/Pike/master-ball/'
'master/l10n-master/l10nbuilds.ini')
cp = ConfigParser()
cp.readfp(l10nbuilds)
for section in cp.sections():
self.stdout.write(section + '\n')
self.handleSection(section, dict(cp.items(section)))

def handleSection(self, section, items):
locales = items['locales']
if locales == 'all':
inipath = '/'.join((
items['repo'], items['mozilla'],
'raw-file', 'default',
items['l10n.ini']
))
ini = ConfigParser()
ini.readfp(urlopen(inipath))
allpath = urljoin(
urljoin(inipath, ini.get('general', 'depth')),
ini.get('general', 'all'))
locales = urlopen(allpath).read()
locales = locales.split()
obs = (Active.objects
.filter(run__tree__code=section)
.exclude(run__locale__code__in=locales)
.order_by('run__locale__code'))
obslocs = ' '.join(obs.values_list('run__locale__code', flat=True))
if not obslocs:
self.stdout.write(' OK\n')
return
s = raw_input('Remove %s? [Y/n] ' % obslocs)
if s.lower() == 'y' or s == '':
obs.delete()

def handleDirs(self, *args, **kwargs):
dirbuilds = json.load(urlopen(
'https://raw.githubusercontent.com/Pike/master-ball/'
'master/l10n-master/dir-builds.json'))
for treedata in dirbuilds:
obs = (Active.objects
.filter(run__tree__code=treedata['name'])
.exclude(run__locale__code__in=treedata['locales'])
.order_by('run__locale__code'))
obslocs = ' '.join(obs.values_list('run__locale__code', flat=True))
if not obslocs:
self.stdout.write(' OK\n')
continue
s = raw_input('Remove %s? [Y/n] ' % obslocs)
if s.lower() == 'y' or s == '':
obs.delete()
47 changes: 47 additions & 0 deletions apps/shipping/static/shipping/css/dashboard.css
Expand Up @@ -72,6 +72,53 @@ table.stats td.status {
}


.actions .pending.oi {
color: #0096DD;
}

.actions .rejected.oi {
color: red;
}
.actions .no_update.oi {
color: black;
}

.signoffs.actions .suggest-error {
color: red;
}
.signoffs.actions .suggest-failure {
color: #ff6c00;
}
.signoffs.actions .suggest-warnings {
color: green;
}
.signoffs.actions .suggest-success {
color: green;
}

.signoffs.status, .signoffs.actions {
text-align: center;
white-space: nowrap;
}
.signoffs.status .status-ok {
color: green;
}

.signoffs .status-fallback {
color: #ff6c00;
}

.signoffs a {
color: #000000;
}

.signoffs a:hover {
color: #000000;
border-color: #484848;
}



/* override of exhibit CSS effect
(done here rather than editing exhibit-bundle.css)
*/
Expand Down
2 changes: 1 addition & 1 deletion apps/shipping/static/shipping/js/dashboard.js
Expand Up @@ -4,7 +4,7 @@
/* global Exhibit */

jQuery(document).one("scriptsLoaded.exhibit", function(evt) {
var EX_OPTIONS = ["result", "shipping", "signoff"];
var EX_OPTIONS = ["result", "action", "signoff"];
var params = Exhibit.parseURLParameters();
for (var i in EX_OPTIONS) {
var option = EX_OPTIONS[i];
Expand Down
51 changes: 36 additions & 15 deletions apps/shipping/templates/shipping/dashboard.html
Expand Up @@ -10,6 +10,7 @@

{% block head_matter %}
<link rel="stylesheet" href="{% static "shipping/css/dashboard.css" %}" type="text/css">
<link rel="stylesheet" href="{% static "css/open-iconic.css" %}" type="text/css">
<link href="{% url 'shipping.views.status.status_json' %}?{{ query }}" type="application/json" rel="exhibit-data"/>
<style>
.progress {
Expand Down Expand Up @@ -55,10 +56,10 @@ <h1 class="large">Sign-offs {% if subtitles %}({{ subtitles|join:", " }}){% endi
data-ex-show-toolbox="false"
data-ex-collectionID="buids"
data-ex-column-labels="Locale, Tree, %, Errors, Missing, Warnings,
Reported, Obsolete, Unchanged, Status, History, Sign-off"
Reported, Obsolete, Unchanged, Status, History, Status, Action"
data-ex-columns=".locale, .tree, .completion, .errors, .missing,
.warnings, .report, .obsolete, .unchanged, .changed,
.completion, .signoff"
.completion, .state, .new_run"
data-ex-cellSpacing="0">
<table style="display:none;">
<tr>
Expand Down Expand Up @@ -89,18 +90,34 @@ <h1 class="large">Sign-offs {% if subtitles %}({{ subtitles|join:", " }}){% endi
data-ex-style-subcontent="background-position:{&#123; .background_offset_x }}px {&#123; .background_offset_y }}px"></div>
</a>
</td>
<td>
<span data-ex-if="exists(.tree.appversion)">
<span>
<a data-ex-href-subcontent="{% url 'shipping.views.signoff.signoff' "&#123;&#123;.locale&#125;&#125;" "&#123;&#123;.tree.appversion&#125;&#125;" %}">
<span data-ex-if="exists(.signoff )">
<span data-ex-content=".signoff"></span>
<span>none</span>
</span>
</a>
</span>
</span>
</td>
<td class="signoffs status">
<span data-ex-if="exists(.tree.appversion)">
<a data-ex-href-subcontent="{% url 'shipping.views.signoff.signoff' "&#123;&#123;.locale&#125;&#125;" "&#123;&#123;.tree.appversion&#125;&#125;" %}">
<span data-ex-if='.state = "OK"'>
<span class="oi status-ok" data-ex-data-glyph-subcontent="{&#123;.state_glyph}}"></span>
<span><span class="oi status-fallback" data-ex-data-glyph-subcontent="{&#123;.state_glyph}}"></span> <span data-ex-content=".state"></span></span>
</span>
</a>
</span>
</td>
<td class="signoffs actions">
<span data-ex-if="exists(.tree.appversion)">
<a data-ex-href-subcontent="{% url 'shipping.views.signoff.signoff' "&#123;&#123;.locale&#125;&#125;" "&#123;&#123;.tree.appversion&#125;&#125;" %}">
<span data-ex-if="exists(.action)">
<span>
<span data-ex-if='.action = "rejected"'><span class="oi rejected" data-glyph='x'></span></span>
<span data-ex-if='contains(.action, "review")'><span class="oi pending" data-glyph="magnifying-glass"></span></span>
</span>
</span>
<span data-ex-if="exists(.new_run)">
<span data-ex-class-subcontent='oi suggest-{&#123;.result}}' data-glyph="graph"></span>
</span>
<span data-ex-if="exists(.needs_update)">
<span title="Needs Update" class="oi no_update" data-glyph="ban"></span>
</span>
</a>
</span>
</td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -128,9 +145,13 @@ <h1 class="large">Sign-offs {% if subtitles %}({{ subtitles|join:", " }}){% endi
<div data-ex-role="facet" data-ex-expression=".locale" data-ex-facet-label="Locale"
data-ex-height="5em"
id="locale-facet"></div>
<div data-ex-role="facet" data-ex-expression=".signoff"
<div data-ex-role="facet" data-ex-expression=".state"
data-ex-missing-label="none"
data-ex-sort-direction="reverse"
data-ex-height="5em" data-ex-facet-label="Sign-off" id="signoff-facet"></div>
<div data-ex-role="facet" data-ex-expression="union(.action, .new_run)"
data-ex-missing-label="none"
data-ex-height="5em" data-ex-facet-label="Action" id="action-facet"></div>
<div><a href="{% url 'shipping.views.index' %}?{{ request.GET.urlencode }}">Edit</a> this dashboard.</div>
</td>
</tr>
Expand Down

0 comments on commit 0e069e4

Please sign in to comment.