Merged in henrik/6.16.1-pyang-work@10995:
Added in support for displaying results from selected submission checks as symbols on draft pages and in draft lists. For now, that means that drafts with yang modules will show either a green or orange yang symbol, depending on the result of the submission yang validation check. - Legacy-Id: 10996
This commit is contained in:
commit
4b0b7e0c58
|
@ -153,6 +153,12 @@ fieldset[disabled] .btn-pass.focus {
|
|||
#timeline .gradient.right {
|
||||
stop-color: white;
|
||||
}
|
||||
.checker-warning {
|
||||
color: #ff5805;
|
||||
}
|
||||
.checker-success {
|
||||
color: #5ebc00;
|
||||
}
|
||||
.btn-default,
|
||||
.btn-primary,
|
||||
.btn-success,
|
||||
|
|
2
bootstrap/dist/css/bootstrap-theme.css.map
vendored
2
bootstrap/dist/css/bootstrap-theme.css.map
vendored
File diff suppressed because one or more lines are too long
2
bootstrap/dist/css/bootstrap-theme.min.css
vendored
2
bootstrap/dist/css/bootstrap-theme.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -153,6 +153,12 @@ fieldset[disabled] .btn-pass.focus {
|
|||
#timeline .gradient.right {
|
||||
stop-color: white;
|
||||
}
|
||||
.checker-warning {
|
||||
color: #ff5805;
|
||||
}
|
||||
.checker-success {
|
||||
color: #5ebc00;
|
||||
}
|
||||
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
|
|
2
bootstrap/dist/css/bootstrap.css.map
vendored
2
bootstrap/dist/css/bootstrap.css.map
vendored
File diff suppressed because one or more lines are too long
2
bootstrap/dist/css/bootstrap.min.css
vendored
2
bootstrap/dist/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
2
bootstrap/dist/css/bootstrap.min.css.map
vendored
2
bootstrap/dist/css/bootstrap.min.css.map
vendored
File diff suppressed because one or more lines are too long
4
bootstrap/dist/js/bootstrap.min.js
vendored
4
bootstrap/dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -157,6 +157,10 @@
|
|||
#timeline .gradient.right { stop-color: white; }
|
||||
|
||||
|
||||
// for the submission checkers
|
||||
.checker-warning { color: darken(saturate(@brand-warning, 20%), 20%); }
|
||||
.checker-success { color: darken(saturate(@brand-success, 20%), 10%); }
|
||||
|
||||
// XXX This change from before is not currently being applied, not sure how
|
||||
// critical this is:
|
||||
//--- /Users/lars/Downloads/bootstrap-3.3.5/less/mixins/forms.less 2015-06-16 10:13:22.000000000 +0200
|
||||
|
|
|
@ -521,6 +521,11 @@ class Document(DocumentInfo):
|
|||
else:
|
||||
return None
|
||||
|
||||
def submission(self):
|
||||
s = self.submission_set.filter(rev=self.rev)
|
||||
s = s.first()
|
||||
return s
|
||||
|
||||
class RelatedDocHistory(models.Model):
|
||||
source = models.ForeignKey('DocHistory')
|
||||
target = models.ForeignKey('DocAlias', related_name="reversely_related_document_history_set")
|
||||
|
|
|
@ -5,10 +5,10 @@ from django.contrib import admin
|
|||
from ietf.submit.models import Preapproval, Submission, SubmissionEvent, SubmissionCheck
|
||||
|
||||
class SubmissionAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'draft_link', 'status_link', 'submission_date',]
|
||||
list_display = ['id', 'rev', 'draft_link', 'status_link', 'submission_date',]
|
||||
ordering = [ '-id' ]
|
||||
search_fields = ['name', ]
|
||||
raw_id_fields = ['group']
|
||||
raw_id_fields = ['group', 'draft']
|
||||
|
||||
def status_link(self, instance):
|
||||
url = urlreverse('submit_submission_status_by_hash',
|
||||
|
@ -33,6 +33,7 @@ admin.site.register(SubmissionEvent, SubmissionEventAdmin)
|
|||
class SubmissionCheckAdmin(admin.ModelAdmin):
|
||||
list_display = ['submission', 'time', 'checker', 'passed', 'errors', 'warnings', 'items']
|
||||
raw_id_fields = ['submission']
|
||||
search_fields = ['submission__name']
|
||||
admin.site.register(SubmissionCheck, SubmissionCheckAdmin)
|
||||
|
||||
class PreapprovalAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -44,6 +44,11 @@ class DraftIdnitsChecker(object):
|
|||
"""
|
||||
name = "idnits check"
|
||||
|
||||
# start using this when we provide more in the way of warnings during
|
||||
# submission checking:
|
||||
# symbol = '<span class="fa fa-check-square"></span>'
|
||||
symbol = ""
|
||||
|
||||
def check_file_txt(self, path):
|
||||
"""
|
||||
Run an idnits check, and return a passed/failed indication, a message,
|
||||
|
@ -107,6 +112,7 @@ class DraftIdnitsChecker(object):
|
|||
class DraftYangChecker(object):
|
||||
|
||||
name = "yang validation"
|
||||
symbol = u'<span class="large">\u262f</span>'
|
||||
|
||||
def check_file_txt(self, path):
|
||||
name = os.path.basename(path)
|
||||
|
|
|
@ -45,6 +45,8 @@ class Submission(models.Model):
|
|||
|
||||
submitter = models.CharField(max_length=255, blank=True, help_text="Name and email of submitter, e.g. \"John Doe <john@example.org>\".")
|
||||
|
||||
draft = models.ForeignKey(Document, null=True, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s-%s" % (self.name, self.rev)
|
||||
|
||||
|
@ -74,6 +76,7 @@ class SubmissionCheck(models.Model):
|
|||
errors = models.IntegerField(null=True, blank=True, default=None)
|
||||
warnings = models.IntegerField(null=True, blank=True, default=None)
|
||||
items = jsonfield.JSONField(null=True, blank=True, default='{}')
|
||||
symbol = models.CharField(max_length=64, default='')
|
||||
#
|
||||
def __unicode__(self):
|
||||
return "%s submission check: %s: %s" % (self.checker, 'Passed' if self.passed else 'Failed', self.message[:48]+'...')
|
||||
|
|
|
@ -27,9 +27,11 @@ api.submit.register(PreapprovalResource())
|
|||
|
||||
from ietf.group.resources import GroupResource
|
||||
from ietf.name.resources import DraftSubmissionStateNameResource
|
||||
from ietf.doc.resources import DocumentResource
|
||||
class SubmissionResource(ModelResource):
|
||||
state = ToOneField(DraftSubmissionStateNameResource, 'state')
|
||||
group = ToOneField(GroupResource, 'group', null=True)
|
||||
draft = ToOneField(DocumentResource, 'draft', null=True)
|
||||
class Meta:
|
||||
cache = SimpleCache()
|
||||
queryset = Submission.objects.all()
|
||||
|
@ -56,6 +58,7 @@ class SubmissionResource(ModelResource):
|
|||
"submitter": ALL,
|
||||
"state": ALL_WITH_RELATIONS,
|
||||
"group": ALL_WITH_RELATIONS,
|
||||
"draft": ALL_WITH_RELATIONS,
|
||||
}
|
||||
api.submit.register(SubmissionResource())
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ def post_submission(request, submission):
|
|||
if new_possibly_replaces:
|
||||
send_review_possibly_replaces_request(request, draft, submitter_info)
|
||||
|
||||
submission.draft = draft
|
||||
submission.save()
|
||||
|
||||
def update_replaces_from_submission(request, submission, draft):
|
||||
|
|
|
@ -121,7 +121,7 @@ def upload_submission(request):
|
|||
def apply_check(submission, checker, method, fn):
|
||||
func = getattr(checker, method)
|
||||
passed, message, errors, warnings, items = func(fn)
|
||||
check = SubmissionCheck(submission=submission, checker=checker.name, passed=passed, message=message, errors=errors, warnings=warnings, items=items)
|
||||
check = SubmissionCheck(submission=submission, checker=checker.name, passed=passed, message=message, errors=errors, warnings=warnings, items=items, symbol=checker.symbol)
|
||||
check.save()
|
||||
|
||||
for checker_path in settings.IDSUBMIT_CHECKER_CLASSES:
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<li><a href="/iesg/agenda/">IESG agenda</a></li>
|
||||
<li><a href="/group/edu/materials/">Tutorials</a></li>
|
||||
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}
|
||||
<li><a href="https://tools.ietf.org/tools/ietfdb/newticket"><span class="fa fa-bug llarge"></span> Report a bug</a></li>
|
||||
<li><a href="https://tools.ietf.org/tools/ietfdb/newticket"><span class="fa fa-bug"></span> Report a bug</a></li>
|
||||
{% if flavor == "top" %}</ul>{% endif %}
|
||||
|
||||
{% if flavor == "top" %}
|
||||
|
|
|
@ -76,6 +76,15 @@
|
|||
{% if latest_revision and latest_revision.time.date != doc.time.date %}
|
||||
(latest revision {{ latest_revision.time|date:"Y-m-d" }})
|
||||
{% endif %}
|
||||
{% for check in doc.submission.checks.all %}
|
||||
{% if check.passed != None and check.symbol.strip %}
|
||||
{% if check.errors or check.warnings %}
|
||||
<span class="checker-warning" title="Submission {{check.checker|title}} returned warnings or errors.">{{ check.symbol|safe }}</span>
|
||||
{% else %}
|
||||
<span class="checker-success" title="Submission {{check.checker|title}} passed">{{ check.symbol|safe }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -59,13 +59,22 @@
|
|||
{% if doc.latest_revision_date|timesince_days|new_enough:request and doc.get_state_slug != "rfc" %}</a>{% endif %}
|
||||
</span>
|
||||
|
||||
{% for check in doc.submission.checks.all %}
|
||||
{% if check.passed != None and check.symbol.strip %}
|
||||
{% if check.errors or check.warnings %}
|
||||
<span class="checker-warning pull-right" title="{{check.checker|title}} returned warnings or errors.">{{ check.symbol|safe }}</span>
|
||||
{% else %}
|
||||
<span class="checker-success pull-right" title="{{check.checker|title}} passed">{{ check.symbol|safe }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if doc.pages %}
|
||||
<br><small class="text-muted">{{doc.pages}} page{{ doc.pages|pluralize }}</small>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if doc.latest_revision_date|timesince_days|new_enough:request %}
|
||||
<wbr><span class="label label-success pull-right">New</span>
|
||||
<wbr><span class="label label-success">New</span>
|
||||
{% endif %}
|
||||
|
||||
{% if doc.get_state_slug == "active" and doc.expirable and doc.expires|timesince_days|expires_soon:request %}
|
||||
|
|
Loading…
Reference in a new issue