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:
@@ -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