Fix: Replace all $t() calls with t() in PermissionsView and LogsView templates and add t to return statements

This commit is contained in:
Torsten Schulz (local)
2025-11-21 14:12:42 +01:00
parent 0285c05fa6
commit b0e610f3ab
2 changed files with 64 additions and 62 deletions

View File

@@ -1,36 +1,36 @@
<template>
<div class="logs-view">
<div class="header">
<h1>{{ $t('logs.title') }}</h1>
<p class="subtitle">{{ $t('logs.subtitle') }}</p>
<h1>{{ t('logs.title') }}</h1>
<p class="subtitle">{{ t('logs.subtitle') }}</p>
</div>
<div class="filters-section">
<div class="filter-controls">
<div class="filter-group">
<label>{{ $t('logs.backend') }}:</label>
<label>{{ t('logs.backend') }}:</label>
<select v-model="filters.backend" class="filter-select">
<option value="">{{ $t('logs.all') }}</option>
<option value="mytischtennis">{{ $t('logs.mytischtennis') }}</option>
<option value="own">{{ $t('logs.ownBackend') }}</option>
<option value="">{{ t('logs.all') }}</option>
<option value="mytischtennis">{{ t('logs.mytischtennis') }}</option>
<option value="own">{{ t('logs.ownBackend') }}</option>
</select>
</div>
<div class="filter-group">
<label>{{ $t('logs.logType') }}:</label>
<label>{{ t('logs.logType') }}:</label>
<select v-model="filters.logType" class="filter-select">
<option value="">{{ $t('logs.all') }}</option>
<option value="api_request">{{ $t('logs.apiRequests') }}</option>
<option value="scheduler">{{ $t('logs.scheduler') }}</option>
<option value="cron_job">{{ $t('logs.cronJobs') }}</option>
<option value="manual">{{ $t('logs.manual') }}</option>
<option value="">{{ t('logs.all') }}</option>
<option value="api_request">{{ t('logs.apiRequests') }}</option>
<option value="scheduler">{{ t('logs.scheduler') }}</option>
<option value="cron_job">{{ t('logs.cronJobs') }}</option>
<option value="manual">{{ t('logs.manual') }}</option>
</select>
</div>
<div class="filter-group">
<label>{{ $t('logs.httpMethod') }}:</label>
<label>{{ t('logs.httpMethod') }}:</label>
<select v-model="filters.method" class="filter-select">
<option value="">{{ $t('logs.all') }}</option>
<option value="">{{ t('logs.all') }}</option>
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
@@ -40,9 +40,9 @@
</div>
<div class="filter-group">
<label>{{ $t('logs.status') }}:</label>
<label>{{ t('logs.status') }}:</label>
<select v-model="filters.statusCode" class="filter-select">
<option value="">{{ $t('logs.all') }}</option>
<option value="">{{ t('logs.all') }}</option>
<option value="200">200 - OK</option>
<option value="400">400 - Bad Request</option>
<option value="401">401 - Unauthorized</option>
@@ -53,27 +53,27 @@
</div>
<div class="filter-group">
<label>{{ $t('logs.path') }}:</label>
<label>{{ t('logs.path') }}:</label>
<input
type="text"
v-model="filters.path"
:placeholder="$t('logs.pathPlaceholder')"
:placeholder="t('logs.pathPlaceholder')"
class="filter-input"
/>
</div>
<div class="filter-group">
<label>{{ $t('logs.from') }}:</label>
<label>{{ t('logs.from') }}:</label>
<input type="date" v-model="filters.startDate" class="filter-input" />
</div>
<div class="filter-group">
<label>{{ $t('logs.to') }}:</label>
<label>{{ t('logs.to') }}:</label>
<input type="date" v-model="filters.endDate" class="filter-input" />
</div>
<button @click="applyFilters" class="btn-primary">{{ $t('logs.applyFilters') }}</button>
<button @click="clearFilters" class="btn-secondary">{{ $t('logs.clearFilters') }}</button>
<button @click="applyFilters" class="btn-primary">{{ t('logs.applyFilters') }}</button>
<button @click="clearFilters" class="btn-secondary">{{ t('logs.clearFilters') }}</button>
</div>
</div>
@@ -83,29 +83,29 @@
<span class="status-icon">{{ statusIcon }}</span>
<span class="status-text">
<template v-if="!loading && !error">
<strong>{{ $t('logs.successfullyLoaded') }}</strong> {{ total }} {{ $t('logs.recordsFound') }}, {{ logs.length }} {{ $t('logs.displayed') }}
<strong>{{ t('logs.successfullyLoaded') }}</strong> {{ total }} {{ t('logs.recordsFound') }}, {{ logs.length }} {{ t('logs.displayed') }}
</template>
<template v-else-if="loading">
{{ $t('logs.loadingLogs') }}
{{ t('logs.loadingLogs') }}
</template>
<template v-else-if="error">
<strong>{{ $t('logs.error') }}:</strong> {{ error }}
<strong>{{ t('logs.error') }}:</strong> {{ error }}
</template>
</span>
<span class="status-time">{{ formatLastLoadTime(lastLoadTime) }}</span>
</div>
</div>
<div v-if="loading && !lastLoadTime" class="loading">{{ $t('logs.loadingLogs') }}</div>
<div v-if="loading && !lastLoadTime" class="loading">{{ t('logs.loadingLogs') }}</div>
<div v-else-if="error && !lastLoadTime" class="error">{{ error }}</div>
<div v-else class="logs-content">
<div class="logs-stats">
<div class="stat-item">
<span class="stat-label">{{ $t('logs.total') }}:</span>
<span class="stat-label">{{ t('logs.total') }}:</span>
<span class="stat-value">{{ total }}</span>
</div>
<div class="stat-item">
<span class="stat-label">{{ $t('logs.displayedLabel') }}:</span>
<span class="stat-label">{{ t('logs.displayedLabel') }}:</span>
<span class="stat-value">{{ logs.length }}</span>
</div>
</div>
@@ -114,14 +114,14 @@
<table class="logs-table">
<thead>
<tr>
<th>{{ $t('logs.time') }}</th>
<th>{{ $t('logs.type') }}</th>
<th>{{ $t('logs.method') }}</th>
<th>{{ $t('logs.path') }}</th>
<th>{{ $t('logs.status') }}</th>
<th>{{ $t('logs.executionTime') }}</th>
<th>{{ $t('logs.errorLabel') }}</th>
<th>{{ $t('logs.actions') }}</th>
<th>{{ t('logs.time') }}</th>
<th>{{ t('logs.type') }}</th>
<th>{{ t('logs.method') }}</th>
<th>{{ t('logs.path') }}</th>
<th>{{ t('logs.status') }}</th>
<th>{{ t('logs.executionTime') }}</th>
<th>{{ t('logs.errorLabel') }}</th>
<th>{{ t('logs.actions') }}</th>
</tr>
</thead>
<tbody>
@@ -152,7 +152,7 @@
<span v-else>-</span>
</td>
<td>
<button @click="viewLogDetails(log)" class="btn-view">{{ $t('logs.details') }}</button>
<button @click="viewLogDetails(log)" class="btn-view">{{ t('logs.details') }}</button>
</td>
</tr>
</tbody>
@@ -165,17 +165,17 @@
:disabled="offset === 0"
class="btn-pagination"
>
{{ $t('logs.previous') }}
{{ t('logs.previous') }}
</button>
<span class="page-info">
{{ $t('logs.page') }} {{ currentPage }} {{ $t('logs.of') }} {{ totalPages }}
{{ t('logs.page') }} {{ currentPage }} {{ t('logs.of') }} {{ totalPages }}
</span>
<button
@click="nextPage"
:disabled="offset + logs.length >= total"
class="btn-pagination"
>
{{ $t('logs.next') }}
{{ t('logs.next') }}
</button>
</div>
</div>
@@ -450,6 +450,7 @@ export default {
});
return {
t,
logs,
total,
loading,

View File

@@ -1,16 +1,16 @@
<template>
<div class="permissions-view">
<div class="header">
<h1>{{ $t('permissions.title') }}</h1>
<p class="subtitle">{{ $t('permissions.subtitle') }}</p>
<h1>{{ t('permissions.title') }}</h1>
<p class="subtitle">{{ t('permissions.subtitle') }}</p>
</div>
<div v-if="loading" class="loading">{{ $t('permissions.loadingMembers') }}</div>
<div v-if="loading" class="loading">{{ t('permissions.loadingMembers') }}</div>
<div v-else-if="error" class="error">{{ error }}</div>
<div v-else class="permissions-content">
<!-- Role Legend -->
<div class="role-legend">
<h3>{{ $t('permissions.availableRoles') }}</h3>
<h3>{{ t('permissions.availableRoles') }}</h3>
<div class="roles-grid">
<div v-for="role in availableRoles" :key="role.value" class="role-card">
<div class="role-name">{{ role.label }}</div>
@@ -21,14 +21,14 @@
<!-- Members Table -->
<div class="members-table">
<h3>{{ $t('permissions.clubMembers') }}</h3>
<h3>{{ t('permissions.clubMembers') }}</h3>
<table>
<thead>
<tr>
<th>{{ $t('permissions.email') }}</th>
<th>{{ $t('permissions.role') }}</th>
<th>{{ $t('permissions.status') }}</th>
<th v-if="!isReadOnly">{{ $t('permissions.actions') }}</th>
<th>{{ t('permissions.email') }}</th>
<th>{{ t('permissions.role') }}</th>
<th>{{ t('permissions.status') }}</th>
<th v-if="!isReadOnly">{{ t('permissions.actions') }}</th>
</tr>
</thead>
<tbody>
@@ -47,7 +47,7 @@
</select>
<span v-else class="role-badge" :class="`role-${member.role}`">
{{ getRoleLabel(member.role) }}
<span v-if="member.isOwner" class="owner-badge">👑 {{ $t('permissions.creator') }}</span>
<span v-if="member.isOwner" class="owner-badge">👑 {{ t('permissions.creator') }}</span>
</span>
</td>
<td>
@@ -56,18 +56,18 @@
class="status-badge status-active"
:class="{ 'clickable': !member.isOwner && !isReadOnly }"
@click="!member.isOwner && !isReadOnly ? toggleMemberStatus(member) : null"
:title="!member.isOwner && !isReadOnly ? $t('permissions.clickToDeactivate') : ''"
:title="!member.isOwner && !isReadOnly ? t('permissions.clickToDeactivate') : ''"
>
{{ $t('permissions.active') }}
{{ t('permissions.active') }}
</span>
<span
v-else
class="status-badge status-inactive"
:class="{ 'clickable': !isReadOnly }"
@click="!isReadOnly ? toggleMemberStatus(member) : null"
:title="!isReadOnly ? $t('permissions.clickToActivate') : ''"
:title="!isReadOnly ? t('permissions.clickToActivate') : ''"
>
{{ $t('permissions.inactive') }}
{{ t('permissions.inactive') }}
</span>
</td>
<td v-if="!isReadOnly">
@@ -76,7 +76,7 @@
@click="openPermissionsDialog(member)"
class="btn-small"
>
{{ $t('permissions.customize') }}
{{ t('permissions.customize') }}
</button>
<span v-else class="muted"></span>
</td>
@@ -90,21 +90,21 @@
<div v-if="selectedMember" class="dialog-overlay" @click.self="closePermissionsDialog">
<div class="dialog-content">
<div class="dialog-header">
<h2>{{ $t('permissions.permissionsFor') }} {{ selectedMember.user?.email }}</h2>
<h2>{{ t('permissions.permissionsFor') }} {{ selectedMember.user?.email }}</h2>
<button @click="closePermissionsDialog" class="close-btn">&times;</button>
</div>
<div class="dialog-body">
<p class="info-text">
{{ $t('permissions.baseRole') }}: <strong>{{ getRoleLabel(selectedMember.role) }}</strong><br>
{{ $t('permissions.customizeInfo') }}
{{ t('permissions.baseRole') }}: <strong>{{ getRoleLabel(selectedMember.role) }}</strong><br>
{{ t('permissions.customizeInfo') }}
</p>
<div class="permissions-grid">
<div v-for="(resource, key) in permissionStructure" :key="key" class="permission-group">
<div class="permission-group-header">
<h4>{{ resource.label }}</h4>
<button class="btn-reset" @click="resetResource(key)" :disabled="isReadOnly">{{ $t('permissions.reset') }}</button>
<button class="btn-reset" @click="resetResource(key)" :disabled="isReadOnly">{{ t('permissions.reset') }}</button>
</div>
<div class="permission-actions">
<div v-for="action in resource.actions" :key="action" class="permission-row">
@@ -122,9 +122,9 @@
</div>
<div class="dialog-footer">
<button @click="resetAll" class="btn-secondary" :disabled="isReadOnly">{{ $t('permissions.resetAll') }}</button>
<button @click="closePermissionsDialog" class="btn-secondary">{{ $t('permissions.cancel') }}</button>
<button @click="saveCustomPermissions" class="btn-primary">{{ $t('permissions.save') }}</button>
<button @click="resetAll" class="btn-secondary" :disabled="isReadOnly">{{ t('permissions.resetAll') }}</button>
<button @click="closePermissionsDialog" class="btn-secondary">{{ t('permissions.cancel') }}</button>
<button @click="saveCustomPermissions" class="btn-primary">{{ t('permissions.save') }}</button>
</div>
</div>
</div>
@@ -546,6 +546,7 @@ export default {
});
return {
t,
loading,
error,
members,