Auto-save push rule tab action changes

This commit is contained in:
miruka
2021-02-25 05:14:42 -04:00
parent 4306098692
commit 84567f1ffd
3 changed files with 14 additions and 21 deletions

View File

@@ -26,7 +26,6 @@ HButton {
onClicked: {
if (requiresOn !== null && ! requiresOn.on) {
requiresOn.clicked()
print(on, clicked)
if (! on) clicked()
return
}

View File

@@ -36,7 +36,7 @@ HListView {
saveFutureId = py.callClientCoro(
userId,
"mass_tweak_pushrules",
"mass_tweak_pushrules_actions",
args,
() => {
if (! root) return
@@ -119,23 +119,17 @@ HListView {
width: root.width
}
footer: AutoDirectionLayout {
z: 100
width: root.width
enabled: Object.keys(root.pendingEdits).length !== 0
onPendingEditsChanged:
utils.isEmptyObject(pendingEdits) ?
autoSaveTimer.stop() :
autoSaveTimer.restart()
ApplyButton {
onClicked: root.save()
loading: root.saveFutureId !== ""
Component.onDestruction: ! utils.isEmptyObject(pendingEdits) && save()
Layout.topMargin: theme.spacing
}
CancelButton {
onClicked: pendingEdits = {}
Layout.topMargin: theme.spacing
}
Timer {
id: autoSaveTimer
interval: 10000
onTriggered: root.save()
}
FlickShortcuts {