feat(Localization, User Management): add missingUserId translations and enhance user ID handling
All checks were successful
Deploy to production / deploy (push) Successful in 2m2s
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:
@@ -347,7 +347,8 @@
|
||||
"cadence": "Interbal",
|
||||
"nextRun": "Pinakataas nga sunod nga dagan",
|
||||
"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": {
|
||||
|
||||
@@ -333,6 +333,7 @@
|
||||
"generatedAt": "Erzeugt am",
|
||||
"empty": "Keine Schedules vorhanden.",
|
||||
"notConnected": "Keine Daemon-Verbindung verfügbar.",
|
||||
"missingUserId": "Keine Benutzer-ID verfügbar (setUserId fehlt).",
|
||||
"sendError": "Anfrage an den Daemon fehlgeschlagen.",
|
||||
"responseError": "Antwort konnte nicht verarbeitet werden.",
|
||||
"currentStep": "Aktueller Schritt",
|
||||
|
||||
@@ -395,7 +395,8 @@
|
||||
"cadence": "Cadence",
|
||||
"nextRun": "Latest next run",
|
||||
"remaining": "Remaining",
|
||||
"noTasks": "No tasks for this worker."
|
||||
"noTasks": "No tasks for this worker.",
|
||||
"missingUserId": "No user ID available (setUserId missing)."
|
||||
}
|
||||
},
|
||||
"chatrooms": {
|
||||
|
||||
@@ -320,7 +320,8 @@
|
||||
"cadence": "Intervalo",
|
||||
"nextRun": "Próxima ejecución máxima",
|
||||
"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": {
|
||||
|
||||
@@ -320,7 +320,8 @@
|
||||
"cadence": "Intervalle",
|
||||
"nextRun": "Prochaine exécution au plus tard",
|
||||
"remaining": "Restant",
|
||||
"noTasks": "Aucune tâche pour ce worker."
|
||||
"noTasks": "Aucune tâche pour ce worker.",
|
||||
"missingUserId": "Aucun ID utilisateur disponible (setUserId manquant)."
|
||||
}
|
||||
},
|
||||
"chatrooms": {
|
||||
|
||||
@@ -418,12 +418,17 @@ const store = createStore({
|
||||
setTimeout(() => {
|
||||
try {
|
||||
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({
|
||||
event: 'setUserId',
|
||||
data: { userId: state.user.id }
|
||||
data: { userId: daemonUserId }
|
||||
});
|
||||
daemonSocket.send(payload);
|
||||
console.log('[Daemon] setUserId gesendet für User:', state.user.id);
|
||||
console.log('[Daemon] setUserId gesendet fuer User:', daemonUserId);
|
||||
} else {
|
||||
console.warn('[Daemon] Socket nicht mehr offen oder Benutzer nicht eingeloggt beim Senden von setUserId');
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(['daemonSocket', 'daemonConnectionStatus', 'menu']),
|
||||
...mapState(['daemonSocket', 'daemonConnectionStatus', 'menu', 'user']),
|
||||
hasAccess() {
|
||||
const path = '/admin/falukant/worker-schedules';
|
||||
const walk = (node) => {
|
||||
@@ -137,6 +137,18 @@ export default {
|
||||
if (this.timer) clearInterval(this.timer);
|
||||
},
|
||||
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() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
@@ -151,6 +163,10 @@ export default {
|
||||
this.error = this.$t('admin.falukant.workerSchedules.notConnected');
|
||||
return;
|
||||
}
|
||||
if (!this.sendSetUserId()) {
|
||||
this.error = this.$t('admin.falukant.workerSchedules.missingUserId');
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
this.error = null;
|
||||
const event = this.detailed ? 'getWorkerSchedulesDetailed' : 'getWorkerSchedules';
|
||||
|
||||
Reference in New Issue
Block a user