diff --git a/src/components/panels/Machine/LogfilesPanel.vue b/src/components/panels/Machine/LogfilesPanel.vue index 54a3703a8..ead4fc515 100644 --- a/src/components/panels/Machine/LogfilesPanel.vue +++ b/src/components/panels/Machine/LogfilesPanel.vue @@ -1,11 +1,30 @@ - - - + + + + + + + {{ mdiFileSyncOutline }} + + + {{ $t('Machine.LogfilesPanel.Rollover') }} + + + - - - + + + + + + + {{ mdiCloseThick }} + + + + + + {{ $t('Machine.LogfilesPanel.RolloverDescription') }} + + + + + + + + + + + + {{ $t('Machine.LogfilesPanel.Cancel') }} + + + {{ $t('Machine.LogfilesPanel.Accept') }} + + + + + diff --git a/src/locales/en.json b/src/locales/en.json index 58a43ff0d..93619ed0a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -421,7 +421,13 @@ "TRIGGERED": "TRIGGERED" }, "LogfilesPanel": { - "Logfiles": "Log Files" + "Accept": "accept", + "Cancel": "cancel", + "Logfiles": "Log Files", + "Rollover": "Rollover Logs", + "RolloverDescription": "Please select which logs should be reset:", + "RolloverToastSuccessful": "Log for \"{name}\"was successfully reset.", + "RolloverToastFailed": "Rollover log for \"{name}\": {message}" }, "SystemPanel": { "Constants": "Constants", diff --git a/src/store/files/actions.ts b/src/store/files/actions.ts index 9ccb44fa4..041800e55 100644 --- a/src/store/files/actions.ts +++ b/src/store/files/actions.ts @@ -334,4 +334,20 @@ export const actions: ActionTree = { uploadSetMaxNumber({ commit }, payload) { commit('uploadSetMaxNumber', payload) }, + + rolloverLog(_, payload) { + payload.rolled_over.forEach((name: string) => { + Vue.$toast.success(i18n.t('Machine.LogfilesPanel.RolloverToastSuccessful', { name })) + }) + + Object.keys(payload.failed).forEach((name: string) => { + const message = payload.failed[name] + + Vue.$toast.error(i18n.t('Machine.LogfilesPanel.RolloverToastFailed', { name, message })) + }) + + setTimeout(() => { + Vue.$socket.emit('server.files.get_directory', { path: 'logs' }, { action: 'files/getDirectory' }) + }, 500) + }, } diff --git a/src/store/variables.ts b/src/store/variables.ts index aa0df7924..862ca0639 100644 --- a/src/store/variables.ts +++ b/src/store/variables.ts @@ -2,7 +2,7 @@ export const defaultLogoColor = '#D41216' export const defaultPrimaryColor = '#2196f3' export const minKlipperVersion = 'v0.10.0-271' -export const minMoonrakerVersion = 'v0.7.1-486' +export const minMoonrakerVersion = 'v0.7.1-797' export const colorArray = ['#F44336', '#8e379d', '#03DAC5', '#3F51B5', '#ffde03', '#009688', '#E91E63'] @@ -117,3 +117,8 @@ export const hiddenDirectories = ['.git'] * https://www.klipper3d.org/Config_Reference.html */ export const availableKlipperConfigReferenceTranslations = ['it', 'hu', 'zh'] + +/* + * List of all rollover logfiles + */ +export const rolloverLogfiles = ['klipper', 'moonraker']
{{ $t('Machine.LogfilesPanel.RolloverDescription') }}