feat: highlight unexpected state in AD dashboard (#8738)

* feat: highlight unexpected state in AD dashboard

* test: add tests for is_unexpected_wg_state

* test: improve tests using WgDraftFactory
This commit is contained in:
Rudi Matz 2025-03-27 18:19:30 -04:00 committed by GitHub
parent 431c475060
commit 752bc21031
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 0 deletions

View file

@ -480,6 +480,19 @@ def state(doc, slug):
slug = "%s-stream-%s" % (doc.type_id, doc.stream_id)
return doc.get_state(slug)
@register.filter
def is_unexpected_wg_state(doc):
"""Returns a flag indicating whether the document has an unexpected wg state."""
if not doc.type_id == "draft":
return False
draft_iesg_state = doc.get_state("draft-iesg")
draft_stream_state = doc.get_state("draft-stream-ietf")
return draft_iesg_state.slug != "idexists" and draft_stream_state is not None and draft_stream_state.slug != "sub-pub"
@register.filter
def statehelp(state):
"Output help icon with tooltip for state."

View file

@ -14,12 +14,14 @@ from ietf.doc.factories import (
ConflictReviewFactory,
BofreqFactory,
StatementFactory,
RfcFactory,
)
from ietf.doc.models import DocEvent
from ietf.doc.templatetags.ietf_filters import (
urlize_ietf_docs,
is_valid_url,
is_in_stream,
is_unexpected_wg_state,
)
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase
@ -174,3 +176,17 @@ class IetfFiltersTests(TestCase):
for input, output in cases:
# debug.show("(input, urlize_ietf_docs(input), output)")
self.assertEqual(urlize_ietf_docs(input), output)
def test_is_unexpected_wg_state(self):
"""
Test that the unexpected_wg_state function works correctly
"""
# test documents with expected wg states
self.assertFalse(is_unexpected_wg_state(RfcFactory()))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'sub-pub')])))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-iesg', 'idexists')])))
self.assertFalse(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'wg-cand'), ('draft-iesg','idexists')])))
# test documents with unexpected wg states due to invalid combination of states
self.assertTrue(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'wg-cand'), ('draft-iesg','lc-req')])))
self.assertTrue(is_unexpected_wg_state(WgDraftFactory (states=[('draft-stream-ietf', 'chair-w'), ('draft-iesg','pub-req')])))

View file

@ -78,6 +78,10 @@
{% person_link action_holder.person title=action_holder.role_for_doc %}{% if action_holder|action_holder_badge %} {{ action_holder|action_holder_badge }}{% endif %}{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if doc|is_unexpected_wg_state %}
<br>
<span class="badge rounded-pill text-bg-warning">Unexpected WG state</span>
{% endif %}
{% else %}
{# RFC #}
{{ doc.std_level|safe }} RFC