save error level in cookie
This commit is contained in:
parent
8d8ab58ef4
commit
1c7f6892fd
736
package-lock.json
generated
736
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ffplayout-frontend",
|
"name": "ffplayout-frontend",
|
||||||
"version": "0.12.0",
|
"version": "0.12.1",
|
||||||
"description": "Web GUI for ffplayout",
|
"description": "Web GUI for ffplayout",
|
||||||
"author": "Jonathan Baecker",
|
"author": "Jonathan Baecker",
|
||||||
"private": true,
|
"private": true,
|
||||||
@ -30,18 +30,18 @@
|
|||||||
"video.js": "^8.17.3"
|
"video.js": "^8.17.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/eslint": "^0.5.3",
|
"@nuxt/eslint": "^0.5.5",
|
||||||
"@nuxtjs/i18n": "^8.5.1",
|
"@nuxtjs/i18n": "^8.5.1",
|
||||||
"@nuxtjs/tailwindcss": "^6.12.1",
|
"@nuxtjs/tailwindcss": "^6.12.1",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.7",
|
||||||
"@types/video.js": "^7.3.58",
|
"@types/video.js": "^7.3.58",
|
||||||
"daisyui": "^4.12.10",
|
"daisyui": "^4.12.10",
|
||||||
"mini-svg-data-uri": "^1.4.4",
|
"mini-svg-data-uri": "^1.4.4",
|
||||||
"postcss": "^8.4.41",
|
"postcss": "^8.4.44",
|
||||||
"postcss-loader": "^8.1.1",
|
"postcss-loader": "^8.1.1",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"sass-loader": "^16.0.1",
|
"sass-loader": "^16.0.1",
|
||||||
"vue": "^3.4.38",
|
"vue": "^3.5.0",
|
||||||
"vue-router": "^4.4.3"
|
"vue-router": "^4.4.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
<div class="join">
|
<div class="join">
|
||||||
<select v-model="errorLevel" class="join-item select select-sm select-bordered w-full max-w-xs">
|
<select v-model="errorLevel" class="join-item select select-sm select-bordered w-full max-w-xs">
|
||||||
<option
|
<option
|
||||||
v-for="(index, value) in severityLevels"
|
v-for="(index, value) in indexStore.severityLevels"
|
||||||
:key="index"
|
:key="index"
|
||||||
:value="value"
|
:value="value"
|
||||||
:selected="value === 'INFO' ? true : false"
|
:selected="value === errorLevel"
|
||||||
>
|
>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</option>
|
</option>
|
||||||
@ -45,6 +45,8 @@ import { storeToRefs } from 'pinia'
|
|||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
const { locale, t } = useI18n()
|
const { locale, t } = useI18n()
|
||||||
|
|
||||||
|
const indexStore = useIndex()
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: `${t('button.logging')} | ffplayout`,
|
title: `${t('button.logging')} | ffplayout`,
|
||||||
})
|
})
|
||||||
@ -58,13 +60,21 @@ const currentLog = ref('')
|
|||||||
const listDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
const listDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
||||||
const { formatLog } = stringFormatter()
|
const { formatLog } = stringFormatter()
|
||||||
|
|
||||||
const errorLevel = ref('INFO')
|
const levelCookie = useCookie('error_level', {
|
||||||
const severityLevels: { [key: string]: number } = {
|
path: '/',
|
||||||
DEBUG: 1,
|
maxAge: 60 * 60 * 24 * 365,
|
||||||
INFO: 2,
|
sameSite: 'lax',
|
||||||
WARN: 3,
|
})
|
||||||
ERROR: 4,
|
|
||||||
}
|
const errorLevel = computed({
|
||||||
|
get() {
|
||||||
|
return levelCookie.value || 'INFO'
|
||||||
|
},
|
||||||
|
|
||||||
|
set(value) {
|
||||||
|
levelCookie.value = value
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getLog()
|
await getLog()
|
||||||
@ -79,7 +89,7 @@ const calendarFormat = (date: Date) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function filterLogsBySeverity(logString: string, minSeverity: string): string {
|
function filterLogsBySeverity(logString: string, minSeverity: string): string {
|
||||||
const minLevel = severityLevels[minSeverity]
|
const minLevel = indexStore.severityLevels[minSeverity]
|
||||||
const logLines = logString.trim().split(/\r?\n/)
|
const logLines = logString.trim().split(/\r?\n/)
|
||||||
|
|
||||||
const filteredLogs = logLines.filter((log) => {
|
const filteredLogs = logLines.filter((log) => {
|
||||||
@ -87,7 +97,7 @@ function filterLogsBySeverity(logString: string, minSeverity: string): string {
|
|||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const logLevel = match[1]
|
const logLevel = match[1]
|
||||||
return severityLevels[logLevel] >= minLevel
|
return indexStore.severityLevels[logLevel] >= minLevel
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
@ -7,6 +7,12 @@ export const useIndex = defineStore('index', {
|
|||||||
alertVariant: 'success',
|
alertVariant: 'success',
|
||||||
alertMsg: '',
|
alertMsg: '',
|
||||||
sseConnected: false,
|
sseConnected: false,
|
||||||
|
severityLevels: {
|
||||||
|
DEBUG: 1,
|
||||||
|
INFO: 2,
|
||||||
|
WARN: 3,
|
||||||
|
ERROR: 4,
|
||||||
|
} as { [key: string]: number }
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {},
|
getters: {},
|
||||||
|
Loading…
Reference in New Issue
Block a user