Skip to content

Commit

Permalink
Merge branch 'develop' into feature/1791-design-status-case-detail
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma authored Nov 1, 2023
2 parents b30845d + 88ae2db commit 28e76a9
Show file tree
Hide file tree
Showing 26 changed files with 419 additions and 113 deletions.
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ django-csp==3.7
# via -r requirements/base.in
django-csp-reports==1.8.1
# via -r requirements/base.in
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via -r requirements/base.in
django-elasticsearch-dsl==7.2.1
# via -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ django-csp-reports==1.8.1
# via
# -c requirements/base.txt
# -r requirements/base.txt
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ django-csp-reports==1.8.1
# -r requirements/ci.txt
django-debug-toolbar==3.2.2
# via -r requirements/dev.in
django-digid-eherkenning==0.7.0
django-digid-eherkenning==0.9.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
Expand Down
34 changes: 23 additions & 11 deletions src/open_inwoner/accounts/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import date
from unittest.mock import patch
from urllib.parse import urlencode

from django.contrib.sites.models import Site
Expand Down Expand Up @@ -68,7 +69,11 @@ def test_registration_page_only_digid_with_invite(self):
furl(reverse("digid:login")).add({"next": necessary_url}).url,
)

def test_digid_fail_without_invite_redirects_to_login_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_without_invite_redirects_to_login_page(self, m):
# disable mock form validation to check redirect
m.return_value = True

self.assertNotIn("invite_url", self.client.session.keys())

url = reverse("digid-mock:password")
Expand All @@ -87,7 +92,11 @@ def test_digid_fail_without_invite_redirects_to_login_page(self):

self.assertRedirectsLogin(response, with_host=True)

def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self, m):
# disable mock form validation to check redirect
m.return_value = True

self.assertNotIn("invite_url", self.client.session.keys())

url = reverse("digid-mock:password")
Expand All @@ -106,7 +115,10 @@ def test_digid_fail_without_invite_and_next_url_redirects_to_login_page(self):

self.assertRedirectsLogin(response, with_host=True)

def test_digid_fail_with_invite_redirects_to_register_page(self):
@patch("digid_eherkenning.validators.Proef11ValidatorBase.__call__")
def test_digid_fail_with_invite_redirects_to_register_page(self, m):
# disable mock form validation to check redirect
m.return_value = True
invite = InviteFactory()
session = self.client.session
session[
Expand Down Expand Up @@ -149,7 +161,7 @@ def test_invite_url_not_in_session_after_successful_login(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}

Expand All @@ -175,7 +187,7 @@ def test_user_can_modify_only_email_when_digid_and_brp(self, m):
"next": reverse("profile:registration_necessary"),
}
data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
url = f"{url}?{urlencode(params)}"
Expand Down Expand Up @@ -223,7 +235,7 @@ def test_partial_response_from_haalcentraal_when_digid_and_brp(self, m):
"next": reverse("profile:registration_necessary"),
}
data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
url = f"{url}?{urlencode(params)}"
Expand Down Expand Up @@ -260,7 +272,7 @@ def test_first_digid_login_updates_brp_fields(self, m):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456782",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -691,7 +703,7 @@ def test_digid_user_success(self):
"""Assert that digid users can register with duplicate emails"""
test_user = DigidUserFactory.create(
email="test@example.com",
bsn="123456789",
bsn="648197724",
)

url = reverse("digid-mock:password")
Expand All @@ -703,7 +715,7 @@ def test_digid_user_success(self):

data = {
# different BSN
"auth_name": "112083948",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -780,7 +792,7 @@ def test_digid_user_non_digid_duplicate_fail(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456789",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down Expand Up @@ -816,7 +828,7 @@ def test_digid_user_can_edit_profile(self):
url = f"{url}?{urlencode(params)}"

data = {
"auth_name": "123456782",
"auth_name": "533458225",
"auth_pass": "bar",
}
# post our password to the IDP
Expand Down
9 changes: 0 additions & 9 deletions src/open_inwoner/cms/cases/tests/test_htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,6 @@ def test_cases(self, m):
# check case is visible
expect(page.get_by_text(self.zaak["identificatie"])).to_be_visible()

# out-of-band anchor menu
menu_items = page.get_by_role(
"complementary", name=_("Secundaire paginanavigatie")
).get_by_role("listitem")

expect(menu_items.get_by_role("link", name=_("Gegevens"))).to_be_visible()
expect(menu_items.get_by_role("link", name=_("Status"))).to_be_visible()
expect(menu_items.get_by_role("link", name=_("Documenten"))).to_be_visible()

# check documents show
documents = page.locator(".file-list").get_by_role("listitem")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<ul class="dashboard__list">
{% for metric in config.metrics %}
<li class="dashboard__list-item">
{% icon metric.icon outlined=True %}
<h4 class="h4">{{ metric.label }}</h4>
<p class="p p--compact">{{ metric.value|default:'-' }}</p>
<p class="p p--compact"><span class="dashboard__item-label">{{ metric.label }}</span> {{ metric.value|default:'-' }}</p>
</li>
{% endfor %}
</ul>
Expand Down
28 changes: 8 additions & 20 deletions src/open_inwoner/components/templatetags/dashboard_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Metric(TypedDict):
icon: str
label: str
value: Optional[str]

Expand All @@ -27,32 +26,24 @@ def case_dashboard(case: dict, **kwargs) -> dict:
{% case_dashboard case %}
Variables:
+ case: dict | The case to be able to build the dashboard, fetching the documents and statusses of the case.
+ case: dict | The case to be able to build the dashboard, fetching the documents and statuses of the case.
Extra context:
+ config: DashboardConfig | The configuration of the dashboard.
"""
config: DashboardConfig = {
"metrics": [
{
"icon": "inventory_2",
"label": _("Aanvraag"),
"label": _("Zaaknummer:"),
"value": case.get("identification"),
},
{
"icon": "calendar_today",
"label": _("Datum"),
"label": _("Aanvraag ingediend op:"),
"value": case.get("start_date"),
},
{
"icon": "task_alt",
"label": _("Status"),
"value": case.get("current_status"),
},
{
"icon": "description",
"label": _("Documenten"),
"value": len(case.get("documents")),
"label": _("Verwachte uitslag:"),
"value": case.get("end_date_legal"),
},
]
}
Expand Down Expand Up @@ -80,18 +71,15 @@ def contactmoment_dashboard(kcm: KCMDict, **kwargs) -> dict:
config: DashboardConfig = {
"metrics": [
{
"icon": "calendar_today",
"label": _("Ontvangstdatum"),
"label": _("Ontvangstdatum: "),
"value": kcm.get("registered_date"),
},
{
"icon": "inventory_2",
"label": _("Contactwijze"),
"label": _("Contactwijze: "),
"value": kcm.get("channel"),
},
{
"icon": "task_alt",
"label": _("Status"),
"label": _("Status: "),
"value": kcm.get("status"),
},
]
Expand Down
27 changes: 27 additions & 0 deletions src/open_inwoner/openzaak/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
UserCaseStatusNotification,
ZaakTypeConfig,
ZaakTypeInformatieObjectTypeConfig,
ZaakTypeResultaatTypeConfig,
ZaakTypeStatusTypeConfig,
)
from .resources.import_resource import StatusTranslationImportResource
Expand Down Expand Up @@ -202,11 +203,37 @@ def has_delete_permission(self, request, obj=None):
return request.user.is_superuser


class ZaakTypeResultaattypeConfigInline(admin.TabularInline):
model = ZaakTypeResultaatTypeConfig
fields = [
"omschrijving",
"resultaattype_url",
"zaaktype_uuids",
"description",
]
readonly_fields = [
"omschrijving",
"resultaattype_url",
"zaaktype_uuids",
]
ordering = (
"zaaktype_uuids",
"omschrijving",
)

def has_add_permission(self, request, obj):
return False

def has_delete_permission(self, request, obj=None):
return request.user.is_superuser


@admin.register(ZaakTypeConfig)
class ZaakTypeConfigAdmin(admin.ModelAdmin):
inlines = [
ZaakTypeInformatieObjectTypeConfigInline,
ZaakTypeStatusTypeConfigInline,
ZaakTypeResultaattypeConfigInline,
]
actions = [
"mark_as_notify_status_changes",
Expand Down
20 changes: 20 additions & 0 deletions src/open_inwoner/openzaak/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ def fetch_single_status_type(status_type_url: str) -> Optional[StatusType]:
return status_type


@cache_result(
"resultaat_type:{resultaat_type_url}", timeout=settings.CACHE_ZGW_CATALOGI_TIMEOUT
)
def fetch_single_resultaat_type(resultaat_type_url: str) -> Optional[ResultaatType]:
client = build_client("catalogi")

if client is None:
return

try:
response = client.retrieve("resultaattype", url=resultaat_type_url)
except (RequestException, ClientError) as e:
logger.exception("exception while making request", exc_info=e)
return

resultaat_type = factory(ResultaatType, response)

return resultaat_type


# not cached because only used by tools,
# and because caching (stale) listings can break lookups
def fetch_zaaktypes_no_cache() -> List[ZaakType]:
Expand Down
Loading

0 comments on commit 28e76a9

Please sign in to comment.