mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-12 22:56:55 +00:00
feat(advancedSettings): add setting to set the number of archived logs
Fixes #3610 Adds a setting in Advanced Settings to modify the number of archived logs to keep. Between 1 and 100
This commit is contained in:
parent
8e1d7cac05
commit
150a3d242e
@ -67,6 +67,16 @@ proc toggleWakuV2Store*(self: Controller) =
|
|||||||
proc isWakuV2StoreEnabled*(self: Controller): bool =
|
proc isWakuV2StoreEnabled*(self: Controller): bool =
|
||||||
return self.nodeConfigurationService.isWakuV2StoreEnabled()
|
return self.nodeConfigurationService.isWakuV2StoreEnabled()
|
||||||
|
|
||||||
|
proc getLogMaxBackups*(self: Controller): int =
|
||||||
|
return self.nodeConfigurationService.getLogMaxBackups()
|
||||||
|
|
||||||
|
proc setMaxLogBackups*(self: Controller, value: int) =
|
||||||
|
if(not self.nodeConfigurationService.setMaxLogBackups(value)):
|
||||||
|
# in the future we may do a call from here to show a popup about this error
|
||||||
|
error "an error occurred, we couldn't set the Max Log Backups"
|
||||||
|
return
|
||||||
|
|
||||||
|
self.delegate.onLogMaxBackupsChanged()
|
||||||
|
|
||||||
proc getWakuV2LightClientEnabled*(self: Controller): bool =
|
proc getWakuV2LightClientEnabled*(self: Controller): bool =
|
||||||
return self.nodeConfigurationService.getV2LightMode()
|
return self.nodeConfigurationService.getV2LightMode()
|
||||||
|
@ -101,3 +101,12 @@ method isWakuV2StoreEnabled*(self: AccessInterface): bool {.base.} =
|
|||||||
|
|
||||||
method toggleWakuV2Store*(self: AccessInterface) {.base.} =
|
method toggleWakuV2Store*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method getLogMaxBackups*(self: AccessInterface): int {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method setMaxLogBackups*(self: AccessInterface, value: int) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method onLogMaxBackupsChanged*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
@ -139,3 +139,12 @@ method toggleWakuV2Store*(self: Module) =
|
|||||||
|
|
||||||
method isWakuV2StoreEnabled*(self: Module): bool =
|
method isWakuV2StoreEnabled*(self: Module): bool =
|
||||||
self.controller.isWakuV2StoreEnabled()
|
self.controller.isWakuV2StoreEnabled()
|
||||||
|
|
||||||
|
method getLogMaxBackups*(self: Module): int =
|
||||||
|
self.controller.getLogMaxBackups()
|
||||||
|
|
||||||
|
method setMaxLogBackups*(self: Module, value: int) =
|
||||||
|
self.controller.setMaxLogBackups(value)
|
||||||
|
|
||||||
|
method onLogMaxBackupsChanged*(self: Module) =
|
||||||
|
self.view.logMaxBackupsChanged()
|
@ -132,3 +132,13 @@ QtObject:
|
|||||||
|
|
||||||
proc toggleWakuV2Store*(self: View) {.slot.} =
|
proc toggleWakuV2Store*(self: View) {.slot.} =
|
||||||
self.delegate.toggleWakuV2Store()
|
self.delegate.toggleWakuV2Store()
|
||||||
|
|
||||||
|
proc logMaxBackupsChanged*(self: View) {.signal.}
|
||||||
|
proc getLogMaxBackups*(self: View): int {.slot.} =
|
||||||
|
return self.delegate.getLogMaxBackups()
|
||||||
|
QtProperty[int] logMaxBackups:
|
||||||
|
read = getLogMaxBackups
|
||||||
|
notify = logMaxBackupsChanged
|
||||||
|
|
||||||
|
proc setMaxLogBackups*(self: View, value: int) {.slot.} =
|
||||||
|
self.delegate.setMaxLogBackups(value)
|
@ -79,16 +79,6 @@ proc init*(self: Service) =
|
|||||||
error "error: ", errDesription
|
error "error: ", errDesription
|
||||||
return
|
return
|
||||||
|
|
||||||
proc fetchNodeConfig(self: Service) =
|
|
||||||
try:
|
|
||||||
let response = status_node_config.getNodeConfig()
|
|
||||||
self.configuration = response.result.toNodeConfigDto()
|
|
||||||
except Exception as e:
|
|
||||||
let errDesription = e.msg
|
|
||||||
error "error: ", errDesription
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
proc saveConfiguration(self: Service, configuration: NodeConfigDto): bool =
|
proc saveConfiguration(self: Service, configuration: NodeConfigDto): bool =
|
||||||
if(not self.settingsService.saveNodeConfiguration(configuration.toJsonNode())):
|
if(not self.settingsService.saveNodeConfiguration(configuration.toJsonNode())):
|
||||||
error "error saving node configuration "
|
error "error saving node configuration "
|
||||||
@ -294,3 +284,11 @@ proc setWakuV2StoreEnabled*(self: Service, enabled: bool, storeCapacity: int = 0
|
|||||||
newConfiguration.WakuV2Config.StoreCapacity = storeCapacity
|
newConfiguration.WakuV2Config.StoreCapacity = storeCapacity
|
||||||
newConfiguration.WakuV2Config.StoreSeconds = storeSeconds
|
newConfiguration.WakuV2Config.StoreSeconds = storeSeconds
|
||||||
return self.saveConfiguration(newConfiguration)
|
return self.saveConfiguration(newConfiguration)
|
||||||
|
|
||||||
|
proc getLogMaxBackups*(self: Service): int =
|
||||||
|
return self.configuration.LogMaxBackups
|
||||||
|
|
||||||
|
proc setMaxLogBackups*(self: Service, value: int): bool =
|
||||||
|
var newConfiguration = self.configuration
|
||||||
|
newConfiguration.LogMaxBackups = value
|
||||||
|
return self.saveConfiguration(newConfiguration)
|
@ -14,6 +14,7 @@ QtObject {
|
|||||||
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
||||||
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
||||||
property bool isWakuV2StoreEnabled: advancedModule ? advancedModule.isWakuV2StoreEnabled : false
|
property bool isWakuV2StoreEnabled: advancedModule ? advancedModule.isWakuV2StoreEnabled : false
|
||||||
|
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
|
||||||
|
|
||||||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||||
|
|
||||||
@ -93,6 +94,13 @@ QtObject {
|
|||||||
root.advancedModule.toggleDebug()
|
root.advancedModule.toggleDebug()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMaxLogBackups(value) {
|
||||||
|
if(!root.advancedModule)
|
||||||
|
return
|
||||||
|
|
||||||
|
root.advancedModule.setMaxLogBackups(value)
|
||||||
|
}
|
||||||
|
|
||||||
function enableDeveloperFeatures() {
|
function enableDeveloperFeatures() {
|
||||||
if(!root.advancedModule)
|
if(!root.advancedModule)
|
||||||
return
|
return
|
||||||
|
@ -11,10 +11,12 @@ import shared.popups 1.0
|
|||||||
import shared.status 1.0
|
import shared.status 1.0
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
|
import StatusQ.Popups 0.1
|
||||||
import StatusQ.Popups.Dialog 0.1
|
import StatusQ.Popups.Dialog 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Controls.Validators 0.1
|
||||||
|
|
||||||
import "../stores"
|
import "../stores"
|
||||||
import "../controls"
|
import "../controls"
|
||||||
@ -417,6 +419,16 @@ SettingsContentBase {
|
|||||||
root.advancedStore.toggleFakeLoadingScreen()
|
root.advancedStore.toggleFakeLoadingScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusSettingsLineButton {
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
text: qsTr("How many log files to keep archived")
|
||||||
|
currentValue: root.advancedStore.logMaxBackups
|
||||||
|
onClicked: {
|
||||||
|
Global.openPopup(changeNumberOfLogsArchived)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FleetsModal {
|
FleetsModal {
|
||||||
@ -528,6 +540,77 @@ SettingsContentBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: changeNumberOfLogsArchived
|
||||||
|
|
||||||
|
StatusModal {
|
||||||
|
id: logChangerModal
|
||||||
|
|
||||||
|
onClosed: destroy()
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 400
|
||||||
|
header.title: qsTr("How many log files do you want to keep archived?")
|
||||||
|
|
||||||
|
contentItem: Column {
|
||||||
|
width: parent.width
|
||||||
|
StatusBaseText {
|
||||||
|
width: parent.width
|
||||||
|
font.pixelSize: 15
|
||||||
|
color: Theme.palette.directColor1
|
||||||
|
padding: 15
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("Choose a number between 1 and 100")
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusInput {
|
||||||
|
id: numberInput
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.leftMargin: Style.current.padding
|
||||||
|
anchors.rightMargin: Style.current.padding
|
||||||
|
label: qsTr("Number of archives files")
|
||||||
|
input.text: root.advancedStore.logMaxBackups
|
||||||
|
placeholderText: qsTr("Number between 1 and 100")
|
||||||
|
validators: [
|
||||||
|
StatusFloatValidator {
|
||||||
|
bottom: 1
|
||||||
|
top: 100
|
||||||
|
errorMessage: qsTr("Number needs to be between 1 and 100")
|
||||||
|
locale: LocaleUtils.userInputLocale
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusBaseText {
|
||||||
|
width: parent.width
|
||||||
|
font.pixelSize: 15
|
||||||
|
color: Theme.palette.directColor1
|
||||||
|
padding: 15
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("This change will only come into action after a restart")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rightButtons: [
|
||||||
|
StatusButton {
|
||||||
|
text: qsTr("Cancel")
|
||||||
|
onClicked: logChangerModal.close()
|
||||||
|
normalColor: "transparent"
|
||||||
|
hoverColor: "transparent"
|
||||||
|
},
|
||||||
|
StatusButton {
|
||||||
|
id: banButton
|
||||||
|
text: qsTr("Change")
|
||||||
|
type: StatusBaseButton.Type.Normal
|
||||||
|
onClicked: {
|
||||||
|
root.advancedStore.setMaxLogBackups(numberInput.input.text)
|
||||||
|
logChangerModal.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmationPopup
|
id: confirmationPopup
|
||||||
property string experimentalFeature: ""
|
property string experimentalFeature: ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user