feat(Localization, User Management): add missingUserId translations and enhance user ID handling
All checks were successful
Deploy to production / deploy (push) Successful in 2m2s

- Added translations for the "missingUserId" key in multiple languages to improve user feedback when user ID is not available.
- Updated the user ID handling in the store and WorkerSchedulesView component to ensure proper user identification when sending data to the daemon.
- Enhanced error handling to notify users when the user ID is missing, improving overall user experience.
This commit is contained in:
Torsten Schulz (local)
2026-05-08 11:09:34 +02:00
parent 008cd7ae86
commit b59526b20d
7 changed files with 33 additions and 7 deletions

View File

@@ -347,7 +347,8 @@
"cadence": "Interbal", "cadence": "Interbal",
"nextRun": "Pinakataas nga sunod nga dagan", "nextRun": "Pinakataas nga sunod nga dagan",
"remaining": "Nahibilin", "remaining": "Nahibilin",
"noTasks": "Walay tasks para ani nga worker." "noTasks": "Walay tasks para ani nga worker.",
"missingUserId": "Walay user ID nga anaa (kulang ang setUserId)."
} }
}, },
"chatrooms": { "chatrooms": {

View File

@@ -333,6 +333,7 @@
"generatedAt": "Erzeugt am", "generatedAt": "Erzeugt am",
"empty": "Keine Schedules vorhanden.", "empty": "Keine Schedules vorhanden.",
"notConnected": "Keine Daemon-Verbindung verfügbar.", "notConnected": "Keine Daemon-Verbindung verfügbar.",
"missingUserId": "Keine Benutzer-ID verfügbar (setUserId fehlt).",
"sendError": "Anfrage an den Daemon fehlgeschlagen.", "sendError": "Anfrage an den Daemon fehlgeschlagen.",
"responseError": "Antwort konnte nicht verarbeitet werden.", "responseError": "Antwort konnte nicht verarbeitet werden.",
"currentStep": "Aktueller Schritt", "currentStep": "Aktueller Schritt",

View File

@@ -395,7 +395,8 @@
"cadence": "Cadence", "cadence": "Cadence",
"nextRun": "Latest next run", "nextRun": "Latest next run",
"remaining": "Remaining", "remaining": "Remaining",
"noTasks": "No tasks for this worker." "noTasks": "No tasks for this worker.",
"missingUserId": "No user ID available (setUserId missing)."
} }
}, },
"chatrooms": { "chatrooms": {

View File

@@ -320,7 +320,8 @@
"cadence": "Intervalo", "cadence": "Intervalo",
"nextRun": "Próxima ejecución máxima", "nextRun": "Próxima ejecución máxima",
"remaining": "Restante", "remaining": "Restante",
"noTasks": "No hay tareas para este worker." "noTasks": "No hay tareas para este worker.",
"missingUserId": "No hay ID de usuario disponible (falta setUserId)."
} }
}, },
"chatrooms": { "chatrooms": {

View File

@@ -320,7 +320,8 @@
"cadence": "Intervalle", "cadence": "Intervalle",
"nextRun": "Prochaine exécution au plus tard", "nextRun": "Prochaine exécution au plus tard",
"remaining": "Restant", "remaining": "Restant",
"noTasks": "Aucune tâche pour ce worker." "noTasks": "Aucune tâche pour ce worker.",
"missingUserId": "Aucun ID utilisateur disponible (setUserId manquant)."
} }
}, },
"chatrooms": { "chatrooms": {

View File

@@ -418,12 +418,17 @@ const store = createStore({
setTimeout(() => { setTimeout(() => {
try { try {
if (daemonSocket.readyState === WebSocket.OPEN && state.isLoggedIn && state.user) { if (daemonSocket.readyState === WebSocket.OPEN && state.isLoggedIn && state.user) {
const daemonUserId = state.user?.hashedId || state.user?.id || state.user?.username;
if (!daemonUserId) {
console.warn('[Daemon] Keine User-ID fuer setUserId vorhanden');
return;
}
const payload = JSON.stringify({ const payload = JSON.stringify({
event: 'setUserId', event: 'setUserId',
data: { userId: state.user.id } data: { userId: daemonUserId }
}); });
daemonSocket.send(payload); daemonSocket.send(payload);
console.log('[Daemon] setUserId gesendet für User:', state.user.id); console.log('[Daemon] setUserId gesendet fuer User:', daemonUserId);
} else { } else {
console.warn('[Daemon] Socket nicht mehr offen oder Benutzer nicht eingeloggt beim Senden von setUserId'); console.warn('[Daemon] Socket nicht mehr offen oder Benutzer nicht eingeloggt beim Senden von setUserId');
} }

View File

@@ -94,7 +94,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapState(['daemonSocket', 'daemonConnectionStatus', 'menu']), ...mapState(['daemonSocket', 'daemonConnectionStatus', 'menu', 'user']),
hasAccess() { hasAccess() {
const path = '/admin/falukant/worker-schedules'; const path = '/admin/falukant/worker-schedules';
const walk = (node) => { const walk = (node) => {
@@ -137,6 +137,18 @@ export default {
if (this.timer) clearInterval(this.timer); if (this.timer) clearInterval(this.timer);
}, },
methods: { methods: {
getDaemonUserId() {
return this.user?.hashedId || this.user?.id || this.user?.username || '';
},
sendSetUserId() {
const userId = this.getDaemonUserId();
if (!userId) return false;
this.daemonSocket.send(JSON.stringify({
event: 'setUserId',
data: { userId },
}));
return true;
},
setupTimer() { setupTimer() {
if (this.timer) { if (this.timer) {
clearInterval(this.timer); clearInterval(this.timer);
@@ -151,6 +163,10 @@ export default {
this.error = this.$t('admin.falukant.workerSchedules.notConnected'); this.error = this.$t('admin.falukant.workerSchedules.notConnected');
return; return;
} }
if (!this.sendSetUserId()) {
this.error = this.$t('admin.falukant.workerSchedules.missingUserId');
return;
}
this.loading = true; this.loading = true;
this.error = null; this.error = null;
const event = this.detailed ? 'getWorkerSchedulesDetailed' : 'getWorkerSchedules'; const event = this.detailed ? 'getWorkerSchedulesDetailed' : 'getWorkerSchedules';