Refactoring: Pinia stores are called *Store now.

This commit is contained in:
baldo 2022-08-23 15:14:07 +02:00
parent 5ae27f530e
commit 2cbdc92ef1
5 changed files with 31 additions and 31 deletions

View file

@ -50,7 +50,7 @@ const props = defineProps<Props>();
const input = ref();
const hasFocus = ref(false);
const suggestedFiltersExpanded = ref(false);
const config = useConfigStore();
const configStore = useConfigStore();
type Filter = {
field: string,
@ -81,7 +81,7 @@ function selectedFilterIndexForField(field: string): number {
}
const suggestedFilters = computed<Filter[][]>(() => {
const cfg = config.getConfig;
const cfg = configStore.getConfig;
const sites = cfg?.community.sites || [];
const domains = cfg?.community.domains || [];

View file

@ -2,13 +2,13 @@
import {useConfigStore} from "@/stores/config";
import {useVersionStore} from "@/stores/version";
const config = useConfigStore();
const version = useVersionStore();
const configStore = useConfigStore();
const versionStore = useVersionStore();
</script>
<template>
<footer v-if="config.getConfig">
ffffng ({{ version.getVersion }})
<footer v-if="configStore.getConfig">
ffffng ({{ versionStore.getVersion }})
<a href="https://github.com/freifunkhamburg/ffffng" target="_blank">
<i class="fa fa-code" aria-hidden="true" /> Source Code
</a>
@ -16,12 +16,12 @@ const version = useVersionStore();
<i class="fa fa-bug" aria-hidden="true" /> Fehler melden
</a>
<a
v-if="config.getConfig.legal.privacyUrl"
:href="config.getConfig.legal.privacyUrl"
v-if="configStore.getConfig.legal.privacyUrl"
:href="configStore.getConfig.legal.privacyUrl"
target="_blank">Datenschutz</a>
<a
v-if="config.getConfig.legal.imprintUrl"
:href="config.getConfig.legal.imprintUrl"
v-if="configStore.getConfig.legal.imprintUrl"
:href="configStore.getConfig.legal.imprintUrl"
target="_blank">Impressum</a>
</footer>
</template>

View file

@ -1,12 +1,12 @@
<script setup lang="ts">
import { useConfigStore } from "@/stores/config";
import {useConfigStore} from "@/stores/config";
import {route, RouteName} from "@/router";
const config = useConfigStore();
const configStore = useConfigStore();
</script>
<template>
<header v-if="config.getConfig">
<header v-if="configStore.getConfig">
<nav>
<RouterLink class="logo" :to="route(RouteName.HOME)">
<img
@ -17,8 +17,8 @@ const config = useConfigStore();
</RouterLink>
<h1>
{{ config.getConfig.community.name }} Knotenverwaltung
<RouterLink :to="route(RouteName.HOME)">
{{ configStore.getConfig.community.name }} Knotenverwaltung
</RouterLink>
</h1>

View file

@ -5,17 +5,17 @@ import {ComponentVariant, MonitoringState} from "@/types";
import {RouteName} from "@/router";
import PageContainer from "@/components/page/PageContainer.vue";
const statistics = useStatisticsStore();
const statisticsStore = useStatisticsStore();
function refresh(): void {
statistics.refresh();
statisticsStore.refresh();
}
refresh();
</script>
<template>
<PageContainer v-if="statistics.getStatistics">
<PageContainer v-if="statisticsStore.getStatistics">
<h2>Knotenstatistik</h2>
<div class="statistics">
@ -23,14 +23,14 @@ refresh();
title="Registrierte Knoten"
icon="circle-o"
:variant="ComponentVariant.INFO"
:value="statistics.getStatistics.nodes.registered"
:value="statisticsStore.getStatistics.nodes.registered"
:route="RouteName.ADMIN_NODES"
/>
<StatisticsCard
title="Mit hinterlegtem fastd-Key"
icon="lock"
:variant="ComponentVariant.WARNING"
:value="statistics.getStatistics.nodes.withVPN"
:value="statisticsStore.getStatistics.nodes.withVPN"
:route="RouteName.ADMIN_NODES"
:filter="{hasKey: true}"
/>
@ -38,7 +38,7 @@ refresh();
title="Mit Koordinaten"
icon="map-marker"
:variant="ComponentVariant.SUCCESS"
:value="statistics.getStatistics.nodes.withCoords"
:value="statisticsStore.getStatistics.nodes.withCoords"
:route="RouteName.ADMIN_NODES"
:filter="{hasCoords: true}"
/>
@ -46,7 +46,7 @@ refresh();
title="Monitoring aktiv"
icon="heartbeat"
:variant="ComponentVariant.SUCCESS"
:value="statistics.getStatistics.nodes.monitoring.active"
:value="statisticsStore.getStatistics.nodes.monitoring.active"
:route="RouteName.ADMIN_NODES"
:filter="{monitoringState: MonitoringState.ACTIVE}"
/>
@ -54,7 +54,7 @@ refresh();
title="Monitoring noch nicht bestätigt"
icon="envelope"
:variant="ComponentVariant.DANGER"
:value="statistics.getStatistics.nodes.monitoring.pending"
:value="statisticsStore.getStatistics.nodes.monitoring.pending"
:route="RouteName.ADMIN_NODES"
:filter="{monitoringState: MonitoringState.PENDING}"
/>

View file

@ -39,7 +39,7 @@ type NodeRedactField = "nickname" | "email" | "token";
type NodeRedactFieldsMap = Partial<Record<NodeRedactField, boolean>>;
type NodesRedactFieldsMap = Partial<Record<MAC, NodeRedactFieldsMap>>;
const nodes = useNodesStore();
const nodesStore = useNodesStore();
const redactFieldsByDefault = ref(true);
const nodesRedactFieldsMap = ref({} as NodesRedactFieldsMap)
@ -49,7 +49,7 @@ async function refresh(page: number): Promise<void> {
loading.value = true;
redactAllFields(true);
try {
await nodes.refresh(
await nodesStore.refresh(
page,
NODE_PER_PAGE,
props.sortDirection,
@ -127,9 +127,9 @@ watch(props, async () => {
<NodesFilterPanel :search-term="searchTerm" :filter="filter" @update-filter="updateFilter"/>
<Pager
:page="nodes.getPage"
:itemsPerPage="nodes.getNodesPerPage"
:totalItems="nodes.getTotalNodes"
:page="nodesStore.getPage"
:itemsPerPage="nodesStore.getNodesPerPage"
:totalItems="nodesStore.getTotalNodes"
@changePage="refresh"/>
<div class="actions">
@ -237,7 +237,7 @@ watch(props, async () => {
<tbody>
<tr
v-for="node in nodes.getNodes"
v-for="node in nodesStore.getNodes"
:class="[node.onlineState ? node.onlineState.toLowerCase() : 'online-state-unknown']">
<td>{{ node.hostname }}</td>
<td v-if="shallRedactField(node, 'nickname')">
@ -334,9 +334,9 @@ watch(props, async () => {
</LoadingContainer>
<Pager
:page="nodes.getPage"
:itemsPerPage="nodes.getNodesPerPage"
:totalItems="nodes.getTotalNodes"
:page="nodesStore.getPage"
:itemsPerPage="nodesStore.getNodesPerPage"
:totalItems="nodesStore.getTotalNodes"
@changePage="refresh"/>
</template>