From 00d7285167e5ed3fcf44bbf842244f600e9cac65 Mon Sep 17 00:00:00 2001 From: jamesread Date: Tue, 11 Nov 2025 10:43:47 +0000 Subject: [PATCH] chore: fix some linting issues --- frontend/main.js | 34 ++++++++++--------- frontend/resources/vue/App.vue | 4 ++- .../resources/vue/views/ExecutionView.vue | 6 ++-- service/internal/api/dashboards.go | 1 - 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/frontend/main.js b/frontend/main.js index 3d821f3..c96a092 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -20,12 +20,6 @@ import App from './resources/vue/App.vue' import { initWebsocket } from './js/websocket.js' import combinedTranslations from '../lang/combined_output.json' -import { - initMarshaller -} from './js/marshaller.js' - -import { checkWebsocketConnection } from './js/websocket.js' - function getSelectedLanguage() { const storedLanguage = localStorage.getItem('olivetin-language'); @@ -38,7 +32,22 @@ function getSelectedLanguage() { } if (navigator.languages && navigator.languages.length > 0) { - return navigator.languages[0]; + const available = Object.keys(combinedTranslations.messages || {}) + + for (const candidate of navigator.languages) { + const lowerCandidate = candidate.toLowerCase() + const exact = available.find(locale => locale.toLowerCase() === lowerCandidate) + + if (exact) { + return exact + } + + const prefix = available.find(locale => locale.toLowerCase().startsWith(lowerCandidate.split('-')[0] + '-')) + + if (prefix) { + return prefix + } + } } return 'en'; @@ -77,24 +86,17 @@ function setupVue (i18nSettings) { app.use(router) app.use(i18nSettings) - // Make i18n instance accessible globally for language switching window.i18n = i18nSettings.global app.mount('#app') } -function main () { - initClient() +async function main () { + const i18nSettings = await initClient() initWebsocket() - setupVue() - - const i18nSettings = await initClient() - setupVue(i18nSettings) - - initMarshaller() } main() diff --git a/frontend/resources/vue/App.vue b/frontend/resources/vue/App.vue index 01a2b6d..de6daaa 100644 --- a/frontend/resources/vue/App.vue +++ b/frontend/resources/vue/App.vue @@ -183,11 +183,13 @@ function renderSidebar() { return } + const rootDashboards = window.initResponse?.rootDashboards || [] + if (typeof sidebar.value.clear === 'function') { sidebar.value.clear() } - for (const rootDashboard of window.initResponse.rootDashboards) { + for (const rootDashboard of rootDashboards) { sidebar.value.addNavigationLink({ id: rootDashboard, name: rootDashboard, diff --git a/frontend/resources/vue/views/ExecutionView.vue b/frontend/resources/vue/views/ExecutionView.vue index 68a78fd..169572d 100644 --- a/frontend/resources/vue/views/ExecutionView.vue +++ b/frontend/resources/vue/views/ExecutionView.vue @@ -330,10 +330,10 @@ onMounted(() => { document.addEventListener('fullscreenchange', (e) => { setTimeout(() => { // Wait for the DOM to settle if (document.fullscreenElement) { - window.terminal.fit() + terminal.fit() } else { - window.terminal.resize(80, 40) - window.terminal.fit() + terminal.resize(80, 40) + terminal.fit() } }, 100) }) diff --git a/service/internal/api/dashboards.go b/service/internal/api/dashboards.go index c837226..389d553 100644 --- a/service/internal/api/dashboards.go +++ b/service/internal/api/dashboards.go @@ -89,7 +89,6 @@ func buildDefaultDashboard(rr *DashboardRenderRequest) *apiv1.Dashboard { } func sortActions(components []*apiv1.DashboardComponent) []*apiv1.DashboardComponent { - log.Infof("sortActions: %+v", components) sort.Slice(components, func(i, j int) bool { if components[i].Action == nil || components[j].Action == nil { return components[i].Title < components[j].Title