SFM/app/ui.py
2026-06-04 14:13:30 +03:00

32 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
import streamlit as st
from app.config import SETTINGS_PREFIX, get_missing_settings
def render_env_check() -> None:
with st.expander("Проверка env окружения"):
if st.button("Проверить OPENBAO__SETTINGS", use_container_width=True):
missing = get_missing_settings()
if missing:
st.error("Не заданы обязательные переменные:")
for name in missing:
st.code(f"{SETTINGS_PREFIX}{name} (резерв: {name})", language="text")
else:
st.success("Все обязательные переменные заданы.")
def render_profile(profile: dict) -> None:
st.success("Аутентификация через Keycloak Raisa выполнена.")
st.subheader("Профиль пользователя")
st.json(
{
"email": profile.get("email"),
"preferred_username": profile.get("preferred_username"),
"name": profile.get("name"),
"realm_roles": profile.get("realm_access", {}).get("roles", []),
}
)