Skip to content

Commit

Permalink
Merge branch 'master' into feature/improved-exception-box-with-copy-p…
Browse files Browse the repository at this point in the history
…aste
  • Loading branch information
shivansh02 authored May 11, 2024
2 parents 0630325 + 9cabbbd commit 20f68fb
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 7 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to use for building macOS release'
description: 'Branch to use for building release'
required: true
default: 'master'
borg_version:
description: 'Borg version to package'
required: true
default: '1.2.1'
default: '1.2.8'
macos_version:
description: 'macOS version for building'
required: true
default: 'macos-11'

jobs:
build:
runs-on: macos-11
runs-on: ${{ github.event.inputs.macos_version }}

steps:
- name: Check out selected branch
Expand Down
5 changes: 4 additions & 1 deletion .github/stale.yml → .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
days-before-issue-stale: 60
days-before-issue-stale: 90
days-before-pr-stale: -1
days-before-issue-close: 7
# days-before-pr-close: 10
Expand Down
39 changes: 39 additions & 0 deletions src/vorta/assets/exclusion_presets/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,44 @@
],
"tags": ["type:dev", "editor:android-studio", "os:linux"],
"author": "shivansh02"
},
{
"name": "Jetbrains IDEs cache, config, path and logs",
"slug": "jetbrains",
"patterns": [
"fm:*/.config/JetBrains",
"fm:*/.cache/JetBrains",
"fm:*/.local/share/JetBrains"
],
"tags": ["type:dev", "editor:jetbrains", "os:linux"],
"author": "SAMAD101"
},
{
"name": "AWS artefacts",
"slug": "aws-artefacts",
"patterns": [
"fm:*/.aws"
],
"tags": ["type:dev", "cloud:aws", "os:linux", "os:darwin"],
"author": "SAMAD101"
},
{
"name": "Spotify cache and config files",
"slug": "spotify",
"patterns": [
"fm:*/.cache/spotify",
"fm:*/.config/spotify"
],
"tags": ["type:media", "media:spotify", "os:linux"],
"author": "SAMAD101"
},
{
"name": "Docker artefacts",
"slug": "docker-artefacts",
"patterns": [
"fm:*/.docker"
],
"tags": ["type:dev", "cloud:docker", "os:linux", "os:darwin"],
"author": "SAMAD101"
}
]
6 changes: 6 additions & 0 deletions src/vorta/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def post_backup_tasks(self, profile_id):
Pruning and checking after successful backup.
"""
profile = BackupProfileModel.get(id=profile_id)
notifier = VortaNotifications.pick()
logger.info('Doing post-backup jobs for %s', profile.name)
if profile.prune_on:
msg = BorgPruneJob.prepare(profile)
Expand Down Expand Up @@ -489,6 +490,11 @@ def post_backup_tasks(self, profile_id):
self.app.jobs_manager.add_job(job)

logger.info('Finished background task for profile %s', profile.name)
notifier.deliver(
self.tr('Vorta Backup'),
self.tr('Post Backup Tasks successful for %s' % profile.name),
level='info',
)

def remove_job(self, profile_id):
if profile_id in self.timers:
Expand Down
2 changes: 1 addition & 1 deletion src/vorta/tray_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def build_menu(self):
cancel_action.triggered.connect(self.app.backup_cancelled_event.emit)
else:
status.setText(self.tr('Next Task: %s') % next_task_time)
profiles = BackupProfileModel.select()
profiles = BackupProfileModel.select().order_by(BackupProfileModel.name)
if profiles.count() > 1:
profile_menu = menu.addMenu(self.tr('Backup Now'))
for profile in profiles:
Expand Down
3 changes: 3 additions & 0 deletions src/vorta/views/diff_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,13 @@ def change_display_mode(self, selection: int):
"""
if selection == 0:
mode = FileTreeModel.DisplayMode.TREE
self.bCollapseAll.setEnabled(True)
elif selection == 1:
mode = FileTreeModel.DisplayMode.SIMPLIFIED_TREE
self.bCollapseAll.setEnabled(True)
elif selection == 2:
mode = FileTreeModel.DisplayMode.FLAT
self.bCollapseAll.setEnabled(False)
else:
raise Exception("Unknown item in comboBoxDisplayMode with index {}".format(selection))

Expand Down
2 changes: 2 additions & 0 deletions src/vorta/views/extract_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ def change_display_mode(self, selection: int):
"""
if selection == 0:
mode = FileTreeModel.DisplayMode.TREE
self.bCollapseAll.setEnabled(True)
elif selection == 1:
mode = FileTreeModel.DisplayMode.SIMPLIFIED_TREE
self.bCollapseAll.setEnabled(True)
else:
raise Exception("Unknown item in comboBoxDisplayMode with index {}".format(selection))

Expand Down
19 changes: 19 additions & 0 deletions tests/unit/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
import vorta.views.archive_tab
from PyQt6.QtCore import QDateTime, QItemSelectionModel, Qt
from PyQt6.QtWidgets import QMenu
from vorta.store.models import ArchiveModel
from vorta.views.diff_result import (
ChangeType,
DiffData,
DiffResultDialog,
DiffTree,
FileType,
parse_diff_json,
parse_diff_lines,
)
from vorta.views.partials.treemodel import FileTreeModel


def setup_diff_result_window(qtbot, mocker, tab, borg_json_output, json_mock_file="diff_archives"):
Expand Down Expand Up @@ -457,3 +460,19 @@ def test_archive_diff_json_parser(line, expected):

assert item.path == PurePath(expected[0]).parts
assert item.data == DiffData(*expected[1:])


@pytest.mark.parametrize(
"selection, expected_mode, expected_bCollapseAllEnabled",
[
(0, FileTreeModel.DisplayMode.TREE, True),
(1, FileTreeModel.DisplayMode.SIMPLIFIED_TREE, True),
(2, FileTreeModel.DisplayMode.FLAT, False),
],
)
def test_change_display_mode(selection: int, expected_mode, expected_bCollapseAllEnabled):
dialog = DiffResultDialog(ArchiveModel(), ArchiveModel(), DiffTree())
dialog.change_display_mode(selection)

assert dialog.model.mode == expected_mode
assert dialog.bCollapseAll.isEnabled() == expected_bCollapseAllEnabled
24 changes: 22 additions & 2 deletions tests/unit/test_extract.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import pytest
import vorta.borg
from PyQt6.QtCore import QModelIndex, Qt
from vorta.views.extract_dialog import ExtractTree, FileData, FileType, parse_json_lines
from vorta.views.partials.treemodel import FileSystemItem
from vorta.store.models import ArchiveModel
from vorta.views.extract_dialog import (
ExtractDialog,
ExtractTree,
FileData,
FileType,
parse_json_lines,
)
from vorta.views.partials.treemodel import FileSystemItem, FileTreeModel


def prepare_borg(mocker, borg_json_output):
Expand Down Expand Up @@ -177,3 +185,15 @@ def test_selection():

select(model, iab)
assert a.data.checkstate == Qt.CheckState(1)


@pytest.mark.parametrize(
"selection, expected_mode, expected_bCollapseAllEnabled",
[(0, FileTreeModel.DisplayMode.TREE, True), (1, FileTreeModel.DisplayMode.SIMPLIFIED_TREE, True)],
)
def test_change_display_mode(selection: int, expected_mode, expected_bCollapseAllEnabled):
dialog = ExtractDialog(ArchiveModel(), ExtractTree())
dialog.change_display_mode(selection)

assert dialog.model.mode == expected_mode
assert dialog.bCollapseAll.isEnabled() == expected_bCollapseAllEnabled

0 comments on commit 20f68fb

Please sign in to comment.