Update daemon socket URL and enhance message rendering in frontend
- Changed the default value for `VITE_DAEMON_SOCKET` in `deploy-frontend.sh` and `update-frontend.sh` to use the `/ws/` path. - Updated the message rendering logic in `MessagesDialog.vue` to utilize a new `formatBody` method for improved translation handling. - Added a new translation for "overproduction" in both English and German localization files.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
>
|
||||
<ul class="messages">
|
||||
<li v-for="n in messages" :key="n.id" :class="{ unread: !n.shown }">
|
||||
<div class="body">{{ $t('falukant.notifications.' + n.tr) }}</div>
|
||||
<div class="body">{{ formatBody(n) }}</div>
|
||||
<div class="footer">
|
||||
<span>{{ formatDate(n.createdAt) }}</span>
|
||||
</div>
|
||||
@@ -116,6 +116,26 @@ export default {
|
||||
try {
|
||||
return new Date(dt).toLocaleString();
|
||||
} catch { return dt; }
|
||||
},
|
||||
formatBody(n) {
|
||||
let key = n.tr;
|
||||
let params = {};
|
||||
if (typeof key === 'string') {
|
||||
const trimmed = key.trim();
|
||||
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
||||
try {
|
||||
const parsed = JSON.parse(trimmed);
|
||||
if (parsed && parsed.tr) {
|
||||
key = parsed.tr;
|
||||
params = { ...parsed };
|
||||
delete params.tr;
|
||||
}
|
||||
} catch (e) {
|
||||
// Fallback: ignore parse error and use raw key
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.$t('falukant.notifications.' + key, params);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
Reference in New Issue
Block a user