From dcfaae7955e44ad4ef0c55ea24d2d52e3752c1df Mon Sep 17 00:00:00 2001 From: baldo Date: Wed, 24 Aug 2022 23:46:56 +0200 Subject: [PATCH] Make sure config and version are loaded before app runs to avoid null checks. --- .../nodes/NodeDeleteConfirmationForm.vue | 4 ++-- .../src/components/nodes/NodeDeleteForm.vue | 6 ++--- .../src/components/nodes/NodeDeletedPanel.vue | 4 ++-- .../src/components/nodes/NodePreviewCard.vue | 10 ++++---- .../src/components/nodes/NodesFilterPanel.vue | 4 ++-- frontend/src/components/page/PageFooter.vue | 2 +- frontend/src/components/page/PageHeader.vue | 2 +- frontend/src/main.ts | 23 +++++++++++-------- frontend/src/stores/config.ts | 7 +++--- frontend/src/stores/version.ts | 7 +++--- 10 files changed, 38 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/nodes/NodeDeleteConfirmationForm.vue b/frontend/src/components/nodes/NodeDeleteConfirmationForm.vue index 53ccc1c..5fa15fc 100644 --- a/frontend/src/components/nodes/NodeDeleteConfirmationForm.vue +++ b/frontend/src/components/nodes/NodeDeleteConfirmationForm.vue @@ -19,7 +19,7 @@ interface Props { const props = defineProps(); const nodeStore = useNodeStore(); const configStore = useConfigStore(); -const email = computed(() => configStore.getConfig?.community.contactEmail); +const email = computed(() => configStore.getConfig.community.contactEmail); const errorDeletingNode = ref(false); @@ -70,7 +70,7 @@ async function onAbort() { Beim Löschen des Knotens ist ein Fehler aufgetreten. Bitte probiere es später nochmal. Sollte dieses Problem weiter bestehen, so wende dich bitte per E-Mail an - {{ email }}{{ email }}. diff --git a/frontend/src/components/nodes/NodeDeleteForm.vue b/frontend/src/components/nodes/NodeDeleteForm.vue index 4ed8782..2835c81 100644 --- a/frontend/src/components/nodes/NodeDeleteForm.vue +++ b/frontend/src/components/nodes/NodeDeleteForm.vue @@ -15,7 +15,7 @@ import RouteButton from "@/components/form/RouteButton.vue"; import { ApiError } from "@/utils/Api"; const configStore = useConfigStore(); -const email = computed(() => configStore.getConfig?.community.contactEmail); +const email = computed(() => configStore.getConfig.community.contactEmail); const nodeStore = useNodeStore(); @@ -67,7 +67,7 @@ async function onSubmit() { Solltest Du den Token nicht mehr haben, wende Dich einfach per E-Mail an - {{ email }}{{ email }}.

@@ -80,7 +80,7 @@ async function onSubmit() { Beim Abrufen des Knotens ist ein Fehler aufgetreten. Bitte probiere es später nochmal. Sollte dieses Problem weiter bestehen, so wende dich bitte per E-Mail an - {{ email }}{{ email }}. diff --git a/frontend/src/components/nodes/NodeDeletedPanel.vue b/frontend/src/components/nodes/NodeDeletedPanel.vue index e91fb7e..8aff44c 100644 --- a/frontend/src/components/nodes/NodeDeletedPanel.vue +++ b/frontend/src/components/nodes/NodeDeletedPanel.vue @@ -8,8 +8,8 @@ import RouteButton from "@/components/form/RouteButton.vue"; import { route, RouteName } from "@/router"; const configStore = useConfigStore(); -const email = computed(() => configStore.getConfig?.community.contactEmail); -const mapUrl = computed(() => configStore.getConfig?.map.mapUrl); +const email = computed(() => configStore.getConfig.community.contactEmail); +const mapUrl = computed(() => configStore.getConfig.map.mapUrl); interface Props { hostname: Hostname; diff --git a/frontend/src/components/nodes/NodePreviewCard.vue b/frontend/src/components/nodes/NodePreviewCard.vue index cb7f24e..246cd33 100644 --- a/frontend/src/components/nodes/NodePreviewCard.vue +++ b/frontend/src/components/nodes/NodePreviewCard.vue @@ -21,7 +21,8 @@ const props = defineProps();
- Token: {{ props.node.token }} + Token: + {{ props.node.token }}
@@ -30,16 +31,17 @@ const props = defineProps();
- MAC-Adresse: {{ props.node.mac }} + MAC-Adresse: + {{ props.node.mac }}
- VPN-Schlüssel: + VPN-Schlüssel: {{ props.node.key || "nicht angegeben" }}
- Monitoring: + Monitoring: Bestätigung ausstehend diff --git a/frontend/src/components/nodes/NodesFilterPanel.vue b/frontend/src/components/nodes/NodesFilterPanel.vue index b405ce4..30ca72f 100644 --- a/frontend/src/components/nodes/NodesFilterPanel.vue +++ b/frontend/src/components/nodes/NodesFilterPanel.vue @@ -91,8 +91,8 @@ function pushFilter(filterGroup: Filter[], filter: Filter): void { const suggestedFilters = computed(() => { const cfg = configStore.getConfig; - const sites = cfg?.community.sites || []; - const domains = cfg?.community.domains || []; + const sites = cfg.community.sites; + const domains = cfg.community.domains; const filterGroups: Filter[][] = []; diff --git a/frontend/src/components/page/PageFooter.vue b/frontend/src/components/page/PageFooter.vue index 51c397c..a523a8b 100644 --- a/frontend/src/components/page/PageFooter.vue +++ b/frontend/src/components/page/PageFooter.vue @@ -7,7 +7,7 @@ const versionStore = useVersionStore();