mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-12 00:55:34 +00:00
chore: fix some linting issues
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user