core: UIUserSettings: remove icon, rename view_name to URL for complete URL

This commit is contained in:
Jens Langhammer 2020-06-29 16:20:33 +02:00
parent 693a92ada5
commit d6a8d8292d
5 changed files with 7 additions and 16 deletions

View File

@ -25,8 +25,7 @@
<ul class="pf-c-nav__list"> <ul class="pf-c-nav__list">
{% for stage in user_stages_loc %} {% for stage in user_stages_loc %}
<li class="pf-c-nav__item"> <li class="pf-c-nav__item">
<a href="{% url stage.view_name %}" class="pf-c-nav__link {% is_active stage.view_name %}"> <a href="{{ stage.url }}" class="pf-c-nav__link {% is_active stage.view_name %}">
<i class="{{ stage.icon }}"></i>
{{ stage.name }} {{ stage.name }}
</a> </a>
</li> </li>
@ -43,7 +42,6 @@
<li class="pf-c-nav__item"> <li class="pf-c-nav__item">
<a href="{{ source.view_name }}" <a href="{{ source.view_name }}"
class="pf-c-nav__link {% if user_settings.view_name == request.get_full_path %} pf-m-current {% endif %}"> class="pf-c-nav__link {% if user_settings.view_name == request.get_full_path %} pf-m-current {% endif %}">
<i class="{{ source.icon }}"></i>
{{ source.name }} {{ source.name }}
</a> </a>
</li> </li>

View File

@ -8,8 +8,7 @@ class UIUserSettings:
"""Dataclass for Stage and Source's user_settings""" """Dataclass for Stage and Source's user_settings"""
name: str name: str
icon: str url: str
view_name: str
@dataclass @dataclass

View File

@ -15,6 +15,7 @@ from django.views.decorators.clickjacking import xframe_options_sameorigin
from django.views.generic import TemplateView, View from django.views.generic import TemplateView, View
from structlog import get_logger from structlog import get_logger
from passbook.audit.models import sanitize_dict
from passbook.core.views.utils import PermissionDeniedView from passbook.core.views.utils import PermissionDeniedView
from passbook.flows.exceptions import EmptyFlowException, FlowNonApplicableException from passbook.flows.exceptions import EmptyFlowException, FlowNonApplicableException
from passbook.flows.models import Flow, FlowDesignation, Stage from passbook.flows.models import Flow, FlowDesignation, Stage
@ -161,7 +162,7 @@ class FlowExecutorView(View):
LOGGER.debug( LOGGER.debug(
"f(exec): User passed all stages", "f(exec): User passed all stages",
flow_slug=self.flow.slug, flow_slug=self.flow.slug,
context=self.plan.context, context=sanitize_dict(self.plan.context),
) )
return self._flow_done() return self._flow_done()

View File

@ -62,15 +62,9 @@ class OAuthSource(Source):
@property @property
def ui_user_settings(self) -> UIUserSettings: def ui_user_settings(self) -> UIUserSettings:
icon_type = self.provider_type
if icon_type == "azure ad":
icon_type = "windows"
icon_class = f"fab fa-{icon_type}"
view_name = "passbook_sources_oauth:oauth-client-user" view_name = "passbook_sources_oauth:oauth-client-user"
return UIUserSettings( return UIUserSettings(
name=self.name, name=self.name, url=reverse(view_name, kwargs={"source_slug": self.slug}),
icon=icon_class,
view_name=reverse((view_name), kwargs={"source_slug": self.slug}),
) )
def __str__(self) -> str: def __str__(self) -> str:

View File

@ -1,5 +1,6 @@
"""OTP Stage""" """OTP Stage"""
from django.db import models from django.db import models
from django.urls import reverse
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from passbook.core.types import UIUserSettings from passbook.core.types import UIUserSettings
@ -20,9 +21,7 @@ class OTPStage(Stage):
@property @property
def ui_user_settings(self) -> UIUserSettings: def ui_user_settings(self) -> UIUserSettings:
return UIUserSettings( return UIUserSettings(
name="OTP", name="OTP", url=reverse("passbook_stages_otp:otp-user-settings"),
icon="pficon-locked",
view_name="passbook_stages_otp:otp-user-settings",
) )
def __str__(self): def __str__(self):