Skip to content
Snippets Groups Projects
Verified Commit 2bec3b75 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Optimize GraphQL queries and reformat

parent 0ef572f5
No related branches found
No related tags found
2 merge requests!1123Resolve "Finalise Vuetify app as SPA",!1066Translations update from Weblate
Pipeline #103710 failed
......@@ -3,7 +3,7 @@
<loading
v-if="
$apollo.loading &&
(!currentUser || !whoAmI || !sitePreferences || !messages)
(!currentUser || !whoAmI || !systemProperties || !messages)
"
>
</loading>
......@@ -12,7 +12,9 @@
<v-list nav dense shaped>
<v-list-item class="logo">
<a id="logo-container" href="/" class="brand-logo">
<brand-logo :site-preferences="sitePreferences"></brand-logo>
<brand-logo
:site-preferences="systemProperties.sitePreferences"
></brand-logo>
<!-- FIXME Translation -->
</a>
</v-list-item>
......@@ -71,7 +73,7 @@
class="white--text text-decoration-none"
href="/"
>
{{ sitePreferences.generalTitle }}
{{ systemProperties.sitePreferences.generalTitle }}
</v-toolbar-title>
<v-spacer></v-spacer>
......@@ -83,7 +85,8 @@
<v-avatar v-bind="attrs" v-on="on">
<img
v-if="
sitePreferences.accountPersonPreferPhoto && whoAmI.photo
systemProperties.sitePreferences.accountPersonPreferPhoto &&
whoAmI.photo
"
:src="whoAmI.photo.url"
:alt="whoAmI.fullName"
......@@ -189,22 +192,22 @@
</v-col>
<v-col class="d-flex justify-end">
<v-btn
v-if="sitePreferences.footerImprintUrl"
v-if="systemProperties.sitePreferences.footerImprintUrl"
small
text
:href="sitePreferences.footerImprintUrl"
:href="systemProperties.sitePreferences.footerImprintUrl"
color="white"
>
{{ $t("base.imprint") }}
</v-btn>
<v-btn
v-if="sitePreferences.footerPrivacyUrl"
v-if="systemProperties.sitePreferences.footerPrivacyUrl"
small
text
:href="sitePreferences.footerPrivacyUrl"
:href="systemProperties.sitePreferences.footerPrivacyUrl"
color="white"
>
{{ $t("base_privacy_policy") }}
{{ $t("base.privacy_policy") }}
</v-btn>
</v-col>
</v-row>
......@@ -271,7 +274,7 @@ export default {
drawer: vuetify.framework.breakpoint.lgAndUp,
currentUser: null,
whoAmI: null,
sitePreferences: null,
systemProperties: null,
messages: null,
openMenuItems: {},
};
......@@ -291,13 +294,28 @@ export default {
whoAmI: {
query: require("./whoAmI.graphql"),
},
sitePreferences: {
query: require("./sitePreferences.graphql"),
},
messages: {
query: require("./messages.graphql"),
pollInterval: 1000,
},
systemProperties: require("./systemProperties.graphql"),
},
watch: {
systemProperties: function (newProperties) {
this.$i18n.locale = newProperties.currentLanguage;
this.$vuetify.lang.current = newProperties.currentLanguage;
this.$vuetify.theme.themes.light.primary =
newProperties.sitePreferences.themePrimary;
this.$vuetify.theme.themes.light.secondary =
newProperties.sitePreferences.themeSecondary;
this.$vuetify.theme.themes.dark.primary =
newProperties.sitePreferences.themePrimary;
this.$vuetify.theme.themes.dark.secondary =
newProperties.sitePreferences.themeSecondary;
},
whoAmI: function (person) {
this.$vuetify.theme.dark = person.preferences.themeDesignMode === "dark";
},
},
name: "App",
components: {
......
......@@ -60,44 +60,7 @@ const app = new Vue({
django: window.django,
// FIXME: maybe just use window.django in every component or find a suitable way to access this property everywhere
showCacheAlert: false,
systemProperties: {
currentLanguage: "en",
availableLanguages: [],
},
sitePreferences: {
themePrimary: "",
themeSecondary: "",
},
personPreferences: {
preferences: {
themeDesignMode: "light",
},
},
}),
apollo: {
systemProperties: require("./systemProperties.graphql"),
sitePreferences: require("./sitePreferences.graphql"),
whoAmI: require("./personPreferences.graphql"),
},
watch: {
systemProperties: function (newProperties) {
this.$i18n.locale = newProperties.currentLanguage;
this.$vuetify.lang.current = newProperties.currentLanguage;
},
sitePreferences: function (newSitePreferences) {
this.$vuetify.theme.themes.light.primary =
newSitePreferences.themePrimary;
this.$vuetify.theme.themes.light.secondary =
newSitePreferences.themeSecondary;
this.$vuetify.theme.themes.dark.primary = newSitePreferences.themePrimary;
this.$vuetify.theme.themes.dark.secondary =
newSitePreferences.themeSecondary;
},
whoAmI: function (newPersonPreferences) {
this.$vuetify.theme.dark =
newPersonPreferences.preferences.themeDesignMode === "dark";
},
},
router,
i18n,
});
......
......@@ -3,7 +3,7 @@
<loading v-if="loading" />
<iframe
:src="'/django' + $route.path"
style="border: 0; margin: -12px;"
style="border: 0; margin: -12px"
width="100%"
:height="iFrameHeight + 'px'"
@load="load"
......
{
"de": {
"about": {
"about_aleksis": "Über AlekSIS®",
"about_aleksis_1": "Diese Plattform wird mit AlekSIS®, einem webbasierten Schulinformationssystem (SIS), welches für die Verwaltung und/oder Veröffentlichung von Bildungseinrichtungen verwendet werden kann. AlekSIS ist freie Software und kann von jedem benutzt werden.",
"about_aleksis_2": " AlekSIS® ist eine eingetragene Wortmarke des Open-Source-Projektes AlekSIS, vertreten durch den Teckids e.V.",
"free_open_source_licence": "Freie/Open Source Lizenz",
"free_software": "Freie Software",
"full_licence_text": "Kompletter Lizenztext",
"licence_consists_of": "Die Lizenz besteht aus",
"licence_information": "Lizenzinformationen",
"licence_information_1": " Der Core und die offiziellen Apps von AlekSIS sind unter der EUPL, Version 1.2 oder später, lizenziert. Für Lizenzinformationen zu Apps von Drittanbietern, wenn installiert, siehe direkt bei der jeweiligen App weiter unten auf dieser Seite. Die Lizenzen sind wie folgt markiert:",
"licence_type": "Lizenztyp",
"licenced_under": "Lizensiert unter",
"more_information_eupl": "Weitere Informationen über die EUPL",
"open_source": "Open Source",
"other_licence": "Andere Lizenz",
"proprietary": "Proprietär",
"source_code": "Quellcode",
"website_of_aleksis": "Website von AlekSIS"
},
"actions": {
"back": "Zurück",
"search": "Suchen"
},
"alerts": {
"page_cached": "Diese Seite enthält vielleicht veraltete Informationen, da es keine Internetverbindung gibt."
},
"base": {
"about_aleksis": "Über AlekSIS® — The Free School Information System",
"imprint": "Impressum",
"person_is_dummy": "Ihr Administratorenkonto ist mit keiner Person verknüpft. Deshalb wurde Ihr Konto mit einer Dummyperson verknüpft.",
"privacy_policy": "Datenschutzerklärung",
"user_not_linked_to_person": "Ihr Benutzerkonto ist nicht mit einer Person verknüpft. Das bedeutet, dass Sie keine schulbezogenen Informationen aufrufen können. Bitte wenden Sie sich an die Verwaltenden von AlekSIS an Ihrer Schule."
},
"celery_progress": {
"error_message": "Der Vorgang konnte nicht erfolgreich beendet werden.",
"progress_title": "Wird geladen ...",
"running_tasks": "1 laufende Aufgabe | {number} laufende Aufgaben",
"success_message": "Der Vorgang wurde erfolgreich beendet."
},
"notifications": {
"mark_as_read": "Als gelesen markieren",
"more_information": "Mehr Informationen",
"no_notifications": "Sie haben keine neuen Benachrichtigungen.",
"notifications": "Benachrichtigungen"
},
"person": {
"avatar": "Avatar",
"logged_in_as": "Angemeldet als"
}
},
"en": {
"about": {
"about_aleksis": "About AlekSIS®",
"about_aleksis_1": "This platform is powered by AlekSIS®, a web-based school information system (SIS) which can be used to manage and/or publish organisational artifacts of educational institutions. AlekSIS is free software and can be used by anyone.",
"about_aleksis_2": "AlekSIS® is a registered trademark of the AlekSIS open source project, represented by Teckids e.V.",
"free_open_source_licence": "Free/Open Source Licence",
"free_software": "Free Software",
"full_licence_text": "Full Licence Text",
"licence_consists_of": "The licence consists of",
"licence_information": "Licence Information",
"licence_information_1": "The core and the official apps of AlekSIS are licenced under the EUPL, version 1.2 or later. For licence information from third-party apps, if installed, refer to the respective components below. The licences are marked like this:",
"licence_type": "Licence Type",
"licenced_under": "Licenced under",
"more_information_eupl": "More information about the EUPL",
"open_source": "Open Source",
"other_licence": "Other Licence",
"proprietary": "Proprietary",
"source_code": "Source Code",
"website_of_aleksis": "Website of AlekSIS"
},
"accounts": {
"login": {
"menu_title": "Login"
},
"logout": {
"menu_title": "Logout"
},
"signup": {
"menu_title": "Sign Up"
"change_password": {
"menu_title": "Change Password"
},
"invitation": {
"accept_invitation": {
......@@ -18,72 +82,97 @@
"menu_title": "Invite Person"
}
},
"two_factor": {
"menu_title": "2FA"
"login": {
"menu_title": "Login"
},
"change_password": {
"menu_title": "Change Password"
"logout": {
"menu_title": "Logout"
},
"signup": {
"menu_title": "Sign Up"
},
"social_connections": {
"menu_title": "Third-party Accounts"
},
"two_factor": {
"menu_title": "2FA"
}
},
"actions": {
"back": "Back",
"search": "Search"
},
"administration": {
"backend_admin": {
"menu_title": "Backend Admin"
},
"menu_title": "Administration",
"system_status": {
"menu_title": "System Status"
},
"backend_admin": {
"menu_title": "Backend Admin"
}
},
"alerts": {
"page_cached": "This page may contain outdated information since there is no internet connection."
},
"announcement": {
"menu_title": "Announcements",
"title": "Announcement",
"title_plural": "Announcements"
},
"base": {
"person_is_dummy": "Your administrator account is not linked to any person. Therefore, a dummy person has been linked to your account.",
"user_not_linked_to_person": "Your user account is not linked to a person. This means you cannot access any school-related information. Please contact the managers of AlekSIS at your school.",
"about_aleksis": "About AlekSIS® — The Free School Information System",
"imprint": "Imprint",
"privacy_policy": "Privacy Policy"
"person_is_dummy": "Your administrator account is not linked to any person. Therefore, a dummy person has been linked to your account.",
"privacy_policy": "Privacy Policy",
"user_not_linked_to_person": "Your user account is not linked to a person. This means you cannot access any school-related information. Please contact the managers of AlekSIS at your school."
},
"celery_progress": {
"error_message": "The operation couldn't be finished successfully.",
"progress_title": "Loading ...",
"running_tasks": "1 running task | {number} running tasks",
"success_message": "The operation has been finished successfully."
},
"dashboard": {
"menu_title": "Dashboard",
"dashboard_widget": {
"menu_title": "Dashboard Widgets",
"title": "Dashboard Widget",
"title_plural": "Dashboard Widgets",
"menu_title": "Dashboard Widgets"
}
"title_plural": "Dashboard Widgets"
},
"menu_title": "Dashboard"
},
"data_check": {
"menu_title": "Data Checks"
},
"ical_feed": {
"menu_title": "Calendar Feeds"
},
"group": {
"menu_title": "Groups",
"title": "Group",
"title_plural": "Groups",
"groups_and_child_groups": "Groups and Child Groups",
"additional_field": {
"menu_title": "Additional Fields",
"title": "Additional Field",
"title_plural": "Additional Fields"
},
"group_type": {
"menu_title": "Group Types",
"title": "Group Type",
"title_plural": "Group Types",
"menu_title": "Group Types"
"title_plural": "Group Types"
},
"additional_field": {
"title": "Additional Field",
"title_plural": "Additional Fields",
"menu_title": "Additional Fields"
}
"groups_and_child_groups": "Groups and Child Groups",
"menu_title": "Groups",
"title": "Group",
"title_plural": "Groups"
},
"ical_feed": {
"menu_title": "Calendar Feeds"
},
"notifications": {
"mark_as_read": "Mark as read",
"more_information": "More information",
"no_notifications": "You have no new notifications.",
"notifications": "Notifications"
},
"oauth": {
"application": {
"menu_title": "OAuth Applications",
"title": "OAuth Application",
"title_plural": "OAuth Applications",
"menu_title": "OAuth Applications"
"title_plural": "OAuth Applications"
},
"authorized_token": {
"menu_title": "Authorized Applications"
......@@ -96,114 +185,25 @@
}
},
"person": {
"title": "Person",
"title_plural": "Persons",
"menu_title": "Persons",
"account_menu_title": "Account",
"avatar": "Avatar",
"logged_in_as": "Logged in as"
"logged_in_as": "Logged in as",
"menu_title": "Persons",
"title": "Person",
"title_plural": "Persons"
},
"preferences": {
"site": {
"menu_title": "Site Preferences"
},
"person": {
"menu_title": "Preferences"
},
"site": {
"menu_title": "Configuration"
}
},
"school_term": {
"menu_title": "School Terms",
"title": "School Term",
"title_plural": "School Terms",
"menu_title": "School Terms"
},
"notifications": {
"notifications": "Notifications",
"more_information": "More information",
"no_notifications": "You have no new notifications.",
"mark_as_read": "Mark as read"
},
"alerts": {
"page_cached": "This page may contain outdated information since there is no internet connection."
},
"celery_progress": {
"progress_title": "Loading ...",
"error_message": "The operation couldn't be finished successfully.",
"success_message": "The operation has been finished successfully.",
"running_tasks": "1 running task | {number} running tasks"
},
"actions": {
"back": "Back",
"search": "Search"
},
"about": {
"about_aleksis": "About AlekSIS®",
"licenced_under": "Licenced under",
"licence_type": "Licence Type",
"free_software": "Free Software",
"open_source": "Open Source",
"proprietary": "Proprietary",
"licence_consists_of": "The licence consists of",
"about_aleksis_1": "This platform is powered by AlekSIS®, a web-based school information system (SIS) which can be used to manage and/or publish organisational artifacts of educational institutions. AlekSIS is free software and can be used by anyone.",
"about_aleksis_2": "AlekSIS® is a registered trademark of the AlekSIS open source project, represented by Teckids e.V.",
"website_of_aleksis": "Website of AlekSIS",
"source_code": "Source Code",
"licence_information": "Licence Information",
"licence_information_1": "The core and the official apps of AlekSIS are licenced under the EUPL, version 1.2 or later. For licence information from third-party apps, if installed, refer to the respective components below. The licences are marked like this:",
"free_open_source_licence": "Free/Open Source Licence",
"other_licence": "Other Licence",
"full_licence_text": "Full Licence Text",
"more_information_eupl": "More information about the EUPL"
}
},
"de": {
"base": {
"person_is_dummy": "Ihr Administratorenkonto ist mit keiner Person verknüpft. Deshalb wurde Ihr Konto mit einer Dummyperson verknüpft.",
"user_not_linked_to_person": "Ihr Benutzerkonto ist nicht mit einer Person verknüpft. Das bedeutet, dass Sie keine schulbezogenen Informationen aufrufen können. Bitte wenden Sie sich an die Verwaltenden von AlekSIS an Ihrer Schule.",
"about_aleksis": "Über AlekSIS® — The Free School Information System",
"imprint": "Impressum",
"privacy_policy": "Datenschutzerklärung"
},
"person": {
"avatar": "Avatar",
"logged_in_as": "Angemeldet als"
},
"notifications": {
"notifications": "Benachrichtigungen",
"more_information": "Mehr Informationen",
"no_notifications": "Sie haben keine neuen Benachrichtigungen.",
"mark_as_read": "Als gelesen markieren"
},
"alerts": {
"page_cached": "Diese Seite enthält vielleicht veraltete Informationen, da es keine Internetverbindung gibt."
},
"celery_progress": {
"progress_title": "Wird geladen ...",
"error_message": "Der Vorgang konnte nicht erfolgreich beendet werden.",
"success_message": "Der Vorgang wurde erfolgreich beendet.",
"running_tasks": "1 laufende Aufgabe | {number} laufende Aufgaben"
},
"actions": {
"back": "Zurück",
"search": "Suchen"
},
"about": {
"about_aleksis": "Über AlekSIS®",
"licenced_under": "Lizensiert unter",
"licence_type": "Lizenztyp",
"free_software": "Freie Software",
"open_source": "Open Source",
"proprietary": "Proprietär",
"licence_consists_of": "Die Lizenz besteht aus",
"about_aleksis_1": "Diese Plattform wird mit AlekSIS®, einem webbasierten Schulinformationssystem (SIS), welches für die Verwaltung und/oder Veröffentlichung von Bildungseinrichtungen verwendet werden kann. AlekSIS ist freie Software und kann von jedem benutzt werden.",
"about_aleksis_2": " AlekSIS® ist eine eingetragene Wortmarke des Open-Source-Projektes AlekSIS, vertreten durch den Teckids e.V.",
"website_of_aleksis": "Website von AlekSIS",
"source_code": "Quellcode",
"licence_information": "Lizenzinformationen",
"licence_information_1": " Der Core und die offiziellen Apps von AlekSIS sind unter der EUPL, Version 1.2 oder später, lizenziert. Für Lizenzinformationen zu Apps von Drittanbietern, wenn installiert, siehe direkt bei der jeweiligen App weiter unten auf dieser Seite. Die Lizenzen sind wie folgt markiert:",
"free_open_source_licence": "Freie/Open Source Lizenz",
"other_licence": "Andere Lizenz",
"full_licence_text": "Kompletter Lizenztext",
"more_information_eupl": "Weitere Informationen über die EUPL"
"title_plural": "School Terms"
}
}
}
{
sitePreferences {
themePrimary
themeSecondary
themeLogo {
url
}
generalTitle
accountPersonPreferPhoto
footerImprintUrl
footerPrivacyUrl
}
}
......@@ -6,5 +6,16 @@
cookie
}
currentLanguage
sitePreferences {
themePrimary
themeSecondary
themeLogo {
url
}
generalTitle
accountPersonPreferPhoto
footerImprintUrl
footerPrivacyUrl
}
}
}
......@@ -7,5 +7,8 @@
fullName
avatarUrl
isDummy
preferences {
themeDesignMode
}
}
}
......@@ -6,18 +6,16 @@ from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet
from haystack.utils.loading import UnifiedIndex
from ..models import CustomMenu, Notification, Person, TaskUserAssignment
from ..models import Notification, Person, TaskUserAssignment
from ..util.apps import AppConfig
from ..util.core_helpers import get_allowed_object_ids, get_app_module, get_app_packages, has_person
from .celery_progress import CeleryProgressFetchedMutation, CeleryProgressType
from .custom_menu import CustomMenuType
from .group import GroupType # noqa
from .installed_apps import AppType
from .message import MessageType
from .notification import MarkNotificationReadMutation, NotificationType
from .person import PersonMutation, PersonType
from .search import SearchResultType
from .site_preferences import SitePreferencesType
from .system_properties import SystemPropertiesType
from .user import UserType
......@@ -43,10 +41,6 @@ class Query(graphene.ObjectType):
SearchResultType, query=graphene.String(), limit=graphene.Int(required=False)
)
site_preferences = graphene.Field(SitePreferencesType)
custom_menu_by_name = graphene.Field(CustomMenuType)
messages = graphene.List(MessageType)
def resolve_notifications(root, info, **kwargs):
......@@ -101,12 +95,6 @@ class Query(graphene.ObjectType):
return results[:limit]
def resolve_site_preferences(root, info, **kwargs):
return info.context.site.preferences
def resolve_custom_menu_by_name(root, info, name, **kwargs):
return CustomMenu.get_default(name)
def resolve_messages(root, info, **kwargs):
return get_messages(info)
......
......@@ -3,7 +3,9 @@ from django.utils import translation
import graphene
from ..models import CustomMenu
from ..util.frontend_helpers import get_language_cookie
from . import CustomMenuType, SitePreferencesType
class LanguageType(graphene.ObjectType):
......@@ -18,6 +20,8 @@ class LanguageType(graphene.ObjectType):
class SystemPropertiesType(graphene.ObjectType):
current_language = graphene.String(required=True)
available_languages = graphene.List(LanguageType)
site_preferences = graphene.Field(SitePreferencesType)
custom_menu_by_name = graphene.Field(CustomMenuType)
def resolve_current_language(parent, info, **kwargs):
return info.context.LANGUAGE_CODE
......@@ -27,3 +31,9 @@ class SystemPropertiesType(graphene.ObjectType):
translation.get_language_info(code) | {"cookie": get_language_cookie(code)}
for code, name in settings.LANGUAGES
]
def resolve_site_preferences(root, info, **kwargs):
return info.context.site.preferences
def resolve_custom_menu_by_name(root, info, name, **kwargs):
return CustomMenu.get_default(name)
......@@ -425,6 +425,6 @@ for app_config in apps.app_configs.values():
urlpatterns.append(
re_path(
r"^(?P<url>.*)$", TemplateView.as_view(template_name="core/vue_index.html"), name="vue_app"
r"^(?P<url>.*)/$", TemplateView.as_view(template_name="core/vue_index.html"), name="vue_app"
)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment