-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ADD: stereum log backup automatically creates backups of the log file option to configure how many backups are stored * changed backup function backups are now created when the main log file reaches 1MB and a new log file gets created * implemented requested changes
- Loading branch information
Showing
4 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
launcher/src/components/UI/setting-page/components/LogBackups.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<div class="LogBacksups-parent w-full h-full justify-center items-center flex"> | ||
<input | ||
type="number" | ||
:value="footerStore.logBackups" | ||
class="lang-btn-parent w-full h-full bg-[#33393E] rounded-md flex justify-center items-center cursor-pointer border border-[#33393E] uppercase pl-3 pr-3 text-gray-200 text-base" | ||
@change="onChange($event)" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { onMounted } from "vue"; | ||
import ControlService from "@/store/ControlService"; | ||
import { useFooter } from "@/store/theFooter"; | ||
const footerStore = useFooter(); | ||
const checkSettings = async () => { | ||
try { | ||
const savedConfig = await ControlService.readConfig(); | ||
if (typeof savedConfig.logBackups.value !== "undefined") { | ||
footerStore.logBackups = savedConfig.logBackups.value; | ||
} else { | ||
updateSettings(5); | ||
} | ||
} catch (error) { | ||
console.error("Failed to load saved settings:", error); | ||
} | ||
}; | ||
const updateSettings = async (logBackup) => { | ||
try { | ||
const prevConf = await ControlService.readConfig(); | ||
const conf = { | ||
...prevConf, | ||
logBackups: { value: logBackup }, | ||
}; | ||
await ControlService.writeConfig(conf); | ||
useFooter.logBackups = logBackup; | ||
checkSettings(); | ||
} catch (error) { | ||
console.error("Failed to update settings:", error); | ||
} | ||
}; | ||
const onChange = async (event) => { | ||
if (event.target.value == "" || event.target.value < 3) { | ||
event.target.value = 3; | ||
} | ||
updateSettings(event.target.value); | ||
}; | ||
onMounted(() => { | ||
checkSettings(); | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
input[type="number"] { | ||
text-align: center; | ||
} | ||
input[type="number"]::-webkit-outer-spin-button, | ||
input[type="number"]::-webkit-inner-spin-button { | ||
-webkit-appearance: none; | ||
margin: 0; | ||
} | ||
.LogBacksups-parent { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters